[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14691] property: include coordinator in bulk update
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14691] property: include coordinator in bulk update of project/orders |
Date: |
Tue, 02 Feb 2016 13:04:56 +0000 |
Revision: 14691
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14691
Author: sigurdne
Date: 2016-02-02 13:04:53 +0000 (Tue, 02 Feb 2016)
Log Message:
-----------
property: include coordinator in bulk update of project/orders
Modified Paths:
--------------
branches/dev-syncromind/property/inc/class.boproject.inc.php
branches/dev-syncromind/property/inc/class.soproject.inc.php
branches/dev-syncromind/property/inc/class.uiproject.inc.php
branches/dev-syncromind/property/setup/phpgw_no.lang
branches/dev-syncromind/property/templates/base/project.xsl
Modified: branches/dev-syncromind/property/inc/class.boproject.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.boproject.inc.php
2016-02-01 18:57:44 UTC (rev 14690)
+++ branches/dev-syncromind/property/inc/class.boproject.inc.php
2016-02-02 13:04:53 UTC (rev 14691)
@@ -1016,9 +1016,9 @@
$this->so->delete($project_id);
}
- function bulk_update_status($start_date, $end_date,
$status_filter, $status_new, $execute, $type, $user_id, $ids, $paid,
$closed_orders, $ecodimb, $transfer_budget, $new_budget, $b_account_id)
+ function bulk_update_status($start_date, $end_date,
$status_filter, $status_new, $execute, $type, $coordinator, $new_coordinator,
$ids, $paid, $closed_orders, $ecodimb, $transfer_budget, $new_budget,
$b_account_id)
{
- return $this->so->bulk_update_status($start_date,
$end_date, $status_filter, $status_new, $execute, $type, $user_id, $ids, $paid,
$closed_orders, $ecodimb, $transfer_budget, $new_budget, $b_account_id);
+ return $this->so->bulk_update_status($start_date,
$end_date, $status_filter, $status_new, $execute, $type, $coordinator,
$new_coordinator, $ids, $paid, $closed_orders, $ecodimb, $transfer_budget,
$new_budget, $b_account_id);
}
public function get_user_list($selected = 0)
Modified: branches/dev-syncromind/property/inc/class.soproject.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.soproject.inc.php
2016-02-01 18:57:44 UTC (rev 14690)
+++ branches/dev-syncromind/property/inc/class.soproject.inc.php
2016-02-02 13:04:53 UTC (rev 14691)
@@ -2648,7 +2648,7 @@
$this->db->transaction_commit();
}
- public function bulk_update_status($start_date, $end_date,
$status_filter, $status_new, $execute, $type, $user_id = 0, $ids, $paid =
false, $closed_orders = false, $ecodimb = 0, $transfer_budget_year = 0,
$new_budget = array(), $b_account_id = 0)
+ public function bulk_update_status($start_date, $end_date,
$status_filter, $status_new, $execute, $type, $coordinator, $new_coordinator,
$ids, $paid = false, $closed_orders = false, $ecodimb = 0,
$transfer_budget_year = 0, $new_budget = array(), $b_account_id = 0)
{
if($transfer_budget_year && $execute && $new_budget)
{
@@ -2702,11 +2702,33 @@
$start_date -= 3600 * 24;
$end_date = $end_date ?
phpgwapi_datetime::date_to_timestamp($end_date) : time();
+ if((int)$new_coordinator && $ids)
+ {
+ $new_coordinator = (int)$new_coordinator;
+ switch($type)
+ {
+ case 'project':
+ $this->db->query("UPDATE
fm_{$type} SET coordinator = {$new_coordinator} WHERE id IN (" . implode(',',
$ids) . ")", __LINE__, __FILE__);
+ break;
+ case 'workorder':
+ $this->db->query("UPDATE
fm_{$type} SET user_id = {$new_coordinator} WHERE id IN (" . implode(',', $ids)
. ")", __LINE__, __FILE__);
+ break;
+ }
+ }
+
$filter = '';
- if($user_id)
+ if($coordinator)
{
- $user_id = (int)$user_id;
- $filter .= "AND fm_{$type}.coordinator =
$user_id";
+ $coordinator = (int)$coordinator;
+ switch($type)
+ {
+ case 'project':
+ $filter .= "AND
fm_{$type}.coordinator = $coordinator";
+ break;
+ case 'workorder':
+ $filter .= "AND
fm_{$type}.user_id = $coordinator";
+ break;
+ }
}
if($ecodimb)
@@ -2743,11 +2765,11 @@
$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}.closed, {$status_table}.descr as status
,{$title_field},{$table}.start_date,{$table}.project_type_id, count(project_id)
as num_open FROM {$table}"
+ $sql = "SELECT DISTINCT
{$table}.id,{$table}.coordinator,{$status_table}.closed, {$status_table}.descr
as status ,{$title_field},{$table}.start_date,{$table}.project_type_id,
count(project_id) as num_open FROM {$table}"
. " {$this->join} {$status_table} ON
{$table}.status = {$status_table}.id "
. " {$this->left_join}
fm_open_workorder_view ON {$table}.id = fm_open_workorder_view.project_id "
. " WHERE ({$table}.start_date >
{$start_date} AND {$table}.start_date < {$end_date} OR {$table}.start_date IS
NULL) {$filter}"
- . " GROUP BY {$table}.id,
{$status_table}.closed, {$status_table}.descr ,{$table}.name,
{$table}.start_date,project_type_id"
+ . " GROUP BY
{$table}.id,{$table}.coordinator, {$status_table}.closed, {$status_table}.descr
,{$table}.name, {$table}.start_date,project_type_id"
. " ORDER BY {$table}.id DESC";
break;
@@ -2781,11 +2803,11 @@
$end_period = (date('Y') - 1) .
13;
$join_method .= "
{$this->left_join} fm_ecobilagoverf ON ( fm_workorder.id =
fm_ecobilagoverf.pmwrkord_code AND fm_ecobilagoverf.periode > $start_period AND
fm_ecobilagoverf.periode < $end_period)";
$actual_cost =
',sum(fm_ecobilagoverf.godkjentbelop) AS actual_cost';
- $group_method = "GROUP BY
fm_workorder.id, fm_workorder.project_id, fm_workorder.account_id,
fm_workorder_status.closed,fm_workorder_status.descr,fm_project.project_type_id,fm_workorder.title,fm_workorder.start_date,fm_workorder.continuous";
+ $group_method = "GROUP BY
fm_workorder.id, fm_workorder.project_id, fm_workorder.account_id,
fm_workorder.coordinator,
fm_workorder_status.closed,fm_workorder_status.descr,fm_project.project_type_id,fm_workorder.title,fm_workorder.start_date,fm_workorder.continuous";
}
$this->_update_status_workorder($execute, $status_new, $ids);
- $sql = "SELECT {$table}.id,
{$table}.project_id,{$status_table}.closed, {$table}.account_id,
{$status_table}.descr as status ,{$title_field},{$table}.start_date
{$actual_cost},"
+ $sql = "SELECT {$table}.id,
{$table}.project_id,{$table}.user_id as coordinator, {$status_table}.closed,
{$table}.account_id, {$status_table}.descr as status
,{$title_field},{$table}.start_date {$actual_cost},"
. " project_type_id, continuous"
. " FROM {$table} {$join_method}"
. " WHERE ({$table}.start_date >
{$start_date} AND {$table}.start_date < {$end_date} {$filter}) OR
{$table}.start_date is NULL"
@@ -2813,6 +2835,7 @@
(
'id' => $this->db->f('id'),
'project_id' =>
$this->db->f('project_id'),
+ 'coordinator' =>
$this->db->f('coordinator'),
'closed' => $this->db->f('closed'),
'title' => $this->db->f('title', true),
'status' => $this->db->f('status',
true),
@@ -2825,7 +2848,7 @@
'b_account_id' =>
$this->db->f('account_id')// only applies to workorders
);
}
-
+// _debug_array($values);die();
foreach($values as &$entry)
{
$sql = sprintf($sql_budget, $entry['id']);
@@ -2857,6 +2880,7 @@
$entry['budget'] = implode(' ;', $budget);
$entry['latest_year'] = $_year;
$entry['active_amount'] =
array_sum($_active_amount);
+ $entry['coordinator_name'] =
$GLOBALS['phpgw']->accounts->get($entry['coordinator'])->__toString();
}
return $values;
Modified: branches/dev-syncromind/property/inc/class.uiproject.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiproject.inc.php
2016-02-01 18:57:44 UTC (rev 14690)
+++ branches/dev-syncromind/property/inc/class.uiproject.inc.php
2016-02-02 13:04:53 UTC (rev 14691)
@@ -2370,15 +2370,17 @@
$b_account_id = phpgw::get_var('b_account_id',
'integer');
$b_account_name = phpgw::get_var('b_account_name');
- if(isset($_POST['user_id']))
+ if(isset($_POST['coordinator']))
{
- $user_id = phpgw::get_var('user_id', 'int');
+ $coordinator = phpgw::get_var('coordinator',
'int');
}
else
{
- $user_id = $this->account;
+ $coordinator = $this->account;
}
+ $new_coordinator = phpgw::get_var('new_coordinator',
'int');
+
$ids = $ids ? $ids : array();
$new_budget = array();
@@ -2401,7 +2403,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, $paid, $closed_orders, $ecodimb,
$transfer_budget, $new_budget, $b_account_id);
+ $list =
$this->bo->bulk_update_status($start_date, $end_date, $status_filter,
$status_new, $execute, $type, $coordinator, $new_coordinator, $ids, $paid,
$closed_orders, $ecodimb, $transfer_budget, $new_budget, $b_account_id);
}
foreach($list as &$entry)
@@ -2464,9 +2466,12 @@
switch($type)
{
case 'project':
+ $lang_coordinator = lang('coordinator');
+ $lang_new_coordinator = lang('new
coordinator');
$myColumnDefs = array
(
array('key' => 'id', 'label' =>
lang('id'), 'sortable' => true, 'formatter' => 'JqueryPortico.formatLink'),
+ array('key' =>
'coordinator_name', 'label' => lang('coordinator'), 'sortable' => false),
array('key' => 'start_date',
'label' => lang('date'), 'sortable' => false),
array('key' => 'title', 'label'
=> lang('title'), 'sortable' => true),
array('key' => 'status',
'label' => lang('status'), 'sortable' => true),
@@ -2485,12 +2490,15 @@
break;
case 'workorder':
+ $lang_coordinator = lang('janitor');
+ $lang_new_coordinator = lang('new
janitor');
$lang_actual_cost = $paid ?
lang('actual cost') . ' ' . lang('total') : lang('actual cost') . ' ' .
(date('Y') - 1);
$myColumnDefs = array
(
array('key' => 'project_id',
'label' => lang('project'), 'sortable' => true),
array('key' => 'id', 'label' =>
lang('id'), 'sortable' => true, 'formatter' => 'JqueryPortico.formatLink'),
+ array('key' =>
'coordinator_name', 'label' => lang('janitor'), 'sortable' => false),
array('key' => 'start_date',
'label' => lang('date'), 'sortable' => false),
array('key' => 'title', 'label'
=> lang('title'), 'sortable' => true),
array('key' => 'status',
'label' => lang('status'), 'sortable' => true),
@@ -2537,12 +2545,7 @@
)
);
- $user_list = $this->bocommon->get_user_list('select',
$user_id, $extra = false, $default = $user_id, $start = -1, $sort = 'ASC',
$order = 'account_lastname', $query = '', $offset = -1);
- foreach($user_list as &$entry)
- {
- $entry['id'] = $entry['user_id'];
- }
- unset($entry);
+ $user_list =
$this->bocommon->get_user_list_right2('select', PHPGW_ACL_EDIT, $coordinator,
$this->acl_location);
switch($type)
{
@@ -2630,7 +2633,8 @@
'type' => $type,
'b_account_data' => $b_account_data,
'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
- 'td_count' => $td_count
+ 'lang_coordinator' => $lang_coordinator,
+ 'lang_new_coordinator' => $lang_new_coordinator,
);
$appname = lang('project');
Modified: branches/dev-syncromind/property/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/property/setup/phpgw_no.lang 2016-02-01
18:57:44 UTC (rev 14690)
+++ branches/dev-syncromind/property/setup/phpgw_no.lang 2016-02-02
13:04:53 UTC (rev 14691)
@@ -1,3 +1,5 @@
+new coordinator property no Ny koordinator
+transfer budget property no Overfør budsjett
economy property no Økonomi
%1 buildings has been updated to not active of %2 already not active
property no %1 Bygninger er oppdatert til IKKE AKTIVE av %2 som var
IKKE AKTIVE fra før
%1 entrances has been updated to not active of %2 already not active
property no %1 Innganger er oppdatert til IKKE AKTIVE av %2 som var
IKKE AKTIVE fra før
@@ -959,6 +961,7 @@
is there a demand from the authorities to correct this condition?
property no Finnes det myndighetskrav for å rette opp tilstanden?
items property no Detaljer
janitor property no Bestiller
+new janitor property no Ny bestiller
jasper reports property no JasperReports
jasper upload property no opplasting av JasperReports
key deliver location property no Sted for å levere nøkkel
Modified: branches/dev-syncromind/property/templates/base/project.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/project.xsl 2016-02-01
18:57:44 UTC (rev 14690)
+++ branches/dev-syncromind/property/templates/base/project.xsl 2016-02-02
13:04:53 UTC (rev 14691)
@@ -933,9 +933,9 @@
</div>
<div class="pure-control-group">
<label for="name">
- <xsl:value-of
select="php:function('lang', 'user')"/>
+ <xsl:value-of
select="lang_coordinator"/>
</label>
- <select name="user_id">
+ <select name="coordinator">
<xsl:attribute
name="title">
<xsl:value-of
select="php:function('lang', 'select user')"/>
</xsl:attribute>
@@ -946,6 +946,24 @@
</select>
</div>
<div class="pure-control-group">
+ <label for="new_coordinator">
+ <xsl:value-of
select="lang_new_coordinator"/>
+ </label>
+ <select name="new_coordinator">
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="php:function('lang', 'select user')"/>
+ </xsl:attribute>
+ <option value="0">
+ <xsl:value-of
select="php:function('lang', 'select')"/>
+ </option>
+ <xsl:for-each
select="user_list/options">
+ <option
value="{id}">
+
<xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </div>
+ <div class="pure-control-group">
<label for="name">
<xsl:value-of
select="php:function('lang', 'type')"/>
</label>
@@ -1046,6 +1064,12 @@
</input>
</div>
<div class="pure-control-group">
+ <label for="name">
+ <xsl:value-of
select="php:function('lang', 'count')"/>
+ </label>
+ <xsl:value-of
select="total_records"/>
+ </div>
+ <div class="pure-control-group">
<label for="name"></label>
<div class="pure-custom">
<xsl:for-each
select="datatable_def">
@@ -1078,4 +1102,4 @@
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
-</xsl:template>
+</xsl:template>
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14691] property: include coordinator in bulk update of project/orders,
Sigurd Nes <=