fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9150] property: alternative invoicehandling


From: Sigurd Nes
Subject: [Fmsystem-commits] [9150] property: alternative invoicehandling
Date: Sun, 15 Apr 2012 15:36:00 +0000

Revision: 9150
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9150
Author:   sigurdne
Date:     2012-04-15 15:35:59 +0000 (Sun, 15 Apr 2012)
Log Message:
-----------
property: alternative invoicehandling

Modified Paths:
--------------
    trunk/property/inc/class.boinvoice.inc.php
    trunk/property/inc/class.soXport.inc.php
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiinvoice.inc.php
    trunk/property/inc/class.uiinvoice2.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/inc/export/default/Basware_X114
    trunk/property/js/portico/ajax_invoice.js
    trunk/property/js/yahoo/project.edit.js
    trunk/property/js/yahoo/workorder.edit.js
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/config.tpl
    trunk/property/templates/base/invoice2.xsl

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/inc/class.boinvoice.inc.php  2012-04-15 15:35:59 UTC (rev 
9150)
@@ -37,6 +37,8 @@
        {
                public $total_records = 0;
                public $sum_amount = 0;
+               public $results = 0;
+               public $allrows = false;
 
                function property_boinvoice($session=false)
                {
@@ -184,7 +186,7 @@
                function read_invoice_sub($voucher_id='',$paid='')
                {
                        $invoice = $this->so->read_invoice_sub(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                               'user_lid' => $this->user_lid,'cat_id' => 
$this->cat_id,'voucher_id'=>$voucher_id,'paid' => $paid));
+                               'user_lid' => $this->user_lid,'cat_id' => 
$this->cat_id,'voucher_id'=>$voucher_id,'paid' => $paid, 'results' => 
$this->results,'allrows'=>$this->allrows));
                        $this->total_records = $this->so->total_records;
                        return $invoice;
                }
@@ -802,4 +804,22 @@
                {
                        return $this->so->get_vouchers($data);
                }
+
+               public function update_voucher2($data)
+               {
+                       $receipt = $this->so->update_voucher2($data);
+                       $receipt = $this->so->forward($data);
+                       
+                       if( isset($data['order_id']) && $data['order_id'])
+                       {
+                               if(isset($data['close_order']) && 
$data['close_order'])
+                               {
+                                       
execMethod('property.soworkorder.close_orders',array($data['order_id']));
+                               }
+                               if(isset($data['close_order_orig']) && 
$data['close_order_orig'] && !$data['close_order'])
+                               {
+                                       
execMethod('property.soworkorder.reopen_orders',array($data['order_id']));
+                               }
+                       }
+               }
        }

Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php    2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/inc/class.soXport.inc.php    2012-04-15 15:35:59 UTC (rev 
9150)
@@ -345,8 +345,6 @@
                                $data['item_id'],
                                $data['external_ref'],
                                $data['currency'],
-                               $this->db->db_addslashes($data['process_log']),
-                               $data['process_code'],
                                $data['manual_record']
                        );
 
@@ -356,13 +354,32 @@
                                . " 
periode,periodization,periodization_start,forfallsdato,fakturanr,spbudact_code,regtid,artid,spvend_code,dima,loc1,"
                                . " 
dimb,mvakode,dimd,oppsynsmannid,saksbehandlerid,budsjettansvarligid,oppsynsigndato,saksigndato,"
                                . " 
budsjettsigndato,merknad,splitt,utbetalingid,utbetalingsigndato,filnavn,overftid,item_type,item_id,external_ref,"
-                               . " 
currency,process_log,process_code,manual_record,belop,godkjentbelop,ordrebelop)"
+                               . " 
currency,manual_record,belop,godkjentbelop,ordrebelop)"
                                . "VALUES ($values, "
                                . $this->db->money_format($data['belop']) . ","
                                . 
$this->db->money_format($data['godkjentbelop']) . ","
                                . $this->db->money_format($data['ordrebelop']) 
. ")";
 
-                       return $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       
+                       if($data['manual_record'] && ($data['process_log'] || 
$data['process_code']))
+                       {
+                               $valueset_log = array
+                               (
+                                       $data['bilagsnr'],
+                                       $data['process_code'],
+                                       
$this->db->db_addslashes($data['process_log']),
+                                       $this->account_id,
+                                       time()
+                               ); 
+
+                               $values = 
$this->db->validate_insert($valueset_log);
+                               
+                               $sql = "INSERT INTO fm_ecobilag_process_log 
(bilagsnr,process_code,process_log,user_id,entry_date) VALUES ({$values})";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                       }
+
+                       return true;
                }
 
 
@@ -415,11 +432,27 @@
                                        'external_ref'                  => 
$this->db->f('external_ref'),
                                        'kostra_id'                             
=> $this->db->f('kostra_id'),
                                        'currency'                              
=> $this->db->f('currency'),
-                                       'process_log'                   => 
$this->db->f('process_log',true),
-                                       'process_code'                  => 
$this->db->f('process_code'),
+                                       'process_log'                   => '', 
//Fetched below
+                                       'process_code'                  => ''
+
                                );
                        }
 
+                       if($voucher)
+                       {
+                               $sql= "SELECT * FROM fm_ecobilag_process_log 
WHERE bilagsnr = {$bilagsnr}";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $process_log    = 
$this->db->f('process_log',true);
+                               $process_code   = $this->db->f('process_code');
+
+                               foreach ($voucher as &$line)
+                               {
+                                       $line['process_log'] = $process_log;
+                                       $line['process_code'] = $process_code;
+                               }
+                       }
+
                        return $voucher;
        }
 

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/inc/class.soinvoice.inc.php  2012-04-15 15:35:59 UTC (rev 
9150)
@@ -361,7 +361,8 @@
                        $paid           = isset($data['paid']) ? $data['paid'] 
: '';
                        $project_id     = isset($data['project_id']) && 
$data['project_id'] ? (int)$data['project_id'] : 0;
                        $order_id       = isset($data['order_id']) && 
$data['order_id'] ? $data['order_id'] : 0 ;//might be bigint
-
+                       $results        = isset($data['results']) && 
$data['results'] ? (int)$data['results'] : 0;
+                       $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
                        if ($paid)
                        {
                                $table = 'fm_ecobilagoverf';
@@ -373,12 +374,18 @@
 
                        switch($order)
                        {
+                               case 'id':
                                case 'dima':
-                               case 'belop':
                                case 'spbudact_code':
                                case 'pmwrkord_code':
                                        $ordermethod = " ORDER BY $order $sort";
                                        break;
+                               case 'amount':
+                                       $ordermethod = " ORDER BY belop $sort";
+                                       break;
+                               case 'approved_amount':
+                                       $ordermethod = " ORDER BY godkjentbelop 
$sort";
+                                       break;
                                default:
                                        $ordermethod = ' ORDER BY pmwrkord_code 
DESC, id DESC';                                 
                        }
@@ -391,6 +398,10 @@
                                $filtermethod .= " {$where} bilagsnr= 
'$voucher_id'";
                                $where = 'AND';
                        }
+                       else if (!$order_id)
+                       {
+                               return array();
+                       }
 
                        if ($order_id)
                        {
@@ -410,9 +421,20 @@
                                . " {$this->left_join} fm_project ON 
fm_workorder.project_id = fm_project.id"
                                . " {$this->join} fm_vendor ON 
$table.spvend_code = fm_vendor.id $filtermethod";
 
-                       $this->db->query($sql . $ordermethod,__LINE__,__FILE__);
-                       $this->total_records = $this->db->num_rows();
+                       $this->db->query('SELECT count(*) AS cnt ' . 
substr($sql,strripos($sql,' FROM')),__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $this->total_records            = $this->db->f('cnt');
 
+
+                       if(!$allrows)
+                       {
+                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__, $results);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
+
                        $i = 0;
 
                        $closed = 
isset($this->config->config_data['workorder_closed_status']) && 
$this->config->config_data['workorder_closed_status'] ? 
$this->config->config_data['workorder_closed_status'] : 'closed';
@@ -1285,8 +1307,8 @@
                                                'order_id'                      
        => $this->db->f('pmwrkord_code'),
                                                'kostra_id'                     
        => $this->db->f('kostra_id'),
                                                'currency'                      
        => $this->db->f('currency'),
-                                               'process_code'                  
=> $this->db->f('process_code'),
-                                               'process_log'                   
=> $this->db->f('process_log',true),
+                                               'process_code'                  
=> '', //Fetched below
+                                               'process_log'                   
=> '',
                                                'oppsynsigndato'                
=> $this->db->f('oppsynsigndato'),
                                                'saksigndato'                   
=> $this->db->f('saksigndato'),
                                                'budsjettsigndato'              
=> $this->db->f('budsjettsigndato'),
@@ -1301,7 +1323,21 @@
                                        );
                        }
 
+                       if($values)
+                       {
+                               $bilagsnr = (int)$values[0]['voucher_id'];
+                               $sql= "SELECT * FROM fm_ecobilag_process_log 
WHERE bilagsnr = {$bilagsnr}";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $process_log    = 
$this->db->f('process_log',true);
+                               $process_code   = $this->db->f('process_code');
 
+                               foreach ($values as &$line)
+                               {
+                                       $line['process_log'] = $process_log;
+                                       $line['process_code'] = $process_code;
+                               }
+                       }
 
                        //_debug_array($values);
                        return $values;
@@ -1671,6 +1707,7 @@
                */
                public function forward($data)
                {
+
                        $receipt = array();
                        $local_error= false;
                        if(isset($data['forward']) && 
is_array($data['forward']) && isset($data['voucher_id']) && $data['voucher_id'])
@@ -1704,6 +1741,11 @@
 
                                if($local_error)
                                {
+                                       foreach ($receipt['error'] as $_error)
+                                       {
+                                               
phpgwapi_cache::message_set($_error['msg'], 'error');
+                                       }
+
                                        return $receipt;
                                }
                                // end check
@@ -1754,6 +1796,137 @@
                        return false;
                }
 
+
+               public function update_voucher2($data)
+               {
+
+                       $GLOBALS['phpgw']->db->transaction_begin();
+                       $value_set = array();
+                       
+                       $value_set['pmwrkord_code'] = $data['order_id'];
+                       $value_set['dimb'] = $data['dim_b'];
+                       $value_set['dima'] = $data['dim_a'];
+                       $value_set['mvakode'] = $data['tax_code'];
+                       $value_set['project_id'] = $data['project_group'];
+                       $value_set['spbudact_code'] = $data['b_account_id'];
+                       $value_set['periode'] = $data['period'];
+                       $value_set['periodization'] = $data['periodization'];
+                       $value_set['periodization_start'] = 
$data['periodization_start'];
+                       $value_set['kreditnota'] = !!$data['park_invoice'];
+
+                       $value_set      = 
$this->db->validate_update($value_set);
+                       $this->db->query("UPDATE fm_ecobilag SET $value_set 
WHERE bilagsnr = '{$data['voucher_id']}'",__LINE__,__FILE__);
+
+                       if($data['order_id'] && $data['b_account_id'])
+                       {
+                               $this->db->query("UPDATE fm_workorder SET 
account_id = '{$data['b_account_id']}' WHERE id='{$data['order_id']}'");
+                       }
+
+                       foreach($data['approved_amount'] as $line_id => 
$approved_amount)
+                       {
+                               $approved_amount                = 
str_replace(array(' ', ','),array('','.'),$approved_amount);
+                               if(is_numeric($approved_amount))
+                               {
+                                       $this->db->query("UPDATE fm_ecobilag 
SET godkjentbelop = '$approved_amount' WHERE id = 
'{$line_id}'",__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       phpgwapi_cache::message_set(lang('Not a 
valid amount'), 'error');
+                               }
+                       }
+
+                       if(isset($data['split_amount']) && 
$data['split_amount'] && is_array($data['split_amount']))
+                       {
+                               foreach($data['split_amount'] as $id => 
$split_amount)
+                               {
+                                       if(!$split_amount)
+                                       {
+                                               continue;
+                                       }
+                                       
+                                       $split_amount           = 
str_replace(array(' ', ','),array('','.'),$split_amount);
+
+                                       if(!is_numeric($split_amount ))
+                                       {
+                                               
phpgwapi_cache::message_set(lang('Not a valid amount'), 'error');
+                                               continue;
+                                       }
+
+                                       $table = 'fm_ecobilag';
+                                       $metadata = $this->db->metadata($table);
+                                       $sql ="SELECT * FROM {$table} WHERE id= 
{$id}";
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                                       $this->db->next_record();
+
+                                       $value_set = array();
+
+                                       foreach($metadata as $_field)
+                                       {
+                                               if($_field->name != 'id')
+                                               {
+                                                       
$value_set[$_field->name] = $this->db->f($_field->name,true);
+                                               }
+                                       }
+
+                                       $this->db->query( "INSERT INTO {$table} 
(" . implode( ',', array_keys($value_set) ) . ')'
+                                               . ' VALUES (' . 
$this->db->validate_insert( array_values($value_set) ) . ')',__LINE__,__FILE__);
+
+                                       $new_id = 
$this->db->get_last_insert_id($table,'id');
+
+                                       $this->db->query("SELECT belop FROM 
{$table} WHERE id={$id}",__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $amount = $this->db->f('belop');
+                                       $new_amount = $amount - $split_amount;
+
+                                       $value_set= array
+                                       (
+                                               'belop'                 => 
$new_amount,
+                                               'godkjentbelop' => $new_amount,
+                                       );
+                                       $value_set      = 
$this->db->validate_update($value_set);
+                                       $this->db->query("UPDATE {$table} SET 
$value_set WHERE id= {$id}" ,__LINE__,__FILE__);
+
+                                       $value_set= array
+                                       (
+                                               'belop'                 => 
$split_amount,
+                                               'godkjentbelop' => 
$split_amount,
+                                       );
+                                       $value_set      = 
$this->db->validate_update($value_set);
+                                       $this->db->query("UPDATE {$table} SET 
$value_set WHERE id= {$new_id}" ,__LINE__,__FILE__);
+                               }
+                       }
+
+
+                       if($data['process_log'] || $data['process_code'])
+                       {
+                               $valueset_log = array
+                               (
+                                       'bilagsnr'              => 
$data['voucher_id'],
+                                       'process_code'  => 
$data['process_code'],
+                                       'process_log'   => 
$this->db->db_addslashes($data['process_log']),
+                                       'user_id'               => 
$this->account_id,
+                                       'entry_date'    => time(),
+                                       'modified_date' => time()
+                               ); 
+
+                               $sql = "SELECT id FROM fm_ecobilag_process_log 
WHERE bilagsnr = '{$data['voucher_id']}'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $process_log_id = 
(int)$this->db->f('id');
+                                       $valueset_log   = 
$this->db->validate_update($valueset_log);
+                                       $this->db->query("UPDATE 
fm_ecobilag_process_log SET $valueset_log WHERE id = 
$process_log_id",__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       $cols = implode(',', 
array_keys($valueset_log));
+                                       $values = 
$this->db->validate_insert($valueset_log);
+                                       $this->db->query("INSERT INTO 
fm_ecobilag_process_log ({$cols}) VALUES ({$values})",__LINE__,__FILE__);
+                               }
+                       }
+                       $GLOBALS['phpgw']->db->transaction_commit();
+               }
+
                public function get_vouchers($data)
                {
                        $filtermethod = '';

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2012-04-13 11:47:39 UTC 
(rev 9149)
+++ trunk/property/inc/class.soworkorder.inc.php        2012-04-15 15:35:59 UTC 
(rev 9150)
@@ -1210,8 +1210,10 @@
 
                        $this->db->transaction_begin();
 
-                       $this->db->query("UPDATE fm_workorder set $value_set 
WHERE id= {$workorder['id']}" ,__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_workorder SET $value_set 
WHERE id= {$workorder['id']}" ,__LINE__,__FILE__);
 
+                       $this->db->query("UPDATE fm_ecobilag SET spbudact_code 
= '{$workorder['b_account_id']}' WHERE pmwrkord_code = '{$workorder['id']}'" 
,__LINE__,__FILE__);
+
 /*                     if($workorder['charge_tenant'])
                        {
                                $this->db->query("UPDATE fm_project set 
charge_tenant = 1 WHERE id =" . $workorder['project_id']);
@@ -1407,4 +1409,28 @@
 
                        return $receipt;
                }
+
+               public function reopen_orders($orders)
+               {
+                       $config         = 
CreateObject('phpgwapi.config','property');
+                       $config->read();
+                       $reopen = 
isset($config->config_data['workorder_reopen_status']) && 
$config->config_data['workorder_reopen_status'] ? 
$config->config_data['workorder_reopen_status'] : 're_opened';
+                       $status_code=array('X' => $closed,'R' => $reopen);
+
+                       $historylog_workorder   = 
CreateObject('property.historylog','workorder');
+
+                       foreach ($orders as $id)
+                       {
+                               $id = (int) $id;
+                               $this->db->query("SELECT type FROM fm_orders 
WHERE id={$id}",__LINE__,__FILE__);
+                               $this->db->next_record();
+                               switch ( $this->db->f('type') )
+                               {
+                                       case 'workorder':
+                                               $historylog_workorder->add('R', 
$id, $reopen);
+                                               
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder set status='{$reopen}' WHERE 
id = {$id}");
+                                               $receipt['message'][] = 
array('msg'=>lang('Workorder %1 is %2',$id, $status_code[$entry]));
+                               }
+                       }
+               }
        }

Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php  2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/inc/class.uiinvoice.inc.php  2012-04-15 15:35:59 UTC (rev 
9150)
@@ -1773,6 +1773,7 @@
 
                        if ($voucher_id)
                        {
+                               $this->bo->allrows = true;
                                $content = 
$this->bo->read_invoice_sub($voucher_id,$paid);
                        }
 

Modified: trunk/property/inc/class.uiinvoice2.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice2.inc.php 2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/inc/class.uiinvoice2.inc.php 2012-04-15 15:35:59 UTC (rev 
9150)
@@ -82,15 +82,28 @@
 
                function index()
                {
+                       $receipt = array();
                        $voucher_id     = phpgw::get_var('voucher_id', 'int');
                        
                        if($values = phpgw::get_var('values'))
                        {
-                               $values['pending_users'] = 
isset($values['pending_users']) && $values['pending_users'] ? 
array_unique($values['pending_users']) : array();
-                               $values['pending_users_orig'] = 
isset($values['pending_users_orig']) && $values['pending_users_orig'] ? 
array_unique($values['pending_users_orig']) : array();
-                               
-                               $receipt = $this->bo->approve_users($values);
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'registration.uipending.index'));
+                               $approve = 
execMethod('property.uiinvoice.get_approve_role');
+
+                               if(!$approve)
+                               {
+                                       $receipt['error'][]=true;
+                                       phpgwapi_cache::message_set(lang('you 
are not approved for this task'), 'error');
+                               }
+
+                               $values['voucher_id'] = $voucher_id;
+                               if(!$receipt['error'])
+                               {
+                                       $receipt = 
$this->bo->update_voucher2($values);
+                               }
+
+                               phpgwapi_cache::message_set(lang('voucher is 
updated'), 'message');
+
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uiinvoice2.index', 'voucher_id' => 
$voucher_id));
                        }
                        else
                        {
@@ -99,27 +112,6 @@
                                        return $this->query();
                                }
 
-                               $status_list = array
-                               (
-                                       array
-                                       (
-                                               'id'    => 0,
-                                               'name'  => lang('Select status')
-                                       ),
-                                       array
-                                       (
-                                               'id'    => 1,
-                                               'name'  => lang('approved')
-                                       ),
-                                       array
-                                       (
-                                               'id'    => 2,
-                                               'name'  => lang('pending')
-                                       ),
-                               );
-
-
-
                                $janitor_list                           = 
$this->bocommon->get_user_list_right(32,$janitor,'.invoice');
                                $supervisor_list                        = 
$this->bocommon->get_user_list_right(64,$supervisor,'.invoice');
                                $budget_responsible_list        = 
$this->bocommon->get_user_list_right(128,$budget_responsible,'.invoice');
@@ -150,46 +142,28 @@
                                        ),
                                        'voucher_info'                          
        => $this->get_single_voucher($voucher_id),
                                        'datatable' => array(
-                                               'source' => 
self::link(array('menuaction' => 'registration.uipending.query', 
'phpgw_return_as' => 'json')),
+                                               'source' => 
self::link(array('menuaction' => 'property.uiinvoice2.query', 'voucher_id' => 
$voucher_id, 'phpgw_return_as' => 'json')),
                                                'field' => array(
                                                        array(
                                                                'key' => 'id',
                                                                'hidden' => true
                                                        ),
                                                        array(
-                                                               'key' => 
'reg_id',
-                                                               'label' => 
lang('id'),
-                                                               'sortable'      
=> true,
-                                                               'formatter' => 
'formatLinkPending'
-                                                       ),
-                                                       array(
-                                                               'key'   =>      
'reg_lid',
-                                                               'label' =>      
lang('user'),
+                                                               'key'   =>      
'amount',
+                                                               'label' =>      
lang('amount'),
                                                                'sortable'      
=>      true
                                                        ),
                                                        array(
-                                                               'key' => 
'reg_dla',
-                                                               'label' => 
lang('time'),
-                                                               'sortable'      
=> true
-                                                       ),
-                                                       array(
-                                                               'key' => 
'reg_approved',
-                                                               'label' => 
lang('approved'),
+                                                               'key' => 
'approved_amount',
+                                                               'label' => 
lang('approved amount'),
                                                                'sortable'      
=> true,
-                                                               'formatter' => 
'FormatterCenter'
+               //                                              'formatter' => 
'FormatterRight',
                                                        ),
                                                        array(
-                                                               'key' => 
'location_code',
-                                                               'label' => 
lang('location'),
-                                                               'sortable'      
=> false
-                                                       ),
-
-                                                       array(
-                                                                       'key' 
=> 'checked',
-                                                                       'label' 
=> lang('approve'),
+                                                                       'key' 
=> 'split',
+                                                                       'label' 
=> lang('split line'),
                                                                        
'sortable' => false,
-                                                                       
'formatter' => 'formatterCheckPending',
-                                                                       
'className' => 'mychecks'
+                                                                       
'formatter' => 'FormatterCenter',
                                                        ),
                                                        array(
                                                                'key' => 
'actions',
@@ -223,25 +197,31 @@
 
                public function query()
                {
-                       $status_id = phpgw::get_var('status_id');
-
                        $this->bo->start = phpgw::get_var('startIndex');
-               
-                       $user_list = $this->bo->read(array('user_id' => 
$user_id, 'role_id' =>$role_id, 
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,
-                                                                               
                   'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run' 
=>$dry_run));
-                       
-                       foreach($user_list as &$user)
+                       $this->bo->order = phpgw::get_var('sort');
+                       $this->bo->sort = phpgw::get_var('dir');
+                       $this->bo->results = phpgw::get_var('results');
+
+                       if ( ! $voucher_id = 
phpgw::get_var('voucher_id_filter') )
                        {
-                               $reg_info = 
unserialize(base64_decode($user['reg_info']));
-                               $user['location_code'] = 
$reg_info['location_code'];
-                               $results['results'][]= $user;
+                               $voucher_id = phpgw::get_var('voucher_id');
                        }
+
+                       $values = $this->bo->read_invoice_sub($voucher_id);
+       
+                       foreach($values as &$entry)
+                       {
+       //                      $entry['split'] = "<input type =\"radio\" 
name=\"values[split]\" value=\"{$entry['id']}\">";
+                               $entry['split'] = "<input type =\"text\" 
name=\"values[split_amount][{$entry['id']}]\" value=\"\">";
+                               $entry['approved_amount'] = "<input type 
=\"text\" name=\"values[approved_amount][{$entry['id']}]\" 
value=\"{$entry['approved_amount']}\">";
+                               $results['results'][]= $entry;
+                       }
                        $results['total_records'] = $this->bo->total_records;
-                       $results['start'] = $this->start;
-                       $results['sort'] = 'location_code';
+                       $results['start'] = $this->bo->start;
+                       $results['sort'] = 'id';
                        $results['dir'] = $this->bo->sort ? $this->bo->sort : 
'ASC';
                                        
-                       array_walk($results['results'], array($this, 
'add_links'), array($type));
+//                     array_walk($results['results'], array($this, 
'add_links'), array($type));
                                                
                        return $this->yui_results($results);
                }
@@ -276,8 +256,8 @@
                        $period_list = 
$this->bocommon->select_list(isset($voucher[0]['period']) ? 
$voucher[0]['period'] : '', $period_list);
                        $periodization_start_list = 
$this->bocommon->select_list(isset($voucher[0]['period']) ? 
$voucher[0]['period'] : '', $periodization_start_list);
 
-                       array_unshift($period_list,array ('id'=> 0,'name'=> 
lang('select')));
-                       array_unshift($periodization_start_list,array ('id'=> 
0,'name'=> lang('select')));
+                       array_unshift($period_list,array ('id'=> '','name'=> 
lang('select')));
+                       array_unshift($periodization_start_list,array ('id'=> 
'','name'=> lang('select')));
 
                        $voucher_info['generic']['period_list']['options'] = 
$period_list;
                        
$voucher_info['generic']['periodization_start_list']['options'] = 
$periodization_start_list;
@@ -290,7 +270,9 @@
                                'is_supervisor'                         => 
lang('supervisor'),
                                'is_budget_responsible'         => lang('b - 
responsible')
                        );
-
+                       
+                       $sign_orig = '';
+                       $my_initials = 
$GLOBALS['phpgw_info']['user']['account_lid'];
                        if(count($voucher))
                        {
 
@@ -322,7 +304,13 @@
                                        'user_list'     => 
!$voucher[0]['budsjettsigndato'] ? array('options' => 
$this->bocommon->get_user_list_right(128,isset($voucher[0]['budget_responsible'])?$voucher[0]['budget_responsible']:'','.invoice'))
 : ''
                                );
 
-                               $my_initials = 
$GLOBALS['phpgw_info']['user']['account_lid'];
+                               foreach($approved_list as &$_approved_list)
+                               {
+                                       
if(isset($_approved_list['user_list']['options']))
+                                       {
+                                               array_unshift 
($_approved_list['user_list']['options'], array('id' => '', 'name' => 
lang('forward')));
+                                       }
+                               }
 
                                foreach($approve as &$_approve)
                                {
@@ -418,6 +406,7 @@
                                        $voucher[0]['external_ref'] = " <a 
href=\"javascript:openwindow('{$baseurl_invoice}{$voucher[0]['external_ref']}','640','800')\"
 >" . lang('invoice id') . '</a>';
                                }
 
+                               $voucher_info['generic']['process_log'] = 
$voucher[0]['process_log'];
                        }
                        else
                        {
@@ -449,9 +438,11 @@
 
                        array_unshift 
($voucher_info['generic']['process_code_list']['options'],array 
('id'=>'','name'=>lang('select')));
                        array_unshift 
($voucher_info['generic']['dimb_list']['options'],array 
('id'=>'','name'=>lang('select')));
-                       array_unshift 
($voucher_info['generic']['periodization_list']['options'],array('id' => '0', 
'name' => lang('none')));
+                       array_unshift 
($voucher_info['generic']['periodization_list']['options'],array('id' => '', 
'name' => lang('none')));
 
                        $voucher_info['voucher'] = $voucher;
+                       $voucher_info['generic']['sign_orig'] = $sign_orig;
+                       $voucher_info['generic']['my_initials'] = $my_initials;
 //_debug_array($voucher_info);die();
 
                        return $voucher_info;

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/inc/class.uiproject.inc.php  2012-04-15 15:35:59 UTC (rev 
9150)
@@ -1716,11 +1716,14 @@
                                        'footer'                                
=> 0
                                );
 
+
+                       $_formatter_voucher_link                        = 
isset($config->config_data['invoicehandler']) && 
$config->config_data['invoicehandler'] == 2 ? 
'YAHOO.widget.DataTable.formatLink_invoicehandler_2' : 
'YAHOO.widget.DataTable.formatLink_voucher';
+
                        $myColumnDefs[2] = array
                                (
                                        'name'          => "2",
                                        'values'        =>      
json_encode(array(      array('key' => 
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink_voucher'),
+                                                                               
                                array('key' => 
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>false,'resizeable'=>true,'formatter'=>$_formatter_voucher_link),
                                                                                
                                array('key' => 'voucher_out_id','hidden'=>true),
                                                                                
                                array('key' => 
'invoice_id','label'=>lang('invoice 
number'),'sortable'=>false,'resizeable'=>true),
                                                                                
                                array('key' => 
'vendor','label'=>lang('vendor'),'sortable'=>false,'resizeable'=>true),

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2012-04-13 11:47:39 UTC 
(rev 9149)
+++ trunk/property/inc/class.uiworkorder.inc.php        2012-04-15 15:35:59 UTC 
(rev 9150)
@@ -1543,8 +1543,8 @@
                        $invoices = array();
                        if ($id)
                        {
-                               $active_invoices = 
execMethod('property.soinvoice.read_invoice_sub', array('order_id' => $id));
-                               $historical_invoices = 
execMethod('property.soinvoice.read_invoice_sub', array('order_id' => $id, 
'paid' => true));
+                               $active_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array('order_id' => $id));
+                               $historical_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array('order_id' => $id, 
'paid' => true));
                                $invoices = 
array_merge($active_invoices,$historical_invoices);
                        }
 
@@ -1584,10 +1584,12 @@
                                );
 
 
+                       $_formatter_voucher_link                        = 
isset($config->config_data['invoicehandler']) && 
$config->config_data['invoicehandler'] == 2 ? 
'YAHOO.widget.DataTable.formatLink_invoicehandler_2' : 
'YAHOO.widget.DataTable.formatLink';
+
                        $myColumnDefs[2] = array
                                (
                                        'name'          => "2",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
+                                       'values'        =>      
json_encode(array(      array('key' => 
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>false,'resizeable'=>true,'formatter'=>
 $_formatter_voucher_link),
                                                                                
                                array('key' => 'voucher_out_id','hidden'=>true),
                                                                                
                                array('key' => 
'invoice_id','label'=>lang('invoice 
number'),'sortable'=>false,'resizeable'=>true),
                                                                                
                                array('key' => 
'vendor','label'=>lang('vendor'),'sortable'=>false,'resizeable'=>true),

Modified: trunk/property/inc/export/default/Basware_X114
===================================================================
--- trunk/property/inc/export/default/Basware_X114      2012-04-13 11:47:39 UTC 
(rev 9149)
+++ trunk/property/inc/export/default/Basware_X114      2012-04-15 15:35:59 UTC 
(rev 9150)
@@ -292,8 +292,8 @@
                //                      'utbetalingsigndato'    => 
$this->db->f('utbetalingsigndato'),
                                        'external_ref'                  => 
$this->db->f('external_ref'),
                                        'currency'                              
=> $this->db->f('currency'),
-                                       'process_log'                   => 
$this->db->f('process_log',true),
-                                       'process_code'                  => 
$this->db->f('process_code'),
+               //                      'process_log'                   => 
$this->db->f('process_log',true),
+               //                      'process_code'                  => 
$this->db->f('process_code'),
 
                                );
                        }
@@ -344,9 +344,7 @@
                                $BilagOverf['external_ref'],
                                $BilagOverf['belop'],
                                $BilagOverf['godkjentbelop'],
-                               $BilagOverf['currency'],
-                               
$this->db->db_addslashes($BilagOverf['process_log']),
-                               $BilagOverf['process_code'],
+                               $BilagOverf['currency']
                        );
 
                        $values = $this->db->validate_insert($values);
@@ -355,7 +353,7 @@
                        . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
                        . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
                        . " 
periode,periodization,periodization_start,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,"
-                       . " 
item_type,item_id,external_ref,belop,godkjentbelop,currency,process_log,process_code)"
+                       . " 
item_type,item_id,external_ref,belop,godkjentbelop,currency)"
                        . " VALUES ({$values})";
 
                        $this->db->query($sql,__LINE__,__FILE__);

Modified: trunk/property/js/portico/ajax_invoice.js
===================================================================
--- trunk/property/js/portico/ajax_invoice.js   2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/js/portico/ajax_invoice.js   2012-04-15 15:35:59 UTC (rev 
9150)
@@ -215,6 +215,10 @@
                                        $("#amount").html( 
data['generic'].amount );
                                        $("#approved_amount").html( 
data['generic'].approved_amount );
                                        $("#currency").html( 
voucher[0].currency );
+                                       $("#process_log").html( 
data['generic'].process_log );
+                                       $("#my_initials").val( 
data['generic'].my_initials );
+                                       $("#sign_orig").val( 
data['generic'].sign_orig );
+
                //                      $("#oppsynsigndato").html( 
voucher[0].oppsynsigndato );
                //                      $("#saksigndato").html( 
voucher[0].saksigndato );
                //                      $("#budsjettsigndato").html( 
voucher[0].budsjettsigndato );
@@ -246,6 +250,7 @@
                                        }
                                        var htmlString_close_order = "<input 
type=\"checkbox\" name=\"values[close_order]\" value=\"1\" title=\"close 
order\"" + checked_close_order + "></input>" + close_order_status;
                                        $("#close_order").html( 
htmlString_close_order );
+                                       $("#close_order_orig").val( 
voucher[0].closed );
 //---------
 
                                        
if(data['generic']['dimb_list']['options'] != 'undefined')
@@ -393,8 +398,7 @@
 
                                                $.each(obj, function(i) {
                                                        var selected = '';
-                                                       if(obj[i].id == 
voucher[0].period)
-
+                                                       if(obj[i].selected != 
'undefined' && obj[i].selected == 1)
                                                        {
                                                                selected = ' 
selected';
                                                        }
@@ -416,6 +420,9 @@
 //                                     $("#janitor").html( '' );
 //                                     $("#supervisor").html( '' );
 //                                     $("#budget_responsible").html( '' );
+                                       $("#close_order_orig").val( '' );
+                                       $("#my_initials").val( '' );
+                                       $("#sign_orig").val( '' );
                                        $("#invoice_date").html( '' );
                                        $("#payment_date").html( '' );
                                        $("#b_account_id").val( '' );
@@ -426,6 +433,7 @@
                                        $("#saksbehandlerid").html( '' );
                                        $("#budsjettansvarligid").html( '' );
                                        $("#remark").html( '' );
+                                       $("#process_log").html( '' );
                                        $("#dim_a").val('' );
                                        $("#dim_b").html( 
"<option>Velg</option>" );
                                        $("#period").html( 
"<option>Velg</option>" );

Modified: trunk/property/js/yahoo/project.edit.js
===================================================================
--- trunk/property/js/yahoo/project.edit.js     2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/js/yahoo/project.edit.js     2012-04-15 15:35:59 UTC (rev 
9150)
@@ -34,7 +34,31 @@
                }
        };
 
+       var oArgs_invoicehandler_2 = {menuaction:'property.uiinvoice2.index'};
+       var sUrl_invoicehandler_2 = phpGWLink('index.php', 
oArgs_invoicehandler_2);
 
+       YAHOO.widget.DataTable.formatLink_invoicehandler_2 = function(elCell, 
oRecord, oColumn, oData)
+       {
+               var voucher_out_id = oRecord.getData('voucher_out_id');
+               if(voucher_out_id)
+               {
+                       var voucher_id = voucher_out_id;
+               }
+               else
+               {
+                       var voucher_id = Math.abs(oData);
+               }
+               if(oData > 0)
+               {
+                       elCell.innerHTML = "<a href="+sUrl_invoicehandler_2 + 
"&voucher_id="+oData+">" + voucher_id + "</a>";
+               }
+               else
+               {
+                       oData = -1*oData;
+                       elCell.innerHTML = "<a 
href="+datatable[2][0]["edit_action"]+"&voucher_id="+oData+"&user_lid=all&paid=true>"
 + voucher_id + "</a>";
+               }
+       };
+
 
/********************************************************************************/
     
        var FormatterRight = function(elCell, oRecord, oColumn, oData)
        {

Modified: trunk/property/js/yahoo/workorder.edit.js
===================================================================
--- trunk/property/js/yahoo/workorder.edit.js   2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/js/yahoo/workorder.edit.js   2012-04-15 15:35:59 UTC (rev 
9150)
@@ -27,6 +27,32 @@
                }
        };
 
+
+       var oArgs_invoicehandler_2 = {menuaction:'property.uiinvoice2.index'};
+       var sUrl_invoicehandler_2 = phpGWLink('index.php', 
oArgs_invoicehandler_2);
+
+       YAHOO.widget.DataTable.formatLink_invoicehandler_2 = function(elCell, 
oRecord, oColumn, oData)
+       {
+               var voucher_out_id = oRecord.getData('voucher_out_id');
+               if(voucher_out_id)
+               {
+                       var voucher_id = voucher_out_id;
+               }
+               else
+               {
+                       var voucher_id = Math.abs(oData);
+               }
+               if(oData > 0)
+               {
+                       elCell.innerHTML = "<a href="+sUrl_invoicehandler_2 + 
"&voucher_id="+oData+">" + voucher_id + "</a>";
+               }
+               else
+               {
+                       oData = -1*oData;
+                       elCell.innerHTML = "<a 
href="+datatable[2][0]["edit_action"]+"&voucher_id="+oData+"&user_lid=all&paid=true>"
 + voucher_id + "</a>";
+               }
+       };
+
 
/********************************************************************************/
 
        this.myParticularRenderEvent = function()

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2012-04-13 11:47:39 UTC (rev 9149)
+++ trunk/property/setup/setup.inc.php  2012-04-15 15:35:59 UTC (rev 9150)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.639';
+       $setup_info['property']['version']              = '0.9.17.640';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -136,6 +136,7 @@
                'fm_ecoart',
                'fm_ecoavvik',
                'fm_ecobilag_process_code',
+               'fm_ecobilag_process_log',
                'fm_ecobilag',
                'fm_ecobilagkilde',
                'fm_ecobilagoverf',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/setup/tables_current.inc.php 2012-04-15 15:35:59 UTC (rev 
9150)
@@ -1014,6 +1014,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_ecobilag_process_log' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'precision' => 
4,'nullable' => False),
+                               'bilagsnr' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'process_code' => array('type' => 'varchar', 
'precision' => 10,'nullable' => true),
+                               'process_log' => array('type' => 
'text','nullable' => false),
+                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'modified_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_ecobilag' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/setup/tables_update.inc.php  2012-04-15 15:35:59 UTC (rev 
9150)
@@ -6128,3 +6128,78 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.638 to 0.9.17.639
+       * Add fm_ecobilag_process_log
+       * 
+       */
+       $test[] = '0.9.17.639';
+       function property_upgrade0_9_17_639()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_ecobilag_process_log', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'precision' => 4,'nullable' => False),
+                                       'bilagsnr' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'process_code' => array('type' => 
'varchar', 'precision' => 10,'nullable' => true),
+                                       'process_log' => array('type' => 
'text','nullable' => false),
+                                       'user_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'modified_date' => array('type' => 
'int', 'precision' => 4,'nullable' => True),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $sql = 'SELECT bilagsnr, process_code, process_log FROM 
fm_ecobilag WHERE process_code IS NOT NULL OR process_log IS NOT NULL';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+               $logs = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $logs[] = array
+                       (
+                               'bilagsnr'              => 
$GLOBALS['phpgw_setup']->oProc->f('bilagsnr'),
+                               'process_code'  => 
$GLOBALS['phpgw_setup']->oProc->f('process_code'),
+                               'process_log'   => 
$GLOBALS['phpgw_setup']->oProc->f('process_log')
+                       );
+               }
+
+               $sql = 'SELECT bilagsnr, process_code, process_log FROM 
fm_ecobilagoverf WHERE process_code IS NOT NULL OR process_log IS NOT NULL';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $logs[] = array
+                       (
+                               'bilagsnr'              => 
$GLOBALS['phpgw_setup']->oProc->f('bilagsnr'),
+                               'process_code'  => 
$GLOBALS['phpgw_setup']->oProc->f('process_code'),
+                               'process_log'   => 
$GLOBALS['phpgw_setup']->oProc->f('process_log')
+                       );
+               }
+
+               foreach ($logs as $log)
+               {
+                       $cols = implode(',', array_keys($log));
+                       $values = 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($log));
+                       $sql = "INSERT INTO fm_ecobilag_process_log ({$cols}) 
VALUES ({$values})";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               }
+
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_ecobilag',array(),'process_code');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_ecobilag',array(),'process_log');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_ecobilagoverf',array(),'process_code');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_ecobilagoverf',array(),'process_log');
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.640';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl    2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/templates/base/config.tpl    2012-04-15 15:35:59 UTC (rev 
9150)
@@ -79,6 +79,15 @@
                </td>
        </tr>
        <tr class="row_off">
+               <td>{lang_invoicehandler}:</td>
+               <td>
+                       <select name="newsettings[invoicehandler]">
+                               <option value="1" 
{selected_invoicehandler_1}>Default</option>
+                               <option value="2" 
{selected_invoicehandler_2}>Alternative</option>
+                       </select>
+               </td>
+       </tr>
+       <tr class="row_off">
                
<td>{lang_workorder_status_that_are_to_be_set_when_invoice_is_processed}:</td>
                <td>
                        <select name="newsettings[workorder_closed_status]">

Modified: trunk/property/templates/base/invoice2.xsl
===================================================================
--- trunk/property/templates/base/invoice2.xsl  2012-04-13 11:47:39 UTC (rev 
9149)
+++ trunk/property/templates/base/invoice2.xsl  2012-04-15 15:35:59 UTC (rev 
9150)
@@ -60,6 +60,9 @@
                        <table>
                                <xsl:apply-templates select="filter_form" />
                                <xsl:apply-templates select="filter_invoice" />
+                       </table>
+                       <form action="#" name="voucher_form" id="voucher_form" 
method="post">
+                       <table>
                                <xsl:call-template name="voucher_fields" />
                                <xsl:call-template name="approve"/>
                                <tr>
@@ -68,8 +71,8 @@
                                                <xsl:apply-templates 
select="datatable"/>
                                        </td>
                                </tr>
-                               <xsl:apply-templates 
select="form/list_actions"/>
                        </table>
+                       </form>
                </div>
        </div>
 </xsl:template>
@@ -200,7 +203,7 @@
                        </td>
                        <td>
                                <div id="amount">
-                                       <xsl:value-of 
select="voucher_info/voucher/amount"/>
+                                       <xsl:value-of 
select="voucher_info/generic/amount"/>
                                </div>
                        </td>
                </tr>
@@ -210,7 +213,7 @@
                        </td>
                        <td>
                                <div id="approved_amount">
-                                       <xsl:value-of 
select="voucher_info/voucher/approved_amount"/>
+                                       <xsl:value-of 
select="voucher_info/generic/approved_amount"/>
                                </div>
                        </td>
                </tr>
@@ -246,41 +249,8 @@
 
                        </td>
                </tr>
-<!--
                <tr>
                        <td>
-                               <xsl:value-of select="php:function('lang', 
'janitor')" />
-                       </td>
-                       <td>
-                               <div id="janitor">
-                                       <xsl:value-of 
select="voucher_info/voucher/janitor"/>
-                               </div>
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                               <xsl:value-of select="php:function('lang', 
'supervisor')" />
-                       </td>
-                       <td>
-                               <div id="supervisor">
-                                       <xsl:value-of 
select="voucher_info/voucher/supervisor"/>
-                               </div>
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                               <xsl:value-of select="php:function('lang', 
'budget responsible')" />
-                       </td>
-                       <td>
-                               <div id="budget_responsible">
-                                       <xsl:value-of 
select="voucher_info/voucher/budget_responsible"/>
-                               </div>
-
-                       </td>
-               </tr>
--->
-               <tr>
-                       <td>
                                <div id = 'order_text'>
                                        <xsl:choose>
                                                <xsl:when 
test="voucher_info/voucher/order_link  != ''">
@@ -296,7 +266,7 @@
                                </div>
                        </td>
                        <td>
-                               <input type="text" name="order_id" 
id="order_id" value="{voucher_info/voucher/order_id}"/>
+                               <input type="text" name="values[order_id]" 
id="order_id" value="{voucher_info/voucher/order_id}"/>
                        </td>
                </tr>
                <tr>
@@ -304,6 +274,8 @@
                                <xsl:value-of select="php:function('lang', 
'close order')" />
                        </td>
                        <td>
+                               <input type="hidden" id ="close_order_orig" 
name="values[close_order_orig]" value="{voucher_info/voucher/closed}"/>
+                               
                                <div id="close_order">
                                        <input type="checkbox" 
name="values[close_order]" value="1">
                                                <xsl:attribute name="title">
@@ -347,7 +319,7 @@
                                <xsl:value-of select="php:function('lang', 'dim 
b')" />
                        </td>
                        <td>
-                               <select id="dim_b" name="dim_b">
+                               <select id="dim_b" name="values[dim_b]">
                                        <xsl:apply-templates 
select="voucher_info/generic/dimb_list/options"/>
                                </select>
                        </td>
@@ -357,7 +329,7 @@
                                        <xsl:value-of 
select="php:function('lang', 'dim a')" />
                        </td>
                        <td>
-                               <input type="text" name="dim_a" id="dim_a" 
value="{voucher_info/voucher/dim_a}"/>
+                               <input type="text" name="values[dim_a]" 
id="dim_a" value="{voucher_info/voucher/dim_a}"/>
                        </td>
                </tr>
                <tr>
@@ -365,7 +337,7 @@
                                <xsl:value-of select="php:function('lang', 'tax 
code')" />
                        </td>
                        <td>
-                               <select id="tax_code" name="tax_code">
+                               <select id="tax_code" name="values[tax_code]">
                                        <xsl:apply-templates 
select="voucher_info/generic/tax_code_list/options"/>
                                </select>
                        </td>
@@ -375,7 +347,7 @@
                                <xsl:value-of select="php:function('lang', 
'project group')" />
                        </td>
                        <td>
-                               <input type="text" name="project_group" 
id="project_group" value="{voucher_info/voucher/project_group}"/>
+                               <input type="text" name="values[project_group]" 
id="project_group" value="{voucher_info/voucher/project_group}"/>
                        </td>
                </tr>
                <tr>
@@ -383,7 +355,7 @@
                                <xsl:value-of select="php:function('lang', 
'budget account')" />
                        </td>
                        <td>
-                               <input type="text" name="b_account_id" 
id="b_account_id" value="{voucher_info/voucher/b_account_id}"/>
+                               <input type="text" name="values[b_account_id]" 
id="b_account_id" value="{voucher_info/voucher/b_account_id}"/>
                        </td>
                </tr>
 
@@ -392,7 +364,7 @@
                                <xsl:value-of select="php:function('lang', 
'period')" />
                        </td>
                        <td>
-                               <select id="period" name="period">
+                               <select id="period" name="values[period]">
                                        <xsl:apply-templates 
select="voucher_info/generic/period_list/options"/>
                                </select>
                        </td>
@@ -402,7 +374,7 @@
                                <xsl:value-of select="php:function('lang', 
'periodization')" />
                        </td>
                        <td>
-                               <select id="periodization" name="periodization">
+                               <select id="periodization" 
name="values[periodization]">
                                        <xsl:apply-templates 
select="voucher_info/generic/periodization_list/options"/>
                                </select>
                        </td>
@@ -413,55 +385,11 @@
                                <xsl:value-of select="php:function('lang', 
'periodization start')" />
                        </td>
                        <td>
-                               <select id="periodization_start" 
name="periodization_start">
+                               <select id="periodization_start" 
name="values[periodization_start]">
                                        <xsl:apply-templates 
select="voucher_info/generic/periodization_start_list/options"/>
                                </select>
                        </td>
                </tr>
-<!--
-               <tr>
-                       <td>
-                               <xsl:value-of select="php:function('lang', 
'oppsynsigndato')" />
-                       </td>
-                       <td>
-                               <div id="oppsynsigndato">
-                                       <xsl:value-of 
select="voucher_info/voucher/oppsynsigndato"/>
-                               </div>
-
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                               <xsl:value-of select="php:function('lang', 
'saksigndato')" />
-                       </td>
-                       <td>
-                               <div id="saksigndato">
-                                       <xsl:value-of 
select="voucher_info/voucher/saksigndato"/>
-                               </div>
-
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                               <xsl:value-of select="php:function('lang', 
'budsjettsigndato')" />
-                       </td>
-                       <td>
-                               <div id="budsjettsigndato">
-                                       <xsl:value-of 
select="voucher_info/voucher/budsjettsigndato"/>
-                               </div>
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                               <xsl:value-of select="php:function('lang', 
'remark')" />
-                       </td>
-                       <td>
-                               <div id="remark">
-                                       <xsl:value-of 
select="voucher_info/voucher/remark_link"/>
-                               </div>
-                       </td>
-               </tr>
--->
 </xsl:template>
 
 
@@ -483,17 +411,17 @@
                                <xsl:value-of select="php:function('lang', 
'voucher process log')"/>
                        </td>
                        <td align="left">
-                               <textarea cols="60" rows="10" 
name="values[process_log]" wrap="virtual">
+                               <textarea id="process_log" cols="60" rows="10" 
name="values[process_log]" wrap="virtual">
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="php:function('lang', 'voucher process log')"/>
                                        </xsl:attribute>
-                                       <xsl:value-of 
select="value_process_log"/>
+                                       <xsl:value-of 
select="voucher_info/generic/process_log"/>
                                </textarea>
                        </td>
                </tr>
                <tr>
-                       <input type="hidden" name="values[sign_orig]" 
value="{sign_orig}"/>
-                       <input type="hidden" name="values[my_initials]" 
value="{my_initials}"/>
+                       <input id="sign_orig" type="hidden" 
name="values[sign_orig]" value="{voucher_info/generic/sign_orig}"/>
+                       <input id="my_initials" type="hidden" 
name="values[my_initials]" value="{voucher_info/generic/my_initials}"/>
                        <td class="th_text" align="left" valign="top" 
style="white-space: nowrap;">
                                <xsl:value-of select="php:function('lang', 
'approve as')"/>
                        </td>
@@ -529,9 +457,6 @@
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="role"/>
                                                                        
</xsl:attribute>
-                                                                       <option 
value="">
-                                                                               
<xsl:value-of select="php:function('lang', 'forward')"/>
-                                                                       
</option>
                                                                        
<xsl:apply-templates select="user_list/options"/>
                                                                </select>
                                                </xsl:otherwise>
@@ -549,12 +474,7 @@
        
        <xsl:call-template name="datasource-definition" />
        <xsl:variable name="label_submit"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
-       <xsl:variable name="label_checkAll"><xsl:value-of 
select="php:function('lang', 'invert_checkboxes')" /></xsl:variable>
-       <div><input type="button" id="select_all" value="{$label_checkAll}" 
onclick="checkAll('mychecks')"/></div>
-       
-       <form action="#" name="voucher_form" id="voucher_form" method="post">
-               <div class="voucher_submit"><input type="submit" 
name="values[save_voucher]" id="save_voucher" value="{$label_submit}" 
onclick="return onSave()"/></div>
-       </form>
+       <div class="voucher_submit"><input type="submit" 
name="values[save_voucher]" id="save_voucher" value="{$label_submit}" 
onclick="return onSave()"/></div>
 </xsl:template>
 
 




reply via email to

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