fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11722] property: formatting, switch config


From: Sigurd Nes
Subject: [Fmsystem-commits] [11722] property: formatting, switch config
Date: Wed, 19 Feb 2014 08:16:22 +0000

Revision: 11722
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11722
Author:   sigurdne
Date:     2014-02-19 08:16:21 +0000 (Wed, 19 Feb 2014)
Log Message:
-----------
property: formatting, switch config

Modified Paths:
--------------
    trunk/property/inc/class.boXport.inc.php
    trunk/property/inc/class.uiXport.inc.php

Modified: trunk/property/inc/class.boXport.inc.php
===================================================================
--- trunk/property/inc/class.boXport.inc.php    2014-02-18 19:44:10 UTC (rev 
11721)
+++ trunk/property/inc/class.boXport.inc.php    2014-02-19 08:16:21 UTC (rev 
11722)
@@ -1,5 +1,4 @@
 <?php
-
        /**
         * phpGroupWare - property: a Facilities Management System.
         *
@@ -36,10 +35,10 @@
        {
 
                var $public_functions = array
-               (
-                       'import'                => true,
-                       'export'                => true,
-                       'export_cron'   => true
+                       (
+                       'import'                 => true,
+                       'export'                 => true,
+                       'export_cron'    => true
                );
                var $start;
                var $query;
@@ -47,58 +46,58 @@
                var $order;
                var $filter;
                var $cat_id;
-               var $use_session = false;
+               var $use_session                 = false;
 
-               function property_boXport( $session = false )
+               function property_boXport($session = false)
                {
 
                        $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'property';
 
-                       $this->config = CreateObject( 'phpgwapi.config', 
'property' );
+                       $this->config = CreateObject('admin.soconfig', 
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
 
-                       if ( $session )
+                       if($session)
                        {
                                $this->read_sessiondata();
                                $this->use_session = true;
                        }
 
-                       $start   = phpgw::get_var( 'start', 'int', 'REQUEST', 0 
);
-                       $query   = phpgw::get_var( 'query' );
-                       $sort    = phpgw::get_var( 'sort' );
-                       $order   = phpgw::get_var( 'order' );
-                       $filter  = phpgw::get_var( 'filter', 'int' );
-                       $cat_id  = phpgw::get_var( 'cat_id', 'int' );
+                       $start   = phpgw::get_var('start', 'int', 'REQUEST', 0);
+                       $query   = phpgw::get_var('query');
+                       $sort    = phpgw::get_var('sort');
+                       $order   = phpgw::get_var('order');
+                       $filter  = phpgw::get_var('filter', 'int');
+                       $cat_id  = phpgw::get_var('cat_id', 'int');
 
-                       if ( $start || $start == 0 )
+                       if($start || $start == 0)
                        {
                                $this->start = $start;
                        }
-                       if ( $query )
+                       if($query)
                        {
                                $this->query = $query;
                        }
-                       if ( $sort )
+                       if($sort)
                        {
                                $this->sort = $sort;
                        }
-                       if ( $order )
+                       if($order)
                        {
                                $this->order = $order;
                        }
-                       if ( $filter )
+                       if($filter)
                        {
-                               $this->filter    = $filter;
+                               $this->filter = $filter;
                        }
-                       $this->cat_id    = $cat_id;
+                       $this->cat_id = $cat_id;
                }
 
                function save_sessiondata()
                {
 
-                       if ( $this->use_session )
+                       if($this->use_session)
                        {
                                $data = array
-                               (
+                                       (
                                        'start'  => $this->start,
                                        'query'  => $this->query,
                                        'sort'   => $this->sort,
@@ -106,18 +105,18 @@
                                        'filter' => $this->filter,
                                        'cat_id' => $this->cat_id
                                );
-                               if ( $this->debug )
+                               if($this->debug)
                                {
                                        echo '<br>Save:';
-                                       _debug_array( $data );
+                                       _debug_array($data);
                                }
-                               $GLOBALS['phpgw']->session->appsession( 
'session_data', 'export', $data );
+                               
$GLOBALS['phpgw']->session->appsession('session_data', 'export', $data);
                        }
                }
 
                function read_sessiondata()
                {
-                       $data = $GLOBALS['phpgw']->session->appsession( 
'session_data', 'export' );
+                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data', 'export');
 
                        $this->start     = $data['start'];
                        $this->query     = $data['query'];
@@ -127,27 +126,27 @@
                        $this->cat_id    = $data['cat_id'];
                }
 
-               function select_import_conv( $selected = '' )
+               function select_import_conv($selected = '')
                {
-                       $dir_handle      = @opendir( PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}" );
+                       $dir_handle      = @opendir(PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}");
                        $i                       = 0;
                        $myfilearray = array();
-                       while ( $file = readdir( $dir_handle ) )
+                       while($file              = readdir($dir_handle))
                        {
-                               if ( (substr( $file, 0, 1 ) != '.') && is_file( 
PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}" ) )
+                               if((substr($file, 0, 1) != '.') && 
is_file(PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}"))
                                {
                                        $myfilearray[$i] = $file;
                                        $i++;
                                }
                        }
-                       closedir( $dir_handle );
-                       sort( $myfilearray );
+                       closedir($dir_handle);
+                       sort($myfilearray);
 
-                       for ( $i = 0; $i < count( $myfilearray ); $i++ )
+                       for($i = 0; $i < count($myfilearray); $i++)
                        {
-                               $fname           = preg_replace( '/_/', ' ', 
$myfilearray[$i] );
+                               $fname           = preg_replace('/_/', ' ', 
$myfilearray[$i]);
                                $sel_file        = '';
-                               if ( $myfilearray[$i] == $selected )
+                               if($myfilearray[$i] == $selected)
                                {
                                        $sel_file = 'selected';
                                }
@@ -160,38 +159,38 @@
                                );
                        }
 
-                       for ( $i = 0; $i < count( $conv_list ); $i++ )
+                       for($i = 0; $i < count($conv_list); $i++)
                        {
-                               if ( $conv_list[$i]['selected'] != 'selected' )
+                               if($conv_list[$i]['selected'] != 'selected')
                                {
-                                       unset( $conv_list[$i]['selected'] );
+                                       unset($conv_list[$i]['selected']);
                                }
                        }
 
                        return $conv_list;
                }
 
-               function select_export_conv( $selected = '' )
+               function select_export_conv($selected = '')
                {
-                       $dir_handle      = @opendir( PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}" );
+                       $dir_handle      = @opendir(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}");
                        $i                       = 0;
                        $myfilearray = array();
-                       while ( $file = readdir( $dir_handle ) )
+                       while($file              = readdir($dir_handle))
                        {
-                               if ( (substr( $file, 0, 1 ) != '.') && is_file( 
PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}" ) )
+                               if((substr($file, 0, 1) != '.') && 
is_file(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}"))
                                {
                                        $myfilearray[$i] = $file;
                                        $i++;
                                }
                        }
-                       closedir( $dir_handle );
-                       sort( $myfilearray );
+                       closedir($dir_handle);
+                       sort($myfilearray);
 
-                       for ( $i = 0; $i < count( $myfilearray ); $i++ )
+                       for($i = 0; $i < count($myfilearray); $i++)
                        {
-                               $fname           = preg_replace( '/_/', ' ', 
$myfilearray[$i] );
+                               $fname           = preg_replace('/_/', ' ', 
$myfilearray[$i]);
                                $sel_file        = '';
-                               if ( $myfilearray[$i] == $selected )
+                               if($myfilearray[$i] == $selected)
                                {
                                        $sel_file = 'selected';
                                }
@@ -204,41 +203,40 @@
                                );
                        }
 
-                       for ( $i = 0; $i < count( $conv_list ); $i++ )
+                       for($i = 0; $i < count($conv_list); $i++)
                        {
-                               if ( $conv_list[$i]['selected'] != 'selected' )
+                               if($conv_list[$i]['selected'] != 'selected')
                                {
-                                       unset( $conv_list[$i]['selected'] );
+                                       unset($conv_list[$i]['selected']);
                                }
                        }
 
                        return $conv_list;
                }
 
-               function select_rollback_file( $selected = '' )
+               function select_rollback_file($selected = '')
                {
-                       $this->config->read();
-                       $file_catalog = 
$this->config->config_data['export_path'];
+                       $file_catalog = 
$this->config->config_data['export']['path'];
 
-                       $dir_handle      = @opendir( $file_catalog );
+                       $dir_handle      = @opendir($file_catalog);
                        $i                       = 0;
                        $myfilearray = '';
-                       while ( $file            = readdir( $dir_handle ) )
+                       while($file              = readdir($dir_handle))
                        {
-                               if ( (substr( $file, 0, 1 ) != '.') && is_file( 
"{$file_catalog}/{$file}" ) )
+                               if((substr($file, 0, 1) != '.') && 
is_file("{$file_catalog}/{$file}"))
                                {
                                        $myfilearray[$i] = $file;
                                        $i++;
                                }
                        }
-                       closedir( $dir_handle );
-                       @sort( $myfilearray );
+                       closedir($dir_handle);
+                       @sort($myfilearray);
 
-                       for ( $i = 0; $i < count( $myfilearray ); $i++ )
+                       for($i = 0; $i < count($myfilearray); $i++)
                        {
-                               $fname           = preg_replace( '/_/', ' ', 
$myfilearray[$i] );
+                               $fname           = preg_replace('/_/', ' ', 
$myfilearray[$i]);
                                $sel_file        = '';
-                               if ( $myfilearray[$i] == $selected )
+                               if($myfilearray[$i] == $selected)
                                {
                                        $sel_file = 'selected';
                                }
@@ -251,24 +249,24 @@
                                );
                        }
 
-                       for ( $i = 0; $i < count( $rollback_list ); $i++ )
+                       for($i = 0; $i < count($rollback_list); $i++)
                        {
-                               if ( $rollback_list[$i]['selected'] != 
'selected' )
+                               if($rollback_list[$i]['selected'] != 'selected')
                                {
-                                       unset( $rollback_list[$i]['selected'] );
+                                       unset($rollback_list[$i]['selected']);
                                }
                        }
 
                        return $rollback_list;
                }
 
-               function import( $invoice_common, $download )
+               function import($invoice_common, $download)
                {
                        include (PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$invoice_common['conv_type']}");
                        $invoice = new import_conv;
 
-                       $buffer = $invoice->import( $invoice_common, $download 
);
-                       if ( $download )
+                       $buffer = $invoice->import($invoice_common, $download);
+                       if($download)
                        {
                                $header  = $invoice->header;
                                $import  = $invoice->import;
@@ -281,7 +279,7 @@
                        return $buffer;
                }
 
-               function export( $data )
+               function export($data)
                {
                        $conv_type                       = $data['conv_type'];
                        $download                        = $data['download'];
@@ -291,32 +289,31 @@
                        include(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
                        $invoice = new export_conv;
 
-                       $buffer = $invoice->overfor( $download, $pre_transfer, 
$force_period_year );
+                       $buffer = $invoice->overfor($download, $pre_transfer, 
$force_period_year);
 
                        return $buffer;
                }
 
-               function rollback( $conv_type, $role_back_date, $rollback_file,
-                                        $rollback_voucher )
+               function rollback($conv_type, $role_back_date, $rollback_file, 
$rollback_voucher)
                {
                        include (PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
                        $invoice = new export_conv;
-                       $buffer  = $invoice->RullTilbake( $role_back_date, 
$rollback_file,
-                                                                        
$rollback_voucher );
+                       $buffer  = $invoice->RullTilbake($role_back_date, 
$rollback_file, $rollback_voucher);
                        return $buffer;
                }
 
-               function export_cron( $data = array())
+               function export_cron($data = array())
                {
                        if(!$data)
                        {
-                               $data = 
unserialize(urldecode(phpgw::get_var('data')));
-                               $data = phpgw::clean_value($data);
+                               $data    = 
unserialize(urldecode(phpgw::get_var('data')));
+                               $data    = phpgw::clean_value($data);
                        }
                        _debug_array($data);
-                       $receipt = $this->export( $data );
+                       $receipt = $this->export($data);
                        {
-                               _debug_array( $receipt );
+                               _debug_array($receipt);
                        }
                }
-       }
+
+       }       
\ No newline at end of file

Modified: trunk/property/inc/class.uiXport.inc.php
===================================================================
--- trunk/property/inc/class.uiXport.inc.php    2014-02-18 19:44:10 UTC (rev 
11721)
+++ trunk/property/inc/class.uiXport.inc.php    2014-02-19 08:16:21 UTC (rev 
11722)
@@ -1,48 +1,46 @@
 <?php
        /**
-       * phpGroupWare - property: a Facilities Management System.
-       *
-       * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
-       * This file is part of phpGroupWare.
-       *
-       * phpGroupWare is free software; you can redistribute it and/or modify
-       * it under the terms of the GNU General Public License as published by
-       * the Free Software Foundation; either version 2 of the License, or
-       * (at your option) any later version.
-       *
-       * phpGroupWare is distributed in the hope that it will be useful,
-       * but WITHOUT ANY WARRANTY; without even the implied warranty of
-       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       * GNU General Public License for more details.
-       *
-       * You should have received a copy of the GNU General Public License
-       * along with phpGroupWare; if not, write to the Free Software
-       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
-       *
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
-       * @package property
-       * @subpackage admin
-       * @version $Id$
-       */
-
+        * phpGroupWare - property: a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+        * @package property
+        * @subpackage admin
+        * @version $Id$
+        */
        phpgw::import_class('phpgwapi.datetime');
 
        /**
         * Description
         * @package property
         */
-
        class property_uiXport
        {
+
                var $public_functions = array
                        (
-                               'import'        => true,
-                               'export'        => true,
-                               'rollback'      => true
-                       );
-
+                       'import'         => true,
+                       'export'         => true,
+                       'rollback'       => true
+               );
                var $start;
                var $query;
                var $sort;
@@ -53,65 +51,65 @@
                function property_uiXport()
                {
 
-                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::invoice';
-                       $this->bo                       = 
CreateObject('property.boXport',true);
-                       $this->invoice                  = 
CreateObject('property.boinvoice');
-                       $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->contacts = CreateObject('property.sogeneric');
-                       $this->contacts->get_location_info('vendor',false);
+                       $GLOBALS['phpgw_info']['flags']['xslt_app']             
         = true;
+                       $GLOBALS['phpgw_info']['flags']['menu_selection']       
 = 'property::invoice';
+                       $this->bo                                               
                                         = CreateObject('property.boXport', 
true);
+                       $this->invoice                                          
                                 = CreateObject('property.boinvoice');
+                       $this->bocommon                                         
                                 = CreateObject('property.bocommon');
+                       $this->contacts                                         
                                 = CreateObject('property.sogeneric');
+                       $this->contacts->get_location_info('vendor', false);
 
-                       $this->acl                              = & 
$GLOBALS['phpgw']->acl;
-                       $this->acl_location             = '.invoice';
-                       $this->acl_read                 = 
$this->acl->check('.invoice', PHPGW_ACL_READ, 'property');
-                       $this->acl_add                  = 
$this->acl->check('.invoice', PHPGW_ACL_ADD, 'property');
-                       $this->acl_edit                 = 
$this->acl->check('.invoice', PHPGW_ACL_EDIT, 'property');
-                       $this->acl_delete               = 
$this->acl->check('.invoice', PHPGW_ACL_DELETE, 'property');
-                       $this->acl_manage               = 
$this->acl->check('.invoice', 16, 'property');
+                       $this->acl                       = & 
$GLOBALS['phpgw']->acl;
+                       $this->acl_location      = '.invoice';
+                       $this->acl_read          = 
$this->acl->check('.invoice', PHPGW_ACL_READ, 'property');
+                       $this->acl_add           = 
$this->acl->check('.invoice', PHPGW_ACL_ADD, 'property');
+                       $this->acl_edit          = 
$this->acl->check('.invoice', PHPGW_ACL_EDIT, 'property');
+                       $this->acl_delete        = 
$this->acl->check('.invoice', PHPGW_ACL_DELETE, 'property');
+                       $this->acl_manage        = 
$this->acl->check('.invoice', 16, 'property');
 
-                       $this->start                    = $this->bo->start;
-                       $this->query                    = $this->bo->query;
-                       $this->sort                     = $this->bo->sort;
-                       $this->order                    = $this->bo->order;
-                       $this->filter                   = $this->bo->filter;
-                       $this->cat_id                   = $this->bo->cat_id;
+                       $this->start     = $this->bo->start;
+                       $this->query     = $this->bo->query;
+                       $this->sort              = $this->bo->sort;
+                       $this->order     = $this->bo->order;
+                       $this->filter    = $this->bo->filter;
+                       $this->cat_id    = $this->bo->cat_id;
                }
 
                function import()
                {
                        if(!$this->acl_add)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop', 'perm' => 2, 'acl_location' 
=> $this->acl_location));
                        }
 
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::import';
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt');
-                       
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt','');
+                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data', 'import_receipt');
+                       $GLOBALS['phpgw']->session->appsession('session_data', 
'import_receipt', '');
 
-                       $art                            = phpgw::get_var('art', 
'int');
-                       $type                           = 
phpgw::get_var('type');
-                       $dim_b                          = 
phpgw::get_var('dim_b', 'int');
-                       $invoice_num            = phpgw::get_var('invoice_num');
-                       $kid_nr                         = 
phpgw::get_var('kid_nr');
-                       $vendor_id                      = 
phpgw::get_var('vendor_id', 'int');
-                       $vendor_name            = phpgw::get_var('vendor_name');
-                       $janitor                        = 
phpgw::get_var('janitor');
-                       $supervisor                     = 
phpgw::get_var('supervisor');
-                       $budget_responsible     = 
phpgw::get_var('budget_responsible');
-                       $invoice_date           = 
urldecode(phpgw::get_var('invoice_date'));
-                       $num_days                       = 
phpgw::get_var('num_days', 'int');
-                       $payment_date           = 
urldecode(phpgw::get_var('payment_date'));
-                       $cancel                         = 
phpgw::get_var('cancel', 'bool');
-                       $convert                        = 
phpgw::get_var('convert', 'bool');
-                       $conv_type                      = 
phpgw::get_var('conv_type');
-                       $sday                           = 
phpgw::get_var('sday', 'int');
-                       $smonth                         = 
phpgw::get_var('smonth', 'int');
-                       $syear                          = 
phpgw::get_var('syear', 'int');
-                       $eday                           = 
phpgw::get_var('eday', 'int');
-                       $emonth                         = 
phpgw::get_var('emonth', 'int');
-                       $eyear                          = 
phpgw::get_var('eyear', 'int');
-                       $download                       = 
phpgw::get_var('download', 'bool');
-                       $auto_tax                       = 
phpgw::get_var('auto_tax', 'bool');
+                       $art                             = 
phpgw::get_var('art', 'int');
+                       $type                            = 
phpgw::get_var('type');
+                       $dim_b                           = 
phpgw::get_var('dim_b', 'int');
+                       $invoice_num             = 
phpgw::get_var('invoice_num');
+                       $kid_nr                          = 
phpgw::get_var('kid_nr');
+                       $vendor_id                       = 
phpgw::get_var('vendor_id', 'int');
+                       $vendor_name             = 
phpgw::get_var('vendor_name');
+                       $janitor                         = 
phpgw::get_var('janitor');
+                       $supervisor                      = 
phpgw::get_var('supervisor');
+                       $budget_responsible      = 
phpgw::get_var('budget_responsible');
+                       $invoice_date            = 
urldecode(phpgw::get_var('invoice_date'));
+                       $num_days                        = 
phpgw::get_var('num_days', 'int');
+                       $payment_date            = 
urldecode(phpgw::get_var('payment_date'));
+                       $cancel                          = 
phpgw::get_var('cancel', 'bool');
+                       $convert                         = 
phpgw::get_var('convert', 'bool');
+                       $conv_type                       = 
phpgw::get_var('conv_type');
+                       $sday                            = 
phpgw::get_var('sday', 'int');
+                       $smonth                          = 
phpgw::get_var('smonth', 'int');
+                       $syear                           = 
phpgw::get_var('syear', 'int');
+                       $eday                            = 
phpgw::get_var('eday', 'int');
+                       $emonth                          = 
phpgw::get_var('emonth', 'int');
+                       $eyear                           = 
phpgw::get_var('eyear', 'int');
+                       $download                        = 
phpgw::get_var('download', 'bool');
+                       $auto_tax                        = 
phpgw::get_var('auto_tax', 'bool');
 
                        $tsvfile = $_FILES['tsvfile']['tmp_name'];
 
@@ -120,113 +118,113 @@
                                $tsvfile = phpgw::get_var('tsvfile');
                        }
 
-                       if ($cancel && $tsvfile)
+                       if($cancel && $tsvfile)
                        {
-                               unlink ($tsvfile);
+                               unlink($tsvfile);
                        }
 
-                       if ($convert)
+                       if($convert)
                        {
                                unset($receipt);
 
-                               if ($conv_type=='')
+                               if($conv_type == '')
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Please - select a import format !'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please - select a import format !'));
                                }
 
-                               if (!$tsvfile)
+                               if(!$tsvfile)
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Please - select a file to import from !'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please - select a file to import from !'));
                                }
 
-                               if (!$art)
+                               if(!$art)
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Please - select type invoice!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please - select type invoice!'));
                                }
-                               if (!$vendor_id)
+                               if(!$vendor_id)
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Please - select Vendor!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please - select Vendor!'));
                                }
 
-                               if (!$type)
+                               if(!$type)
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Please - select type order!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please - select type order!'));
                                }
 
-                               if (!$budget_responsible)
+                               if(!$budget_responsible)
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Please - select budget responsible!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please - select budget responsible!'));
                                }
 
-                               if (!$this->invoice->check_vendor($vendor_id))
+                               if(!$this->invoice->check_vendor($vendor_id))
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' . $vendor_id);
+                                       $receipt['error'][] = array('msg' => 
lang('That Vendor ID is not valid !') . ' : ' . $vendor_id);
                                }
 
-                               if (!$payment_date && !$num_days)
+                               if(!$payment_date && !$num_days)
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Please - select either payment date or number of days from 
invoice date !'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please - select either payment date or number of days from invoice date 
!'));
                                }
 
-                               if (!file_exists($tsvfile))
+                               if(!file_exists($tsvfile))
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('The file is empty or removed!'));
+                                       $receipt['error'][] = array('msg' => 
lang('The file is empty or removed!'));
                                }
-                               if (!is_array($receipt['error']))
+                               if(!is_array($receipt['error']))
                                {
                                        if($invoice_date)
                                        {
-                                               $sdateparts = 
phpgwapi_datetime::date_array($invoice_date);
-                                               $sday = $sdateparts['day'];
-                                               $smonth = $sdateparts['month'];
-                                               $syear = $sdateparts['year'];
+                                               $sdateparts      = 
phpgwapi_datetime::date_array($invoice_date);
+                                               $sday            = 
$sdateparts['day'];
+                                               $smonth          = 
$sdateparts['month'];
+                                               $syear           = 
$sdateparts['year'];
                                                unset($sdateparts);
 
-                                               $edateparts = 
phpgwapi_datetime::date_array($payment_date);
-                                               $eday = $edateparts['day'];
-                                               $emonth = $edateparts['month'];
-                                               $eyear = $edateparts['year'];
+                                               $edateparts      = 
phpgwapi_datetime::date_array($payment_date);
+                                               $eday            = 
$edateparts['day'];
+                                               $emonth          = 
$edateparts['month'];
+                                               $eyear           = 
$edateparts['year'];
                                                unset($edateparts);
                                        }
 
-                                       $old = $tsvfile;
-                                       $tsvfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'].'/invoice_import_'.basename($tsvfile);
-                                       rename($old,$tsvfile);
+                                       $old     = $tsvfile;
+                                       $tsvfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'] . '/invoice_import_' . 
basename($tsvfile);
+                                       rename($old, $tsvfile);
 
-                                       $invoice_common=array
+                                       $invoice_common = array
                                                (
-                                                       'bilagsnr'              
                => $this->invoice->next_bilagsnr(),
-                                                       'art'                   
                => $art,
-                                                       'type'                  
                => $type,
-                                                       'dim_b'                 
                => $dim_b,
-                                                       'invoice_num'           
        => $invoice_num,
-                                                       'kid_nr'                
                => $kid_nr,
-                                                       'vendor_id'             
                => $vendor_id,
-                                                       'vendor_name'           
        => $vendor_name,
-                                                       'janitor'               
                => $janitor,
-                                                       'supervisor'            
        => $supervisor,
-                                                       'budget_responsible'    
=> $budget_responsible,
-                                                       'num_days'              
                => $num_days,
-                                                       'sday'                  
                => $sday,
-                                                       'smonth'                
                => $smonth,
-                                                       'syear'                 
                => $syear,
-                                                       'eday'                  
                => $eday,
-                                                       'emonth'                
                => $emonth,
-                                                       'eyear'                 
                => $eyear,
-                                                       'tsvfile'               
                => $tsvfile,
-                                                       'conv_type'             
                => $conv_type,
-                                                       'invoice_date'          
        => $invoice_date,
-                                                       'payment_date'          
        => $payment_date,
-                                                       'auto_tax'              
                => $auto_tax
-                                               );
+                                               'bilagsnr'                      
 => $this->invoice->next_bilagsnr(),
+                                               'art'                           
 => $art,
+                                               'type'                          
 => $type,
+                                               'dim_b'                         
 => $dim_b,
+                                               'invoice_num'            => 
$invoice_num,
+                                               'kid_nr'                        
 => $kid_nr,
+                                               'vendor_id'                     
 => $vendor_id,
+                                               'vendor_name'            => 
$vendor_name,
+                                               'janitor'                       
 => $janitor,
+                                               'supervisor'             => 
$supervisor,
+                                               'budget_responsible' => 
$budget_responsible,
+                                               'num_days'                      
 => $num_days,
+                                               'sday'                          
 => $sday,
+                                               'smonth'                        
 => $smonth,
+                                               'syear'                         
 => $syear,
+                                               'eday'                          
 => $eday,
+                                               'emonth'                        
 => $emonth,
+                                               'eyear'                         
 => $eyear,
+                                               'tsvfile'                       
 => $tsvfile,
+                                               'conv_type'                     
 => $conv_type,
+                                               'invoice_date'           => 
$invoice_date,
+                                               'payment_date'           => 
$payment_date,
+                                               'auto_tax'                      
 => $auto_tax
+                                       );
 
-                                       $buffer = 
$this->bo->import($invoice_common,$download);
+                                       $buffer = 
$this->bo->import($invoice_common, $download);
 
                                        if(!$download)
                                        {
                                                $receipt = $buffer;
-                                               
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt',$receipt);
-                                               unlink ($tsvfile);
+                                               
$GLOBALS['phpgw']->session->appsession('session_data', 'import_receipt', 
$receipt);
+                                               unlink($tsvfile);
                                                unset($invoice_common);
                                                unset($art);
                                                unset($type);
@@ -248,7 +246,7 @@
                                        else
                                        {
                                                
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-                                               
$this->debug_import($buffer,$invoice_common);
+                                               $this->debug_import($buffer, 
$invoice_common);
                                                return;
                                        }
                                }
@@ -259,9 +257,9 @@
 
                        $link_data = array
                                (
-                                       'menuaction'    => 
'property.uiXport.import',
-                                       'sub'           => $sub
-                               );
+                               'menuaction' => 'property.uiXport.import',
+                               'sub'            => $sub
+                       );
 
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
@@ -271,139 +269,122 @@
 
                        $data = array
                                (
-                                       'menu'                                  
                        => $this->bocommon->get_menu(),
-                                       'msgbox_data'                           
                => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'menu'                                          
                 => $this->bocommon->get_menu(),
+                               'msgbox_data'                                   
         => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                                   
         => $GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'cancel_action'                                 
         => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiinvoice.index', 'sub' => $sub)),
+                               'lang_cancel'                                   
         => lang('Cancel'),
+                               'lang_cancel_statustext'                        
 => lang('cancel the import'),
+                               'action_url'                                    
         => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property' . '.uiXport.import')),
+                               'tsvfilename'                                   
         => '',
+                               'lang_debug'                                    
         => lang('Debug output in browser'),
+                               'lang_debug_statustext'                         
 => lang('Check this to have the output to screen before import (recommended)'),
+                               'value_debug'                                   
         => $download,
+                               'lang_import'                                   
         => lang('Import'),
+                               'lang_import_statustext'                        
 => lang('click this button to start the import'),
+                               'lang_invoice_date'                             
         => lang('invoice date'),
+                               'lang_payment_date'                             
         => lang('Payment date'),
+                               'lang_no_of_days'                               
         => lang('Days'),
+                               'lang_invoice_number'                           
 => lang('Invoice Number'),
+                               'lang_invoice_num_statustext'            => 
lang('Enter Invoice Number'),
+                               'lang_select'                                   
         => lang('Select per button !'),
+                               'lang_kidnr'                                    
         => lang('KID nr'),
+                               'lang_kid_nr_statustext'                        
 => lang('Enter Kid nr'),
+                               'lang_vendor'                                   
         => lang('Vendor'),
+                               'addressbook_link'                              
         => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uilookup.vendor')),
+                               'lang_invoice_date_statustext'           => 
lang('Enter the invoice date'),
+                               'lang_num_days_statustext'                      
 => lang('Enter the payment date or the payment delay'),
+                               'lang_payment_date_statustext'           => 
lang('Enter the payment date or the payment delay'),
+                               'lang_file_statustext'                          
 => lang('Select the file to import from'),
+                               'lang_vendor_statustext'                        
 => lang('Select the vendor by clicking the button'),
+                               'lang_vendor_name_statustext'            => 
lang('Select the vendor by clicking the button'),
+                               'lang_select_vendor_statustext'          => 
lang('Select the vendor by clicking this button'),
+                               'value_invoice_date'                            
 => $invoice_date,
+                               'value_payment_date'                            
 => $payment_date,
+                               'value_belop'                                   
         => $belop,
+                               'value_vendor_id'                               
         => $vendor_id,
+                               'value_vendor_name'                             
         => $vendor_name,
+                               'value_kid_nr'                                  
         => $kid_nr,
+                               'value_dim_b'                                   
         => $dim_b,
+                               'value_invoice_num'                             
         => $invoice_num,
+                               'value_merknad'                                 
         => $merknad,
+                               'value_num_days'                                
         => $num_days,
+                               //                              'value_tsvfile' 
                                        => $tsvfile,
+                               'lang_file'                                     
                 => lang('File'),
+                               'lang_conv'                                     
                 => lang('Conversion'),
+                               'conv_list'                                     
                 => $this->bo->select_import_conv($conv_type),
+                               'select_conv'                                   
         => 'conv_type',
+                               'lang_select_conversion'                        
 => lang('Select the type of conversion:'),
+                               'lang_conv_statustext'                          
 => lang('You have to select the Conversion for this import'),
+                               'lang_auto_tax'                                 
         => lang('Auto TAX'),
+                               'lang_auto_tax_statustext'                      
 => lang('Set tax during import'),
+                               'lang_art'                                      
                 => lang('Art'),
+                               'art_list'                                      
                 => $this->invoice->get_lisfm_ecoart($art),
+                               'select_art'                                    
         => 'art',
+                               'lang_select_art'                               
         => lang('Select Invoice Type'),
+                               'lang_art_statustext'                           
 => lang('You have to select type of invoice'),
+                               'lang_type'                                     
                 => lang('Type invoice II'),
+                               'type_list'                                     
                 => $this->invoice->get_type_list($type),
+                               'select_type'                                   
         => 'type',
+                               'lang_no_type'                                  
         => lang('No type'),
+                               'lang_type_statustext'                          
 => lang('Select the type  invoice. To do not use type -  select NO TYPE'),
+                               'lang_dimb'                                     
                 => lang('Dim B'),
+                               'dimb_list'                                     
                 => $this->invoice->select_dimb_list($dim_b),
+                               'select_dimb'                                   
         => 'dim_b',
+                               'lang_no_dimb'                                  
         => lang('No Dim B'),
+                               'lang_dimb_statustext'                          
 => lang('Select the Dim B for this invoice. To do not use Dim B -  select NO 
DIM B'),
+                               'lang_janitor'                                  
         => lang('Janitor'),
+                               'janitor_list'                                  
         => $this->bocommon->get_user_list_right(32, $janitor, '.invoice'),
+                               'select_janitor'                                
         => 'janitor',
+                               'lang_no_janitor'                               
         => lang('No janitor'),
+                               'lang_janitor_statustext'                       
 => lang('Select the janitor responsible for this invoice. To do not use 
janitor -  select NO JANITOR'),
+                               'lang_supervisor'                               
         => lang('Supervisor'),
+                               'supervisor_list'                               
         => $this->bocommon->get_user_list_right(64, $supervisor, '.invoice'),
+                               'select_supervisor'                             
         => 'supervisor',
+                               'lang_no_supervisor'                            
 => lang('No supervisor'),
+                               'lang_supervisor_statustext'             => 
lang('Select the supervisor responsible for this invoice. To do not use 
supervisor -  select NO SUPERVISOR'),
+                               'lang_budget_responsible'                       
 => lang('B - responsible'),
+                               'budget_responsible_list'                       
 => $this->bocommon->get_user_list_right(128, $budget_responsible, '.invoice'),
+                               'select_budget_responsible'                     
 => 'budget_responsible',
+                               'lang_select_budget_responsible'         => 
lang('Select B-Responsible'),
+                               'lang_budget_responsible_statustext' => 
lang('You have to select a budget responsible for this invoice in order to make 
the import')
+                       );
 
-                                       'form_action'                           
                => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                                       'cancel_action'                         
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.index', 'sub'=> $sub)),
-                                       'lang_cancel'                           
                => lang('Cancel'),
-                                       'lang_cancel_statustext'                
        => lang('cancel the import'),
-                                       'action_url'                            
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>  
'property' .'.uiXport.import')),
-                                       'tsvfilename'                           
                => '',
-
-                                       'lang_debug'                            
                => lang('Debug output in browser'),
-                                       'lang_debug_statustext'                 
        => lang('Check this to have the output to screen before import 
(recommended)'),
-                                       'value_debug'                           
                => $download,
-
-                                       'lang_import'                           
                => lang('Import'),
-                                       'lang_import_statustext'                
        => lang('click this button to start the import'),
-
-                                       'lang_invoice_date'                     
                => lang('invoice date'),
-                                       'lang_payment_date'                     
                => lang('Payment date'),
-                                       'lang_no_of_days'                       
                => lang('Days'),
-                                       'lang_invoice_number'                   
        => lang('Invoice Number'),
-                                       'lang_invoice_num_statustext'           
=> lang('Enter Invoice Number'),
-
-                                       'lang_select'                           
                => lang('Select per button !'),
-                                       'lang_kidnr'                            
                => lang('KID nr'),
-                                       'lang_kid_nr_statustext'                
        => lang('Enter Kid nr'),
-
-                                       'lang_vendor'                           
                => lang('Vendor'),
-                                       'addressbook_link'                      
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilookup.vendor')),
-
-                                       'lang_invoice_date_statustext'          
=> lang('Enter the invoice date'),
-                                       'lang_num_days_statustext'              
        => lang('Enter the payment date or the payment delay'),
-                                       'lang_payment_date_statustext'          
=> lang('Enter the payment date or the payment delay'),
-                                       'lang_file_statustext'                  
        => lang('Select the file to import from'),
-                                       'lang_vendor_statustext'                
        => lang('Select the vendor by clicking the button'),
-                                       'lang_vendor_name_statustext'           
=> lang('Select the vendor by clicking the button'),
-                                       'lang_select_vendor_statustext'         
=> lang('Select the vendor by clicking this button'),
-
-
-                                       'value_invoice_date'                    
        => $invoice_date,
-                                       'value_payment_date'                    
        => $payment_date,
-                                       'value_belop'                           
                => $belop,
-                                       'value_vendor_id'                       
                => $vendor_id,
-                                       'value_vendor_name'                     
                => $vendor_name,
-                                       'value_kid_nr'                          
                => $kid_nr,
-                                       'value_dim_b'                           
                => $dim_b,
-                                       'value_invoice_num'                     
                => $invoice_num,
-                                       'value_merknad'                         
                => $merknad,
-                                       'value_num_days'                        
                => $num_days,
-       //                              'value_tsvfile'                         
                => $tsvfile,
-
-                                       'lang_file'                             
                        => lang('File'),
-                                       'lang_conv'                             
                        => lang('Conversion'),
-                                       'conv_list'                             
                        => $this->bo->select_import_conv($conv_type),
-                                       'select_conv'                           
                => 'conv_type',
-                                       'lang_select_conversion'                
        => lang('Select the type of conversion:'),
-                                       'lang_conv_statustext'                  
        => lang('You have to select the Conversion for this import'),
-
-                                       'lang_auto_tax'                         
                => lang('Auto TAX'),
-                                       'lang_auto_tax_statustext'              
        => lang('Set tax during import'),
-
-                                       'lang_art'                              
                        => lang('Art'),
-                                       'art_list'                              
                        => $this->invoice->get_lisfm_ecoart($art),
-                                       'select_art'                            
                => 'art',
-                                       'lang_select_art'                       
                => lang('Select Invoice Type'),
-                                       'lang_art_statustext'                   
        => lang('You have to select type of invoice'),
-
-                                       'lang_type'                             
                        => lang('Type invoice II'),
-                                       'type_list'                             
                        => $this->invoice->get_type_list($type),
-                                       'select_type'                           
                => 'type',
-                                       'lang_no_type'                          
                => lang('No type'),
-                                       'lang_type_statustext'                  
        => lang('Select the type  invoice. To do not use type -  select NO 
TYPE'),
-
-                                       'lang_dimb'                             
                        => lang('Dim B'),
-                                       'dimb_list'                             
                        => $this->invoice->select_dimb_list($dim_b),
-                                       'select_dimb'                           
                => 'dim_b',
-                                       'lang_no_dimb'                          
                => lang('No Dim B'),
-                                       'lang_dimb_statustext'                  
        => lang('Select the Dim B for this invoice. To do not use Dim B -  
select NO DIM B'),
-
-                                       'lang_janitor'                          
                => lang('Janitor'),
-                                       'janitor_list'                          
                => $this->bocommon->get_user_list_right(32,$janitor,'.invoice'),
-                                       'select_janitor'                        
                => 'janitor',
-                                       'lang_no_janitor'                       
                => lang('No janitor'),
-                                       'lang_janitor_statustext'               
        => lang('Select the janitor responsible for this invoice. To do not use 
janitor -  select NO JANITOR'),
-
-                                       'lang_supervisor'                       
                => lang('Supervisor'),
-                                       'supervisor_list'                       
                => 
$this->bocommon->get_user_list_right(64,$supervisor,'.invoice'),
-                                       'select_supervisor'                     
                => 'supervisor',
-                                       'lang_no_supervisor'                    
        => lang('No supervisor'),
-                                       'lang_supervisor_statustext'            
=> lang('Select the supervisor responsible for this invoice. To do not use 
supervisor -  select NO SUPERVISOR'),
-
-                                       'lang_budget_responsible'               
        => lang('B - responsible'),
-                                       'budget_responsible_list'               
        => 
$this->bocommon->get_user_list_right(128,$budget_responsible,'.invoice'),
-                                       'select_budget_responsible'             
        => 'budget_responsible',
-                                       'lang_select_budget_responsible'        
=> lang('Select B-Responsible'),
-                                       'lang_budget_responsible_statustext'=> 
lang('You have to select a budget responsible for this invoice in order to make 
the import')
-                               );
-
                        $GLOBALS['phpgw']->xslttpl->add_file(array('invoice'));
 
-                       $appname        = lang('Invoice');
-                       $function_msg   = lang('Import from CSV');
+                       $appname                 = lang('Invoice');
+                       $function_msg    = lang('Import from CSV');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('import' => $data));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('import' => $data));
                        //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
-               function debug_import($buffer='',$invoice_common='')
+               function debug_import($buffer = '', $invoice_common = '')
                {
-                       $table  = $buffer['table'];
-                       $header = $buffer['header'];
-                       $import = $buffer['import'];
+                       $table   = $buffer['table'];
+                       $header  = $buffer['header'];
+                       $import  = $buffer['import'];
 
-                       $sum=0;
+                       $sum = 0;
 
                        $i = 0;
-                       foreach ($table as $dummy => $record)
+                       foreach($table as $dummy => $record)
                        {
-                               $k=0;
-                               foreach ($import as $text => $key)
+                               $k = 0;
+                               foreach($import as $text => $key)
                                {
-                                       $content[$i]['row'][$k]['value']        
= $record[$key];
-                                       $content[$i]['row'][$k]['align']        
= 'center';
-                                       if ($key=='belop')
+                                       $content[$i]['row'][$k]['value'] = 
$record[$key];
+                                       $content[$i]['row'][$k]['align'] = 
'center';
+                                       if($key == 'belop')
                                        {
-                                               
$content[$i]['row'][$k]['align']        = 'right';
-                                               $sum=$sum+$record[$key];
-                                               
$content[$i]['row'][$k]['value']        = number_format($record[$key], 2, ',', 
'');
+                                               
$content[$i]['row'][$k]['align'] = 'right';
+                                               $sum                            
                         = $sum + $record[$key];
+                                               
$content[$i]['row'][$k]['value'] = number_format($record[$key], 2, ',', '');
                                        }
-                                       else if ($key=='stedsnavn')
+                                       else if($key == 'stedsnavn')
                                        {
-                                               
$content[$i]['row'][$k]['align']        = 'left';
+                                               
$content[$i]['row'][$k]['align'] = 'left';
                                        }
 
                                        $k++;
@@ -411,49 +392,47 @@
                                $i++;
                        }
 
-                       foreach ($import as $text => $key)
+                       foreach($import as $text => $key)
                        {
                                $table_header[] = array
                                        (
-                                               'header'        => $text,
-                                               'width'         => '5%',
-                                               'align'         => 'center'
-                                       );
+                                       'header' => $text,
+                                       'width'  => '5%',
+                                       'align'  => 'center'
+                               );
                        }
 
                        $link_data_add = array
                                (
-                                       'menuaction'    => 
'property.uiXport.import',
-                                       'convert'       => 'true'
-                               );
+                               'menuaction' => 'property.uiXport.import',
+                               'convert'        => 'true'
+                       );
 
                        $link_data_cancel = array
                                (
-                                       'menuaction'    => 
'property.uiXport.import',
-                                       'cancel'        => true
+                               'menuaction' => 'property.uiXport.import',
+                               'cancel'         => true
+                       );
 
-                               );
+                       $link_data_add           = $link_data_add + 
$invoice_common;
+                       $link_data_cancel        = $link_data_cancel + 
$invoice_common;
 
-                       $link_data_add          = $link_data_add + 
$invoice_common;
-                       $link_data_cancel       = $link_data_cancel + 
$invoice_common;
 
-
                        $table_add[] = array
                                (
-                                       'lang_add'                              
        => lang('Import'),
-                                       'lang_add_statustext'           => 
lang('Import this invoice'),
-                                       'add_action'                            
=> $GLOBALS['phpgw']->link('/index.php',$link_data_add),
-                                       'lang_cancel'                           
=> lang('cancel'),
-                                       'lang_cancel_statustext'        => 
lang('Do not import this invoice'),
-                                       'cancel_action'                         
=> $GLOBALS['phpgw']->link('/index.php',$link_data_cancel)
+                               'lang_add'                               => 
lang('Import'),
+                               'lang_add_statustext'    => lang('Import this 
invoice'),
+                               'add_action'                     => 
$GLOBALS['phpgw']->link('/index.php', $link_data_add),
+                               'lang_cancel'                    => 
lang('cancel'),
+                               'lang_cancel_statustext' => lang('Do not import 
this invoice'),
+                               'cancel_action'                  => 
$GLOBALS['phpgw']->link('/index.php', $link_data_cancel)
+                       );
 
-                               );
+                       $vendor = $this->contacts->read_single(array('id' => 
$invoice_common['vendor_id']), array('attributes' => array(array('column_name' 
=> 'org_name'))));
 
-                       $vendor = $this->contacts->read_single(array('id' => 
$invoice_common['vendor_id']), array('attributes'=>array(array('column_name' => 
'org_name'))));
-
                        foreach($vendor['attributes'] as $attribute)
                        {
-                               if($attribute['column_name']=='org_name')
+                               if($attribute['column_name'] == 'org_name')
                                {
                                        $vendor_name = $attribute['value'];
                                        break;
@@ -462,39 +441,39 @@
 
                        $data = array
                                (
-                                       'artid'                                 
                => $invoice_common['art'],
-                                       'lang_type'                             
                => lang('Type'),
-                                       'lang_bilagsnr'                         
        => lang('bilagsnr'),
-                                       'bilagsnr'                              
                => $invoice_common['bilagsnr'],
-                                       'lang_vendor'                           
        => lang('Vendor'),
-                                       'vendor_name'                           
        => $vendor_name,
-                                       'spvend_code'                           
        => $invoice_common['vendor_id'],
-                                       'lang_fakturadato'                      
        => lang('invoice date'),
-                                       'fakturadato'                           
        => 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($table[0]['fakturadato'])),
-                                       'lang_forfallsdato'                     
        => lang('Payment date'),
-                                       'forfallsdato'                          
        => 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($table[0]['forfallsdato'])),
-                                       'lang_janitor'                          
        => lang('Janitor'),
-                                       'oppsynsmannid'                         
        => $invoice_common['janitor'],
-                                       'lang_supervisor'                       
        => lang('Supervisor'),
-                                       'saksbehandlerid'                       
        => $invoice_common['supervisor'],
-                                       'lang_budget_responsible'               
=> lang('Budget Responsible'),
-                                       'budsjettansvarligid'                   
=> $invoice_common['budget_responsible'],
-                                       'lang_sum'                              
                => lang('Sum'),
-                                       'sum'                                   
                => number_format($sum, 2, ',', ''),
-                                       'table_header'                          
        => $table_header,
-                                       'values'                                
                => $content,
-                                       'table_add'                             
                => $table_add
-                               );
+                               'artid'                                         
 => $invoice_common['art'],
+                               'lang_type'                                     
 => lang('Type'),
+                               'lang_bilagsnr'                          => 
lang('bilagsnr'),
+                               'bilagsnr'                                      
 => $invoice_common['bilagsnr'],
+                               'lang_vendor'                            => 
lang('Vendor'),
+                               'vendor_name'                            => 
$vendor_name,
+                               'spvend_code'                            => 
$invoice_common['vendor_id'],
+                               'lang_fakturadato'                       => 
lang('invoice date'),
+                               'fakturadato'                            => 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
strtotime($table[0]['fakturadato'])),
+                               'lang_forfallsdato'                      => 
lang('Payment date'),
+                               'forfallsdato'                           => 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
strtotime($table[0]['forfallsdato'])),
+                               'lang_janitor'                           => 
lang('Janitor'),
+                               'oppsynsmannid'                          => 
$invoice_common['janitor'],
+                               'lang_supervisor'                        => 
lang('Supervisor'),
+                               'saksbehandlerid'                        => 
$invoice_common['supervisor'],
+                               'lang_budget_responsible'        => 
lang('Budget Responsible'),
+                               'budsjettansvarligid'            => 
$invoice_common['budget_responsible'],
+                               'lang_sum'                                      
 => lang('Sum'),
+                               'sum'                                           
 => number_format($sum, 2, ',', ''),
+                               'table_header'                           => 
$table_header,
+                               'values'                                        
 => $content,
+                               'table_add'                                     
 => $table_add
+                       );
 
                        unset($content);
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','table_header'));
-                       $appname                                                
= lang('Invoice');
-                       $function_msg   = lang('Debug');
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('invoice', 
'table_header'));
+                       $appname                 = lang('Invoice');
+                       $function_msg    = lang('Debug');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('debug' => $data));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('debug' => $data));
                        //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
@@ -502,89 +481,85 @@
                {
                        if(!$this->acl_manage)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>16, 'acl_location'=> $this->acl_location));
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop', 'perm' => 16, 'acl_location' 
=> $this->acl_location));
                        }
 
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::export';
                        $GLOBALS['phpgw']->xslttpl->add_file(array('invoice',
                                'search_field'));
 
-                       $values         = phpgw::get_var('values');
-                       $date   = phpgw::get_var('date');
+                       $values  = phpgw::get_var('values');
+                       $date    = phpgw::get_var('date');
                        $receipt = array();
 
                        if($values['submit'])
                        {
-                               if (!$values['conv_type'] && !$values['file'] )
+                               if(!$values['conv_type'] && !$values['file'])
                                {
 
-                                       $receipt['error'][] =  array('msg'=> 
lang('No conversion type could be located.') . ' - ' . lang('Please choose a 
conversion type from the list'));
+                                       $receipt['error'][] = array('msg' => 
lang('No conversion type could be located.') . ' - ' . lang('Please choose a 
conversion type from the list'));
                                }
                                else if($values['conv_type'] && 
!$values['file'])
                                {
-                                       $receipt = 
$this->bo->export(array('conv_type'=>$values['conv_type'],'download'=>$values['download'],'force_period_year'=>$values['force_period_year']));
+                                       $receipt = 
$this->bo->export(array('conv_type' => $values['conv_type'], 'download' => 
$values['download'], 'force_period_year' => $values['force_period_year']));
                                        if(!$values['download'])
                                        {
-                                               
$GLOBALS['phpgw_info']['flags'][noheader] = true;
-                                               
$GLOBALS['phpgw_info']['flags'][nofooter] = true;
-                                               
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
-                                               
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                                               
$GLOBALS['phpgw_info']['flags'][noheader]                = true;
+                                               
$GLOBALS['phpgw_info']['flags'][nofooter]                = true;
+                                               
$GLOBALS['phpgw_info']['flags']['xslt_app']              = false;
+                                               
$GLOBALS['phpgw_info']['flags']['noframework']   = true;
                                                echo '<pre>' . 
$receipt['message'][0]['msg'] . '</pre>';
-                                               echo '&nbsp<a 
href="'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiXport.export')) . '">' . lang('Back') . '</a>';
+                                               echo '&nbsp<a href="' . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiXport.export')) . '">' . lang('Back') . '</a>';
                                        }
                                }
                        }
                        else
                        {
-                               $date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $date = 
$GLOBALS['phpgw']->common->show_date(mktime(0, 0, 0, date("m"), date("d"), 
date("Y")), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        }
                        //_debug_array($receipt);
 
                        $link_data = array
                                (
-                                       'menuaction'            => 
'property.uiXport.export'
-                               );
+                               'menuaction' => 'property.uiXport.export'
+                       );
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $data = array
                                (
-                                       'menu'                                  
        => $this->bocommon->get_menu(),
-                                       'msgbox_data'                           
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                                       'lang_export_statustext'        => 
lang('click this button to start the export'),
-                                       'lang_select_conv'                      
=> lang('Select conversion'),
-                                       'conv_list'                             
        => $this->bo->select_export_conv($values['conv_type']),
-                                       'select_conv'                           
=> 'values[conv_type]',
-                                       'lang_conv_statustext'          => 
lang('Select conversion'),
+                               'menu'                                   => 
$this->bocommon->get_menu(),
+                               'msgbox_data'                    => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'lang_export_statustext' => lang('click this 
button to start the export'),
+                               'lang_select_conv'               => 
lang('Select conversion'),
+                               'conv_list'                              => 
$this->bo->select_export_conv($values['conv_type']),
+                               'select_conv'                    => 
'values[conv_type]',
+                               'lang_conv_statustext'   => lang('Select 
conversion'),
+                               'lang_rollback_file'     => lang('Roll back'),
+                               'link_rollback_file'     => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiXport.rollback')),
+                               'lang_export_to_file'    => lang('Export to 
file'),
+                               'value_debug'                    => 
$values['debug'],
+                               'lang_debug_statustext'  => lang('Uncheck to 
debug the result'),
+                               'lang_submit'                    => 
lang('Submit'),
+                               'lang_cancel'                    => 
lang('Cancel'),
+                               'form_action'                    => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'lang_save'                              => 
lang('save')
+                       );
 
-                                       'lang_rollback_file'            => 
lang('Roll back'),
-                                       'link_rollback_file'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiXport.rollback')),
-
-                                       'lang_export_to_file'           => 
lang('Export to file'),
-                                       'value_debug'                           
=> $values['debug'],
-                                       'lang_debug_statustext'         => 
lang('Uncheck to debug the result'),
-
-                                       'lang_submit'                           
=> lang('Submit'),
-                                       'lang_cancel'                           
=> lang('Cancel'),
-
-                                       'form_action'                           
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                                       'lang_save'                             
        => lang('save')
-                               );
-
                        //_debug_array($data);
-                       $appname        = lang('Invoice');
-                       $function_msg   = lang('Export invoice');
+                       $appname                 = lang('Invoice');
+                       $function_msg    = lang('Export invoice');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('export' => $data));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('export' => $data));
                }
 
                function rollback()
                {
                        if(!$this->acl_manage)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>16, 'acl_location'=> $this->acl_location));
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop', 'perm' => 16, 'acl_location' 
=> $this->acl_location));
                        }
 
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::invoice::rollback';
@@ -592,33 +567,33 @@
                        $GLOBALS['phpgw']->xslttpl->add_file(array('invoice',
                                'search_field'));
 
-                       $values         = phpgw::get_var('values');
-                       $date   = phpgw::get_var('date');
+                       $values  = phpgw::get_var('values');
+                       $date    = phpgw::get_var('date');
                        //_debug_array($values);
 
                        if($values['submit'])
                        {
-                               if (!$values['conv_type'])
+                               if(!$values['conv_type'])
                                {
-                                       $receipt['error'][] = array('msg'=> 
lang('No conversion type could be located.') .' - ' . lang('Please choose a 
conversion type from the list'));
+                                       $receipt['error'][] = array('msg' => 
lang('No conversion type could be located.') . ' - ' . lang('Please choose a 
conversion type from the list'));
                                }
 
                                if(!$values['file'] && !$values['voucher_id'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Please choose a file or a voucher'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please choose a file or a voucher'));
                                }
 
                                if(!$receipt['error'])
                                {
-                                       $receipt = 
$this->bo->rollback($values['conv_type'],$values['file'],$date,$values['voucher_id']);
+                                       $receipt = 
$this->bo->rollback($values['conv_type'], $values['file'], $date, 
$values['voucher_id']);
                                }
                        }
                        else
                        {
-                               $date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $date = 
$GLOBALS['phpgw']->common->show_date(mktime(0, 0, 0, date("m"), date("d"), 
date("Y")), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        }
 
-                       $link_data = array('menuaction' => 
'property.uiXport.rollback');
+                       $link_data = array('menuaction' => 
'property.uiXport.rollback');
 
                        //_debug_array($receipt);
                        $GLOBALS['phpgw']->jqcal->add_listener('date');
@@ -627,40 +602,35 @@
 
                        $data = array
                                (
-                                       'msgbox_data'                           
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'msgbox_data'                    => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'lang_select_conv'               => 
lang('Select conversion'),
+                               'conv_list'                              => 
$this->bo->select_export_conv($values['conv_type']),
+                               'select_conv'                    => 
'values[conv_type]',
+                               'lang_conv_statustext'   => lang('Select 
conversion'),
+                               'lang_select_file'               => 
lang('Select file to roll back'),
+                               'lang_no_file'                   => lang('No 
file selected'),
+                               'lang_file_statustext'   => lang('Select file 
to roll back'),
+                               'select_file'                    => 
'values[file]',
+                               'rollback_file_list'     => 
$this->bo->select_rollback_file($values['file']),
+                               'lang_export_to_file'    => lang('Export to 
file'),
+                               'value_debug'                    => 
$values['debug'],
+                               'value_date'                     => $date,
+                               'lang_date'                              => 
lang('Export date'),
+                               'lang_date_statustext'   => lang('Select date 
for the file to roll back'),
+                               'lang_submit'                    => 
lang('Submit'),
+                               'lang_cancel'                    => 
lang('Cancel'),
+                               'form_action'                    => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'lang_save'                              => 
lang('save')
+                       );
 
-                                       'lang_select_conv'                      
=> lang('Select conversion'),
-                                       'conv_list'                             
        => $this->bo->select_export_conv($values['conv_type']),
-                                       'select_conv'                           
=> 'values[conv_type]',
-                                       'lang_conv_statustext'          => 
lang('Select conversion'),
-
-                                       'lang_select_file'                      
=> lang('Select file to roll back'),
-                                       'lang_no_file'                          
=> lang('No file selected'),
-                                       'lang_file_statustext'          => 
lang('Select file to roll back'),
-                                       'select_file'                           
=> 'values[file]',
-
-                                       'rollback_file_list'            => 
$this->bo->select_rollback_file($values['file']),
-                                       'lang_export_to_file'           => 
lang('Export to file'),
-                                       'value_debug'                           
=> $values['debug'],
-
-                                       'value_date'                            
=> $date,
-                                       'lang_date'                             
        => lang('Export date'),
-                                       'lang_date_statustext'          => 
lang('Select date for the file to roll back'),
-
-                                       'lang_submit'                           
=> lang('Submit'),
-                                       'lang_cancel'                           
=> lang('Cancel'),
-
-                                       'form_action'                           
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                                       'lang_save'                             
        => lang('save')
-                               );
-
                        //_debug_array($data);
 
-                       $appname                        = lang('Invoice');
-                       $function_msg           = lang('Rollback invoice');
+                       $appname                 = lang('Invoice');
+                       $function_msg    = lang('Rollback invoice');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('rollback' => $data));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('rollback' => $data));
                }
-       }
+
+       }       
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]