[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10716] property: bulk update budget
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10716] property: bulk update budget |
Date: |
Sun, 27 Jan 2013 18:57:21 +0000 |
Revision: 10716
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10716
Author: sigurdne
Date: 2013-01-27 18:57:20 +0000 (Sun, 27 Jan 2013)
Log Message:
-----------
property: bulk update budget
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/js/yahoo/project.bulk_update_status.js
trunk/property/templates/base/project.xsl
Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php 2013-01-25 14:32:52 UTC (rev
10715)
+++ trunk/property/inc/class.boproject.inc.php 2013-01-27 18:57:20 UTC (rev
10716)
@@ -884,9 +884,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)
+ 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)
{
- 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);
+ 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);
}
public function get_user_list($selected = 0)
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2013-01-25 14:32:52 UTC (rev
10715)
+++ trunk/property/inc/class.soproject.inc.php 2013-01-27 18:57:20 UTC (rev
10716)
@@ -2580,13 +2580,26 @@
}
- 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=0)
+ 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=0,$new_budget = array())
{
- if($transfer_budget)
+ if($transfer_budget && $execute)
{
echo "<H1> Overføre budsjett for valgte
prosjekt/bestillinger til år {$transfer_budget} </H1>";
- _debug_array($ids);
+
+//_debug_array($new_budget);
+
+ foreach($new_budget as $_id => $_budget)
+ {
+ if((int)$_budget['latest_year'] >=
(int)$transfer_budget)
+ {
+ continue;
+ }
+_debug_array($_id);
+_debug_array($_budget);
+
+ }
+
die();
}
@@ -2709,14 +2722,17 @@
$this->db->query($sql,__LINE__,__FILE__);
$budget = array();
+ $_year = 0;
while ($this->db->next_record())
{
+ $_year = $this->db->f('year');
$_active = $this->db->f('active') ? X :
0;
$_budget =
number_format((int)$this->db->f('budget'), 0, ',', '.');
- $budget[] = $this->db->f('year') . "
[{$_active}/ {$_budget}]";
+ $budget[] = $_year . " [{$_active}/
{$_budget}]";
}
$entry['budget'] = implode(' ;', $budget);
+ $entry['latest_year'] = $_year;
}
return $values;
Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php 2013-01-25 14:32:52 UTC (rev
10715)
+++ trunk/property/inc/class.uiproject.inc.php 2013-01-27 18:57:20 UTC (rev
10716)
@@ -2245,7 +2245,20 @@
$paid = phpgw::get_var('paid',
'bool', 'POST');
$closed_orders = phpgw::get_var('closed_orders',
'bool', 'POST');
$transfer_budget= phpgw::get_var('transfer_budget',
'integer');
-
+ $__new_budget = phpgw::get_var('new_budget');
+
+ $_new_budget = explode(',', trim($__new_budget, ','));
+
+ $new_budget = array();
+ foreach($_new_budget as $_entry)
+ {
+ $budget_arr = explode('::', $_entry);
+ $new_budget[$budget_arr[0]][$budget_arr[1]] =
$budget_arr[2];
+ }
+ unset($_entry);
+ unset($budget_arr);
+
+//_debug_array($new_budget);die();
if(isset($_POST['user_id']))
{
$user_id = phpgw::get_var('user_id',
'int');
@@ -2275,7 +2288,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);
+ $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);
}
foreach ($list as &$entry)
@@ -2286,40 +2299,37 @@
if($entry['project_type_id'] != 3)
{
$_obligation = 0;
+ $_order = 0;
if(!$entry['closed'] && $type ==
'project')
{
$_budget_arr =
$this->bo->get_budget($entry['id']);
- foreach($_budget_arr as
$_budget_entry)
- {
-
if($_budget_entry['active'])
- {
- $_obligation +=
$_budget_entry['sum_oblications'];
- }
- }
-
- $_obligation =
round($_obligation);
-
- $entry['new_budget'] = "<input
type='text' name='values[new_budget][{$entry['id']}]' value='{$_obligation}'
title=''>";
}
if(!$entry['closed'] && $type ==
'workorder')
{
$_budget_arr =
execMethod('property.soworkorder.get_budget', $entry['id']);
+ }
+
+ if($_budget_arr)
+ {
foreach($_budget_arr as
$_budget_entry)
{
if($_budget_entry['active'])
{
$_obligation +=
$_budget_entry['sum_oblications'];
+ $_order +=
$_budget_entry['sum_orders'];
}
}
$_obligation =
round($_obligation);
- $entry['new_budget'] = "<input
type='text' name='values[new_budget][{$entry['id']}]' value='{$_obligation}'
title=''>";
+ $entry['new_budget'] = "<input
type='text' class='myValuesForPHP' id='{$entry['id']}::budget_amount'
name='{$entry['id']}::budget_amount' value='{$_obligation}' title=''></input>";
+ $entry['new_budget'] .= "<input
type='hidden' class='myValuesForPHP' id='{$entry['id']}::obligation'
name='{$entry['id']}::obligation' value='{$_obligation}' ></input>";
+ $entry['new_budget'] .= "<input
type='hidden' class='myValuesForPHP' id='{$entry['id']}::order_amount'
name='{$entry['id']}::order_amount' value='{$_order}'></input>";
+ $entry['new_budget'] .= "<input
type='hidden' class='myValuesForPHP' id='{$entry['id']}::latest_year'
name='{$entry['id']}::latest_year' value='{$entry['latest_year']}'></input>";
+
}
-
-
}
$entry['obligation'] = $_obligation;
}
Modified: trunk/property/js/yahoo/project.bulk_update_status.js
===================================================================
--- trunk/property/js/yahoo/project.bulk_update_status.js 2013-01-25
14:32:52 UTC (rev 10715)
+++ trunk/property/js/yahoo/project.bulk_update_status.js 2013-01-27
18:57:20 UTC (rev 10716)
@@ -71,6 +71,21 @@
}
}
document.form.id_to_update.value = values_tophp;
+ valuesForPHP =
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');
+
+ values_tophp = [];
+ var temp_id = false;
+ var temp_value = false;
+
+ for(i=0;i<valuesForPHP.length;i++)
+ {
+ temp_id = valuesForPHP[i].name;
+ temp_value = valuesForPHP[i].value;
+ // values_tophp[temp_id] = temp_value;
+ values_tophp[i] = temp_id + '::' + temp_value;
+
+ }
+ document.form.new_budget.value = values_tophp;
}
Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl 2013-01-25 14:32:52 UTC (rev
10715)
+++ trunk/property/templates/base/project.xsl 2013-01-27 18:57:20 UTC (rev
10716)
@@ -1066,6 +1066,7 @@
<div id="paging_0">
</div>
<div
id="datatable-container_0"/>
<input type="hidden"
name="id_to_update" value=""/>
+ <input type="hidden"
name="new_budget" value=""/>
</td>
</tr>
</form>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10716] property: bulk update budget,
Sigurd Nes <=