[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14547] Syncromind: Merge 14400:14546 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14547] Syncromind: Merge 14400:14546 from trunk |
Date: |
Wed, 09 Dec 2015 18:15:59 +0000 |
Revision: 14547
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14547
Author: sigurdne
Date: 2015-12-09 18:15:59 +0000 (Wed, 09 Dec 2015)
Log Message:
-----------
Syncromind: Merge 14400:14546 from trunk
Modified Paths:
--------------
branches/dev-syncromind/controller/inc/class.uiprocedure.inc.php
branches/dev-syncromind/controller/templates/base/procedure/print_procedure.xsl
branches/dev-syncromind/controller/templates/base/procedure/procedure_item.xsl
branches/dev-syncromind/phpgwapi/inc/class.db_pdo.inc.php
branches/dev-syncromind/property/inc/class.botts.inc.php
branches/dev-syncromind/property/inc/class.sotts.inc.php
branches/dev-syncromind/property/inc/class.uitts.inc.php
branches/dev-syncromind/property/js/portico/tts.view.js
branches/dev-syncromind/property/setup/phpgw_no.lang
branches/dev-syncromind/property/setup/setup.inc.php
branches/dev-syncromind/property/setup/tables_current.inc.php
branches/dev-syncromind/property/setup/tables_update.inc.php
branches/dev-syncromind/property/templates/base/tts.xsl
Property Changed:
----------------
branches/dev-syncromind/
branches/dev-syncromind/controller/
Property changes on: branches/dev-syncromind
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653,13656-13668,13670-13689,13691-13726,13731-13773,13775,13778-13791,13793-13800,13802-13811,13816-13880,13882-13931,13934,13940-13963,13978-14029,14031-14268,14273-14399
+ /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653,13656-13668,13670-13689,13691-13726,13731-13773,13775,13778-13791,13793-13800,13802-13811,13816-13880,13882-13931,13934,13940-13963,13978-14029,14031-14268,14273-14399,14401-14546
Property changes on: branches/dev-syncromind/controller
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/stavangerkommune/controller:12743-12875,12986
/trunk/controller:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653,13656-13668,13670-13689,13691-13726,13728-13729,13731-13773,13802-13811,13816-13880,13882-13931,13940-13963,13978-14029,14031-14268,14273-14399
+ /branches/stavangerkommune/controller:12743-12875,12986
/trunk/controller:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653,13656-13668,13670-13689,13691-13726,13728-13729,13731-13773,13802-13811,13816-13880,13882-13931,13940-13963,13978-14029,14031-14268,14273-14399,14401-14546
Modified: branches/dev-syncromind/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.uiprocedure.inc.php
2015-12-09 17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/controller/inc/class.uiprocedure.inc.php
2015-12-09 18:15:59 UTC (rev 14547)
@@ -179,6 +179,9 @@
if(isset($_POST['save_procedure'])) // The user has
pressed the save button
{
+ //var_dump($_POST);
+
//var_dump(strtotime(phpgw::get_var('start_date')));
+ //die;
if(!$this->add && !$this->edit)
{
phpgwapi_cache::message_set('No
access', 'error');
@@ -202,9 +205,9 @@
$procedure->set_description($description_txt);
$procedure->set_reference($reference_txt);
$procedure->set_attachment(phpgw::get_var('attachment'));
-
$procedure->set_start_date(strtotime(phpgw::get_var('start_date_hidden')));
-
$procedure->set_end_date(strtotime(phpgw::get_var('end_date_hidden')));
-
$procedure->set_revision_date(strtotime(phpgw::get_var('revision_date_hidden')));
+
$procedure->set_start_date(strtotime(phpgw::get_var('start_date')));
+
$procedure->set_end_date(strtotime(phpgw::get_var('end_date')));
+
$procedure->set_revision_date(strtotime(phpgw::get_var('revision_date')));
$procedure->set_control_area_id(phpgw::get_var('control_area'));
$revision =
(int)$procedure->get_revision_no();
@@ -280,8 +283,8 @@
$procedure->set_description($description_txt);
$procedure->set_reference($reference_txt);
$procedure->set_attachment(phpgw::get_var('attachment'));
-
$procedure->set_start_date(strtotime(phpgw::get_var('start_date_hidden')));
-
$procedure->set_end_date(strtotime(phpgw::get_var('end_date_hidden')));
+
$procedure->set_start_date(strtotime(phpgw::get_var('start_date')));
+
$procedure->set_end_date(strtotime(phpgw::get_var('end_date')));
$procedure->set_control_area_id(phpgw::get_var('control_area'));
if(isset($procedure_id) &&
$procedure_id > 0)
@@ -492,19 +495,35 @@
$procedure->set_responsibility(str_replace(' ', ' ',
$procedure->get_responsibility()));
$procedure->set_reference(str_replace(' ',
' ', $procedure->get_reference()));
- $procedure_array = $procedure->toArray();
+
if($procedure->get_start_date() &&
$procedure->get_start_date() != null)
{
- $procedure_start_date =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_start_date());
+ //$procedure_start_date =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_start_date());
+
$procedure->set_start_date(date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_start_date()));
}
+ else
+ {
+ $procedure->set_start_date("");
+ }
if($procedure->get_end_date() &&
$procedure->get_end_date() != null)
{
- $procedure_end_date =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_end_date());
+ //$procedure_end_date =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_end_date());
+
$procedure->set_end_date(date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_end_date()));
}
+ else
+ {
+ $procedure->set_end_date("");
+ }
if($procedure->get_revision_date() &&
$procedure->get_revision_date() != null)
{
- $procedure_revision_date =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_revision_date());
+ //$procedure_revision_date =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_revision_date());
+
$procedure->set_revision_date(date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$procedure->get_revision_date()));
}
+ else
+ {
+ $procedure->set_revision_date("");
+ }
+ $procedure_array = $procedure->toArray();
if(!$view_revision)
{
@@ -521,7 +540,7 @@
$table_values[] = array('row'
=> $rev);
}
}
-
+
$tabs = array(
'procedure' => array('label' =>
lang('Procedure'), 'link' => '#procedure'),
'documents' => array(
@@ -734,4 +753,4 @@
$value['labels'][] = lang('edit');
}
}
- }
\ No newline at end of file
+ }
Modified:
branches/dev-syncromind/controller/templates/base/procedure/print_procedure.xsl
===================================================================
---
branches/dev-syncromind/controller/templates/base/procedure/print_procedure.xsl
2015-12-09 17:18:44 UTC (rev 14546)
+++
branches/dev-syncromind/controller/templates/base/procedure/print_procedure.xsl
2015-12-09 18:15:59 UTC (rev 14547)
@@ -23,8 +23,8 @@
</xsl:if>
</div>
<div>
- <label for="revision_date"><xsl:value-of
select="php:function('lang','Procedure revision date')" /></label>
- <xsl:if test="procedure/revision_date != 0">
+ <xsl:if test="procedure/revision_date != 0">
+ <label for="revision_date"><xsl:value-of
select="php:function('lang','Procedure revision date')" /></label>
<xsl:variable name="revisiondate"><xsl:value-of
select="procedure/revision_date" /></xsl:variable>
<xsl:value-of select="php:function('date',
$date_format, $revisiondate)" />
</xsl:if>
@@ -32,7 +32,7 @@
<div>
<xsl:if test="procedure/end_date != 0">
<label for="end_date"><xsl:value-of
select="php:function('lang','Procedure end date')" /></label>
-
+ <xsl:value-of select="procedure/end_date" />
<xsl:variable name="enddate"><xsl:value-of
select="procedure/end_date" /></xsl:variable>
<xsl:value-of select="php:function('date',
$date_format, $enddate)" />
</xsl:if>
@@ -91,7 +91,7 @@
}
ol{
- margin: 0;
+ margin: 15px;
padding: 0 20px;
}
Modified:
branches/dev-syncromind/controller/templates/base/procedure/procedure_item.xsl
===================================================================
---
branches/dev-syncromind/controller/templates/base/procedure/procedure_item.xsl
2015-12-09 17:18:44 UTC (rev 14546)
+++
branches/dev-syncromind/controller/templates/base/procedure/procedure_item.xsl
2015-12-09 18:15:59 UTC (rev 14547)
@@ -55,7 +55,7 @@
</input>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="start_date" />
+ <xsl:value-of
select="procedure/start_date" />
</xsl:otherwise>
</xsl:choose>
</dd>
@@ -69,7 +69,7 @@
</input>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="revision_date" />
+ <xsl:value-of
select="procedure/revision_date" />
</xsl:otherwise>
</xsl:choose>
</dd>
@@ -83,7 +83,7 @@
</input>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="end_date" />
+ <xsl:value-of
select="procedure/end_date" />
</xsl:otherwise>
</xsl:choose>
</dd>
Modified: branches/dev-syncromind/phpgwapi/inc/class.db_pdo.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.db_pdo.inc.php 2015-12-09
17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/phpgwapi/inc/class.db_pdo.inc.php 2015-12-09
18:15:59 UTC (rev 14547)
@@ -437,19 +437,15 @@
}
/**
- * Execute a query with limited result set
+ * Get the limit statement for a query with limited result set
*
* @param string $sql the query to be executed
* @param integer $offset row to start from
- * @param integer $line the line method was called from - use
__LINE__
- * @param string $file the file method was called from - use
__FILE__
* @param integer $num_rows number of rows to return (optional),
if unset will use
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
- * @return integer current query id if sucesful and null if fails
+ * @return string offset and limit
*/
-
- function limit_query($sql, $offset, $line = '', $file = '',
$num_rows = 0)
+ function get_offset($sql = '', $offset, $num_rows = 0)
{
- $this->_get_fetchmode();
$offset = (int)$offset;
$num_rows = (int)$num_rows;
@@ -485,7 +481,26 @@
$sql .= " LIMIT {$num_rows}";
$sql .= $offset ? " OFFSET {$offset}"
: '';
}
+ return $sql;
+ }
+ /**
+ * Execute a query with limited result set
+ *
+ * @param string $sql the query to be executed
+ * @param integer $offset row to start from
+ * @param integer $line the line method was called from - use
__LINE__
+ * @param string $file the file method was called from - use
__FILE__
+ * @param integer $num_rows number of rows to return (optional),
if unset will use
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
+ * @return integer current query id if sucesful and null if fails
+ */
+
+ function limit_query($sql, $offset, $line = '', $file = '',
$num_rows = 0)
+ {
+ $this->_get_fetchmode();
+
+ $sql = $this->get_offset($sql, $offset, $num_rows);
+
if ($this->debug)
{
printf("Debug: limit_query = %s<br />offset=%d,
num_rows=%d<br />\n", $sql, $offset, $num_rows);
Modified: branches/dev-syncromind/property/inc/class.botts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.botts.inc.php 2015-12-09
17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/inc/class.botts.inc.php 2015-12-09
18:15:59 UTC (rev 14547)
@@ -1712,6 +1712,15 @@
return $values;
}
+ public function get_budgets($id)
+ {
+ $budgets = $this->so->get_budgets($id);
+ foreach($budgets as &$budget)
+ {
+ $budget['created_on_date'] =
$GLOBALS['phpgw']->common->show_date($payment['created_on'],$this->dateformat);
+ }
+ return $budgets;
+ }
public function get_payments($id)
{
$payments = $this->so->get_payments($id);
Modified: branches/dev-syncromind/property/inc/class.sotts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.sotts.inc.php 2015-12-09
17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/inc/class.sotts.inc.php 2015-12-09
18:15:59 UTC (rev 14547)
@@ -139,20 +139,20 @@
$custom_filtermethod=
isset($data['custom_filtermethod']) && $data['custom_filtermethod'] ?
(array)$data['custom_filtermethod']:array();
- $result_order_field = '';
+ $result_order_field = array();
if($order)
{
if($order == 'assignedto')
{
- $result_order_field =
',account_lastname';
- $order_join =
"LEFT OUTER JOIN phpgw_accounts ON
fm_tts_tickets.assignedto=phpgw_accounts.account_id";
- $order =
'account_lastname';
+ $result_order_field =
array('account_lastname' => 'account_lastname');
+ $order_join = "LEFT OUTER JOIN
phpgw_accounts ON fm_tts_tickets.assignedto=phpgw_accounts.account_id";
+ $order = 'account_lastname';
}
else if($order == 'user')
{
- $result_order_field =
',account_lastname';
- $order_join =
"LEFT OUTER JOIN phpgw_accounts ON
fm_tts_tickets.user_id=phpgw_accounts.account_id";
- $order =
'account_lastname';
+ $result_order_field =
array('account_lastname' => 'account_lastname');
+ $order_join = "LEFT OUTER JOIN
phpgw_accounts ON fm_tts_tickets.user_id=phpgw_accounts.account_id";
+ $order = 'account_lastname';
}
else
{
@@ -163,9 +163,10 @@
}
else
{
- $ordermethod = ' ORDER BY fm_tts_tickets.id
DESC';
+ $ordermethod = ' ORDER BY id DESC';
}
+ $union_select = false;
$filtermethod = '';
$where = 'WHERE';
@@ -385,9 +386,13 @@
$where = 'AND';
}
- $actual_cost_field =
'fm_tts_tickets.actual_cost';
+ $actual_cost_field = array('actual_cost'
=>'fm_tts_tickets.actual_cost');
+ $budget_field = array('budget'
=>'fm_tts_tickets.budget');
+
$actual_cost_group_field =
',fm_tts_tickets.actual_cost';
- $date_join = '';
+ $budget_group_field = ',fm_tts_tickets.budget';
+ $date_cost_join = '';
+ $date_budget_join = '';
if($start_date)
{
@@ -395,20 +400,31 @@
$order_edit =
$GLOBALS['phpgw']->acl->check('.ticket.order', PHPGW_ACL_EDIT, 'property');
$_end_date = $end_date + 3600 * 16 +
phpgwapi_datetime::user_timezone();
$_start_date = $start_date - 3600 * 8 +
phpgwapi_datetime::user_timezone();
- $filtermethod .= " $where
(fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date
<= $_end_date ";
+ $filtermethod .= " $where
fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date
<= $_end_date ";
if($order_add || $order_edit)
{
- $end_period
= date('Ym', $end_date);
- $start_period =
date('Ym', $start_date);
- $filtermethod .= " OR
(fm_tts_payments.period >= {$start_period} AND fm_tts_payments.period <=
{$end_period}))";
- $date_join
= "LEFT JOIN fm_tts_payments ON ( fm_tts_tickets.id=fm_tts_payments.ticket_id
AND fm_tts_payments.period >= $start_period AND fm_tts_payments.period <=
$end_period )";
- $actual_cost_field =
'SUM(fm_tts_payments.amount) AS actual_cost';
+ $union_select = true;
+ $end_period = date('Ym', $end_date);
+ $start_period = date('Ym',
$start_date);
+// $filtermethod .= " OR
(fm_tts_payments.period >= {$start_period} AND fm_tts_payments.period <=
{$end_period})";
+ $date_cost_join = "LEFT OUTER JOIN
fm_tts_payments ON ( fm_tts_tickets.id=fm_tts_payments.ticket_id AND
fm_tts_payments.period >= $start_period AND fm_tts_payments.period <=
$end_period )";
+// $actual_cost_field =
'SUM(fm_tts_payments.amount) AS actual_cost';
+ $actual_cost_field =
array('SUM(actual_cost) AS actual_cost' =>'fm_tts_payments.amount as
actual_cost');
+
$actual_cost_group_field = '';
+
+ $start_budget_period = date('Y',
$end_date) . '00';
+ $end_budget_period = date('Y',
$start_date) . '13';
+// $filtermethod .= " OR
(fm_tts_budget.period >= {$start_budget_period} AND fm_tts_budget.period <=
{$end_budget_period}))";
+ $date_budget_join = "LEFT OUTER JOIN
fm_tts_budget ON ( fm_tts_tickets.id=fm_tts_budget.ticket_id AND
fm_tts_budget.period >= $start_budget_period AND fm_tts_budget.period <=
$end_budget_period )";
+// $budget_field =
'SUM(fm_tts_budget.amount) AS budget';
+ $budget_field = array('SUM(budget) AS
budget' =>'fm_tts_budget.amount as budget');
+ $budget_group_field = '';
}
else
{
- $filtermethod .= ')';
+// $filtermethod .= ')';
}
$where = 'AND';
@@ -479,44 +495,116 @@
}
}
- $return_fields =
"fm_tts_tickets.id,fm_tts_tickets.assignedto,fm_tts_tickets.status,fm_tts_tickets.user_id,"
- .
"fm_tts_tickets.subject,fm_tts_tickets.address,fm_tts_tickets.location_code,fm_tts_tickets.priority,fm_tts_tickets.cat_id,fm_tts_tickets.group_id,"
- .
"fm_tts_tickets.entry_date,fm_tts_tickets.modified_date,fm_tts_tickets.finnish_date,fm_tts_tickets.finnish_date2,fm_tts_tickets.order_id,fm_tts_tickets.vendor_id,"
- .
"fm_tts_tickets.budget,fm_tts_tickets.billable_hours,fm_district.descr as
district,fm_tts_views.id as
view,fm_location1.loc1_name,fm_tts_tickets.ecodimb,fm_tts_tickets.order_dim1
{$result_order_field}";
+ $_return_field_array = array(
+ 'id' =>
'fm_tts_tickets.id',
+ 'assignedto' =>
'fm_tts_tickets.assignedto',
+ 'status' =>
'fm_tts_tickets.status',
+ 'user_id' =>
'fm_tts_tickets.user_id',
+ 'subject' =>
'fm_tts_tickets.subject',
+ 'address' =>
'fm_tts_tickets.address',
+ 'location_code' =>
'fm_tts_tickets.location_code',
+ 'priority' =>
'fm_tts_tickets.priority',
+ 'cat_id' =>
'fm_tts_tickets.cat_id',
+ 'group_id' =>
'fm_tts_tickets.group_id',
+ 'entry_date' =>
'fm_tts_tickets.entry_date',
+ 'modified_date' =>
'fm_tts_tickets.modified_date',
+ 'finnish_date' =>
'fm_tts_tickets.finnish_date',
+ 'finnish_date2' =>
'fm_tts_tickets.finnish_date2',
+ 'order_id' =>
'fm_tts_tickets.order_id',
+ 'vendor_id' =>
'fm_tts_tickets.vendor_id',
+ 'billable_hours' =>
'fm_tts_tickets.billable_hours',
+ 'district' =>
'fm_district.descr as district',
+ 'view' =>
'fm_tts_views.id as view',
+ 'loc1_name' =>
'fm_location1.loc1_name',
+ 'ecodimb' =>
'fm_tts_tickets.ecodimb',
+ 'order_dim1' =>
'fm_tts_tickets.order_dim1'
+ );
$custom_cols = $this->custom->find('property',
'.ticket', 0, '', 'ASC', 'attrib_sort', true, true);
- foreach($custom_cols as $custom_col)
+ foreach ($custom_cols as $custom_col)
{
- $return_fields .=
",fm_tts_tickets.{$custom_col['column_name']}";
+
$_return_field_array[$custom_col['column_name']] =
"fm_tts_tickets.{$custom_col['column_name']}";
}
- $sql = "SELECT DISTINCT
{$return_fields},{$actual_cost_field} FROM fm_tts_tickets"
- . " {$this->left_join} fm_location1 ON
fm_tts_tickets.loc1=fm_location1.loc1"
- . " {$this->left_join} fm_part_of_town ON
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id"
- . " {$this->left_join} fm_district ON fm_district.id =
fm_part_of_town.district_id"
- . " {$order_join}{$date_join}"
- . " LEFT OUTER JOIN fm_tts_views ON (fm_tts_tickets.id
= fm_tts_views.id AND fm_tts_views.account_id='{$this->account}')";
+ if ($result_order_field)
+ {
+ $_return_field_array =
array_merge($_return_field_array, $result_order_field);
+ }
+ $return_field_array = array_merge($_return_field_array,
$actual_cost_field);
+ $return_field_array = array_merge($return_field_array,
$budget_field);
+
+ $return_fields_union = implode(',',
array_values($_return_field_array));
+ $return_fields = implode(',',
array_keys($return_field_array));
+ $return_fields_plain = implode(',',
array_values($return_field_array));
+
+ $union_budget = "SELECT {$return_fields_union}, 0 as
actual_cost ,SUM(fm_tts_budget.amount) as budget FROM fm_tts_tickets"
+ . " {$this->left_join} fm_location1 ON
fm_tts_tickets.loc1=fm_location1.loc1"
+ . " {$this->left_join} fm_part_of_town ON
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id"
+ . " {$this->left_join} fm_district ON
fm_district.id = fm_part_of_town.district_id"
+ . " {$order_join}{$date_budget_join}"
+ . " LEFT OUTER JOIN fm_tts_views ON
(fm_tts_tickets.id = fm_tts_views.id AND
fm_tts_views.account_id='{$this->account}')";
+ $union_cost = "SELECT
{$return_fields_union},SUM(fm_tts_payments.amount) as actual_cost, 0 as budget
FROM fm_tts_tickets"
+ . " {$this->left_join} fm_location1 ON
fm_tts_tickets.loc1=fm_location1.loc1"
+ . " {$this->left_join} fm_part_of_town ON
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id"
+ . " {$this->left_join} fm_district ON
fm_district.id = fm_part_of_town.district_id"
+ . " {$order_join}{$date_cost_join}"
+ . " LEFT OUTER JOIN fm_tts_views ON
(fm_tts_tickets.id = fm_tts_views.id AND
fm_tts_views.account_id='{$this->account}')";
+
if(isset($custom_filter['joinmethod_datatype']) &&
$custom_filter['joinmethod_datatype'])
{
foreach($custom_filter['joinmethod_datatype']
as $_joinmethod)
{
+ $union_budget .= $_joinmethod;
+ $union_cost .= $_joinmethod;
+ }
+ }
+
+ $sql = "SELECT DISTINCT {$return_fields_plain} FROM
fm_tts_tickets"
+ . " {$this->left_join} fm_location1 ON
fm_tts_tickets.loc1=fm_location1.loc1"
+ . " {$this->left_join} fm_part_of_town ON
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id"
+ . " {$this->left_join} fm_district ON
fm_district.id = fm_part_of_town.district_id"
+ . "
{$order_join}{$date_cost_join}{$date_budget_join}"
+ . " LEFT OUTER JOIN fm_tts_views ON
(fm_tts_tickets.id = fm_tts_views.id AND
fm_tts_views.account_id='{$this->account}')";
+
+ if(isset($custom_filter['joinmethod_datatype']) &&
$custom_filter['joinmethod_datatype'])
+ {
+ foreach($custom_filter['joinmethod_datatype']
as $_joinmethod)
+ {
$sql .= $_joinmethod;
}
}
- $group_fields = str_ireplace(array('fm_district.descr
as district', 'fm_tts_views.id as view'), array(
- 'fm_district.descr', 'fm_tts_views.id'),
$return_fields);
- $sql .= " {$filtermethod} {$querymethod} GROUP BY
{$group_fields}{$actual_cost_group_field}";
+ $limit_and_offset = '';
- $sql_cnt = "SELECT DISTINCT fm_tts_tickets.budget
,{$actual_cost_field}, fm_tts_tickets.id FROM fm_tts_tickets"
- . " {$this->left_join} fm_location1 ON
fm_tts_tickets.loc1=fm_location1.loc1"
- . " {$this->left_join} fm_part_of_town ON
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id"
- . " {$this->left_join} fm_district ON fm_district.id =
fm_part_of_town.district_id"
- . " {$order_join}{$date_join}"
- . " LEFT OUTER JOIN fm_tts_views ON (fm_tts_tickets.id
= fm_tts_views.id AND fm_tts_views.account_id='{$this->account}')";
+ if(!$allrows && $union_select)
+ {
+ $allrows = true;//handled within the subselect
+ $limit_and_offset = $this->db->get_offset('',
$start);
+ }
+ $group_fields = str_ireplace(array('fm_district.descr
as district', 'fm_tts_views.id as view'),
array('fm_district.descr','fm_tts_views.id'), $return_fields_plain);
+ $group_fields_union =
str_ireplace(array('fm_district.descr as district', 'fm_tts_views.id as view'),
array('fm_district.descr','fm_tts_views.id'), $return_fields_union);
+ $sub_select = "({$union_budget} {$filtermethod}
{$querymethod} GROUP BY {$group_fields_union} {$ordermethod}
{$limit_and_offset}) UNION ({$union_cost} {$filtermethod} {$querymethod} GROUP
BY {$group_fields_union} {$ordermethod} {$limit_and_offset})";
+
+ if($union_select)
+ {
+ $main_sql = "SELECT {$return_fields} FROM
({$sub_select} ) as t GROUP BY " . implode(',',
array_keys($_return_field_array)) . " {$ordermethod}";
+
+ }
+ else
+ {
+ $main_sql = $sql . " {$filtermethod}
{$querymethod} GROUP BY
{$group_fields}{$budget_group_field}{$actual_cost_group_field} {$ordermethod}";
+ }
+
+ $sql_cnt = "SELECT DISTINCT budget,actual_cost,
fm_tts_tickets.id FROM fm_tts_tickets"
+ . " {$this->left_join} fm_location1 ON
fm_tts_tickets.loc1=fm_location1.loc1"
+ . " {$this->left_join} fm_part_of_town ON
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id"
+ . " {$this->left_join} fm_district ON
fm_district.id = fm_part_of_town.district_id"
+ . "
{$order_join}{$date_cost_join}{$date_budget_join}"
+ . " LEFT OUTER JOIN fm_tts_views ON
(fm_tts_tickets.id = fm_tts_views.id AND
fm_tts_views.account_id='{$this->account}')";
+
if(isset($custom_filter['joinmethod_datatype']) &&
$custom_filter['joinmethod_datatype'])
{
foreach($custom_filter['joinmethod_datatype']
as $_joinmethod)
@@ -526,28 +614,35 @@
}
$sql_cnt .= " {$filtermethod} {$querymethod}";
-//_debug_array($sql);
- $cache_info = phpgwapi_cache::session_get('property',
'tts_listing_metadata');
+// $cache_info =
phpgwapi_cache::session_get('property','tts_listing_metadata');
if(!isset($cache_info['sql_hash']) ||
$cache_info['sql_hash'] != md5($sql_cnt))
{
$cache_info = array();
}
-
- if(!$cache_info)
+//_debug_array($main_sql);
+// if(!$cache_info)
{
- $sql2 = "SELECT count(*) as cnt, sum(budget) as
sum_budget, sum(actual_cost) as sum_actual_cost FROM ({$sql_cnt} GROUP BY
fm_tts_tickets.id, fm_tts_tickets.budget {$actual_cost_group_field}) as t";
+ if($union_select)
+ {
+ $sub_select = "({$union_budget}
{$filtermethod} {$querymethod} {$filter_closed} GROUP BY {$group_fields_union})
UNION ({$union_cost} {$filtermethod} {$querymethod} {$filter_closed} GROUP BY
{$group_fields_union})";
+ $sql2 = "SELECT count(*) as cnt,
sum(budget) as sum_budget, sum(actual_cost) as sum_actual_cost FROM
({$sub_select} ) as t";
+ }
+ else
+ {
+ $sql2 = "SELECT count(*) as cnt,
sum(budget) as sum_budget, sum(actual_cost) as sum_actual_cost FROM ({$sql_cnt}
GROUP BY fm_tts_tickets.id, fm_tts_tickets.budget) as t";
+ }
$this->db->query($sql2, __LINE__, __FILE__);
$this->db->next_record();
unset($sql2);
$cache_info = array
- (
- 'total_records' =>
$this->db->f('cnt'),
- 'sum_budget' =>
$this->db->f('sum_budget'),
- 'sum_actual_cost' =>
$this->db->f('sum_actual_cost'),
- 'sql_hash' =>
md5($sql_cnt)
+ (
+ 'total_records' =>
$union_select ? ((int)$this->db->f('cnt')/2) : $this->db->f('cnt'),
+ 'sum_budget' =>
$this->db->f('sum_budget'),
+ 'sum_actual_cost' =>
$this->db->f('sum_actual_cost'),
+ 'sql_hash' =>
md5($sql_cnt)
);
@@ -560,15 +655,24 @@
$closed_status[] =
"C{$custom['id']}";
}
}
- $filter_closed = " AND fm_tts_tickets.status
NOT IN ('" . implode("','", $closed_status) . "')";
- $sql2 = "SELECT (SUM(budget)
- SUM(actual_cost)) as sum_difference FROM ({$sql_cnt} {$filter_closed} GROUP
BY fm_tts_tickets.id, fm_tts_tickets.budget {$actual_cost_group_field}) as t";
- $this->db->query($sql2, __LINE__, __FILE__);
+ $filter_closed = " AND fm_tts_tickets.status
NOT IN ('" . implode("','", $closed_status) . "')";
+ if($union_select)
+ {
+ $sub_select = "({$union_budget}
{$filtermethod} {$querymethod} {$filter_closed} GROUP BY {$group_fields_union})
UNION ({$union_cost} {$filtermethod} {$querymethod} {$filter_closed} GROUP BY
{$group_fields_union})";
+ $sql2 = "SELECT (SUM(budget) -
SUM(actual_cost)) as sum_difference FROM ({$sub_select}) as t";
+ }
+ else
+ {
+ $sql2 = "SELECT (SUM(budget) -
SUM(actual_cost)) as sum_difference FROM ({$sql_cnt} {$filter_closed} GROUP BY
fm_tts_tickets.id) as t";
+ }
+
+ $this->db->query($sql2,__LINE__,__FILE__);
$this->db->next_record();
unset($sql2);
$cache_info['sum_difference'] =
(float)$this->db->f('sum_difference');
- phpgwapi_cache::session_set('property',
'tts_listing_metadata', $cache_info);
+//
phpgwapi_cache::session_set('property','tts_listing_metadata',$cache_info);
}
$this->total_records =
(int)$cache_info['total_records'];
@@ -581,22 +685,12 @@
{
if(!$allrows)
{
- $this->db->limit_query($sql .
$ordermethod, $start, __LINE__, __FILE__);
+
$this->db->limit_query($main_sql,$start,__LINE__,__FILE__);
}
else
{
$_fetch_single = false;
- /*
- if($this->total_records > 200)
- {
- $_fetch_single = true;
- }
- else
- {
- $_fetch_single = false;
- }
- */
- $this->db->query($sql . $ordermethod,
__LINE__, __FILE__, false, $_fetch_single);
+
$this->db->query($main_sql,__LINE__,__FILE__, false, $_fetch_single );
unset($_fetch_single);
}
@@ -1092,24 +1186,24 @@
$this->db->query("SELECT * FROM fm_tts_tickets WHERE
id='$id'", __LINE__, __FILE__);
$this->db->next_record();
- $location_code =
$this->db->f('location_code');
- $oldlocation_code =
$this->db->f('location_code');
- $oldfinnish_date =
$this->db->f('finnish_date');
- $oldfinnish_date2 =
$this->db->f('finnish_date2');
- $oldassigned =
$this->db->f('assignedto');
- $oldgroup_id =
$this->db->f('group_id');
- $oldpriority =
$this->db->f('priority');
- $oldcat_id =
$this->db->f('cat_id');
- $old_status =
$this->db->f('status');
- $ticket['old_status'] = $old_status; // used for
custom functions
- $old_budget =
$this->db->f('budget');
- $old_billable_hours =
(float)$this->db->f('billable_hours');
- // $old_billable_rate =
$this->db->f('billable_rate');
- $old_subject =
$this->db->f('subject');
- $old_contact_id =
$this->db->f('contact_id');
- $old_order_cat_id =
$this->db->f('order_cat_id');
- $old_building_part =
$this->db->f('building_part', true);
- $old_order_dim1 =
(int)$this->db->f('order_dim1');
+ $location_code =
$this->db->f('location_code');
+ $oldlocation_code =
$this->db->f('location_code');
+ $oldfinnish_date =
$this->db->f('finnish_date');
+ $oldfinnish_date2 =
$this->db->f('finnish_date2');
+ $oldassigned =
$this->db->f('assignedto');
+ $oldgroup_id =
$this->db->f('group_id');
+ $oldpriority =
$this->db->f('priority');
+ $oldcat_id =
$this->db->f('cat_id');
+ $old_status =
$this->db->f('status');
+ $ticket['old_status'] = $old_status; // used for
custom functions
+ // $old_budget =
$this->db->f('budget');
+ $old_billable_hours =
(float)$this->db->f('billable_hours');
+ // $old_billable_rate = $this->db->f('billable_rate');
+ $old_subject =
$this->db->f('subject');
+ $old_contact_id =
$this->db->f('contact_id');
+ $old_order_cat_id =
$this->db->f('order_cat_id');
+ $old_building_part =
$this->db->f('building_part',true);
+ $old_order_dim1 =
(int)$this->db->f('order_dim1');
if($oldcat_id == 0)
@@ -1459,9 +1553,35 @@
if($order_add || $order_edit)
{
- if((int)$ticket['actual_cost'])
+ if ((int)$ticket['budget'])
{
+ $this->db->query("SELECT sum(amount) AS
budget FROM fm_tts_budget WHERE ticket_id = {$id}", __LINE__,__FILE__);
+ $this->db->next_record();
+ $old_budget = $this->db->f('budget');
+ $new_budget =str_replace(',', '.',
($old_budget + $ticket['budget']));
+
+ $this->db->query("UPDATE fm_tts_tickets
SET budget='{$new_budget}' WHERE id='$id'",__LINE__,__FILE__);
+
+ $value_set_cost = array
+ (
+ 'ticket_id' => $id,
+ 'amount' =>
str_replace(',', '.', $ticket['budget']),
+ 'period' =>
$ticket['budget_period'] . '01',
+ 'created_on'=> time(),
+ 'created_by'=> $this->account
+ );
+
+ $cols_cost = implode(',',
array_keys($value_set_cost));
+ $values_cost =
$this->db->validate_insert(array_values($value_set_cost));
+ $this->db->query("INSERT INTO
fm_tts_budget ({$cols_cost}) VALUES ({$values_cost})");
+
+
$this->historylog->add('B',$id,(float)$new_budget , $old_budget);
+ $receipt['message'][]= array('msg' =>
lang('budget changed'));
+ }
+ if ((int)$ticket['actual_cost'])
+ {
+
$this->db->query("SELECT sum(amount) AS
actual_cost FROM fm_tts_payments WHERE ticket_id = {$id}", __LINE__, __FILE__);
$this->db->next_record();
$old_actual_cost =
$this->db->f('actual_cost');
@@ -1509,7 +1629,7 @@
$receipt['message'][] = array('msg'
=> lang('building part has been updated'));
$this->fields_updated[] =
'building_part';
}
-
+/*
if($old_budget != $ticket['budget'])
{
$this->fields_updated[] = 'budget';
@@ -1517,7 +1637,7 @@
. "' where id='$id'", __LINE__,
__FILE__);
$this->historylog->add('B', $id,
$ticket['budget'], $old_budget);
}
-
+*/
$value_set['vendor_id'] =
$ticket['vendor_id'];
$value_set['b_account_id'] =
$ticket['b_account_id'];
$value_set['order_descr'] =
$this->db->db_addslashes($ticket['order_descr']);
@@ -1749,6 +1869,30 @@
return $values;
}
+ public function get_budgets($id)
+ {
+ $id = (int) $id;
+ $values = array();
+ $sql = "SELECT * FROM fm_tts_budget WHERE ticket_id =
{$id} ORDER BY period ASC";
+
+ $this->db->query($sql, __LINE__,__FILE__);
+
+ while ($this->db->next_record())
+ {
+ $values[] = array
+ (
+ 'id' => $this->db->f('id'),
+ 'ticket_id' =>
$this->db->f('ticket_id'),
+ 'amount' =>
$this->db->f('amount'),
+ 'period' =>
$this->db->f('period'),
+ 'created_on'=>
$this->db->f('created_on'),
+ 'created_by'=>
$this->db->f('created_by'),
+ 'remark' =>
$this->db->f('remark', true)
+ );
+ }
+ return $values;
+ }
+
public function get_payments($id)
{
$id = (int)$id;
@@ -1791,4 +1935,4 @@
return $values;
}
- }
\ No newline at end of file
+ }
Modified: branches/dev-syncromind/property/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uitts.inc.php 2015-12-09
17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/inc/class.uitts.inc.php 2015-12-09
18:15:59 UTC (rev 14547)
@@ -1497,6 +1497,8 @@
$access_order = true;
}
+ $ticket = $this->bo->read_single($id, $values);
+
if(isset($values['save']))
{
if(!$this->acl_edit)
@@ -1549,7 +1551,7 @@
if($access_order)
{
- if((isset($values['order_id']) &&
$values['order_id']) && (!isset($values['budget']) || !$values['budget']))
+ if(!$ticket['budget'] &&
((isset($values['order_id']) && $values['order_id']) &&
(!isset($values['budget']) || !$values['budget'])))
{
$receipt['error'][] =
array('msg' => lang('budget') . ': ' . lang('Missing value'));
}
@@ -1651,7 +1653,6 @@
$values =
$this->bocommon->preserve_attribute_values($values, $values_attribute);
}
- $ticket = $this->bo->read_single($id, $values);
if(isset($ticket['attributes']) &&
is_array($ticket['attributes']))
{
@@ -2344,7 +2345,7 @@
)
);
- $payments = $this->bo->get_payments($id);
+ $budgets = $this->bo->get_budgets($id);
$datatable_def[] = array
(
'container' => 'datatable-container_4',
@@ -2354,6 +2355,22 @@
array('key' => 'amount', 'label' =>
lang('amount'), 'sortable' => true, 'resizeable' => true,
'formatter' =>
'FormatterAmount2'),
array('key' => 'remark', 'label' =>
lang('remark'), 'sortable' => false, 'resizeable' => true)),
+ 'data' => json_encode($budgets),
+ 'config' => array(
+ array('disableFilter' => true),
+ array('disablePagination' => true)
+ )
+ );
+ $payments = $this->bo->get_payments($id);
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_5',
+ 'requestUrl' => "''",
+ 'ColumnDefs' => array(array('key' => 'period',
'label' => lang('period'), 'sortable' => true,
+ 'resizeable' => true),
+ array('key' => 'amount', 'label' =>
lang('amount'), 'sortable' => true, 'resizeable' => true,
+ 'formatter' =>
'FormatterAmount2'),
+ array('key' => 'remark', 'label' =>
lang('remark'), 'sortable' => false, 'resizeable' => true)),
'data' => json_encode($payments),
'config' => array(
array('disableFilter' => true),
@@ -2375,7 +2392,7 @@
$datatable_def[] = array
(
- 'container' => 'datatable-container_5',
+ 'container' => 'datatable-container_6',
'requestUrl' =>
json_encode(self::link(array('menuaction' => 'property.notify.update_data',
'location_id' => $location_id,
'location_item_id' => $id, 'action' => 'refresh_notify_contact',
'phpgw_return_as' => 'json'))),
@@ -2438,7 +2455,7 @@
// $order_catetory =
$this->cats->formatted_xslt_list(array('select_name' =>
'values[order_cat_id]','selected' => $ticket['order_cat_id']));
$year = date('Y') - 1;
- $limit = $year + 3;
+ $limit = $year + 4;
while($year < $limit)
{
Modified: branches/dev-syncromind/property/js/portico/tts.view.js
===================================================================
--- branches/dev-syncromind/property/js/portico/tts.view.js 2015-12-09
17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/js/portico/tts.view.js 2015-12-09
18:15:59 UTC (rev 14547)
@@ -28,6 +28,33 @@
});
};
+this.local_DrawCallback5 = function()
+{
+ //console.log(oTable4);
+ var api = oTable5.api();
+ // Remove the formatting to get integer data for
summation
+ var intVal = function ( i )
+ {
+ return typeof i === 'string' ?
+ i.replace(/[\$,]/g, '')*1 :
+ typeof i === 'number' ?
+ i : 0;
+ };
+
+ var columns = ["1"];
+
+ columns.forEach(function(col)
+ {
+ data = api.column( col, { page: 'current'}
).data();
+ pageTotal = data.length ?
+ data.reduce(function (a, b){
+ return intVal(a) +
intVal(b);
+ }) : 0;
+
+ $(api.column(col).footer()).html("<div
align=\"right\">"+pageTotal+"</div>");
+ });
+
+};
/********************************************************************************/
var FormatterCenter = function(key, oData)
{
Modified: branches/dev-syncromind/property/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/property/setup/phpgw_no.lang 2015-12-09
17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/setup/phpgw_no.lang 2015-12-09
18:15:59 UTC (rev 14547)
@@ -353,7 +353,7 @@
close order property no Avslutt Ordre
close this window property no Steng vindu
code property no Kode
-collapse all common no Slå samen
+collapse all common no Slå sammen
column could not be added property no Kolonne kunne ikke
legges til
column description property no Beskrivelse av kolonne
column name property no Kolonnenavn
Modified: branches/dev-syncromind/property/setup/setup.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/setup.inc.php 2015-12-09
17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/setup/setup.inc.php 2015-12-09
18:15:59 UTC (rev 14547)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.694';
+ $setup_info['property']['version'] = '0.9.17.695';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
@@ -141,6 +141,7 @@
'fm_tts_history',
'fm_tts_views',
'fm_tts_payments',
+ 'fm_tts_budget',
'fm_org_unit',
'fm_ecoart',
'fm_ecoavvik',
Modified: branches/dev-syncromind/property/setup/tables_current.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/tables_current.inc.php
2015-12-09 17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/setup/tables_current.inc.php
2015-12-09 18:15:59 UTC (rev 14547)
@@ -1119,6 +1119,21 @@
'fk' => array('fm_tts_tickets' => array('ticket_id' =>
'id')),
'uc' => array()
),
+ 'fm_tts_budget' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto','nullable' =>
False),
+ 'ticket_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'amount' => array('type' =>
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' =>
false),
+ 'period' => array('type' => 'int','precision'
=> '4','nullable' => false),
+ 'remark' => array('type' => 'text','nullable'
=> true),
+ 'created_on' => array('type' => 'int',
'precision' => 4,'nullable' => true),
+ 'created_by' => array('type' => 'int',
'precision' => 4,'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'ix' => array(),
+ 'fk' => array('fm_tts_tickets' => array('ticket_id' =>
'id')),
+ 'uc' => array()
+ ),
'fm_org_unit' => array(
'fd' => array(
'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
Modified: branches/dev-syncromind/property/setup/tables_update.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/tables_update.inc.php
2015-12-09 17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/setup/tables_update.inc.php
2015-12-09 18:15:59 UTC (rev 14547)
@@ -8623,4 +8623,67 @@
$GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.694';
return $GLOBALS['setup_info']['property']['currentver'];
}
- }
\ No newline at end of file
+ }
+
+ /**
+ * Update property version from 0.9.17.694 to 0.9.17.695
+ * differentiate budget.
+ */
+ $test[] = '0.9.17.694';
+ function property_upgrade0_9_17_694()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_tts_budget', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'auto','nullable' => False),
+ 'ticket_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'amount' => array('type' =>
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' =>
false),
+ 'period' => array('type' =>
'int','precision' => '4','nullable' => false),
+ 'remark' => array('type' =>
'text','nullable' => true),
+ 'created_on' => array('type' => 'int',
'precision' => 4,'nullable' => true),
+ 'created_by' => array('type' => 'int',
'precision' => 4,'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'ix' => array(),
+ 'fk' => array('fm_tts_tickets' =>
array('ticket_id' => 'id')),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT id, budget,
entry_date FROM fm_tts_tickets WHERE budget != 0 ORDER BY entry_date");
+
+ $tickets = array();
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $tickets[] = array
+ (
+ 'id' =>
$GLOBALS['phpgw_setup']->oProc->f('id'),
+ 'budget' =>
$GLOBALS['phpgw_setup']->oProc->f('budget'),
+ 'entry_date' =>
$GLOBALS['phpgw_setup']->oProc->f('entry_date')
+ );
+ }
+
+ foreach($tickets as $ticket)
+ {
+ $period = date('Ym', $ticket['entry_date']);
+ $value_set = array
+ (
+ 'ticket_id' => $ticket['id'],
+ 'amount' => $ticket['budget'],
+ 'period' => $period,
+ 'created_on'=> $ticket['entry_date']
+ );
+ $cols = implode(',', array_keys($value_set));
+ $values =
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($value_set));
+ $sql = "INSERT INTO fm_tts_budget ({$cols}) VALUES
({$values})";
+
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+ }
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.695';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
Modified: branches/dev-syncromind/property/templates/base/tts.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/tts.xsl 2015-12-09
17:18:44 UTC (rev 14546)
+++ branches/dev-syncromind/property/templates/base/tts.xsl 2015-12-09
18:15:59 UTC (rev 14547)
@@ -707,8 +707,60 @@
</input>
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
</div>
+
+
<div
class="pure-control-group">
<label>
+
<xsl:value-of select="php:function('lang', 'cost estimate')"/>
+
</label>
+
<input type="text" name="values[budget]">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'Enter the
budget')"/>
+
</xsl:attribute>
+
</input>
+
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+
<xsl:variable name="lang_period">
+
<xsl:value-of select="php:function('lang', 'period')"/>
+
</xsl:variable>
+
+
<select name="values[budget_period]">
+
<xsl:attribute name="title">
+
<xsl:value-of select='$lang_period'/>
+
</xsl:attribute>
+
<xsl:apply-templates select="year_list/options"/>
+
</select>
+
+
<xsl:text> </xsl:text> [ <xsl:value-of select='$lang_period'/> ]
+ </div>
+ <div
class="pure-control-group">
+
<label>
+
<xsl:value-of select="php:function('lang', 'budget')"/>
+
</label>
+
+
<div class = 'pure-u-md-1-3'>
+
<!--div id="paging_4"> </div>
+
<div class="pure-table" id="datatable-container_4"/-->
+
<xsl:for-each select="datatable_def">
+
<xsl:if test="container = 'datatable-container_4'">
+
<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="data" select ='data'/>
+
<xsl:with-param name="tabletools" select
='tabletools' />
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+
</xsl:if>
+
</xsl:for-each>
+
+
</div>
+ </div>
+
+
+
+
+ <div
class="pure-control-group">
+
<label>
<xsl:value-of select="php:function('lang', 'payment')"/>
</label>
<input type="text" name="values[actual_cost]">
@@ -739,7 +791,7 @@
<!--div id="paging_4"> </div>
<div class="pure-table" id="datatable-container_4"/-->
<xsl:for-each select="datatable_def">
-
<xsl:if test="container = 'datatable-container_4'">
+
<xsl:if test="container = 'datatable-container_5'">
<xsl:call-template name="table_setup">
<xsl:with-param name="container" select
='container'/>
<xsl:with-param name="requestUrl" select
='requestUrl'/>
@@ -916,7 +968,7 @@
<div class="pure-table"
id="datatable-container_5"/>
<div
id="datatable-buttons_5"/-->
<xsl:for-each
select="datatable_def">
- <xsl:if test="container
= 'datatable-container_5'">
+ <xsl:if test="container
= 'datatable-container_6'">
<xsl:call-template name="table_setup">
<xsl:with-param name="container" select ='container'/>
<xsl:with-param name="requestUrl" select ='requestUrl'/>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14547] Syncromind: Merge 14400:14546 from trunk,
Sigurd Nes <=