[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8510] property: bulk_update_status
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8510] property: bulk_update_status |
Date: |
Fri, 06 Jan 2012 19:40:16 +0000 |
Revision: 8510
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8510
Author: sigurdne
Date: 2012-01-06 19:40:15 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
property: bulk_update_status
Modified Paths:
--------------
trunk/property/inc/class.boproject.inc.php
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.uiproject.inc.php
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_update.inc.php
trunk/property/templates/base/project.xsl
Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php 2012-01-06 14:03:49 UTC (rev
8509)
+++ trunk/property/inc/class.boproject.inc.php 2012-01-06 19:40:15 UTC (rev
8510)
@@ -806,8 +806,8 @@
$this->so->delete($project_id);
}
- function bulk_update_status($start_date, $end_date,
$status_filter, $status_new, $execute, $type, $user_id,$ids)
+ function bulk_update_status($start_date, $end_date,
$status_filter, $status_new, $execute, $type,
$user_id,$ids,$paid,$closed_orders)
{
- return $this->so->bulk_update_status($start_date,
$end_date, $status_filter, $status_new, $execute, $type, $user_id,$ids);
+ return $this->so->bulk_update_status($start_date,
$end_date, $status_filter, $status_new, $execute, $type,
$user_id,$ids,$paid,$closed_orders);
}
}
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2012-01-06 14:03:49 UTC (rev
8509)
+++ trunk/property/inc/class.soproject.inc.php 2012-01-06 19:40:15 UTC (rev
8510)
@@ -1285,7 +1285,7 @@
}
- function bulk_update_status($start_date, $end_date,
$status_filter, $status_new, $execute, $type, $user_id = 0,$ids)
+ function bulk_update_status($start_date, $end_date,
$status_filter, $status_new, $execute, $type, $user_id = 0,$ids,$paid = false,
$closed_orders = false)
{
$start_date = $start_date ?
phpgwapi_datetime::date_to_timestamp($start_date) : time();
$end_date = $end_date ?
phpgwapi_datetime::date_to_timestamp($end_date) : time();
@@ -1306,20 +1306,29 @@
switch($type)
{
case 'project':
+ if($closed_orders)
+ {
+ $filter .= " AND
fm_open_workorder.project_id IS NULL";
+ }
+
$table = 'fm_project';
$status_table = 'fm_project_status';
$title_field = 'fm_project.name as
title';
$this->_update_status_project($execute,
$status_new, $ids);
$sql = "SELECT DISTINCT {$table}.id,
$status_table.descr as status ,{$title_field},{$table}.start_date,
count(project_id) as num_open FROM {$table}"
. " {$this->join} {$status_table} ON
{$table}.status = {$status_table}.id "
- . " {$this->left_join} fm_workorder ON
{$table}.id = fm_workorder.project_id "
- . " {$this->join} fm_workorder_status
ON fm_workorder.status = fm_workorder_status.id "
- . " WHERE ({$table}.start_date >
{$start_date} AND {$table}.start_date < {$end_date} {$filter}) AND
fm_workorder_status.delivered IS NULL AND fm_workorder_status.closed IS NULL"
+ . " {$this->left_join}
fm_open_workorder ON {$table}.id = fm_open_workorder.project_id "
+ . " WHERE ({$table}.start_date >
{$start_date} AND {$table}.start_date < {$end_date} {$filter})"
. " GROUP BY {$table}.id,
$status_table.descr ,{$table}.name, {$table}.start_date"
. " ORDER BY {$table}.id DESC";
break;
case 'workorder':
+ if($paid)
+ {
+ $filter .= " AND (act_mtrl_cost
> 0 OR act_vendor_cost > 0)";
+ }
+
$table = 'fm_workorder';
$status_table = 'fm_workorder_status';
$title_field = 'fm_workorder.title';
Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php 2012-01-06 14:03:49 UTC (rev
8509)
+++ trunk/property/inc/class.uiproject.inc.php 2012-01-06 19:40:15 UTC (rev
8510)
@@ -1976,6 +1976,9 @@
$type = phpgw::get_var('type');
$user_id = phpgw::get_var('user_id',
'int');
$id_to_update = phpgw::get_var('id_to_update');
+ $paid = phpgw::get_var('paid',
'bool', 'POST');
+ $closed_orders = phpgw::get_var('closed_orders',
'bool', 'POST');
+
if($id_to_update)
{
@@ -1998,7 +2001,7 @@
if(($execute || $get_list) && $type)
{
- $list =
$this->bo->bulk_update_status($start_date, $end_date, $status_filter,
$status_new, $execute, $type, $user_id,$ids);
+ $list =
$this->bo->bulk_update_status($start_date, $end_date, $status_filter,
$status_new, $execute, $type, $user_id,$ids,$paid,$closed_orders);
}
$total_records = count($list);
@@ -2070,13 +2073,13 @@
),
array
(
- 'id' => 'project',
- 'name' => lang('project')
+ 'id' => 'workorder',
+ 'name' => lang('workorder')
),
array
(
- 'id' => 'workorder',
- 'name' => lang('workorder')
+ 'id' => 'project',
+ 'name' => lang('project')
)
);
@@ -2099,7 +2102,11 @@
'user_list' =>
array('options' => $user_list),
'start_date' => $start_date,
'end_date' =>
$end_date,
- 'total_records' =>
$total_records
+ 'total_records' =>
$total_records,
+ 'paid' =>
$paid,
+ 'closed_orders' =>
$closed_orders,
+ 'check_paid' => $type ==
'workorder' ? 1 : 0,
+ 'check_closed_orders' => $type == 'project' ?
1 : 0
);
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2012-01-06 14:03:49 UTC (rev 8509)
+++ trunk/property/setup/setup.inc.php 2012-01-06 19:40:15 UTC (rev 8510)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.630';
+ $setup_info['property']['version'] = '0.9.17.631';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2012-01-06 14:03:49 UTC (rev
8509)
+++ trunk/property/setup/tables_update.inc.php 2012-01-06 19:40:15 UTC (rev
8510)
@@ -5756,7 +5756,29 @@
}
}
+
/**
+ * Update property version from 0.9.17.630 to 0.9.17.631
+ * keep track of projects with open orders
+ */
+ $test[] = '0.9.17.630';
+ function property_upgrade0_9_17_630()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+ $sql = 'CREATE OR REPLACE VIEW fm_open_workorder AS'
+ . ' SELECT fm_workorder.id, fm_workorder.project_id,
fm_workorder_status.descr FROM fm_workorder'
+ . ' JOIN fm_workorder_status ON fm_workorder.status =
fm_workorder_status.id WHERE fm_workorder_status.delivered IS NULL AND
fm_workorder_status.closed IS NULL';
+
+ $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.631';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
+ /**
* Update property version from 0.9.17.607 to 0.9.17.608
* Add more room for address at tickets
*
Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl 2012-01-06 14:03:49 UTC (rev
8509)
+++ trunk/property/templates/base/project.xsl 2012-01-06 19:40:15 UTC (rev
8510)
@@ -850,6 +850,44 @@
</select>
</td>
</tr>
+ <xsl:choose>
+ <xsl:when test="check_paid = 1">
+ <tr>
+ <td>
+
<xsl:value-of select="php:function('lang', 'paid')"/>
+ </td>
+ <td>
+ <input
type="checkbox" name="paid" value="True">
+
<xsl:if test="paid = 1">
+
<xsl:attribute name="checked" value="checked"/>
+
</xsl:if>
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'workorder')"/>
+
</xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="check_closed_orders = 1">
+ <tr>
+ <td>
+
<xsl:value-of select="php:function('lang', 'closed')"/>
+ </td>
+ <td>
+ <input
type="checkbox" name="closed_orders" value="True">
+
<xsl:if test="closed_orders = 1">
+
<xsl:attribute name="checked" value="checked"/>
+
</xsl:if>
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'projekt')"/>
+
</xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
<tr>
<td>
</td>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8510] property: bulk_update_status,
Sigurd Nes <=