[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14968] property: more on integration
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14968] property: more on integration |
Date: |
Tue, 03 May 2016 14:05:34 +0000 |
Revision: 14968
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14968
Author: sigurdne
Date: 2016-05-03 14:05:33 +0000 (Tue, 03 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.sotts.inc.php
trunk/property/inc/class.soworkorder.inc.php
trunk/property/inc/class.uitts.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
trunk/property/js/portico/tts.view.js
trunk/property/js/portico/workorder.edit.js
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
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-03 10:38:03 UTC (rev
14967)
+++ trunk/property/inc/class.botts.inc.php 2016-05-03 14:05:33 UTC (rev
14968)
@@ -1726,7 +1726,7 @@
return $values;
}
- public function receive_order( $id )
+ public function receive_order( $id, $received_percent )
{
$receive_order = true; // used as trigger within the
custom function
$acl_location = $this->acl_location;
Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php 2016-05-03 10:38:03 UTC
(rev 14967)
+++ trunk/property/inc/class.boworkorder.inc.php 2016-05-03 14:05:33 UTC
(rev 14968)
@@ -1099,7 +1099,7 @@
}
}
- public function receive_order( $id )
+ public function receive_order( $id, $received_percent )
{
$receive_order = true; // used as trigger within the
custom function
$acl_location = '.project.workorder';
Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php 2016-05-03 10:38:03 UTC (rev
14967)
+++ trunk/property/inc/class.sotts.inc.php 2016-05-03 14:05:33 UTC (rev
14968)
@@ -822,6 +822,7 @@
$ticket['modified_date'] =
$this->db->f('modified_date');
$ticket['order_sent'] =
$this->db->f('order_sent');
$ticket['order_received'] =
$this->db->f('order_received');
+ $ticket['order_received_percent'] =
$this->db->f('order_received_percent');
$user_id = (int)$this->db->f('user_id');
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2016-05-03 10:38:03 UTC
(rev 14967)
+++ trunk/property/inc/class.soworkorder.inc.php 2016-05-03 14:05:33 UTC
(rev 14968)
@@ -971,8 +971,9 @@
'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')
- );
+ 'order_received' =>
$this->db->f('order_received'),
+ 'order_received_percent' =>
$this->db->f('order_received_percent')
+ );
$sql = "SELECT periodization_id,"
. " sum(fm_workorder_budget.budget) AS
budget, sum(fm_workorder_budget.combined_cost) AS combined_cost,"
Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php 2016-05-03 10:38:03 UTC (rev
14967)
+++ trunk/property/inc/class.uitts.inc.php 2016-05-03 14:05:33 UTC (rev
14968)
@@ -2477,6 +2477,186 @@
)
);
+
+ // start invoice
+ $invoices = array();
+ $active_invoices =
execMethod('property.soinvoice.read_invoice_sub_sum', array(
+ 'order_id' => $id));
+ $historical_invoices =
execMethod('property.soinvoice.read_invoice_sub_sum', array(
+ 'order_id' => $id,
+ 'paid' => true));
+ $invoices = array_merge($active_invoices,
$historical_invoices);
+
+
+ $link_data_invoice1 = array
+ (
+ 'menuaction' => 'property.uiinvoice.index',
+ 'user_lid' => 'all'
+ );
+ $link_data_invoice2 = array
+ (
+ 'menuaction' => 'property.uiinvoice2.index'
+ );
+
+ $content_invoice = array();
+ $amount = 0;
+ $approved_amount = 0;
+ foreach ($invoices as $entry)
+ {
+ $entry['voucher_id'] = $entry['transfer_time']
? -1 * $entry['voucher_id'] : $entry['voucher_id'];
+ if ($entry['voucher_out_id'])
+ {
+ $voucher_out_id =
$entry['voucher_out_id'];
+ }
+ else
+ {
+ $voucher_out_id =
abs($entry['voucher_id']);
+ }
+
+ if
($this->bo->config->config_data['invoicehandler'] == 2)
+ {
+ if ($entry['voucher_id'] > 0)
+ {
+
$link_data_invoice2['voucher_id'] = $entry['voucher_id'];
+ $url =
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice2);
+ }
+ else
+ {
+
$link_data_invoice1['voucher_id'] = abs($entry['voucher_id']);
+ $link_data_invoice1['paid'] =
'true';
+ $url =
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+ }
+ }
+ else
+ {
+ if ($entry['voucher_id'] > 0)
+ {
+
$link_data_invoice1['voucher_id'] = $entry['voucher_id'];
+ $link_data_invoice1['query'] =
$entry['voucher_id'];
+ $url =
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+ }
+ else
+ {
+
$link_data_invoice1['voucher_id'] = abs($entry['voucher_id']);
+ $link_data_invoice1['paid'] =
'true';
+ $url =
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+ }
+ }
+ $link_voucher_id = "<a href='" . $url . "'>" .
$voucher_out_id . "</a>";
+
+ $content_invoice[] = array
+ (
+ 'voucher_id' => ($_lean) ?
$entry['voucher_id'] : $link_voucher_id,
+ 'voucher_out_id' =>
$entry['voucher_out_id'],
+ 'status' => $entry['status'],
+ 'period' => $entry['period'],
+ 'periodization' =>
$entry['periodization'],
+ 'periodization_start' =>
$entry['periodization_start'],
+ 'invoice_id' => $entry['invoice_id'],
+ 'budget_account' =>
$entry['budget_account'],
+ 'dima' => $entry['dima'],
+ 'dimb' => $entry['dimb'],
+ 'dimd' => $entry['dimd'],
+ 'type' => $entry['type'],
+ 'amount' => $entry['amount'],
+ 'approved_amount' =>
$entry['approved_amount'],
+ 'vendor' => $entry['vendor'],
+ 'external_project_id' =>
$entry['project_id'],
+ 'currency' => $entry['currency'],
+ 'budget_responsible' =>
$entry['budget_responsible'],
+ 'budsjettsigndato' =>
$entry['budsjettsigndato'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']),
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
+ 'transfer_time' =>
$entry['transfer_time'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']),
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
+ );
+
+ $amount += $entry['amount'];
+ $approved_amount += $entry['approved_amount'];
+ }
+
+ $invoice_def = array
+ (
+ array(
+ 'key' => 'voucher_id',
+ 'label' => lang('bilagsnr'),
+ 'sortable' => false,
+ 'value_footer' => lang('Sum')),
+ array(
+ 'key' => 'voucher_out_id',
+ 'hidden' => true),
+ array(
+ 'key' => 'invoice_id',
+ 'label' => lang('invoice number'),
+ 'sortable' => false),
+ array(
+ 'key' => 'vendor',
+ 'label' => lang('vendor'),
+ 'sortable' => false),
+ array(
+ 'key' => 'amount',
+ 'label' => lang('amount'),
+ 'sortable' => false,
+ 'className' => 'right',
+ 'value_footer' =>
number_format($amount, 2, $this->decimal_separator, '.')),
+ array(
+ 'key' => 'approved_amount',
+ 'label' => lang('approved amount'),
+ 'sortable' => false,
+ 'className' => 'right',
+ 'value_footer' =>
number_format($approved_amount, 2, $this->decimal_separator, '.')),
+ array(
+ 'key' => 'period',
+ 'label' => lang('period'),
+ 'sortable' => false),
+ array(
+ 'key' => 'periodization',
+ 'label' => lang('periodization'),
+ 'sortable' => false),
+ array(
+ 'key' => 'periodization_start',
+ 'label' => lang('periodization start'),
+ 'sortable' => false),
+ array(
+ 'key' => 'currency',
+ 'label' => lang('currency'),
+ 'sortable' => false),
+ array(
+ 'key' => 'type',
+ 'label' => lang('type'),
+ 'sortable' => false),
+ array(
+ 'key' => 'budget_responsible',
+ 'label' => lang('budget responsible'),
+ 'sortable' => false),
+ array(
+ 'key' => 'budsjettsigndato',
+ 'label' => lang('budsjettsigndato'),
+ 'sortable' => false),
+ array(
+ 'key' => 'transfer_time',
+ 'label' => lang('transfer time'),
+ 'sortable' => false)
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_7',
+ 'requestUrl' => "''",
+ 'data' => json_encode($content_invoice),
+ 'ColumnDefs' => $invoice_def,
+ 'config' => array(
+ array(
+ 'disableFilter' => true),
+ array(
+ 'disablePagination' => true)
+ )
+ );
+
+
+
+ // end invoice table
+
+
//----------------------------------------------datatable settings--------
+
+
$_filter_buildingpart = array();
$filter_buildingpart =
isset($this->bo->config->config_data['filter_buildingpart']) ?
$this->bo->config->config_data['filter_buildingpart'] : array();
@@ -2485,7 +2665,6 @@
$_filter_buildingpart =
array("filter_{$filter_key}" => 1);
}
-
//----------------------------------------------datatable settings--------
//_debug_array($supervisor_email);die();
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$cat_select =
$this->cats->formatted_xslt_list(array('select_name' => 'values[cat_id]',
@@ -2666,7 +2845,8 @@
'preview_html' =>
"javascript:preview_html($id)",
'preview_pdf' => "javascript:preview_pdf($id)",
'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
- 'value_order_received' =>
$GLOBALS['phpgw']->common->show_date($ticket['order_received'])
+ 'value_order_received' =>
$GLOBALS['phpgw']->common->show_date($ticket['order_received']),
+ 'value_order_received_percent' => (int)
$ticket['order_received_percent']
);
phpgwapi_jquery::load_widget('numberformat');
@@ -2763,8 +2943,8 @@
}
$id = phpgw::get_var('id', 'int');
-
- return $this->bo->receive_order($id);
+ $received_percent = phpgw::get_var('received_percent',
'int');
+ return $this->bo->receive_order($id, $received_percent);
}
private function _get_eco_service_name( $id )
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2016-05-03 10:38:03 UTC
(rev 14967)
+++ trunk/property/inc/class.uiworkorder.inc.php 2016-05-03 14:05:33 UTC
(rev 14968)
@@ -2374,7 +2374,8 @@
'collect_building_part' =>
$collect_building_part,
'building_part_list' => $building_part_list,
'order_dim1_list' => $order_dim1_list,
- 'value_order_received' =>
$GLOBALS['phpgw']->common->show_date($values['order_received'])
+ 'value_order_received' =>
$GLOBALS['phpgw']->common->show_date($values['order_received']),
+ 'value_order_received_percent' => (int)
$values['order_received_percent']
);
$appname = lang('Workorder');
@@ -2899,8 +2900,8 @@
}
$id = phpgw::get_var('id', 'int');
-
- return $this->bo->receive_order($id);
+ $received_percent = phpgw::get_var('received_percent',
'int');
+ return $this->bo->receive_order($id, $received_percent);
}
private function _get_eco_service_name( $id )
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-03 10:38:03 UTC (rev 14967)
+++
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
2016-05-03 14:05:33 UTC (rev 14968)
@@ -38,7 +38,7 @@
if (isset($id) && $id && isset($acl_location) && $acl_location &&
isset($receive_order) && $receive_order)
{
$exporter_varemottak = new
lag_agresso_varemottak($acl_location, $id);
- $result = $exporter_varemottak->transfer($id);
+ $result = $exporter_varemottak->transfer($id,
$received_percent);
}
class lag_agresso_varemottak
@@ -63,7 +63,7 @@
}
}
- public function transfer( $id )
+ public function transfer( $id, $received_percent )
{
$values = $this->values;
// _debug_array($values);die();
@@ -73,7 +73,7 @@
'lines' => array(
array(
'UnitCode' => 'STK',
- 'Quantity' => 1,
+ 'Quantity' =>
($received_percent / 100),
)
)
);
@@ -86,14 +86,15 @@
// $export_ok = $exporter_varemottak->transfer();
if ($export_ok)
{
- $this->log_transfer( $id );
+ $this->log_transfer( $id, $received_percent );
}
return $export_ok;
}
- private function log_transfer( $id )
+ private function log_transfer( $id, $received_percent )
{
$id = (int)$id;
+ $received_percent = (int)$received_percent;
switch ($this->acl_location)
{
case '.ticket':
@@ -105,9 +106,9 @@
$table = 'fm_workorder';
break;
}
- $historylog->add('RM', $id, "Varemottak overført til
agresso");
+ $historylog->add('RM', $id, "Varemottak
({$received_percent} %) overført til agresso");
$now = time();
- $GLOBALS['phpgw']->db->query("UPDATE {$table} SET
order_received = {$now} WHERE id = {$id}");
+ $GLOBALS['phpgw']->db->query("UPDATE {$table} SET
order_received = {$now}, order_received_percent = {$received_percent} WHERE id
= {$id}");
}
}
Modified: trunk/property/js/portico/tts.view.js
===================================================================
--- trunk/property/js/portico/tts.view.js 2016-05-03 10:38:03 UTC (rev
14967)
+++ trunk/property/js/portico/tts.view.js 2016-05-03 14:05:33 UTC (rev
14968)
@@ -285,7 +285,11 @@
function receive_order(order_id)
{
- var oArgs = {menuaction: 'property.uitts.receive_order', id: order_id};
+ var oArgs = {
+ menuaction: 'property.uitts.receive_order',
+ id: order_id,
+ received_percent:$( "#slider-range-min" ).slider( "value" )
+ };
var strURL = phpGWLink('index.php', oArgs, true);
$.ajax({
type: 'POST',
@@ -316,3 +320,17 @@
timeout: 5000
});
}
+
+ $(function() {
+ $( "#slider-range-min" ).slider({
+ range: "min",
+ value: $( "#value_order_received_percent" ).val() || 0,
+ min: 0,
+ max: 100,
+ step: 10,
+ slide: function( event, ui ) {
+ $( "#order_received_percent" ).val( ui.value + " %");
+ }
+ });
+ $( "#order_received_percent" ).val( $( "#slider-range-min" ).slider(
"value" ) + " %");
+ });
Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2016-05-03 10:38:03 UTC (rev
14967)
+++ trunk/property/js/portico/workorder.edit.js 2016-05-03 14:05:33 UTC (rev
14968)
@@ -36,7 +36,11 @@
function receive_order(workorder_id)
{
- var oArgs = {menuaction: 'property.uiworkorder.receive_order', id:
workorder_id};
+ var oArgs = {
+ menuaction: 'property.uiworkorder.receive_order',
+ id: workorder_id,
+ received_percent: $("#slider-range-min").slider("value")
+ };
var strURL = phpGWLink('index.php', oArgs, true);
$.ajax({
type: 'POST',
@@ -180,7 +184,7 @@
if ($("#vendor_id").val() != vendor_id)
{
- var oArgs = {menuaction:
'property.uiworkorder.get_vendor_contract',vendor_id:$("#vendor_id").val()};
+ var oArgs = {menuaction:
'property.uiworkorder.get_vendor_contract', vendor_id: $("#vendor_id").val()};
var requestUrl = phpGWLink('index.php', oArgs, true);
var htmlString = "";
@@ -387,5 +391,17 @@
// parent.hide_popupBox();
});
+ $("#slider-range-min").slider({
+ range: "min",
+ value: $("#value_order_received_percent").val() || 0,
+ min: 0,
+ max: 100,
+ step: 10,
+ slide: function (event, ui)
+ {
+ $("#order_received_percent").val(ui.value + " %");
+ }
+ });
+ $("#order_received_percent").val($("#slider-range-min").slider("value")
+ " %");
+
});
-
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2016-05-03 10:38:03 UTC (rev 14967)
+++ trunk/property/setup/setup.inc.php 2016-05-03 14:05:33 UTC (rev 14968)
@@ -11,7 +11,7 @@
* @version $Id$
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.699';
+ $setup_info['property']['version'] = '0.9.17.700';
$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-05-03 10:38:03 UTC (rev
14967)
+++ trunk/property/setup/tables_current.inc.php 2016-05-03 14:05:33 UTC (rev
14968)
@@ -597,6 +597,7 @@
'order_dim1' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'order_sent' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
'order_received' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
+ 'order_received_percent' => array('type' =>
'int', 'precision' => 2, 'nullable' => True),
),
'pk' => array('id'),
'fk' => array(),
@@ -1158,6 +1159,7 @@
'modified_date' => array('type' => 'int',
'precision' => '4', 'nullable' => True),
'order_sent' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
'order_received' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
+ 'order_received_percent' => 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-05-03 10:38:03 UTC (rev
14967)
+++ trunk/property/setup/tables_update.inc.php 2016-05-03 14:05:33 UTC (rev
14968)
@@ -9094,3 +9094,34 @@
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.699';
+
+ function property_upgrade0_9_17_699()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder",
'order_received_percent', array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => True
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets",
'order_received_percent', array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => True
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.700';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl 2016-05-03 10:38:03 UTC (rev
14967)
+++ trunk/property/templates/base/tts.xsl 2016-05-03 14:05:33 UTC (rev
14968)
@@ -1057,9 +1057,30 @@
</input>
<div id="order_received_time" class="pure-custom">
<xsl:value-of select="value_order_received"/>
+
<div id="slider-range-min"></div>
</div>
+
<input class="pure-custom" type="text" id="order_received_percent"
readonly="readonly" size="6"/>
+
<input type="hidden" id="value_order_received_percent"
value="{value_order_received_percent}"/>
</div>
+ <div
class="pure-control-group">
+
<div class="pure-custom">
+
<xsl:for-each select="datatable_def">
+
<xsl:if test="container = 'datatable-container_7'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select
='container'/>
+
<xsl:with-param name="requestUrl" select
='requestUrl' />
+
<xsl:with-param name="ColumnDefs" select
='ColumnDefs' />
+
<xsl:with-param name="tabletools" select
='tabletools' />
+
<xsl:with-param name="data" select ='data' />
+
<xsl:with-param name="config" select ='config'
/>
+
</xsl:call-template>
+
</xsl:if>
+
</xsl:for-each>
+
</div>
+ </div>
+
+
</xsl:when>
</xsl:choose>
</xsl:when>
Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2016-05-03 10:38:03 UTC (rev
14967)
+++ trunk/property/templates/base/workorder.xsl 2016-05-03 14:05:33 UTC (rev
14968)
@@ -987,7 +987,10 @@
</input>
<div
id="order_received_time" class="pure-custom">
<xsl:value-of select="value_order_received"/>
+ <div
id="slider-range-min"></div>
</div>
+ <input
class="pure-custom" type="text" id="order_received_percent" readonly="readonly"
size="6"/>
+ <input
type="hidden" id="value_order_received_percent"
value="{value_order_received_percent}"/>
</div>
</xsl:when>
</xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14968] property: more on integration,
Sigurd Nes <=