[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14961] property: more on integration
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14961] property: more on integration |
Date: |
Mon, 02 May 2016 10:23:13 +0000 |
Revision: 14961
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14961
Author: sigurdne
Date: 2016-05-02 10:23:13 +0000 (Mon, 02 May 2016)
Log Message:
-----------
property: more on integration
Modified Paths:
--------------
trunk/property/inc/class.botts.inc.php
trunk/property/inc/class.sotts.inc.php
trunk/property/inc/class.soworkorder.inc.php
trunk/property/inc/class.uiwo_hour.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php
trunk/property/js/portico/workorder.edit.js
trunk/property/setup/default_records.inc.php
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
trunk/property/templates/base/config.tpl
trunk/property/templates/base/wo_hour.xsl
trunk/property/templates/base/workorder.xsl
Added Paths:
-----------
trunk/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
Removed Paths:
-------------
trunk/property/inc/custom/default/BkBygg_exporter_ordre_til_Agresso.php
trunk/property/js/portico/ajax_project_edit.js
trunk/property/js/portico/ajax_workorder_edit.js
Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/inc/class.botts.inc.php 2016-05-02 10:23:13 UTC (rev
14961)
@@ -874,6 +874,8 @@
case 'MS':
$type = lang('Sent by sms');
break;
+ case 'RM': $type = lang('remark');
+ break;
default:
// nothing
}
Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/inc/class.sotts.inc.php 2016-05-02 10:23:13 UTC (rev
14961)
@@ -820,6 +820,8 @@
$ticket['branch_id'] =
$this->db->f('branch_id');
$ticket['entry_date'] =
$this->db->f('entry_date');
$ticket['modified_date'] =
$this->db->f('modified_date');
+ $ticket['order_sent'] =
$this->db->f('order_sent');
+ $ticket['order_received'] =
$this->db->f('order_received');
$user_id = (int)$this->db->f('user_id');
@@ -1083,7 +1085,7 @@
* * T - Category change
* * S - Subject change
* * B - Budget
- * * AC - actual cost changed
+ * * AC - actual cost changed
* * H - Billing hours
* * F - finnish date
* * C% - Status changed
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2016-04-30 21:09:45 UTC
(rev 14960)
+++ trunk/property/inc/class.soworkorder.inc.php 2016-05-02 10:23:13 UTC
(rev 14961)
@@ -928,7 +928,7 @@
'key_deliver' =>
$this->db->f('key_deliver'),
'key_responsible' =>
$this->db->f('key_responsible'),
'charge_tenant' =>
$this->db->f('charge_tenant'),
- 'descr' =>
stripslashes($this->db->f('descr')),
+ 'descr' => $this->db->f('descr',true),
'status' => $this->db->f('status'),
'calculation' =>
$this->db->f('calculation'),
'b_account_id' =>
(int)$this->db->f('account_id'),
@@ -968,6 +968,10 @@
'tax_code' => $this->db->f('tax_code'),
'unspsc_code' =>
$this->db->f('unspsc_code'),
'service_id' =>
$this->db->f('service_id'),
+ 'building_part' =>
$this->db->f('building_part'),
+ 'order_dim1' =>
$this->db->f('order_dim1'),
+ 'order_sent' =>
$this->db->f('order_sent'),
+ 'order_received' =>
$this->db->f('order_received')
);
$sql = "SELECT periodization_id,"
@@ -1262,6 +1266,8 @@
$workorder['tax_code'],
$workorder['unspsc_code'],
$workorder['service_id'],
+ $workorder['building_part'],
+ $workorder['order_dim1'],
isset($workorder['vendor_email']) &&
is_array($workorder['vendor_email']) ? implode(',', $workorder['vendor_email'])
: ''
);
@@ -1271,7 +1277,7 @@
.
"tender_received,inspection_on_completion,status,"
.
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,"
.
"user_id,ecodimb,category,billable_hours,contract_sum,approved,continuous,fictive_periodization,"
- . "contract_id, tax_code, unspsc_code,
service_id, mail_recipients $cols) "
+ . "contract_id, tax_code, unspsc_code,
service_id,building_part, order_dim1, mail_recipients $cols) "
. "VALUES ( {$values} {$vals})", __LINE__,
__FILE__);
$this->db->query("INSERT INTO fm_orders (id,type)
VALUES ({$id},'workorder')");
@@ -1413,6 +1419,8 @@
'tax_code' => $workorder['tax_code'],
'unspsc_code' => $workorder['unspsc_code'],
'service_id' => $workorder['service_id'],
+ 'building_part' => $workorder['building_part'],
+ 'order_dim1' => $workorder['order_dim1'],
'mail_recipients' =>
isset($workorder['vendor_email']) && is_array($workorder['vendor_email']) ?
implode(',', $workorder['vendor_email']) : '',
);
Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/inc/class.uiwo_hour.inc.php 2016-05-02 10:23:13 UTC (rev
14961)
@@ -1338,6 +1338,30 @@
unset($_ok);
}
+ $criteria = array
+ (
+ 'appname' => 'property',
+ 'location' =>
'.project.workorder.transfer',
+ 'allrows' => true
+ );
+
+ $custom_functions =
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+ foreach ($custom_functions as $entry)
+ {
+ // prevent path traversal
+ if (preg_match('/\.\./',
$entry['file_name']))
+ {
+ continue;
+ }
+
+ $file = PHPGW_SERVER_ROOT .
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+ if ($entry['active'] && is_file($file)
&& !$entry['client_side'] && !$entry['pre_commit'])
+ {
+ require $file;
+ }
+ }
+
$_to = isset($workorder['mail_recipients'][0])
&& $workorder['mail_recipients'][0] ? implode(';',
$workorder['mail_recipients']) : $to_email;
$email_data['use_yui_table'] = false;
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2016-04-30 21:09:45 UTC
(rev 14960)
+++ trunk/property/inc/class.uiworkorder.inc.php 2016-05-02 10:23:13 UTC
(rev 14961)
@@ -2185,6 +2185,30 @@
$active_tab = phpgw::get_var('tab', 'string',
'REQUEST', 'general');
+ $collect_building_part = false;
+ $building_part_list = array();
+ $order_dim1_list = array();
+
if(isset($config->config_data['workorder_require_building_part']))
+ {
+
if($config->config_data['workorder_require_building_part'] == 1)
+ {
+ $collect_building_part = true;
+ $filter_buildingpart =
isset($config->config_data['filter_buildingpart']) ?
$config->config_data['filter_buildingpart'] : array();
+
+ $_filter_buildingpart = array();
+ if ($filter_key = array_search('.b_account',
$filter_buildingpart))
+ {
+ $_filter_buildingpart =
array("filter_{$filter_key}" => 1);
+ }
+ $building_part_list = array('options' =>
$this->bocommon->select_category_list(array(
+ 'type' => 'building_part',
'selected' => $values['building_part'], 'order' => 'id',
+ 'id_in_name' => 'num', 'filter'
=> $_filter_buildingpart)));
+ $order_dim1_list = array('options' =>
$this->bocommon->select_category_list(array(
+ 'type' => 'order_dim1',
'selected' => $values['order_dim1'], 'order' => 'id',
+ 'id_in_name' => 'num')));
+ }
+ }
+
$data = array
(
'datatable_def' => $datatable_def,
@@ -2346,6 +2370,9 @@
'contract_list' => array('options' =>
$this->get_vendor_contract($values['vendor_id'], $values['contract_id']) ),
'value_unspsc_code' => $values['unspsc_code'],
'value_unspsc_code_name' =>
$this->_get_unspsc_code_name($values['unspsc_code']),
+ 'collect_building_part' =>
$collect_building_part,
+ 'building_part_list' => $building_part_list,
+ 'order_dim1_list' => $order_dim1_list,
);
$appname = lang('Workorder');
Copied: trunk/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
(from rev 14960,
trunk/property/inc/custom/default/BkBygg_exporter_ordre_til_Agresso.php)
===================================================================
--- trunk/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
(rev 0)
+++ trunk/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
2016-05-02 10:23:13 UTC (rev 14961)
@@ -0,0 +1,435 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 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 helpdesk
+ * @version $Id$
+ */
+ /**
+ * Description
+ * @package property
+ */
+
+
+ /**
+ * Description of BkBygg_exporter_data_til_Agresso
+ *
+ * @author Sigurd Nes
+ */
+ class BkBygg_exporter_data_til_Agresso
+ {
+
+ var $dim0; // Art
+ var $dim1; // Ansvar
+ var $dim2; // Tjeneste
+ var $dim3; // Objekt
+ var $dim4; // Kontrakt - frivillig
+ var $dim5; // Prosjekt
+ var $dim6; // Aktivitet - frivillig
+ var $transfer_xml;
+ var $connection;
+ var $order_id;
+
+ public function __construct( $param )
+ {
+ $this->db = & $GLOBALS['phpgw']->db;
+ $this->soXport = CreateObject('property.soXport');
+ $this->config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
+ $this->order_id = $param['order_id'];
+ }
+
+ public function create_transfer_xml( $param )
+ {
+ $Orders = array();
+ /*
+ UN-kodene i Agresso ligger med prefiks UN- foran
koden.
+ Eks: UN-70111601: Plantetjenester
+ */
+
+ $Seller = array(
+ 'Name' => $param['vendor_name'],
+ 'AddressInfo' => array(
+ array(
+ 'Address' =>
$param['vendor_address']
+ )
+ ),
+ 'SellerNo' => $param['vendor_id'],
+// 'SellerReferences' => array(
+// array(
+// 'SalesMan' => 12573,
+// )
+// )
+ );
+
+ $Header = array(
+ 'AcceptFlag' => 1,
+ 'OrderType]' => 'WB',
+ 'Status' => 'N',
+ 'OrderDate' => date('Y-m-d'),
+ 'Currency' => 'NOK',
+ 'Seller' => array($Seller),
+ 'Buyer' => array($param['buyer']),
+ );
+
+ $DetailInfo = array();
+ $DetailInfo[] = array(
+ 'ReferenceCode' => array(
+ 'Code' => 'A0',
+ 'Value' => $param['dim0'] // Art
+ )
+ );
+ $DetailInfo[] = array(
+ 'ReferenceCode' => array(
+ 'Code' => 'C1',
+ 'Value' => $param['dim1'] // Ansvar
+ )
+ );
+ $DetailInfo[] = array(
+ 'ReferenceCode' => array(
+ 'Code' => 'Q0',
+ 'Value' => $param['dim2'] // Tjeneste
+ )
+ );
+ $DetailInfo[] = array(
+ 'ReferenceCode' => array(
+ 'Code' => 'F0',
+ 'Value' => $param['dim3'] // Objekt
+ )
+ );
+ $DetailInfo[] = array(
+ 'ReferenceCode' => array(
+ 'Code' => 'A7',
+ 'Value' => $param['dim4'] // Kontrakt
+ )
+ );
+ $DetailInfo[] = array(
+ 'ReferenceCode' => array(
+ 'Code' => 'B0',
+ 'Value' => $param['dim5'] // Prosjekt
+ )
+ );
+ $DetailInfo[] = array(
+ 'ReferenceCode' => array(
+ 'Code' => 'B1',
+ 'Value' => $param['dim6'] // Aktivitet
+ )
+ );
+ $DetailInfo[] = array(
+ 'ReferenceCode' => array(
+ 'Code' => 'A1',
+ 'Value' => $param['tax_code'] // Moms
kode
+ )
+ );
+
+ $Detail = array();
+ $i = 1;
+ foreach ($param['lines'] as $line)
+ {
+
+ $Detail[] = array(
+ 'LineNo' => $i,
+ 'Status' => 'N',
+ 'BuyerProductCode' =>
$line['unspsc_code'], //74000176, //UN-kode
+ 'BuyerProductDescr' => $line['descr'],
//'Kopipapir',
+ 'UnitCode' => 'STK',
+ 'Quantity' => 100,
+ 'DetailInfo' => $DetailInfo
+ );
+
+ $i++;
+ }
+
+
+ $Orders['Order'][] = array(
+ 'OrderNo' => $param['order_id'],
+ 'VoucherType' => 'IV',
+ 'TransType' => 41,
+ 'Header' => array($Header),
+ 'Details' => array('Detail' => $Detail)
+ );
+
+// _debug_array($Orders);
+// die();
+
+ $root_attributes = array(
+ 'Version' => "542",
+ 'xmlns:xsi' =>
"http://www.w3.org/2001/XMLSchema-instance",
+ 'xsi:noNamespaceSchemaLocation' =>
"http://services.agresso.com/schema/ABWOrder/2004/07/02/ABWOrder.xsd"
+ );
+ $xml_creator = new xml_creator('ABWOrder',
$root_attributes);
+ $xml_creator->fromArray($Orders);
+ $this->transfer_xml = $xml_creator->getDocument();
+ return $this->transfer_xml;
+ // $xml_creator->output();
+ // die();
+ }
+
+ /**
+ * Output the content of a current xml document.
+ * @access public
+ * @param null
+ */
+ public function output()
+ {
+ header('Content-type: text/xml');
+ echo $this->transfer_xml;
+ }
+
+
+ protected function create_file_name( $ref = '' )
+ {
+ if (!$ref)
+ {
+ throw new
Exception('BkBygg_exporter_data_til_Agresso::create_file_name() Mangler
referanse');
+ }
+ $fil_katalog =
$this->config->config_data['export']['path'];
+
+ $filename = "{$fil_katalog}/FDV_ordre_{$ref}.xml";
+
+ //Sjekk om filen eksisterer
+ if (file_exists($filename))
+ {
+ unlink($filename);
+ }
+
+ return $filename;
+ }
+
+ public function transfer( )
+ {
+ $this->db->transaction_begin();
+
+ $filename = $this->create_file_name($this->order_id);
+ $batchid = $this->soXport->increment_batchid();
+ $content = $this->transfer_xml;
+
+ if(false) // keep a copy?
+ {
+ $file_written = false;
+ $fp = fopen($filename, "wb");
+ fwrite($fp, $buffer);
+
+ if (fclose($fp))
+ {
+ $file_written = true;
+ }
+ }
+
+ $transfer_ok = false;
+ if ($this->config->config_data['common']['method'] ==
'ftp' || $this->config->config_data['common']['method'] == 'ssh')
+ {
+ if (!$connection = $this->connection)
+ {
+ $connection = $this->phpftp_connect();
+ }
+
+ $basedir =
$this->config->config_data['export']['remote_basedir'];
+ if ($basedir)
+ {
+ $remote_file = $basedir . '/' .
basename($filename);
+ }
+ else
+ {
+ $remote_file = basename($filename);
+ }
+
+ switch
($this->config->config_data['common']['method'])
+ {
+ case 'ftp';
+ $tmp = tmpfile();
+ fwrite($tmp, $content);
+ rewind($tmp);
+ $transfer_ok =
ftp_fput($connection, $remote_file, $tmp, FTP_BINARY);
+ fclose($tmp);
+ // $transfer_ok =
ftp_put($connection, $remote_file, $filename, FTP_BINARY);
+ break;
+ case 'ssh';
+ $sftp = ssh2_sftp($connection);
+ $stream =
@fopen("ssh2.sftp://$sftp$remote_file", 'w');
+ fwrite($stream, $content);
+ $transfer_ok = @fclose($stream);
+ break;
+ default:
+ $transfer_ok = false;
+ }
+ if ($transfer_ok)
+ {
+
$this->soXport->log_transaction($batchid, $this->order_id, lang('transferred
Order %1 to Agresso', basename($filename)));
+ $this->db->transaction_commit(); //
Reverse the batch_id - increment
+ }
+ else
+ {
+ $this->db->transaction_abort();
+
$this->soXport->log_transaction($batchid, $this->order_id, lang('Failed to
transfere Order %1 to Agresso', basename($filename)));
+ // @unlink($filename);
+ }
+ }
+ return $transfer_ok;
+ }
+
+ function phpftp_connect()
+ {
+ $server = $this->config->config_data['common']['host'];
+ $user = $this->config->config_data['common']['user'];
+ $password =
$this->config->config_data['common']['password'];
+ $port = 22;
+
+ switch ($this->config->config_data['common']['method'])
+ {
+ case 'ftp';
+ if ($connection = ftp_connect($server))
+ {
+ ftp_login($connection, $user,
$password);
+ }
+ break;
+ case 'ssh';
+ if (!function_exists("ssh2_connect"))
+ {
+ die("function ssh2_connect
doesn't exist");
+ }
+ if (!($connection =
ssh2_connect("$server", $port)))
+ {
+ $message = "fail: unable to
establish connection";
+ _debug_array($message);
+ //$receipt['error'][]=
array('msg' => $message);
+ }
+ else
+ {
+ // try to authenticate with
username root, password secretpassword
+ if
(!ssh2_auth_password($connection, $user, $password))
+ {
+ $message = "fail:
unable to authenticate";
+ _debug_array($message);
+ //$receipt['error'][]=
array('msg' => $message);
+ }
+ }
+ break;
+ }
+ $this->connection = $connection;
+ return $connection;
+ }
+ }
+
+ class xml_creator extends XMLWriter
+ {
+
+ /**
+ * Constructor.
+ * @param string $prm_rootElementName A root element's name of
a current xml document
+ * @param ARRAY $root_attributtes array of root attributes.
+ * @param string $prm_xsltFilePath Path of a XSLT file.
+ * @access public
+ * @param null
+ */
+ public function __construct( $prm_rootElementName,
$root_attributes = array(), $prm_xsltFilePath = '' )
+ {
+ $this->openMemory();
+ $this->setIndent(true);
+ $this->setIndentString(' ');
+ $this->startDocument('1.0', 'UTF-8');
+
+ if ($prm_xsltFilePath)
+ {
+ $this->writePi('xml-stylesheet',
'type="text/xsl" href="' . $prm_xsltFilePath . '"');
+ }
+
+ $this->startElement($prm_rootElementName);
+
+ foreach ($root_attributes as $key => $value)
+ {
+ $this->writeAttribute($key, $value);
+ }
+ }
+
+ /**
+ * Set an element with a text to a current xml document.
+ * @access public
+ * @param string $prm_elementName An element's name
+ * @param string $prm_ElementText An element's text
+ * @return null
+ */
+ public function setElement( $prm_elementName, $prm_ElementText )
+ {
+ $this->startElement($prm_elementName);
+ $this->text($prm_ElementText);
+ $this->endElement();
+ }
+
+ /**
+ * Construct elements and texts from an array.
+ * The array should contain an attribute's name in index part
+ * and a attribute's text in value part.
+ * @access public
+ * @param array $prm_array Contains attributes and texts
+ * @return null
+ */
+ public function fromArray( array $array )
+ {
+ foreach ($array as $key => $val)
+ {
+ if (is_array($val))
+ {
+ if (is_numeric($key))
+ {
+ // numeric keys aren't allowed
so we'll skip the key
+ $this->fromArray($val);
+ }
+ else
+ {
+ $this->startElement($key);
+ $this->fromArray($val);
+ $this->endElement();
+ }
+ }
+ else
+ {
+ $this->writeElement($key, $val);
+ }
+ }
+ }
+
+ /**
+ * Return the content of a current xml document.
+ * @access public
+ * @param null
+ * @return string Xml document
+ */
+ public function getDocument()
+ {
+ $this->endElement();
+ $this->endDocument();
+ return $this->outputMemory();
+ }
+
+ /**
+ * Output the content of a current xml document.
+ * @access public
+ * @param null
+ */
+ public function output()
+ {
+ header('Content-type: text/xml');
+ echo $this->getDocument();
+ }
+ }
\ No newline at end of file
Deleted: trunk/property/inc/custom/default/BkBygg_exporter_ordre_til_Agresso.php
===================================================================
--- trunk/property/inc/custom/default/BkBygg_exporter_ordre_til_Agresso.php
2016-04-30 21:09:45 UTC (rev 14960)
+++ trunk/property/inc/custom/default/BkBygg_exporter_ordre_til_Agresso.php
2016-05-02 10:23:13 UTC (rev 14961)
@@ -1,435 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2016 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 helpdesk
- * @version $Id: class.uitts.inc.php 14940 2016-04-26 11:02:40Z
sigurdne $
- */
- /**
- * Description
- * @package property
- */
-
-
- /**
- * Description of BkBygg_exporter_ordre_til_Agresso
- *
- * @author Sigurd Nes
- */
- class BkBygg_exporter_ordre_til_Agresso
- {
-
- var $dim0; // Art
- var $dim1; // Ansvar
- var $dim2; // Tjeneste
- var $dim3; // Objekt
- var $dim4; // Kontrakt - frivillig
- var $dim5; // Prosjekt
- var $dim6; // Aktivitet - frivillig
- var $transfer_xml;
- var $connection;
- var $order_id;
-
- public function __construct( $param )
- {
- $this->db = & $GLOBALS['phpgw']->db;
- $this->soXport = CreateObject('property.soXport');
- $this->config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
- $this->order_id = $param['order_id'];
- }
-
- public function create_transfer_xml( $param )
- {
- $Orders = array();
- /*
- UN-kodene i Agresso ligger med prefiks UN- foran
koden.
- Eks: UN-70111601: Plantetjenester
- */
-
- $Seller = array(
- 'Name' => $param['vendor_name'],
- 'AddressInfo' => array(
- array(
- 'Address' =>
$param['vendor_address']
- )
- ),
- 'SellerNo' => $param['vendor_id'],
-// 'SellerReferences' => array(
-// array(
-// 'SalesMan' => 12573,
-// )
-// )
- );
-
- $Header = array(
- 'AcceptFlag' => 1,
- 'OrderType]' => 'WB',
- 'Status' => 'N',
- 'OrderDate' => date('Y-m-d'),
- 'Currency' => 'NOK',
- 'Seller' => array($Seller),
- 'Buyer' => array($param['buyer']),
- );
-
- $DetailInfo = array();
- $DetailInfo[] = array(
- 'ReferenceCode' => array(
- 'Code' => 'A0',
- 'Value' => $param['dim0'] // Art
- )
- );
- $DetailInfo[] = array(
- 'ReferenceCode' => array(
- 'Code' => 'C1',
- 'Value' => $param['dim1'] // Ansvar
- )
- );
- $DetailInfo[] = array(
- 'ReferenceCode' => array(
- 'Code' => 'Q0',
- 'Value' => $param['dim2'] // Tjeneste
- )
- );
- $DetailInfo[] = array(
- 'ReferenceCode' => array(
- 'Code' => 'F0',
- 'Value' => $param['dim3'] // Objekt
- )
- );
- $DetailInfo[] = array(
- 'ReferenceCode' => array(
- 'Code' => 'A7',
- 'Value' => $param['dim4'] // Kontrakt
- )
- );
- $DetailInfo[] = array(
- 'ReferenceCode' => array(
- 'Code' => 'B0',
- 'Value' => $param['dim5'] // Prosjekt
- )
- );
- $DetailInfo[] = array(
- 'ReferenceCode' => array(
- 'Code' => 'B1',
- 'Value' => $param['dim6'] // Aktivitet
- )
- );
- $DetailInfo[] = array(
- 'ReferenceCode' => array(
- 'Code' => 'A1',
- 'Value' => $param['tax_code'] // Moms
kode
- )
- );
-
- $Detail = array();
- $i = 1;
- foreach ($param['lines'] as $line)
- {
-
- $Detail[] = array(
- 'LineNo' => $i,
- 'Status' => 'N',
- 'BuyerProductCode' =>
$line['unspsc_code'], //74000176, //UN-kode
- 'BuyerProductDescr' => $line['descr'],
//'Kopipapir',
- 'UnitCode' => 'STK',
- 'Quantity' => 100,
- 'DetailInfo' => $DetailInfo
- );
-
- $i++;
- }
-
-
- $Orders['Order'][] = array(
- 'OrderNo' => $param['order_id'],
- 'VoucherType' => 'IV',
- 'TransType' => 41,
- 'Header' => array($Header),
- 'Details' => array('Detail' => $Detail)
- );
-
-// _debug_array($Orders);
-// die();
-
- $root_attributes = array(
- 'Version' => "542",
- 'xmlns:xsi' =>
"http://www.w3.org/2001/XMLSchema-instance",
- 'xsi:noNamespaceSchemaLocation' =>
"http://services.agresso.com/schema/ABWOrder/2004/07/02/ABWOrder.xsd"
- );
- $xml_creator = new xml_creator('ABWOrder',
$root_attributes);
- $xml_creator->fromArray($Orders);
- $this->transfer_xml = $xml_creator->getDocument();
- return $this->transfer_xml;
- // $xml_creator->output();
- // die();
- }
-
- /**
- * Output the content of a current xml document.
- * @access public
- * @param null
- */
- public function output()
- {
- header('Content-type: text/xml');
- echo $this->transfer_xml;
- }
-
-
- protected function create_file_name( $ref = '' )
- {
- if (!$ref)
- {
- throw new
Exception('BkBygg_exporter_ordre_til_Agresso::create_file_name() Mangler
referanse');
- }
- $fil_katalog =
$this->config->config_data['export']['path'];
-
- $filename = "{$fil_katalog}/FDV_{$ref}.xml";
-
- //Sjekk om filen eksisterer
- if (file_exists($filename))
- {
- unlink($filename);
- }
-
- return $filename;
- }
-
- public function transfer( )
- {
- $this->db->transaction_begin();
-
- $filename = $this->create_file_name($this->order_id);
- $batchid = $this->soXport->increment_batchid();
- $content = $this->transfer_xml;
-
- if(false) // keep a copy?
- {
- $file_written = false;
- $fp = fopen($filename, "wb");
- fwrite($fp, $buffer);
-
- if (fclose($fp))
- {
- $file_written = true;
- }
- }
-
- $transfer_ok = false;
- if ($this->config->config_data['common']['method'] ==
'ftp' || $this->config->config_data['common']['method'] == 'ssh')
- {
- if (!$connection = $this->connection)
- {
- $connection = $this->phpftp_connect();
- }
-
- $basedir =
$this->config->config_data['export']['remote_basedir'];
- if ($basedir)
- {
- $remote_file = $basedir . '/' .
basename($filename);
- }
- else
- {
- $remote_file = basename($filename);
- }
-
- switch
($this->config->config_data['common']['method'])
- {
- case 'ftp';
- $tmp = tmpfile();
- fwrite($tmp, $content);
- rewind($tmp);
- $transfer_ok =
ftp_fput($connection, $remote_file, $tmp, FTP_BINARY);
- fclose($tmp);
- // $transfer_ok =
ftp_put($connection, $remote_file, $filename, FTP_BINARY);
- break;
- case 'ssh';
- $sftp = ssh2_sftp($connection);
- $stream =
@fopen("ssh2.sftp://$sftp$remote_file", 'w');
- fwrite($stream, $content);
- $transfer_ok = @fclose($stream);
- break;
- default:
- $transfer_ok = false;
- }
- if ($transfer_ok)
- {
-
$this->soXport->log_transaction($batchid, $this->order_id, lang('transferred
Order %1 to Agresso', basename($filename)));
- $this->db->transaction_commit(); //
Reverse the batch_id - increment
- }
- else
- {
- $this->db->transaction_abort();
-
$this->soXport->log_transaction($batchid, $this->order_id, lang('Failed to
transfere Order %1 to Agresso', basename($filename)));
- // @unlink($filename);
- }
- }
- return $transfer_ok;
- }
-
- function phpftp_connect()
- {
- $server = $this->config->config_data['common']['host'];
- $user = $this->config->config_data['common']['user'];
- $password =
$this->config->config_data['common']['password'];
- $port = 22;
-
- switch ($this->config->config_data['common']['method'])
- {
- case 'ftp';
- if ($connection = ftp_connect($server))
- {
- ftp_login($connection, $user,
$password);
- }
- break;
- case 'ssh';
- if (!function_exists("ssh2_connect"))
- {
- die("function ssh2_connect
doesn't exist");
- }
- if (!($connection =
ssh2_connect("$server", $port)))
- {
- $message = "fail: unable to
establish connection";
- _debug_array($message);
- //$receipt['error'][]=
array('msg' => $message);
- }
- else
- {
- // try to authenticate with
username root, password secretpassword
- if
(!ssh2_auth_password($connection, $user, $password))
- {
- $message = "fail:
unable to authenticate";
- _debug_array($message);
- //$receipt['error'][]=
array('msg' => $message);
- }
- }
- break;
- }
- $this->connection = $connection;
- return $connection;
- }
- }
-
- class xml_creator extends XMLWriter
- {
-
- /**
- * Constructor.
- * @param string $prm_rootElementName A root element's name of
a current xml document
- * @param ARRAY $root_attributtes array of root attributes.
- * @param string $prm_xsltFilePath Path of a XSLT file.
- * @access public
- * @param null
- */
- public function __construct( $prm_rootElementName,
$root_attributes = array(), $prm_xsltFilePath = '' )
- {
- $this->openMemory();
- $this->setIndent(true);
- $this->setIndentString(' ');
- $this->startDocument('1.0', 'UTF-8');
-
- if ($prm_xsltFilePath)
- {
- $this->writePi('xml-stylesheet',
'type="text/xsl" href="' . $prm_xsltFilePath . '"');
- }
-
- $this->startElement($prm_rootElementName);
-
- foreach ($root_attributes as $key => $value)
- {
- $this->writeAttribute($key, $value);
- }
- }
-
- /**
- * Set an element with a text to a current xml document.
- * @access public
- * @param string $prm_elementName An element's name
- * @param string $prm_ElementText An element's text
- * @return null
- */
- public function setElement( $prm_elementName, $prm_ElementText )
- {
- $this->startElement($prm_elementName);
- $this->text($prm_ElementText);
- $this->endElement();
- }
-
- /**
- * Construct elements and texts from an array.
- * The array should contain an attribute's name in index part
- * and a attribute's text in value part.
- * @access public
- * @param array $prm_array Contains attributes and texts
- * @return null
- */
- public function fromArray( array $array )
- {
- foreach ($array as $key => $val)
- {
- if (is_array($val))
- {
- if (is_numeric($key))
- {
- // numeric keys aren't allowed
so we'll skip the key
- $this->fromArray($val);
- }
- else
- {
- $this->startElement($key);
- $this->fromArray($val);
- $this->endElement();
- }
- }
- else
- {
- $this->writeElement($key, $val);
- }
- }
- }
-
- /**
- * Return the content of a current xml document.
- * @access public
- * @param null
- * @return string Xml document
- */
- public function getDocument()
- {
- $this->endElement();
- $this->endDocument();
- return $this->outputMemory();
- }
-
- /**
- * Output the content of a current xml document.
- * @access public
- * @param null
- */
- public function output()
- {
- header('Content-type: text/xml');
- echo $this->getDocument();
- }
- }
\ No newline at end of file
Added:
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
===================================================================
---
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
(rev 0)
+++
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
2016-05-02 10:23:13 UTC (rev 14961)
@@ -0,0 +1,179 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 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 helpdesk
+ * @version $Id$
+ */
+ /**
+ * Description
+ * @package property
+ */
+ /**
+ * Description of lag_agresso_varemottak
+ *
+ * @author Sigurd Nes
+ */
+ if (isset($data['order_id']) && $data['order_id'] &&
isset($data['varemottak']) && $data['varemottak'])
+ {
+ $exporter_varemottak = new
lag_agresso_varemottak($this->acl_location, $id);
+ $exporter_varemottak->transfer($id);
+ }
+
+ class lag_agresso_varemottak
+ {
+
+ private $acl_location;
+ private $values;
+
+ function __construct( $acl_location, $id )
+ {
+ switch ($acl_location)
+ {
+ case '.ticket':
+ $this->acl_location = $acl_location;
+ $this->values =
ExecMethod('property.sotts.read_single', $id);
+ break;
+ default:
+ $this->acl_location =
'.project.workorder';
+ $this->values =
ExecMethod('property.soworkorder.read_single', $id);
+ break;
+ }
+ }
+
+ public function transfer( $id )
+ {
+ $values = $this->values;
+// _debug_array($values);die();
+
+ $param = array(
+ 'order_id' => $values['order_id'],
+ 'lines' => array(
+ array(
+ 'UnitCode' => 'STK',
+ 'Quantity' => 1,
+ )
+ )
+ );
+
+ $exporter_varemotta = new
BkBygg_exporter_varemottak_til_Agresso();
+ $exporter_varemotta->create_transfer_xml();
+ $exporter_varemotta->output();
+ die();
+ $export_ok = $exporter_ordre->transfer();
+ if ($export_ok)
+ {
+ $this->log_transfer( $id );
+ }
+ }
+
+ private function log_transfer( $id )
+ {
+ $id = (int)$id;
+ switch ($this->acl_location)
+ {
+ case '.ticket':
+ $historylog =
CreateObject('property.historylog', 'tts');
+ $table = 'fm_tts_tickets';
+ break;
+ default:
+ $historylog =
CreateObject('property.historylog', 'workorder');
+ $table = 'fm_workorder';
+ break;
+ }
+ $historylog->add('RM', $id, "Varemottak overført til
agresso");
+ $GLOBALS['phpgw']->db->query("UPDATE {$table} SET
order_received = 1 WHERE id = {$id}");
+ }
+ }
+
+ class BkBygg_exporter_varemottak_til_Agresso extends
BkBygg_exporter_data_til_Agresso
+ {
+
+ var $transfer_xml;
+ var $connection;
+ var $order_id;
+
+ public function __construct( $param )
+ {
+ parent::__construct($param);
+ }
+
+ public function create_transfer_xml( $param )
+ {
+ $Orders = array();
+ $Detail = array();
+ $i = 1;
+ foreach ($param['lines'] as $line)
+ {
+ $Detail[] = array(
+ 'LineNo' => $i,
+ 'Status' => 'N',
+ 'UnitCode' => $line['UnitCode'],
+ 'Quantity' => $line['Quantity'],
+ );
+ $i++;
+ }
+
+ $Orders['Order'][] = array(
+ 'OrderNo' => $param['order_id'],
+ 'VoucherType' => 'VV',
+ 'TransType' => 51,
+ 'Details' => array('Detail' => $Detail)
+ );
+
+// _debug_array($Orders);
+// die();
+
+ $root_attributes = array(
+ 'Version' => "542",
+ 'xmlns:xsi' =>
"http://www.w3.org/2001/XMLSchema-instance",
+ 'xsi:noNamespaceSchemaLocation' =>
"http://services.agresso.com/schema/ABWOrder/2004/07/02/ABWOrder.xsd"
+ );
+ $xml_creator = new xml_creator('ABWOrder',
$root_attributes);
+ $xml_creator->fromArray($Orders);
+ $this->transfer_xml = $xml_creator->getDocument();
+ return $this->transfer_xml;
+ // $xml_creator->output();
+ // die();
+ }
+
+ protected function create_file_name( $ref = '' )
+ {
+ if (!$ref)
+ {
+ throw new
Exception('BkBygg_exporter_data_til_Agresso::create_file_name() Mangler
referanse');
+ }
+ $fil_katalog =
$this->config->config_data['export']['path'];
+
+ $filename = "{$fil_katalog}/FDV_varemottak_{$ref}.xml";
+
+ //Sjekk om filen eksisterer
+ if (file_exists($filename))
+ {
+ unlink($filename);
+ }
+
+ return $filename;
+ }
+ }
\ No newline at end of file
Modified:
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php
===================================================================
--- trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php
2016-04-30 21:09:45 UTC (rev 14960)
+++ trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php
2016-05-02 10:23:13 UTC (rev 14961)
@@ -24,99 +24,143 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage helpdesk
- * @version $Id: class.uitts.inc.php 14940 2016-04-26 11:02:40Z
sigurdne $
+ * @version $Id$
*/
/**
* Description
* @package property
*/
+ //if (false)
+ if (isset($data['order_id']) && $data['order_id'] &&
isset($data['save']) && $data['save'] && isset($data['vendor_email'][0]) &&
$data['vendor_email'][0])
+ {
+ $exporter_ordre = new lag_agresso_ordre_fra_melding();
+ $exporter_ordre->transfer($id);
+ }
+ class lag_agresso_ordre_fra_melding
+ {
- //if (false)
- if(isset($data['order_id']) && $data['order_id'] &&
isset($data['save']) && $data['save'] && isset($data['vendor_email'][0]) &&
$data['vendor_email'][0])
- {
- $_ticket = $this->read_single($id);
+ function __construct()
+ {
+
+ }
+
+ public function transfer( $id )
+ {
+ $_ticket = ExecMethod('property.sotts.read_single',
$id);
// _debug_array($_ticket);die();
- $contacts = CreateObject('property.sogeneric');
- $contacts->get_location_info('vendor', false);
+ $contacts = CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor', false);
- $custom = createObject('property.custom_fields');
- $vendor_data['attributes'] = $custom->find('property',
'.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
+ $custom = createObject('property.custom_fields');
+ $vendor_data['attributes'] = $custom->find('property',
'.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
- $vendor_data = $contacts->read_single(array('id' =>
$_ticket['vendor_id']), $vendor_data);
- if (is_array($vendor_data))
- {
- foreach ($vendor_data['attributes'] as $attribute)
+ $vendor_data = $contacts->read_single(array('id' =>
$_ticket['vendor_id']), $vendor_data);
+ if (is_array($vendor_data))
{
- if ($attribute['name'] == 'adresse')
+ foreach ($vendor_data['attributes'] as
$attribute)
{
- $vendor['address'] =
$attribute['value'];
+ if ($attribute['name'] == 'adresse')
+ {
+ $vendor['address'] =
$attribute['value'];
+ }
+ if ($attribute['name'] == 'org_name')
+ {
+ $vendor['name'] =
$attribute['value'];
+ }
}
- if ($attribute['name'] == 'org_name')
+ }
+ unset($contacts);
+
+
+ if (phpgw::get_var('on_behalf_of_assigned', 'bool') &&
isset($_ticket['assignedto_name']))
+ {
+ $user_name = $_ticket['assignedto_name'];
+
$GLOBALS['phpgw']->preferences->set_account_id($_ticket['assignedto'], true);
+ $GLOBALS['phpgw_info']['user']['preferences'] =
$GLOBALS['phpgw']->preferences->data;
+ $account_lid =
$GLOBALS['phpgw']->accounts->id2lid($_ticket['assignedto']);
+ }
+ else
+ {
+ $user_name =
$GLOBALS['phpgw_info']['user']['fullname'];
+ $account_lid =
$GLOBALS['phpgw_info']['user']['account_lid'];
+ }
+ // $ressursnr =
$GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr'];
+
+ $buyer = array(
+ 'Name' => $user_name,
+ 'AddressInfo' => array(
+ array(
+ 'Address' => $_ticket['address']
+ )
+ ),
+ 'BuyerReferences' => array(
+ array(
+ 'Responsible' => $account_lid,
+ 'RequestedBy' => $account_lid,
+ 'Accountable' => $account_lid,
+ )
+ )
+ );
+ if ($_ticket['location_data'])
+ {
+ $dim3 =
isset($_ticket['location_data']['loc2']) && $_ticket['location_data']['loc2'] ?
"{$_ticket['location_data']['loc1']}{$_ticket['location_data']['loc2']}" :
"{$_ticket['location_data']['loc1']}01";
+ }
+ else
+ {
+ $dim3 = 9;
+ }
+
+ $dim6 = 9;
+
+ if ($_ticket['order_dim1'])
+ {
+ $sogeneric = CreateObject('property.sogeneric',
'order_dim1');
+ $sogeneric_data =
$sogeneric->read_single(array('id' => $_ticket['order_dim1']));
+ if ($sogeneric_data)
{
- $vendor['name'] = $attribute['value'];
+ $dim6 =
"{$_ticket['building_part']}{$sogeneric_data['num']}";
}
}
- }
- unset($contacts);
+ $param = array(
+ 'dim0' => $_ticket['b_account_id'],
// Art
+ 'dim1' => $_ticket['ecodimb'],
// Ansvar
+ 'dim2' => $_ticket['service_id'] ?
$_ticket['service_id'] : 9, // Tjeneste liste 30 stk, default 9
+ 'dim3' => $dim3,
// Objekt: eiendom + bygg: 6 siffer
+ 'dim4' => $_ticket['contract_id'],
// Kontrakt - frivillig / 9, 7 tegn - alfanumerisk
+ 'dim5' => $_ticket['external_project_id'],
// Prosjekt
+ 'dim6' => $dim6,
// Aktivitet - frivillig: bygningsdel, 3 siffer +
bokstavkode
+ 'vendor_id' => $_ticket['vendor_id'],
+ 'vendor_name' => $vendor['name'],
+ 'vendor_address' => $vendor['address'],
+ 'order_id' => $_ticket['order_id'],
+ 'tax_code' => $_ticket['tax_code'],
+ 'buyer' => $buyer,
+ 'lines' => array(
+ array(
+ 'unspsc_code' =>
$_ticket['unspsc_code'],
+ 'descr' =>
strip_tags($_ticket['order_descr'])
+ )
+ )
+ );
- if (phpgw::get_var('on_behalf_of_assigned', 'bool') &&
isset($_ticket['assignedto_name']))
- {
- $user_name = $_ticket['assignedto_name'];
-
$GLOBALS['phpgw']->preferences->set_account_id($_ticket['assignedto'], true);
- $GLOBALS['phpgw_info']['user']['preferences'] =
$GLOBALS['phpgw']->preferences->data;
- $account_lid =
$GLOBALS['phpgw']->accounts->id2lid($_ticket['assignedto']);
+ $exporter_ordre = new
BkBygg_exporter_data_til_Agresso();
+ $exporter_ordre->create_transfer_xml($param);
+ $exporter_ordre->output();
+ die();
+ $export_ok = $exporter_ordre->transfer();
+ if ($export_ok)
+ {
+ $this->log_transfer( $id );
+ }
}
- else
+
+ private function log_transfer( $id )
{
- $user_name = $GLOBALS['phpgw_info']['user']['fullname'];
- $account_lid =
$GLOBALS['phpgw_info']['user']['account_lid'];
+ $historylog = CreateObject('property.historylog',
'tts');
+ $historylog->add('RM', $id, "Ordre overført til
agresso");
+ $GLOBALS['phpgw']->db->query("UPDATE fm_tts_tickets SET
order_sent = 1 WHERE id = {$id}");
}
- // $ressursnr =
$GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr'];
-
- $buyer = array(
- 'Name' => $user_name,
- 'AddressInfo' => array(
- array(
- 'Address' => $_ticket['address']
- )
- ),
- 'BuyerReferences' => array(
- array(
- 'Responsible' => $account_lid,
- 'RequestedBy' => $account_lid,
- 'Accountable' => $account_lid,
- )
- )
- );
-
- $param = array(
- 'dim0' => $_ticket['b_account_id'],
// Art
- 'dim1' => $_ticket['ecodimb'],
// Ansvar
- 'dim2' => $_ticket['service_id'] ?
$_ticket['service_id'] : 9, // Tjeneste liste 30 stk, default 9
- 'dim3' => $_ticket['location_data']['loc1'] .
($_ticket['location_data']['loc2'] ? $_ticket['location_data']['loc2'] : '01')
, // Objekt: eiendom + bygg: 6 siffer
- 'dim4' => $_ticket['contract_id'],
// Kontrakt - frivillig / 9, 7 tegn -
alfanumerisk
- 'dim5' => $_ticket['external_project_id'],
// Prosjekt
- 'dim6' => $_ticket['order_dim1'],
// Aktivitet - frivillig: bygningsdel,
3 siffer + bokstavkode
- 'vendor_id' => $_ticket['vendor_id'],
- 'vendor_name' => $vendor['name'],
- 'vendor_address' => $vendor['address'],
- 'order_id' => $_ticket['order_id'],
- 'tax_code' => $_ticket['tax_code'],
- 'buyer' => $buyer,
- 'lines' => array(
- array(
- 'unspsc_code' =>
$_ticket['unspsc_code'],
- 'descr' =>
strip_tags($_ticket['order_descr'])
- )
- )
- );
-
- $exporter_ordre = new BkBygg_exporter_ordre_til_Agresso();
- $exporter_ordre->create_transfer_xml($param);
- $exporter_ordre->output();
- die();
- // $exporter_ordre->transfer();
- }
+ }
\ No newline at end of file
Added:
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
===================================================================
---
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
(rev 0)
+++
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
2016-05-02 10:23:13 UTC (rev 14961)
@@ -0,0 +1,231 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 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 helpdesk
+ * @version $Id$
+ */
+ /**
+ * Description
+ * @package property
+ */
+ //if (false)
+ if (true)
+ {
+ $exporter_ordre = new lag_agresso_ordre_fra_workorder();
+ $exporter_ordre->transfer($project, $workorder);
+ }
+
+ class lag_agresso_ordre_fra_workorder
+ {
+
+ public function __construct()
+ {
+ $this->cats = CreateObject('phpgwapi.categories', -1,
'property', '.project');
+ $this->cats->supress_info = true;
+ }
+
+ public function transfer( $project, $workorder )
+ {
+// _debug_array($workorder);die();
+
+ $contacts = CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor', false);
+
+ $custom = createObject('property.custom_fields');
+ $vendor_data['attributes'] = $custom->find('property',
'.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
+
+ $vendor_data = $contacts->read_single(array('id' =>
$workorder['vendor_id']), $vendor_data);
+ if (is_array($vendor_data))
+ {
+ foreach ($vendor_data['attributes'] as
$attribute)
+ {
+ if ($attribute['name'] == 'adresse')
+ {
+ $vendor['address'] =
$attribute['value'];
+ }
+ if ($attribute['name'] == 'org_name')
+ {
+ $vendor['name'] =
$attribute['value'];
+ }
+ }
+ }
+ unset($contacts);
+
+
$GLOBALS['phpgw']->preferences->set_account_id($workorder['user_id'], true);
+
+ $user_name =
$GLOBALS['phpgw']->accounts->get($workorder['user_id'])->__toString();
+ $account_lid =
$GLOBALS['phpgw']->accounts->id2lid($workorder['user_id']);
+
+ if ($workorder['location_code'])
+ {
+ $location_code = $workorder['location_code'];
+ $location = explode('-', $location_code);
+ $dim3 = isset($location[1]) && $location[1] ?
"{$location[0]}{$location[1]}" : "{$location[0]}01";
+ }
+ else if ($project['location_code'])
+ {
+ $location_code = $project['location_code'];
+ $location = explode('-', $location_code);
+ $dim3 = isset($location[1]) && $location[1] ?
"{$location[0]}{$location[1]}" : "{$location[0]}01";
+ }
+ else
+ {
+ $dim3 = 9;
+ }
+
+ $address_element =
execMethod('property.botts.get_address_element', $location_code);
+ $_address = array();
+ foreach ($address_element as $entry)
+ {
+ $_address[] = "{$entry['text']}:
{$entry['value']}";
+ }
+
+ $address = '';
+ if ($_address)
+ {
+ $address = implode(', ', $_address);
+ }
+
+ $buyer = array(
+ 'Name' => $user_name,
+ 'AddressInfo' => array(
+ array(
+ 'Address' => $address
+ )
+ ),
+ 'BuyerReferences' => array(
+ array(
+ 'Responsible' => $account_lid,
+ 'RequestedBy' => $account_lid,
+ 'Accountable' => $account_lid,
+ )
+ )
+ );
+
+
+ //EBF...
+
+ $location_info =
execMethod('property.bolocation.read_single', $location[0]);
+
+ $tax_code = 0;
+ $tjeneste = 9;
+ if ($location_info['attributes'])
+ {
+ $_found = 0;
+ foreach ($location_info['attributes'] as $key
=> $attribute)
+ {
+ if ($attribute['name'] == 'mva')
+ {
+ $tax_code = $attribute['value'];
+ $_found ++;
+ }
+ if ($attribute['name'] == 'kostra_id')
+ {
+ $tjeneste = $attribute['value'];
+ $_found ++;
+ }
+ if ($_found == 2)
+ {
+ break;
+ }
+ }
+ }
+
+ //Override from workorder
+ $tax_code = $workorder['tax_code'] ?
$workorder['tax_code'] : $tax_code;
+ $tjeneste = $workorder['service_id'] ?
$workorder['service_id'] : $tjeneste;
+
+// _debug_array($location_info);die();
+ $config = CreateObject('phpgwapi.config', 'property');
+ $config->read();
+
+ $collect_building_part = false;
+ if
(isset($config->config_data['workorder_require_building_part']))
+ {
+ if
($config->config_data['workorder_require_building_part'] == 1)
+ {
+ $collect_building_part = true;
+ }
+ }
+
+ if ($collect_building_part)
+ {
+ if ($workorder['order_dim1'])
+ {
+ $sogeneric =
CreateObject('property.sogeneric', 'order_dim1');
+ $sogeneric_data =
$sogeneric->read_single(array('id' => $workorder['order_dim1']));
+ if ($sogeneric_data)
+ {
+ $dim6 =
"{$workorder['building_part']}{$sogeneric_data['num']}";
+ }
+ }
+ }
+ else
+ {
+ $category =
$this->cats->return_single($workorder['cat_id']);
+ $category_arr = explode('-',
$category[0]['name']);
+ $dim6 = (int)trim($category_arr[0]);
+ }
+
+ $param = array(
+ 'dim0' => $workorder['b_account_id'], // Art
+ 'dim1' => $workorder['ecodimb'], // Ansvar
+ 'dim2' => $tjeneste, // Tjeneste liste 30 stk,
default 9
+ 'dim3' => $dim3, // Objekt: eiendom + bygg: 6
siffer
+ 'dim4' => $workorder['contract_id'], //
Kontrakt - frivillig / 9, 7 tegn - alfanumerisk
+ 'dim5' => $project['external_project_id'], //
Prosjekt
+ 'dim6' => $dim6, // Aktivitet - frivillig:
bygningsdel, 3 siffer + bokstavkode
+ 'vendor_id' => $workorder['vendor_id'],
+ 'vendor_name' => $vendor['name'],
+ 'vendor_address' => $vendor['address'],
+ 'order_id' => $workorder['id'],
+ 'tax_code' => $tax_code,
+ 'buyer' => $buyer,
+ 'lines' => array(
+ array(
+ 'unspsc_code' =>
$workorder['unspsc_code'],
+ 'descr' =>
strip_tags($workorder['descr'])
+ )
+ )
+ );
+
+ $exporter_ordre = new
BkBygg_exporter_data_til_Agresso();
+ $exporter_ordre->create_transfer_xml($param);
+ $exporter_ordre->output();
+ die();
+ $export_ok = $exporter_ordre->transfer();
+ if ($export_ok)
+ {
+ $this->log_transfer( $workorder['id'] );
+ }
+ }
+
+ private function log_transfer( $id )
+ {
+ $historylog = CreateObject('property.historylog',
'workorder');
+ $historylog->add('RM', $id, "Ordre overført til
agresso");
+ $GLOBALS['phpgw']->db->query("UPDATE fm_workorder SET
order_sent = 1 WHERE id = {$id}");
+ }
+ }
\ No newline at end of file
Deleted: trunk/property/js/portico/ajax_project_edit.js
===================================================================
--- trunk/property/js/portico/ajax_project_edit.js 2016-04-30 21:09:45 UTC
(rev 14960)
+++ trunk/property/js/portico/ajax_project_edit.js 2016-05-02 10:23:13 UTC
(rev 14961)
@@ -1,41 +0,0 @@
-$(document).ready(function ()
-{
-
- $("#global_category_id").change(function ()
- {
- var oArgs = {menuaction: 'property.boworkorder.get_category',
cat_id: $(this).val()};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- var htmlString = "";
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl,
- success: function (data)
- {
- if (data != null)
- {
- if (data.active != 1)
- {
- alert('Denne kan ikke velges');
- }
- }
- }
- });
- });
-});
-
-$(document).ready(function ()
-{
-
- $("#order_time_span").change(function ()
- {
- var oArgs = {menuaction: 'property.uiproject.get_orders',
project_id: project_id, year: $(this).val()};
-// var requestUrl = phpGWLink('index.php', oArgs, true);
- execute_async(myDataTable_1, oArgs);
- oArgs = {menuaction: 'property.uiproject.get_vouchers',
project_id: project_id, year: $(this).val()};
- execute_async(myDataTable_2, oArgs);
- });
-});
-
Deleted: trunk/property/js/portico/ajax_workorder_edit.js
===================================================================
--- trunk/property/js/portico/ajax_workorder_edit.js 2016-04-30 21:09:45 UTC
(rev 14960)
+++ trunk/property/js/portico/ajax_workorder_edit.js 2016-05-02 10:23:13 UTC
(rev 14961)
@@ -1,123 +0,0 @@
-$(document).ready(function ()
-{
-
- $("#global_category_id").change(function ()
- {
- var oArgs = {menuaction: 'property.boworkorder.get_category',
cat_id: $(this).val()};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- var htmlString = "";
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl,
- success: function (data)
- {
- if (data != null)
- {
- if (data.active != 1)
- {
- alert('Denne kan ikke velges');
- }
- }
- }
- });
- });
-
-
- $("#workorder_edit").on("submit", function (e)
- {
-
- if ($("#lean").val() == 0)
- {
- return;
- }
-
- e.preventDefault();
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- var requestUrl = $(thisForm).attr("action");
- $.ajax({
- type: 'POST',
- url: requestUrl + "&phpgw_return_as=json&" +
$(thisForm).serialize(),
- success: function (data)
- {
- if (data)
- {
- if (data.sessionExpired)
- {
- alert('Sesjonen er utløpt - du
må logge inn på nytt');
- return;
- }
-
- var obj = data;
-
- var submitBnt =
$(thisForm).find("input[type='submit']");
- if (obj.status == "updated")
- {
- $(submitBnt).val("Lagret");
- }
- else
- {
- $(submitBnt).val("Feil ved
lagring");
- }
-
- // Changes text on save button back to
original
- window.setTimeout(function ()
- {
- $(submitBnt).val('Lagre');
-
$(submitBnt).addClass("not_active");
- }, 1000);
-
- var ok = true;
- var htmlString = "";
- if (data['receipt'] != null)
- {
- if (data['receipt']['error'] !=
null)
- {
- ok = false;
- for (var i = 0; i <
data['receipt']['error'].length; ++i)
- {
- htmlString +=
"<div class=\"error\">";
- htmlString +=
data['receipt']['error'][i]['msg'];
- htmlString +=
'</div>';
- }
-
- }
- if (typeof
(data['receipt']['message']) != 'undefined')
- {
- for (var i = 0; i <
data['receipt']['message'].length; ++i)
- {
- htmlString +=
"<div class=\"msg_good\">";
- htmlString +=
data['receipt']['message'][i]['msg'];
- htmlString +=
'</div>';
- }
-
- }
- $("#receipt").html(htmlString);
- }
-
- if (ok)
- {
- parent.closeJS_remote();
- // parent.hide_popupBox();
- }
- }
- }
- });
- });
-
- $("#workorder_cancel").on("submit", function (e)
- {
- if ($("#lean").val() == 0)
- {
- return;
- }
- e.preventDefault();
- parent.closeJS_remote();
-// parent.hide_popupBox();
- });
-
-});
-
Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/js/portico/workorder.edit.js 2016-05-02 10:23:13 UTC (rev
14961)
@@ -110,7 +110,7 @@
$("#order_tab").val(tab);
}
-this.showlightbox_manual_invoide = function (workorder_id)
+this.showlightbox_manual_invoice = function (workorder_id)
{
var oArgs = {menuaction: 'property.uiworkorder.add_invoice', order_id:
workorder_id};
var sUrl = phpGWLink('index.php', oArgs);
@@ -228,3 +228,130 @@
var strURL = phpGWLink('index.php', oArgs, true);
JqueryPortico.autocompleteHelper(strURL, 'unspsc_code_name', 'unspsc_code',
'unspsc_code_container');
+
+// from ajax_workorder_edit.js
+
+
+$(document).ready(function ()
+{
+
+ $("#global_category_id").change(function ()
+ {
+ var oArgs = {menuaction: 'property.boworkorder.get_category',
cat_id: $(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function (data)
+ {
+ if (data != null)
+ {
+ if (data.active != 1)
+ {
+ alert('Denne kan ikke velges');
+ }
+ }
+ }
+ });
+ });
+
+
+ $("#workorder_edit").on("submit", function (e)
+ {
+
+ if ($("#lean").val() == 0)
+ {
+ return;
+ }
+
+ e.preventDefault();
+ var thisForm = $(this);
+ var submitBnt = $(thisForm).find("input[type='submit']");
+ var requestUrl = $(thisForm).attr("action");
+ $.ajax({
+ type: 'POST',
+ url: requestUrl + "&phpgw_return_as=json&" +
$(thisForm).serialize(),
+ success: function (data)
+ {
+ if (data)
+ {
+ if (data.sessionExpired)
+ {
+ alert('Sesjonen er utløpt - du
må logge inn på nytt');
+ return;
+ }
+
+ var obj = data;
+
+ var submitBnt =
$(thisForm).find("input[type='submit']");
+ if (obj.status == "updated")
+ {
+ $(submitBnt).val("Lagret");
+ }
+ else
+ {
+ $(submitBnt).val("Feil ved
lagring");
+ }
+
+ // Changes text on save button back to
original
+ window.setTimeout(function ()
+ {
+ $(submitBnt).val('Lagre');
+
$(submitBnt).addClass("not_active");
+ }, 1000);
+
+ var ok = true;
+ var htmlString = "";
+ if (data['receipt'] != null)
+ {
+ if (data['receipt']['error'] !=
null)
+ {
+ ok = false;
+ for (var i = 0; i <
data['receipt']['error'].length; ++i)
+ {
+ htmlString +=
"<div class=\"error\">";
+ htmlString +=
data['receipt']['error'][i]['msg'];
+ htmlString +=
'</div>';
+ }
+
+ }
+ if (typeof
(data['receipt']['message']) != 'undefined')
+ {
+ for (var i = 0; i <
data['receipt']['message'].length; ++i)
+ {
+ htmlString +=
"<div class=\"msg_good\">";
+ htmlString +=
data['receipt']['message'][i]['msg'];
+ htmlString +=
'</div>';
+ }
+
+ }
+ $("#receipt").html(htmlString);
+ }
+
+ if (ok)
+ {
+ parent.closeJS_remote();
+ // parent.hide_popupBox();
+ }
+ }
+ }
+ });
+ });
+
+ $("#workorder_cancel").on("submit", function (e)
+ {
+ if ($("#lean").val() == 0)
+ {
+ return;
+ }
+ e.preventDefault();
+ parent.closeJS_remote();
+// parent.hide_popupBox();
+ });
+
+});
+
Modified: trunk/property/setup/default_records.inc.php
===================================================================
--- trunk/property/setup/default_records.inc.php 2016-04-30 21:09:45 UTC
(rev 14960)
+++ trunk/property/setup/default_records.inc.php 2016-05-02 10:23:13 UTC
(rev 14961)
@@ -36,6 +36,7 @@
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations
(app_id, name, descr) VALUES ({$app_id}, '.custom', 'custom queries')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations
(app_id, name, descr, allow_grant, allow_c_function, allow_c_attrib,
c_attrib_table) VALUES ({$app_id}, '.project', 'Demand -> Workorder', 1, 1, 1,
'fm_project')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations
(app_id, name, descr, allow_grant, allow_c_function, allow_c_attrib,
c_attrib_table) VALUES ({$app_id}, '.project.workorder', 'Workorder', 1, 1 ,1,
'fm_workorder')");
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations
(app_id, name, descr, allow_c_function) VALUES ({$app_id},
'.project.workorder.transfer', 'Transfer Workorder', 1)");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations
(app_id, name, descr, allow_grant, allow_c_function, allow_c_attrib,
c_attrib_table) VALUES ({$app_id}, '.project.request', 'Request', 1, 1 ,1,
'fm_request')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations
(app_id, name, descr, allow_grant, allow_c_function, allow_c_attrib,
c_attrib_table) VALUES ({$app_id}, '.ticket', 'Helpdesk', 1, 1, 1,
'fm_tts_tickets')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations
(app_id, name, descr, allow_c_attrib, c_attrib_table) VALUES ({$app_id},
'.ticket.order', 'Helpdesk ad hock order', 1, 'fm_tts_tickets')");
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2016-04-30 21:09:45 UTC (rev 14960)
+++ trunk/property/setup/setup.inc.php 2016-05-02 10:23:13 UTC (rev 14961)
@@ -11,7 +11,7 @@
* @version $Id$
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.697';
+ $setup_info['property']['version'] = '0.9.17.699';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/setup/tables_current.inc.php 2016-05-02 10:23:13 UTC (rev
14961)
@@ -593,7 +593,11 @@
'tax_code' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'unspsc_code' => array('type' => 'varchar',
'precision' => '15', 'nullable' => True),
'service_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
- ),
+ 'building_part' => array('type' => 'varchar',
'precision' => 4, 'nullable' => True),
+ 'order_dim1' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
+ 'order_sent' => array('type' => 'int',
'precision' => 2, 'nullable' => True),
+ 'order_received' => array('type' => 'int',
'precision' => 2, 'nullable' => True),
+ ),
'pk' => array('id'),
'fk' => array(),
'ix' => array(),
@@ -1152,6 +1156,8 @@
'publish_note' => array('type' => 'int',
'precision' => 2, 'nullable' => True),
'branch_id' => array('type' => 'int',
'precision' => '4', 'nullable' => True),
'modified_date' => array('type' => 'int',
'precision' => '4', 'nullable' => True),
+ 'order_sent' => array('type' => 'int',
'precision' => 2, 'nullable' => True),
+ 'order_received' => array('type' => 'int',
'precision' => 2, 'nullable' => True),
),
'pk' => array('id'),
'ix' => array(),
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/setup/tables_update.inc.php 2016-05-02 10:23:13 UTC (rev
14961)
@@ -9018,3 +9018,79 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+
+ /**
+ * Update property version from 0.9.17.696 to 0.9.17.697
+ * Add parametres for integration with e-commerse platforms
+ */
+ $test[] = '0.9.17.697';
+
+ function property_upgrade0_9_17_697()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw']->locations->add('.project.workorder.transfer', 'Transfer
Workorder', 'property', $allow_grant = null, $custom_tbl = null, $c_function =
true);
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.698';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
+ /**
+ * Update property version from 0.9.17.696 to 0.9.17.697
+ * Add parametres for integration with e-commerse platforms
+ */
+ $test[] = '0.9.17.698';
+
+ function property_upgrade0_9_17_698()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+ $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder",
'building_part', array(
+ 'type' => 'varchar',
+ 'precision' => 4,
+ 'nullable' => True
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder",
'order_dim1', array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => True
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder",
'order_sent', array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => True
+ )
+ );
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder",
'order_received', array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => True
+ )
+ );
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets",
'order_sent', array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => True
+ )
+ );
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets",
'order_received', array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => True
+ )
+ );
+
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.699';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/templates/base/config.tpl 2016-05-02 10:23:13 UTC (rev
14961)
@@ -61,41 +61,41 @@
<textarea cols="40" rows="4"
name="newsettings[sms_client_order_notice]"
wrap="virtual">{value_sms_client_order_notice}</textarea>
</td>
</tr>
- </tr>
+ </tr>
<tr>
- <td>{lang_dimb_responsible_1}:</td>
- <td>
- <select name="newsettings[dimb_responsible_1]">
- {hook_dimb_cat_1}
- </select>
- </td>
- </tr>
+ <td>{lang_dimb_responsible_1}:</td>
+ <td>
+ <select name="newsettings[dimb_responsible_1]">
+ {hook_dimb_cat_1}
+ </select>
+ </td>
+ </tr>
<tr class="pure-table-odd">
- <td>{lang_dimb_responsible_2}:</td>
- <td>
- <select name="newsettings[dimb_responsible_2]">
- {hook_dimb_cat_2}
- </select>
- </td>
- </tr>
+ <td>{lang_dimb_responsible_2}:</td>
+ <td>
+ <select name="newsettings[dimb_responsible_2]">
+ {hook_dimb_cat_2}
+ </select>
+ </td>
+ </tr>
<tr>
- <td>{lang_invoicehandler}:</td>
- <td>
- <select name="newsettings[invoicehandler]">
- <option value="1"
{selected_invoicehandler_1}>Default</option>
- <option value="2"
{selected_invoicehandler_2}>Alternative</option>
- </select>
- </td>
- </tr>
+ <td>{lang_invoicehandler}:</td>
+ <td>
+ <select name="newsettings[invoicehandler]">
+ <option value="1"
{selected_invoicehandler_1}>Default</option>
+ <option value="2"
{selected_invoicehandler_2}>Alternative</option>
+ </select>
+ </td>
+ </tr>
<tr class="pure-table-odd">
- <td>{lang_invoice_acl}:</td>
- <td>
- <select name="newsettings[invoice_acl]">
- <option value="default"
{selected_invoice_acl_default}>ACL</option>
- <option value="dimb"
{selected_invoice_acl_dimb}>DimB</option>
- </select>
- </td>
- </tr>
+ <td>{lang_invoice_acl}:</td>
+ <td>
+ <select name="newsettings[invoice_acl]">
+ <option value="default"
{selected_invoice_acl_default}>ACL</option>
+ <option value="dimb"
{selected_invoice_acl_dimb}>DimB</option>
+ </select>
+ </td>
+ </tr>
<tr>
<td>{lang_project_status_on_approval}:</td>
<td>
@@ -149,12 +149,12 @@
</tr>
<tr class="pure-table-odd">
-
<td>{lang_workorder_status_that_are_to_be_set_when_invoice_is_processed}:</td>
- <td>
- <select name="newsettings[workorder_closed_status]">
- {hook_workorder_closed_status}
- </select>
- </td>
+
<td>{lang_workorder_status_that_are_to_be_set_when_invoice_is_processed}:</td>
+ <td>
+ <select
name="newsettings[workorder_closed_status]">
+ {hook_workorder_closed_status}
+ </select>
+ </td>
<tr>
<td>{lang_workorder_reopen_status_that_are_to_be_set_when_invoice_is_processed}:</td>
<td>
@@ -162,6 +162,14 @@
{hook_workorder_reopen_status}
</select>
</td>
+ <tr>
+ <td>{lang_require_building_part_at_workorder}:</td>
+ <td>
+ <select
name="newsettings[workorder_require_building_part]">
+ <option value=""
{selected_workorder_require_building_part_}>NO</option>
+ <option value="1"
{selected_workorder_require_building_part_1}>YES</option>
+ </select>
+ </td>
</tr>
<tr class="pure-table-odd">
<td>{lang_require_vendor_at_workorder}:</td>
@@ -584,49 +592,49 @@
</tr>
<tr>
- <td>{lang_filter_buildingpart}:</td>
- <td>
- <table>
- {hook_filter_buildingpart}
- </table>
- </td>
- </tr>
+ <td>{lang_filter_buildingpart}:</td>
+ <td>
+ <table>
+ {hook_filter_buildingpart}
+ </table>
+ </td>
+ </tr>
<tr class="pure-table-odd">
- <td>{lang_condition_survey_import_category}:</td>
- <td>
- <table>
- {hook_condition_survey_import_cat}
- </table>
- </td>
- </tr>
+ <td>{lang_condition_survey_import_category}:</td>
+ <td>
+ <table>
+ {hook_condition_survey_import_cat}
+ </table>
+ </td>
+ </tr>
<tr>
-
<td>{lang_initial_status_that_are_to_be_set_when_condition_survey_are_imported}:</td>
- <td>
- <select
name="newsettings[condition_survey_initial_status]">
- {hook_condition_survey_initial_status}
- </select>
- </td>
- </tr>
+
<td>{lang_initial_status_that_are_to_be_set_when_condition_survey_are_imported}:</td>
+ <td>
+ <select
name="newsettings[condition_survey_initial_status]">
+ {hook_condition_survey_initial_status}
+ </select>
+ </td>
+ </tr>
<tr>
-
<td>{lang_hidden_status_that_are_to_be_set_when_condition_survey_are_imported}:</td>
- <td>
- <select
name="newsettings[condition_survey_hidden_status]">
- {hook_condition_survey_hidden_status}
- </select>
- </td>
- </tr>
+
<td>{lang_hidden_status_that_are_to_be_set_when_condition_survey_are_imported}:</td>
+ <td>
+ <select
name="newsettings[condition_survey_hidden_status]">
+ {hook_condition_survey_hidden_status}
+ </select>
+ </td>
+ </tr>
<tr class="pure-table-odd">
-
<td>{lang_obsolete_status_that_are_to_be_set_for_old_records_when_condition_survey_are_imported}:</td>
- <td>
- <select
name="newsettings[condition_survey_obsolete_status]">
- {hook_condition_survey_obsolete_status}
- </select>
- </td>
- </tr>
+
<td>{lang_obsolete_status_that_are_to_be_set_for_old_records_when_condition_survey_are_imported}:</td>
+ <td>
+ <select
name="newsettings[condition_survey_obsolete_status]">
+ {hook_condition_survey_obsolete_status}
+ </select>
+ </td>
+ </tr>
<!--
groupnotification
Modified: trunk/property/templates/base/wo_hour.xsl
===================================================================
--- trunk/property/templates/base/wo_hour.xsl 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/templates/base/wo_hour.xsl 2016-05-02 10:23:13 UTC (rev
14961)
@@ -676,7 +676,7 @@
<table
border="1" width="100%" bordercolor="#000000" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
-
<xsl:value-of select="descr"/>
+
<xsl:value-of disable-output-escaping="yes" select="descr"/>
</td>
</tr>
</table>
Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2016-04-30 21:09:45 UTC (rev
14960)
+++ trunk/property/templates/base/workorder.xsl 2016-05-02 10:23:13 UTC (rev
14961)
@@ -346,7 +346,7 @@
<xsl:attribute
name="title">
<xsl:value-of
select="lang_descr_statustext"/>
</xsl:attribute>
- <xsl:value-of
select="value_descr"/>
+ <xsl:value-of
disable-output-escaping="yes" select="value_descr"/>
</textarea>
</div>
<div class="pure-control-group">
@@ -682,6 +682,77 @@
</input>
<div
id="unspsc_code_container"/>
</div>
+ <xsl:choose>
+ <xsl:when
test="collect_building_part=1">
+ <div
class="pure-control-group">
+ <xsl:variable
name="lang_building_part">
+
<xsl:value-of select="php:function('lang', 'building part')"/>
+ </xsl:variable>
+ <label>
+
<xsl:value-of select="$lang_building_part"/>
+ </label>
+ <select
name="values[building_part]">
+
<xsl:attribute name="title">
+
<xsl:value-of select="$lang_building_part"/>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="$lang_building_part"/>
+
</xsl:attribute>
+ <option
value="">
+
<xsl:value-of select="$lang_building_part"/>
+
</option>
+
<xsl:apply-templates select="building_part_list/options"/>
+ </select>
+ </div>
+ <div
class="pure-control-group">
+ <xsl:variable
name="lang_order_dim1">
+
<xsl:value-of select="php:function('lang', 'order_dim1')"/>
+ </xsl:variable>
+ <label>
+
<xsl:value-of select="$lang_order_dim1"/>
+ </label>
+ <select
name="values[order_dim1]">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'order_dim1')"/>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="$lang_order_dim1"/>
+
</xsl:attribute>
+ <option
value="">
+
<xsl:value-of select="php:function('lang', 'order_dim1')"/>
+
</option>
+
<xsl:apply-templates select="order_dim1_list/options"/>
+ </select>
+ </div>
+ <div
class="pure-control-group">
+ <xsl:variable
name="lang_tax_code">
+
<xsl:value-of select="php:function('lang', 'tax code')"/>
+ </xsl:variable>
+ <label>
+
<xsl:value-of select="$lang_tax_code"/>
+ </label>
+ <select
name="values[tax_code]">
+
<xsl:attribute name="title">
+
<xsl:value-of select="$lang_tax_code"/>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="$lang_tax_code"/>
+
</xsl:attribute>
+
<xsl:apply-templates select="tax_code_list/options"/>
+ </select>
+ </div>
+ </xsl:when>
+ </xsl:choose>
+
<div class="pure-control-group">
<label for="name">
<xsl:value-of
select="lang_cat_sub"/>
@@ -907,7 +978,7 @@
<xsl:variable name="lang_add_invoice_statustext">
<xsl:value-of select="php:function('lang', 'add invoice')"/>
</xsl:variable>
- <a
href="javascript:showlightbox_manual_invoide({value_workorder_id})"
title="{$lang_add_invoice_statustext}">
+ <a
href="javascript:showlightbox_manual_invoice({value_workorder_id})"
title="{$lang_add_invoice_statustext}">
<xsl:value-of select="php:function('lang', 'add invoice')"/>
</a>
</xsl:when>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14961] property: more on integration,
Sigurd Nes <=