phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.boifc.inc.php import/Import_...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property/inc class.boifc.inc.php import/Import_...
Date: Wed, 10 Jan 2007 15:08:50 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Changes by:     Sigurd Nes <sigurdne>   07/01/10 15:08:50

Modified files:
        inc            : class.boifc.inc.php 
        inc/import     : Import_fra_Kemner_xml 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.boifc.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/property/inc/import/Import_fra_Kemner_xml?cvsroot=phpgroupware&r1=1.7&r2=1.8

Patches:
Index: class.boifc.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.boifc.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- class.boifc.inc.php 9 Jan 2007 15:07:08 -0000       1.2
+++ class.boifc.inc.php 10 Jan 2007 15:08:50 -0000      1.3
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage ifc
-       * @version $Id: class.boifc.inc.php,v 1.2 2007/01/09 15:07:08 sigurdne 
Exp $
+       * @version $Id: class.boifc.inc.php,v 1.3 2007/01/10 15:08:50 sigurdne 
Exp $
        */
 
        /**
@@ -154,7 +154,7 @@
 
 //                     _debug_array($this->xml_to_array($ifcfile));
 
-                       $xa = CreateObject('phpgwapi.XmlToArray');
+                       $xa = CreateObject('property.XmlToArray');
                        $xml = $xa->parseFile($ifcfile);
                        _debug_array($xml);
 

Index: import/Import_fra_Kemner_xml
===================================================================
RCS file: /sources/phpgroupware/property/inc/import/Import_fra_Kemner_xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- import/Import_fra_Kemner_xml        31 Oct 2005 18:58:12 -0000      1.7
+++ import/Import_fra_Kemner_xml        10 Jan 2007 15:08:50 -0000      1.8
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage import
-       * @version $Id: Import_fra_Kemner_xml,v 1.7 2005/10/31 18:58:12 
sigurdne Exp $
+       * @version $Id: Import_fra_Kemner_xml,v 1.8 2007/01/10 15:08:50 
sigurdne Exp $
        */
 
        /**
@@ -53,23 +53,27 @@
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->dateformat       = $this->bocommon->dateformat;
                        $this->datetimeformat   = 
$this->bocommon->datetimeformat;
-                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
-                       $this->xmltool          = 
CreateObject('phpgwapi.xmltool');
+//                     $this->xmltool          = 
CreateObject('phpgwapi.xmltool');
                }
 
                function import($invoice_common,$download)
                {
                        $tsvfile        = $invoice_common['tsvfile'];
-                       $conv_type      = $invoice_common['conv_type'];
                        $valid_data= False;
                        $bilagsnr = $this->invoice->next_bilagsnr();
 
                        $buffer = array();
                        $buffer = $this->import_start_file($buffer);
 
-                       $xmldata=file_get_contents($tsvfile);
+/*                     $xmldata=file_get_contents($tsvfile);
                        $this->xmltool->import_xml($xmldata);
                        $var_result = $this->xmltool->export_var();
+*/
+                       $xmlparse = CreateObject('property.XmlToArray');
+                       $var_result = $xmlparse->parseFile($tsvfile);
+
+                       set_time_limit(300);
+
 //_debug_array($var_result);
 
                        if(is_array($var_result['Invoice'][0]))
@@ -81,34 +85,29 @@
                                $data[0]=$var_result['Invoice'];
                        }
 
-//_debug_array($data);
-
                        if (isset($data) AND is_array($data))
                        {
                                $num = count($data);
 
                                for ($i = 0; $i < $num; ++$i)
                                {
-                       
                                        $buffer = 
$this->import_start_record($buffer);
-
-
-                                       $Gnr            = 
$data[$i]['Header']['Text1'][0];
-                                       $Bnr            = 
$data[$i]['Header']['Text2'][0];
-                                       $sekjonnr       = 
$data[$i]['Header']['Text4'][0];
+                                       $Gnr            = 
$data[$i]['Header'][0]['Text1'];
+                                       $Bnr            = 
$data[$i]['Header'][0]['Text2'];
+                                       $sekjonnr       = 
$data[$i]['Header'][0]['Text4'];
 
                                        $fakturanr      = 
$data[$i]['InvoiceNo'];
-                                       $fakturadato    = 
date($this->dateformat,strtotime($data[$i]['Header']['InvoiceDate'][0]));
-                                       $forfallsdato   = 
date($this->dateformat,strtotime($data[$i]['Header']['DueDate'][0]));
+                                       $fakturadato    = 
date($this->dateformat,strtotime($data[$i]['Header'][0]['InvoiceDate']));
+                                       $forfallsdato   = 
date($this->dateformat,strtotime($data[$i]['Header'][0]['DueDate']));
 
-                                       $periode = 
date(n,strtotime($data[$i]['Header']['InvoiceDate'][0]));
+                                       $periode = 
date(n,strtotime($data[$i]['Header'][0]['InvoiceDate']));
                                        
-                                       $belop  = 
$data[$i]['Summary']['TotalInclTax'];
-                                       $kidnr  = 
$data[$i]['Header']['PaymentInfo']['0']['BacsId'];
+                                       $belop  = 
$data[$i]['Summary'][0]['TotalInclTax'];
+                                       $kidnr  = 
$data[$i]['Header'][0]['PaymentInfo'][0]['BacsId'];
 
                                        $gid = $Gnr.'/'.$Bnr.'-'.$sekjonnr;
                                        $item_type = 1;
-                                       $item_id = '1201' . 
$data[$i]['Header']['HeaderText'][0];
+                                       $item_id = '1201' . 
$data[$i]['Header'][0]['HeaderText'];
                                        
                                        $buffer = 
$this->import_new_attrib($buffer,'fakturanr',$fakturanr,$invoice_common);
                                        $buffer = 
$this->import_new_attrib($buffer,periode,$periode,$invoice_common);
@@ -123,7 +122,6 @@
                                        $buffer = 
$this->import_new_attrib($buffer,item_type,$item_type,$invoice_common);
                                        $buffer = 
$this->import_new_attrib($buffer,item_id,$item_id,$invoice_common);
 
-
                                        //Finn dima fra Boei
                                        $gabinfo = 
$this->soXport->gabnr_to_objekt($Gnr,$Bnr,$sekjonnr);
                                        $buffer = 
$this->import_new_attrib($buffer,dima,$gabinfo['dima'],$invoice_common);
@@ -132,7 +130,7 @@
                                        
$boei_gateadresse=$this->soXport->dima_to_address($gabinfo['dima']);
                                        $buffer = 
$this->import_new_attrib($buffer,boei_gateadresse,$boei_gateadresse,$invoice_common);
 
-                                       $referanse = 
$data[$i]['Header']['ShipTo'][0]['AddressInfo']['Address'];
+                                       $referanse = 
$data[$i]['Header'][0]['ShipTo'][0]['AddressInfo'][0]['Address'];
        
                                        $buffer = 
$this->import_new_attrib($buffer,referanse,$referanse,$invoice_common);         
       
 
@@ -142,43 +140,43 @@
 
                                        $bilagsnr++;
 
-                                       foreach ($data[$i]['Details']['Detail'] 
as $detail)
+                                       foreach 
($data[$i]['Details'][0]['Detail'] as $detail)
                                        {
-                                               if 
(is_array($detail['Products']['SellerProductDescr']))
+                                               if 
(is_array($detail['Products'][0]['SellerProductDescr']))
                                                {
-                                                       $merknad .= 
implode("",$detail['Products']['SellerProductDescr']) . "\t";
+                                                       $merknad .= 
implode("",$detail['Products'][0]['SellerProductDescr']) . "\t";
                                                }
                                                else
                                                {
-                                                       $merknad .= 
$detail['Products']['SellerProductDescr'] . "\t";
+                                                       $merknad .= 
$detail['Products'][0]['SellerProductDescr'] . "\t";
                                                }
                                                
 
-                                               if 
(is_array($detail['Products']['UnitCode']))
+                                               if 
(is_array($detail['Products'][0]['UnitCode']))
                                                {
-                                                       $merknad .= 
implode("",$detail['Products']['UnitCode']) . "\t";
+                                                       $merknad .= 
implode("",$detail['Products'][0]['UnitCode']) . "\t";
                                                }
                                                else
                                                {
-                                                       $merknad .= 
$detail['Products']['UnitCode'] . "\t";
+                                                       $merknad .= 
$detail['Products'][0]['UnitCode'] . "\t";
                                                }
                                                
-                                               if 
(is_array($detail['Products']['Quantity']))
+                                               if 
(is_array($detail['Products'][0]['Quantity']))
                                                {
-                                                       $merknad .= 
implode("",$detail['Products']['Quantity']) . "\t";
+                                                       $merknad .= 
implode("",$detail['Products'][0]['Quantity']) . "\t";
                                                }
                                                else
                                                {
-                                                       $merknad .= 
$detail['Products']['Quantity'] . "\t";
+                                                       $merknad .= 
$detail['Products'][0]['Quantity'] . "\t";
                                                }
                                                
-                                               if 
(is_array($detail['Products']['Price']))
+                                               if 
(is_array($detail['Products'][0]['Price']))
                                                {
-                                                       $merknad .= 
implode("",$detail['Products']['Price'])."\r\n";
+                                                       $merknad .= 
implode("",$detail['Products'][0]['Price'])."\r\n";
                                                }
                                                else
                                                {
-                                                       $merknad .= 
$detail['Products']['Price']."\r\n";
+                                                       $merknad .= 
$detail['Products'][0]['Price']."\r\n";
                                                }
 
                                        }
@@ -190,7 +188,6 @@
                                }
                        }
 
-
                        if(!$download)
                        {
                                $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
@@ -289,4 +286,3 @@
                        return $receipt;
                }
        }
-?>




reply via email to

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