[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11666] property: remove obsolete
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11666] property: remove obsolete |
Date: |
Mon, 10 Feb 2014 10:28:03 +0000 |
Revision: 11666
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11666
Author: sigurdne
Date: 2014-02-10 10:28:03 +0000 (Mon, 10 Feb 2014)
Log Message:
-----------
property: remove obsolete
Removed Paths:
-------------
trunk/property/inc/import/default/Import_fra_Kemner_xml
trunk/property/inc/import/default/Import_fra_Service
Deleted: trunk/property/inc/import/default/Import_fra_Kemner_xml
===================================================================
--- trunk/property/inc/import/default/Import_fra_Kemner_xml 2014-02-10
09:57:55 UTC (rev 11665)
+++ trunk/property/inc/import/default/Import_fra_Kemner_xml 2014-02-10
10:28:03 UTC (rev 11666)
@@ -1,247 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @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.13 2007/03/18 16:33:16
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class import_conv
- {
- var $spbudact_code='11954111';
- var $dimb=99;
- var $mvakode=0;
- var $kildeid=1;
- var $splitt=0;
- var $soXport;
- var $invoice;
-
- var $import = array(
- 'Bilagsnr' => 'bilagsnr',
- 'Fakturanr' => 'fakturanr',
- 'Gnr/Bnr-seksjon' => 'gid',
- 'Konto' => 'spbudact_code',
- 'Objekt' => 'dima', //objectclass: organizationalPerson
- 'DimB' => 'dimb',
- 'KID' => 'kidnr',
- 'MVA' => 'mvakode',
- 'Tjeneste'=> 'kostra_id',
- 'Belop [kr]' => 'belop',
- 'Referanse' => 'referanse',
- 'BOEI Gateadresse' => 'boei_gateadresse',
- 'Saksbehandler' =>'saksbehandlerid'
- );
-
- var $header =
array('Bilagsnr','Fakturanr','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Tjeneste','Belop
[kr]','Referanse','Saksbehandler');
-
- function import_conv()
- {
- $this->soXport =
CreateObject('property.soXport');
- $this->invoice =
CreateObject('property.boinvoice');
- $this->dateformat =
$GLOBALS['phpgw']->db->date_format();
- $this->datetimeformat =
$GLOBALS['phpgw']->db->datetime_format();
- }
-
- function import($invoice_common,$download)
- {
- $tsvfile = $invoice_common['tsvfile'];
- $bilagsnr = $this->invoice->next_bilagsnr();
-
- $buffer = array();
-
- set_time_limit(300);
-
- $reader = new XMLReader();
- $reader->open($tsvfile);
-
- $i = 0;
- while ($reader->read())
- {
- if ($reader->nodeType == XMLREADER::ELEMENT &&
$reader->localName == 'Invoice')
- {
- //print $reader->readOuterXML() . "\n";
- $xml = new DOMDocument('1.0', 'utf-8');
- $xml->formatOutput = true;
- $domnode = $reader->expand();
- $xml->appendChild($domnode);
- unset($domnode);
- $fakturanr =
$xml->getElementsByTagName('InvoiceNo')->item(0)->nodeValue;
- $fakturadato =
date($this->dateformat,strtotime($xml->getElementsByTagName('InvoiceDate')->item(0)->nodeValue));
- $forfallsdato =
date($this->dateformat,strtotime($xml->getElementsByTagName('DueDate')->item(0)->nodeValue));
- $periode =
date('Ym',strtotime($xml->getElementsByTagName('InvoiceDate')->item(0)->nodeValue));
-
- $Gnr =
$xml->getElementsByTagName('Text1')->item(0)->nodeValue;
- $Bnr =
$xml->getElementsByTagName('Text2')->item(0)->nodeValue;
- $sekjonnr =
$xml->getElementsByTagName('Text4')->item(0)->nodeValue;
- $belop =
$xml->getElementsByTagName('TotalInclTax')->item(0)->nodeValue;
- $kidnr =
$xml->getElementsByTagName('BacsId')->item(0)->nodeValue;
- $item_id = '1201' .
$xml->getElementsByTagName('HeaderText')->item(0)->nodeValue;
-
- $Link1 =
$xml->getElementsByTagName('Link1')->item(0)->nodeValue;
- $TextLink1 =
$xml->getElementsByTagName('TextLink1')->item(0)->nodeValue;
-
- $ShipTo =
$xml->getElementsByTagName('ShipTo')->item(0);
- $xpath = new DOMXpath($xml);
- $address =
$xpath->query("AddressInfo/Address", $ShipTo)->item(0)->nodeValue;
-
- $details =
$xml->getElementsByTagName('Details');
-
- $Products =
$xpath->query("Detail/Products", $details->item(0));
-
- $length = $Products->length;
- $merknad = '';
- for($j=0; $j<$length; $j++)
- {
-
- $merknad .=
$xpath->query("SellerProductDescr", $Products->item($j))->item(0)->nodeValue .
"\n";
- $merknad .=
$xpath->query("UnitCode", $Products->item($j))->item(0)->nodeValue . "\t";
- $merknad .=
$xpath->query("Quantity", $Products->item($j))->item(0)->nodeValue . "\t";
- $merknad .=
$xpath->query("Price", $Products->item($j))->item(0)->nodeValue . "\n";
-
- $Info =
$xpath->query("ProductSpecification/Info", $Products->item($j));
- for($k=0; $k<($Info->length-1);
$k++)
- {
- $merknad .=
trim($Info->item($k)->nodeValue) . "\n";
-
- }
-
- }
- $merknad .= "\n" . $TextLink1;
- $merknad .= "\n" . $Link1;
- unset($xml);
- unset($xpath);
-// print_r($merknad);
-
- if( $invoice_common['art'] == 2 ) //
kreditnota
- {
- $belop = -1 * abs($belop);
- }
-
- $buffer[$i]['fakturanr'] = $fakturanr;
- $buffer[$i]['periode'] = $periode;
- $buffer[$i]['forfallsdato'] =
$forfallsdato;
- $buffer[$i]['fakturadato'] =
$fakturadato;
- $buffer[$i]['belop'] = $belop;
- $buffer[$i]['godkjentbelop'] = $belop;
-
- $buffer[$i]['kidnr'] = $kidnr;
- $buffer[$i]['gid'] =
$Gnr.'/'.$Bnr.'-'.$sekjonnr;
- $buffer[$i]['bilagsnr'] = $bilagsnr;
-
- if(isset($invoice_common['dim_b']) &&
$invoice_common['dim_b'])
- {
- $buffer[$i]['dimb'] =
$invoice_common['dim_b'];
- }
- else
- {
- $buffer[$i]['dimb'] =
$this->dimb;
- }
-
- $buffer[$i]['item_type'] = 1;
- $buffer[$i]['item_id'] = $item_id;
-
- //Finn dima fra Boei
- $gabinfo =
$this->soXport->gabnr_to_objekt($Gnr,$Bnr,$sekjonnr);
- $buffer[$i]['dima'] = $gabinfo['dima'];
- $buffer[$i]['loc1'] = $gabinfo['loc1'];
- $buffer[$i]['mvakode'] = $this->mvakode;
-
- if($gabinfo['loc1'] &&
(isset($invoice_common['auto_tax']) && $invoice_common['auto_tax']))
- {
-
$mvakode=$this->soXport->auto_tax($gabinfo['loc1']);
-
- if($mvakode)
- {
- $buffer[$i]['mvakode']
= $mvakode;
- }
- }
-
- if(isset($invoice_common['auto_tax'])
&& $invoice_common['auto_tax'])
- {
- $buffer[$i]['mvakode'] =
$this->soXport->tax_b_account_override($buffer[$i]['mvakode']
,$this->spbudact_code);
- $buffer[$i]['mvakode'] =
$this->soXport->tax_vendor_override($buffer[$i]['mvakode']
,$invoice_common['vendor_id']);
- }
-
- $buffer[$i]['kostra_id'] =
$this->soXport->get_kostra_id($gabinfo['loc1']);
-
- //finn boei gateadresse for kontroll
-
$boei_gateadresse=$this->soXport->dima_to_address($gabinfo['dima']);
- $buffer[$i]['boei_gateadresse'] =
$boei_gateadresse;
-
- $buffer[$i]['referanse'] = $address;
-
- //FIXME - hardcoded for now
- switch($gabinfo['district_id'])
- {
- case '1':
- $saksbehandlerid =
'ho1330';
- break;
- case '2':
- $saksbehandlerid =
'ef584';
- break;
- case '3':
- $saksbehandlerid =
'shl5631';
- break;
- default:
- $saksbehandlerid =
$invoice_common['supervisor'];
- }
-
- $buffer[$i]['merknad'] = 'Kemner adr:
'.$address."\r\n".'BOEI adr: '.$boei_gateadresse."\r\n" .$merknad;
- $buffer[$i]['splitt'] = $this->splitt;
- $buffer[$i]['kildeid'] = $this->kildeid;
- $buffer[$i]['spbudact_code'] =
$this->spbudact_code;
- $buffer[$i]['typeid'] =
$invoice_common['type'];
- $buffer[$i]['regtid'] =
date($this->datetimeformat);
- $buffer[$i]['artid'] =
$invoice_common['art'];
- $buffer[$i]['spvend_code'] =
$invoice_common['vendor_id'];
- $buffer[$i]['oppsynsmannid'] =
$invoice_common['janitor'];
- $buffer[$i]['saksbehandlerid'] =
$saksbehandlerid;
- $buffer[$i]['budsjettansvarligid'] =
$invoice_common['budget_responsible'];
-//_debug_array($bilagsnr);
- $bilagsnr++;
- $i++;
- }
- }
- $reader->close();
-
- if(!$download)
- {
- $buffer =
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
- }
-
- return $buffer;
- }
-
- function import_end_file($buffer,$bilagsnr)
- {
- $num = $this->soXport->add($buffer);
- $receipt['message'][]= array('msg' =>
lang('Successfully imported %1 records into your invoice register.',$num).'
'.lang('ID').': '. $bilagsnr);
- return $receipt;
- }
- }
Deleted: trunk/property/inc/import/default/Import_fra_Service
===================================================================
--- trunk/property/inc/import/default/Import_fra_Service 2014-02-10
09:57:55 UTC (rev 11665)
+++ trunk/property/inc/import/default/Import_fra_Service 2014-02-10
10:28:03 UTC (rev 11666)
@@ -1,287 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage import
- * @version $Id: Import_fra_Service,v 1.19 2007/03/18 16:33:16 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class import_conv
- {
- var $currentrecord = array(); //used for buffering to allow uid
lines to go first
- var $id = -1;
- var $kildeid=1;
- var $splitt=0;
- var $type = 'csv';
- var $header_count = 18;
- var $soXport;
- var $invoice;
-
- var $import = array(
- 'Bestilling' => 'pmwrkord_code',
- 'Fakt. Nr' => 'fakturanr',
- 'Konto' => 'spbudact_code',
- 'Objekt' => 'dima',
- 'Fag/Timer/Matr' => 'dimd',
- 'MVA' => 'mvakode',
- 'Tjeneste'=> 'kostra_id',
- 'Belop [kr]' => 'belop'
- );
-
- var $header = array('Bestilling','Fakt.
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Belop [kr]');
-
- function import_conv()
- {
- $this->db =
clone($GLOBALS['phpgw']->db);
- $this->soXport =
CreateObject('property.soXport');
- $this->invoice =
CreateObject('property.boinvoice');
- $this->bocommon =
CreateObject('property.bocommon');
- $this->dateformat =
$GLOBALS['phpgw']->db->date_format();
- $this->datetimeformat =
$GLOBALS['phpgw']->db->datetime_format();
- $this->next_bilagsnr =
$this->invoice->next_bilagsnr();
- }
-
- function import($invoice_common,$download)
- {
- $tsvfile = $invoice_common['tsvfile'];
- $conv_type = $invoice_common['conv_type'];
- $buffer = array();
- $buffer = $this->import_start_file($buffer);
- $fp = fopen($tsvfile,'r');
-
- for ($i = 1; $i < $this->header_count &&
fgetcsv($fp,8000,';'); ++$i);
-
- while ($data = fgetcsv($fp,8000,';'))
- {
- $num = count($data);
- $buffer = $this->import_start_record($buffer);
- for ($c=0; $c<$num; $c++ )
- {
- //Send name/value pairs along with the
buffer
- if ($this->import[$this->header[$c]] !=
'')
- {
- $buffer =
$this->import_new_attrib($buffer,
$this->import[$this->header[$c]],$data[$c],$invoice_common);
- }
- }
- if($data[1] && $data[6]) // fakturanr og beløp
- {
- ++$this->id;
- $buffer =
$this->import_end_record($buffer,$invoice_common);
- }
- }
- fclose($fp);
-
- if(!$download)
- {
- $buffer =
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
- }
-
- $this->header = array('Bestilling','Fakt.
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Tjeneste','Belop [kr]');
-
- return $buffer;
- }
-
-
- function import_start_file($buffer)
- {
- return $buffer;
- }
-
- function import_start_record($buffer)
- {
- $this->currentrecord = array();
- return $buffer;
- }
-
- function import_new_attrib($buffer,$name,$value,$invoice_common)
- {
- $value = $this->bocommon->ascii2utf(trim($value));
- $value =
str_replace(array('\n','\r'),array('<BR>',''),$value);
-
- $this->currentrecord += array($name => $value);
-
- return $buffer;
- }
-
- function import_end_record($buffer,$invoice_common)
- {
- $buffer[$this->id] = array();
-
- foreach ($this->currentrecord as $name => $value)
- {
- $invoice_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
- if($invoice_common['num_days'])
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
- }
- else
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
- }
-
- if($name=='belop')
- {
- $value = str_replace('kr','',$value);
- $value = str_replace(' ','',$value);
- $value = str_replace(',','.',$value);
-
- if( $invoice_common['art'] == 2 ) //
kreditnota
- {
- $value = -1 * abs($value);
- }
-
- $godkjentbelop = $value;
- }
- if($name=='pmwrkord_code')
- {
-
if(!$this->soXport->check_order(intval($value)))
- {
- $value='';
- }
- else
- {
-
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value));
- }
- }
- if($name=='spbudact_code')
- {
- $value =
$this->check_spbudact_code($value);
- }
-
- if($name=='fakturanr')
- {
- if($invoice_common['invoice_num'])
- {
-
$value=$invoice_common['invoice_num'];
- }
- }
-
- if($name=='dima')
- {
- $value = $this->check_dima($value);
- $buffer[$this->id]['loc1'] =
$loc1=substr($value,0,4);
- }
-
- if($name=='mvakode')
- {
- if( $invoice_common['auto_tax'])
- {
- $value =
(int)$this->soXport->auto_tax($buffer[$this->id]['loc1']);
- }
- else
- {
- $value = (int) $value;
- }
- }
-
- $buffer[$this->id][$name] = $value;
- $buffer[$this->id]['bilagsnr'] =
$this->next_bilagsnr;
- $buffer[$this->id]['splitt'] = $this->splitt;
- $buffer[$this->id]['kildeid'] = $this->kildeid;
- $buffer[$this->id]['kidnr'] =
$invoice_common['kid_nr'];
- $buffer[$this->id]['typeid'] =
$invoice_common['type'];
- $buffer[$this->id]['fakturadato'] =
$invoice_date;
- $buffer[$this->id]['forfallsdato'] =
$payment_date;
- $buffer[$this->id]['periode'] =
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
- $buffer[$this->id]['regtid'] =
date($this->datetimeformat);
- $buffer[$this->id]['artid'] =
$invoice_common['art'];
- $buffer[$this->id]['godkjentbelop'] =
$godkjentbelop;
- $buffer[$this->id]['spvend_code'] =
$invoice_common['vendor_id'];
- $buffer[$this->id]['dimb'] =
$invoice_common['dim_b'];
- $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]['loc1']);
- }
-
- 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' AND ((fm_location1.category <> 99) OR (fm_location1.category IS
NULL))");
- $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' AND
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
- $this->db->next_record();
- if ($this->db->f('location_code'))
- {
- $dima =
str_replace('-','',$this->db->f('location_code'));
- }
- else
- {
- unset($dima);
- }
- }
- }
-
- return $dima;
- }
-
- function import_end_file($buffer,$bilagsnr)
- {
- $num = $this->soXport->add($buffer);
- $receipt['message'][]= array('msg' =>
lang('Successfully imported %1 records into your invoice register.',$num).'
'.lang('ID').': '. $bilagsnr);
- return $receipt;
- }
- }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11666] property: remove obsolete,
Sigurd Nes <=