phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc/import Import_fra_Service_xml, 1.11 Impo


From: ceb
Subject: [Phpgroupware-cvs] property/inc/import Import_fra_Service_xml, 1.11 Import_fra_Service, 1.11
Date: Thu, 24 Feb 2005 14:30:44 -0000

Update of property/inc/import

Modified Files:
     Branch: MAIN
            Import_fra_Service_xml lines: +50 -7
            Import_fra_Service lines: +49 -7

Log Message:
committed prop-18-branch version to head

====================================================
Index: property/inc/import/Import_fra_Service_xml
diff -u property/inc/import/Import_fra_Service_xml:1.10 
property/inc/import/Import_fra_Service_xml:1.11
--- property/inc/import/Import_fra_Service_xml:1.10     Thu Sep 30 12:25:41 2004
+++ property/inc/import/Import_fra_Service_xml  Thu Jan 13 16:52:48 2005
@@ -26,6 +26,7 @@

                function import_conv()
                {
+                       $this->db               = $GLOBALS['phpgw']->db;
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->soXport          = 
CreateObject($this->currentapp.'.soXport');
                        $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
@@ -166,10 +167,7 @@
                                }
                                if($name=='spbudact_code')
                                {
-                                       
if(!$this->soXport->check_spbudact_code(intval($value)))
-                                       {
-                                               $value='';
-                                       }
+                                       $value = 
$this->check_spbudact_code($value);
                                }

                                if($name=='fakturanr')
@@ -185,9 +183,10 @@
                                        $value = 
$this->soXport->auto_tax($buffer[$this->id]['dima']);
                                }

-                               if($buffer[$this->id]['dima'])
+                               if($name=='dima')
                                {
-                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($buffer[$this->id]['dima'],0,4);
+                                       $value = $this->check_dima($value);
+                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($value,0,4);
                                }

                                $buffer[$this->id][$name] = $value;
@@ -207,17 +206,61 @@
                                $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
                                $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
                                $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+
                                if($invoice_common['auto_tax'])
                                {
                                        $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
                                        $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
                                        $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
                                }
-
                        }
                        return $buffer;
                }

+               function check_spbudact_code($id)
+               {
+                       $b_account='';
+                       $this->db->query("select id from fm_b_account where 
id='$id'");
+                       $this->db->next_record();
+                       if ($this->db->f('id'))
+                       {
+                               $b_account = $this->db->f('id');
+                       }
+                       else
+                       {
+                               $this->db->query("select id from 
fm_b_account_convert where old_id='$id'");
+                               $this->db->next_record();
+                               $b_account = $this->db->f('id');
+                       }
+
+                       return $b_account;
+               }
+
+               function check_dima($id)
+               {
+                       $loc1=substr($id,0,4);
+                       $loc2=substr($id,4,2);
+
+                       $this->db->query("select loc1 from fm_location1 where 
loc1='$loc1'");
+                       $this->db->next_record();
+                       if ($this->db->f('loc1'))
+                       {
+                               $dima = $this->db->f('loc1');
+
+                               if ($loc2)
+                               {
+                                       $this->db->query("select location_code 
from fm_location2 where loc1='$loc1' AND loc2='$loc2'");
+                                       $this->db->next_record();
+                                       if ($this->db->f('location_code'))
+                                       {
+                                               $dima = 
str_replace('-','',$this->db->f('location_code'));
+                                       }
+                               }
+                       }
+
+                       return $dima;
+               }
+
                function import_end_file($buffer,$bilagsnr)
                {
                        $num    = $this->soXport->add($buffer);

====================================================
Index: property/inc/import/Import_fra_Service
diff -u property/inc/import/Import_fra_Service:1.10 
property/inc/import/Import_fra_Service:1.11
--- property/inc/import/Import_fra_Service:1.10 Thu Sep 30 12:25:41 2004
+++ property/inc/import/Import_fra_Service      Thu Jan 13 16:52:48 2005
@@ -26,6 +26,7 @@

                function import_conv()
                {
+                       $this->db               = $GLOBALS['phpgw']->db;
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->soXport          = 
CreateObject($this->currentapp.'.soXport');
                        $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
@@ -152,10 +153,7 @@
                                }
                                if($name=='spbudact_code')
                                {
-                                       
if(!$this->soXport->check_spbudact_code(intval($value)))
-                                       {
-                                               $value='';
-                                       }
+                                       $value = 
$this->check_spbudact_code($value);
                                }

                                if($name=='fakturanr')
@@ -166,15 +164,15 @@
                                        }
                                }

-//_debug_array($name);
                                if($name=='mvakode' && 
$invoice_common['auto_tax'])
                                {
                                        $value = 
$this->soXport->auto_tax($buffer[$this->id]['dima']);
                                }

-                               if($buffer[$this->id]['dima'])
+                               if($name=='dima')
                                {
-                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($buffer[$this->id]['dima'],0,4);
+                                       $value = $this->check_dima($value);
+                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($value,0,4);
                                }

                                $buffer[$this->id][$name] = $value;
@@ -204,6 +202,50 @@
                        }
                        return $buffer;
                }
+
+               function check_spbudact_code($id)
+               {
+                       $b_account='';
+                       $this->db->query("select id from fm_b_account where 
id='$id'");
+                       $this->db->next_record();
+                       if ($this->db->f('id'))
+                       {
+                               $b_account = $this->db->f('id');
+                       }
+                       else
+                       {
+                               $this->db->query("select id from 
fm_b_account_convert where old_id='$id'");
+                               $this->db->next_record();
+                               $b_account = $this->db->f('id');
+                       }
+
+                       return $b_account;
+               }
+
+               function check_dima($id)
+               {
+                       $loc1=substr($id,0,4);
+                       $loc2=substr($id,4,2);
+
+                       $this->db->query("select loc1 from fm_location1 where 
loc1='$loc1'");
+                       $this->db->next_record();
+                       if ($this->db->f('loc1'))
+                       {
+                               $dima = $this->db->f('loc1');
+
+                               if ($loc2)
+                               {
+                                       $this->db->query("select location_code 
from fm_location2 where loc1='$loc1' AND loc2='$loc2'");
+                                       $this->db->next_record();
+                                       if ($this->db->f('location_code'))
+                                       {
+                                               $dima = 
str_replace('-','',$this->db->f('location_code'));
+                                       }
+                               }
+                       }
+
+                       return $dima;
+               }

                function import_end_file($buffer,$bilagsnr)
                {






reply via email to

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