fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11780] allow debug in import


From: Sigurd Nes
Subject: [Fmsystem-commits] [11780] allow debug in import
Date: Tue, 04 Mar 2014 10:20:15 +0000

Revision: 11780
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11780
Author:   sigurdne
Date:     2014-03-04 10:20:15 +0000 (Tue, 04 Mar 2014)
Log Message:
-----------
allow debug in import

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.uiimport.inc.php
    trunk/property/inc/import/default/cvs_import_fiktiv_faktura_nlsh

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2014-03-04 08:46:48 UTC (rev 
11779)
+++ trunk/property/inc/class.boinvoice.inc.php  2014-03-04 10:20:15 UTC (rev 
11780)
@@ -39,6 +39,7 @@
                public $sum_amount = 0;
                public $results = 0;
                public $allrows = false;
+               public $debug = false;
                /**
                 *
                 * @var boolean In case of mass-import of fictious invoices
@@ -514,6 +515,7 @@
                        $buffer = array();
                        $soXport    = CreateObject('property.soXport');
                        $soXport->supertransaction = $this->supertransaction;
+                       $soXport->debug = $this->debug;
                        if($values['loc1']=$values['location']['loc1'])
                        {
                                $values['dima']=implode('',$values['location']);
@@ -608,7 +610,8 @@
 
                                
if($soXport->add_manual_invoice($buffer,$skip_update_voucher_id))
                                {
-                                       $receipt['message'][] = 
array('msg'=>lang('Invoice %1 is added',$soXport->voucher_id));
+                                       $_msg = $this->debug ? 'DEBUG: ': '';
+                                       $receipt['message'][] = array('msg'=> 
$_msg. lang('Invoice %1 is added',$soXport->voucher_id));
                                        $receipt['voucher_id'] = 
$soXport->voucher_id;
                                }
                                else

Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php    2014-03-04 08:46:48 UTC (rev 
11779)
+++ trunk/property/inc/class.soXport.inc.php    2014-03-04 10:20:15 UTC (rev 
11780)
@@ -211,6 +211,12 @@
                        return $this->db->f('cnt');
                }
 
+               /**
+                * Add voucher to work-katalog
+                * @param array $buffer holds the dataset
+                * @param bool $skip_update_voucher_id do not increment 
voucher_id
+                * @return int number of records inserted
+                */
                function add($buffer, $skip_update_voucher_id = false)
                {
                        if ( $this->db->get_transaction() )
@@ -753,6 +759,11 @@
 
                        reset($voucher);
 
+                       if($this->debug)
+                       {
+                               return true;
+                       }
+
                        foreach ($voucher as &$line)
                        {
                                if($line['order_id'])
@@ -770,6 +781,7 @@
                                        $operator = '+';
                                        if(!$this->debug)
                                        {
+                                               
//notify_coordinator_on_consumption is performed here..
                                                
$this->correct_actual_cost($line['order_id'],$amount, $actual_cost_field, 
$operator);
                                        }
                                }

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2014-03-04 08:46:48 UTC (rev 
11779)
+++ trunk/property/inc/class.soinvoice.inc.php  2014-03-04 10:20:15 UTC (rev 
11780)
@@ -733,7 +733,7 @@
                        while($this->db->next_record())
                        {
                                $consume[] = array
-                                       (
+                               (
                                        'consume'                => 
round($this->db->f('consume')),
                                        'period'                 => 
$this->db->f('periode'),
                                        'district_id'    => 
$this->db->f('district_id'),
@@ -742,13 +742,11 @@
                                );
                        }
 
-                       $filtermethod = ltrim($filtermethod, ' AND ');
-
                        $sql = "SELECT district_id,periode,sum(godkjentbelop) 
as consume {$select_account_class}"
                        . " FROM  fm_ecobilag {$this->join} fm_location1 ON 
(fm_ecobilag.loc1 = fm_location1.loc1) "
                        . " {$this->join} fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id) "
                        . " {$this->join} fm_b_account ON 
(fm_ecobilag.spbudact_code = fm_b_account.id) "
-                       . " WHERE ({$filtermethod})"
+                       . " WHERE (1=1 {$filtermethod})"
                        . " GROUP BY district_id,periode $group_account_class"
                        . " ORDER BY periode";
 
@@ -758,7 +756,7 @@
                        while($this->db->next_record())
                        {
                                $consume[] = array
-                                       (
+                               (
                                        'consume'                => 
round($this->db->f('consume')),
                                        'period'                 => 
$this->db->f('periode'),
                                        'district_id'    => 
$this->db->f('district_id'),

Modified: trunk/property/inc/class.uiimport.inc.php
===================================================================
--- trunk/property/inc/class.uiimport.inc.php   2014-03-04 08:46:48 UTC (rev 
11779)
+++ trunk/property/inc/class.uiimport.inc.php   2014-03-04 10:20:15 UTC (rev 
11780)
@@ -155,9 +155,8 @@
                                }
 
 
-                               $this->import_conversion = new 
import_conversion($location_id);
                                $this->debug = phpgw::get_var('debug', 'bool');
-                               $this->import_conversion->debug = $this->debug;
+                               $this->import_conversion = new 
import_conversion($location_id,$this->debug);
 
                                // Get the path for user input or use a default 
path
 

Modified: trunk/property/inc/import/default/cvs_import_fiktiv_faktura_nlsh
===================================================================
--- trunk/property/inc/import/default/cvs_import_fiktiv_faktura_nlsh    
2014-03-04 08:46:48 UTC (rev 11779)
+++ trunk/property/inc/import/default/cvs_import_fiktiv_faktura_nlsh    
2014-03-04 10:20:15 UTC (rev 11780)
@@ -11,7 +11,7 @@
                protected $month;
                protected $date;
 
-               public function __construct()
+               public function __construct($location_id,$debug = false)
                {
                        set_time_limit(10000); //Set the time limit for this 
request
                        $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
@@ -25,7 +25,12 @@
 
                        $this->config           = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
 
-
+                       if($debug)
+                       {
+                               $this->debug = true;
+                               $this->boinvoice->debug = true;
+                       }
+                       
                        $file_info = pathinfo($_FILES['file']['name']);
                        $this->period = substr($file_info['filename'],-6);
                        
@@ -128,7 +133,7 @@
                        $values['regtid']                       = 
date($GLOBALS['phpgw']->db->datetime_format());
 
                        $receipt                                        = 
$this->boinvoice->add_manual_invoice($values);
-
+                       
                        $ok     = false;
 
                        if(!isset($receipt['error']) || !$receipt['error'])
@@ -141,7 +146,7 @@
 
                                
$this->soproject->close_period_from_budget($workorder['project_id'], 
$data_close);
 
-                               
execMethod('property.soXport.update_actual_cost_from_archive',array($order_id 
=> true));
+//                             
execMethod('property.soXport.update_actual_cost_from_archive',array($order_id 
=> true));
 
                                $ok     = true;
 




reply via email to

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