fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11331] property: import fix


From: Sigurd Nes
Subject: [Fmsystem-commits] [11331] property: import fix
Date: Thu, 26 Sep 2013 11:49:16 +0000

Revision: 11331
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11331
Author:   sigurdne
Date:     2013-09-26 11:49:11 +0000 (Thu, 26 Sep 2013)
Log Message:
-----------
property: import fix

Modified Paths:
--------------
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/import/default/cvs_import_fiktiv_faktura_nlsh

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-09-26 10:47:35 UTC (rev 
11330)
+++ trunk/property/inc/class.soproject.inc.php  2013-09-26 11:49:11 UTC (rev 
11331)
@@ -1750,7 +1750,7 @@
                                        'amount_out'            => 
$this->db->f('amount_out'),
                                        'from_project'          => 
$this->db->f('from_project'),
                                        'to_project'            => 
$this->db->f('to_project'),
-                                       'user_id'                       => 
$this->db->f('this->account'),
+                                       'user_id'                       => 
$this->db->f('user_id'),
                                        'entry_date'            => 
$this->db->f('entry_date'),
                                        'active'                        => 
!!$this->db->f('active'),
                                        'remark'                        => 
$this->db->f('remark',true)
@@ -2279,20 +2279,23 @@
                function close_period_from_budget($project_id, $data)
                {
                        $project_id = (int) $project_id;
+                       $closed_orig_b_period = 
isset($data['closed_orig_b_period']) && $data['closed_orig_b_period'] ? 
$data['closed_orig_b_period'] : array();
+                       $closed_b_period = isset($data['closed_b_period']) && 
$data['closed_b_period'] ? $data['closed_b_period'] : array();
+                       
                        $close_period = array();
                        $open_period = array();
 
-                       foreach($data['closed_orig_b_period'] as $period)
+                       foreach($closed_orig_b_period as $period)
                        {
-                               if(!in_array($period, $data['closed_b_period']))
+                               if(!in_array($period, $closed_b_period))
                                {
                                        $open_period[] = $period;
                                }
                        }
 
-                       foreach($data['closed_b_period'] as $period)
+                       foreach($closed_b_period as $period)
                        {
-                               if(!in_array($period, 
$data['closed_orig_b_period']))
+                               if(!in_array($period, $closed_orig_b_period))
                                {
                                        $close_period[] = $period;
                                }

Modified: trunk/property/inc/import/default/cvs_import_fiktiv_faktura_nlsh
===================================================================
--- trunk/property/inc/import/default/cvs_import_fiktiv_faktura_nlsh    
2013-09-26 10:47:35 UTC (rev 11330)
+++ trunk/property/inc/import/default/cvs_import_fiktiv_faktura_nlsh    
2013-09-26 11:49:11 UTC (rev 11331)
@@ -7,6 +7,8 @@
                public $errors = array();
                public $debug = true;
                protected $period;
+               protected $year;
+               protected $month;
                protected $date;
 
                public function __construct()
@@ -18,6 +20,7 @@
                        $this->boinvoice        = 
CreateObject('property.boinvoice');
                        $this->soinvoice        = 
CreateObject('property.soinvoice');
                        $this->boworkorder      = 
CreateObject('property.boworkorder');
+                       $this->soproject        = 
CreateObject('property.soproject');
 
                        $this->config           = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
 
@@ -30,9 +33,9 @@
                                throw new Exception("Ikke en periode: 
{$this->period}" );
                        }
 
-                       $_year = substr($this->period,0,4);
-                       $_month = substr($this->period,-2);
-                       $_date = mktime(0, 0, 0, $_month, 15, $_year);
+                       $this->year = substr($this->period,0,4);
+                       $this->month = substr($this->period,-2);
+                       $_date = mktime(0, 0, 0, $this->month, 15, $this->year);
 
                        $this->date = 
$GLOBALS['phpgw']->common->show_date($_date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                }
@@ -113,7 +116,7 @@
                                $i++;
                        }
 
-                       $values['spbudact_code']        = 
$workorder['b_account_id'];
+                       $values['b_account_id']         = 
$workorder['b_account_id'];
                        $values['invoice_date']         = $this->date;
                        $values['payment_date']         = $this->date;
                        $values['paid_date']            = $this->date;
@@ -129,17 +132,24 @@
 
                        if(!isset($receipt['error']) || !$receipt['error'])
                        {
+                               $this->messages[] = "Importerer faktura med 
beløp {$amount} til bestilling {$order_id}";
+                               $data_close = array
+                               (
+                                       'closed_b_period'       => 
array("{$this->year}_{$this->month}")
+                               );
 
-                               $this->messages[] = "Importerer faktura med 
beløp {$amount} til bestilling {$order_id}";
+                               
$this->soproject->close_period_from_budget($workorder['project_id'], 
$data_close);
+
+                               
execMethod('property.soXport.update_actual_cost_from_archive',array($order_id 
=> true));
+
                                $ok     = true;
+
                        }
                        else
                        {
                                $this->errors[] = "Noe feilet med bestilling 
{$order_id}";
                        }
 
-                       
execMethod('property.soXport.update_actual_cost_from_archive',array($order_id 
=> true));
-
                        return $ok;
 
                }




reply via email to

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