[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14963] property: more on integration
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14963] property: more on integration |
Date: |
Mon, 02 May 2016 13:35:04 +0000 |
Revision: 14963
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14963
Author: sigurdne
Date: 2016-05-02 13:35:04 +0000 (Mon, 02 May 2016)
Log Message:
-----------
property: more on integration
Modified Paths:
--------------
trunk/property/inc/class.botts.inc.php
trunk/property/inc/class.boworkorder.inc.php
trunk/property/inc/class.uitts.inc.php
trunk/property/inc/class.uiworkorder.inc.php
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_melding.php
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
trunk/property/js/portico/tts.view.js
trunk/property/js/portico/workorder.edit.js
trunk/property/setup/phpgw_no.lang
trunk/property/templates/base/tts.xsl
trunk/property/templates/base/workorder.xsl
Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php 2016-05-02 11:05:25 UTC (rev
14962)
+++ trunk/property/inc/class.botts.inc.php 2016-05-02 13:35:04 UTC (rev
14963)
@@ -1725,4 +1725,39 @@
}
return $values;
}
+
+ public function receive_order( $id )
+ {
+ $receive_order = true; // used as trigger within the
custom function
+ $acl_location = $this->acl_location;
+
+ $criteria = array(
+ 'appname' => 'property',
+ 'location' => $acl_location,
+ '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;
+ }
+ }
+ // $result from the custom function
+ return array(
+ 'result' => $result,
+ 'time' =>
$GLOBALS['phpgw']->common->show_date(time())
+ );
+ }
+
}
\ No newline at end of file
Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php 2016-05-02 11:05:25 UTC
(rev 14962)
+++ trunk/property/inc/class.boworkorder.inc.php 2016-05-02 13:35:04 UTC
(rev 14963)
@@ -1098,4 +1098,38 @@
}
}
}
+
+ public function receive_order( $id )
+ {
+ $receive_order = true; // used as trigger within the
custom function
+ $acl_location = '.project.workorder';
+
+ $criteria = array(
+ 'appname' => 'property',
+ 'location' => $acl_location,
+ '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;
+ }
+ }
+ // $result from the custom function
+ return array(
+ 'result' => $result,
+ 'time' =>
$GLOBALS['phpgw']->common->show_date(time())
+ );
+ }
}
\ No newline at end of file
Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php 2016-05-02 11:05:25 UTC (rev
14962)
+++ trunk/property/inc/class.uitts.inc.php 2016-05-02 13:35:04 UTC (rev
14963)
@@ -54,7 +54,8 @@
'get_ecodimb' => true,
'get_b_account' => true,
'get_external_project'=> true,
- 'get_unspsc_code'=> true
+ 'get_unspsc_code'=> true,
+ 'receive_order' => true
);
/**
@@ -2664,7 +2665,8 @@
'options' =>
execMethod('property.boproject.select_branch_list', $values['branch_id'])) : '',
'preview_html' =>
"javascript:preview_html($id)",
'preview_pdf' => "javascript:preview_pdf($id)",
- 'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab)
+ 'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+ 'value_order_received' =>
$GLOBALS['phpgw']->common->show_date($ticket['order_received'])
);
phpgwapi_jquery::load_widget('numberformat');
@@ -2753,7 +2755,18 @@
return $this->bocommon->get_b_account();
}
+ public function receive_order( )
+ {
+ if (!$GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_ADD, 'property'))
+ {
+ return;
+ }
+ $id = phpgw::get_var('id', 'int');
+
+ return $this->bo->receive_order($id);
+ }
+
private function _get_eco_service_name( $id )
{
return $this->bocommon->get_eco_service_name($id);
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2016-05-02 11:05:25 UTC
(rev 14962)
+++ trunk/property/inc/class.uiworkorder.inc.php 2016-05-02 13:35:04 UTC
(rev 14963)
@@ -69,7 +69,8 @@
'get_eco_service'=> true,
'get_ecodimb' => true,
'get_b_account' => true,
- 'get_unspsc_code'=> true
+ 'get_unspsc_code'=> true,
+ 'receive_order' => true
);
function __construct()
@@ -2890,7 +2891,18 @@
return $this->bocommon->get_b_account();
}
+ public function receive_order( )
+ {
+ if (!$this->acl_edit)
+ {
+ return;
+ }
+ $id = phpgw::get_var('id', 'int');
+
+ return $this->bo->receive_order($id);
+ }
+
private function _get_eco_service_name( $id )
{
return $this->bocommon->get_eco_service_name($id);
Modified: trunk/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
===================================================================
--- trunk/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
2016-05-02 11:05:25 UTC (rev 14962)
+++ trunk/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
2016-05-02 13:35:04 UTC (rev 14963)
@@ -237,7 +237,8 @@
}
$transfer_ok = false;
- if ($this->config->config_data['common']['method'] ==
'ftp' || $this->config->config_data['common']['method'] == 'ssh')
+// if ($this->config->config_data['common']['method'] ==
'ftp' || $this->config->config_data['common']['method'] == 'ssh')
+ if (false)//Not yet...
{
if (!$connection = $this->connection)
{
Modified:
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
===================================================================
---
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
2016-05-02 11:05:25 UTC (rev 14962)
+++
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
2016-05-02 13:35:04 UTC (rev 14963)
@@ -35,10 +35,10 @@
*
* @author Sigurd Nes
*/
- if (isset($data['order_id']) && $data['order_id'] &&
isset($data['varemottak']) && $data['varemottak'])
+ if (isset($id) && $id && isset($acl_location) && $acl_location &&
isset($receive_order) && $receive_order)
{
- $exporter_varemottak = new
lag_agresso_varemottak($this->acl_location, $id);
- $exporter_varemottak->transfer($id);
+ $exporter_varemottak = new
lag_agresso_varemottak($acl_location, $id);
+ $result = $exporter_varemottak->transfer($id);
}
class lag_agresso_varemottak
@@ -58,6 +58,7 @@
default:
$this->acl_location =
'.project.workorder';
$this->values =
ExecMethod('property.soworkorder.read_single', $id);
+ $this->values['order_id'] = $id;
break;
}
}
@@ -77,15 +78,17 @@
)
);
- $exporter_varemotta = new
BkBygg_exporter_varemottak_til_Agresso();
- $exporter_varemotta->create_transfer_xml();
- $exporter_varemotta->output();
- die();
- $export_ok = $exporter_ordre->transfer();
+ $exporter_varemottak = new
BkBygg_exporter_varemottak_til_Agresso(array('order_id' =>
$values['order_id']));
+ $exporter_varemottak->create_transfer_xml($param);
+ $exporter_varemottak->output();
+ $export_ok = true;
+ // die();
+ // $export_ok = $exporter_varemottak->transfer();
if ($export_ok)
{
$this->log_transfer( $id );
}
+ return $export_ok;
}
private function log_transfer( $id )
@@ -155,8 +158,6 @@
$xml_creator->fromArray($Orders);
$this->transfer_xml = $xml_creator->getDocument();
return $this->transfer_xml;
- // $xml_creator->output();
- // die();
}
protected function create_file_name( $ref = '' )
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-05-02 11:05:25 UTC (rev 14962)
+++ trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php
2016-05-02 13:35:04 UTC (rev 14963)
@@ -48,6 +48,11 @@
public function transfer( $id )
{
$_ticket = ExecMethod('property.sotts.read_single',
$id);
+ if ($_ticket['order_sent'])
+ {
+ return 2;
+ }
+
// _debug_array($_ticket);die();
$contacts = CreateObject('property.sogeneric');
@@ -146,7 +151,7 @@
)
);
- $exporter_ordre = new
BkBygg_exporter_data_til_Agresso();
+ $exporter_ordre = new
BkBygg_exporter_data_til_Agresso(array('order_id' => $_ticket['order_id']));
$exporter_ordre->create_transfer_xml($param);
$exporter_ordre->output();
die();
Modified:
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
===================================================================
---
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
2016-05-02 11:05:25 UTC (rev 14962)
+++
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
2016-05-02 13:35:04 UTC (rev 14963)
@@ -30,8 +30,8 @@
* Description
* @package property
*/
- //if (false)
- if (true)
+
+ if (!$workorder['order_sent'])
{
$exporter_ordre = new lag_agresso_ordre_fra_workorder();
$exporter_ordre->transfer($project, $workorder);
Modified: trunk/property/js/portico/tts.view.js
===================================================================
--- trunk/property/js/portico/tts.view.js 2016-05-02 11:05:25 UTC (rev
14962)
+++ trunk/property/js/portico/tts.view.js 2016-05-02 13:35:04 UTC (rev
14963)
@@ -283,3 +283,36 @@
var strURL = phpGWLink('index.php', oArgs, true);
JqueryPortico.autocompleteHelper(strURL, 'unspsc_code_name', 'unspsc_code',
'unspsc_code_container');
+function receive_order(order_id)
+{
+ var oArgs = {menuaction: 'property.uitts.receive_order', id: order_id};
+ var strURL = phpGWLink('index.php', oArgs, true);
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: strURL,
+ success: function (data)
+ {
+ if (data != null)
+ {
+ var msg;
+ if (data['result'] == true)
+ {
+ msg = 'OK';
+
$("#order_received_time").html(data['time']);
+ }
+ else
+ {
+ msg = 'Error';
+
+ }
+ window.alert(msg);
+ }
+ },
+ failure: function (o)
+ {
+ window.alert('failure - try again - once');
+ },
+ timeout: 5000
+ });
+}
Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2016-05-02 11:05:25 UTC (rev
14962)
+++ trunk/property/js/portico/workorder.edit.js 2016-05-02 13:35:04 UTC (rev
14963)
@@ -36,9 +36,35 @@
function receive_order(workorder_id)
{
- var oArgs = {menuaction: 'property.uiworkorder.receive_order',
order_id: workorder_id};
- var sUrl = phpGWLink('index.php', oArgs);
- alert(sUrl);
+ var oArgs = {menuaction: 'property.uiworkorder.receive_order', id:
workorder_id};
+ var strURL = phpGWLink('index.php', oArgs, true);
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: strURL,
+ success: function (data)
+ {
+ if (data != null)
+ {
+ var msg;
+ if (data['result'] == true)
+ {
+ msg = 'OK';
+ }
+ else
+ {
+ msg = 'Error';
+
+ }
+ window.alert(msg);
+ }
+ },
+ failure: function (o)
+ {
+ window.alert('failure - try again - once');
+ },
+ timeout: 5000
+ });
}
function check_and_submit_valid_session()
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2016-05-02 11:05:25 UTC (rev 14962)
+++ trunk/property/setup/phpgw_no.lang 2016-05-02 13:35:04 UTC (rev 14963)
@@ -2057,4 +2057,6 @@
hjemmel common no Hjemmel
record has been edited common no data er editert
external project property no Eksternt prosjekt
-unspsc code common no UNSPSC-kode
\ No newline at end of file
+unspsc code common no UNSPSC-kode
+order received property no Varemottak
+receive order property no Motta vare
\ No newline at end of file
Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl 2016-05-02 11:05:25 UTC (rev
14962)
+++ trunk/property/templates/base/tts.xsl 2016-05-02 13:35:04 UTC (rev
14963)
@@ -1043,6 +1043,23 @@
<xsl:apply-templates select="status_list/options"/>
</select>
</div>
+ <div
class="pure-control-group">
+
<label for="name">
+
<xsl:value-of select="php:function('lang', 'order received')"/>
+
</label>
+
<xsl:variable name="lang_receive_order">
+
<xsl:value-of select="php:function('lang', 'receive order')"/>
+
</xsl:variable>
+
<input type="button" class="pure-button pure-button-primary" name="edit"
value="{$lang_receive_order}" onClick="receive_order({location_item_id});">
+
<xsl:attribute name="title">
+
<xsl:value-of select="$lang_receive_order"/>
+
</xsl:attribute>
+
</input>
+
<div id="order_received_time" class="pure-custom">
+
<xsl:value-of select="value_order_received"/>
+
</div>
+ </div>
+
</xsl:when>
</xsl:choose>
</xsl:when>
Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2016-05-02 11:05:25 UTC (rev
14962)
+++ trunk/property/templates/base/workorder.xsl 2016-05-02 13:35:04 UTC (rev
14963)
@@ -985,7 +985,9 @@
<xsl:value-of select="$lang_receive_order"/>
</xsl:attribute>
</input>
- <xsl:value-of
select="value_order_received"/>
+ <div
id="order_received_time" class="pure-custom">
+
<xsl:value-of select="value_order_received"/>
+ </div>
</div>
</xsl:when>
</xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14963] property: more on integration,
Sigurd Nes <=