fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [12972] simplify bulk update


From: Sigurd Nes
Subject: [Fmsystem-commits] [12972] simplify bulk update
Date: Thu, 09 Apr 2015 10:38:40 +0000

Revision: 12972
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12972
Author:   sigurdne
Date:     2015-04-09 10:38:39 +0000 (Thu, 09 Apr 2015)
Log Message:
-----------
simplify bulk update

Modified Paths:
--------------
    branches/dev-syncromind/property/inc/class.uiproject.inc.php
    branches/dev-syncromind/property/js/portico/project.bulk_update_status.js

Modified: branches/dev-syncromind/property/inc/class.uiproject.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiproject.inc.php        
2015-04-09 04:24:03 UTC (rev 12971)
+++ branches/dev-syncromind/property/inc/class.uiproject.inc.php        
2015-04-09 10:38:39 UTC (rev 12972)
@@ -2312,25 +2312,13 @@
                        $status_new     = phpgw::get_var('status_new');
                        $type                   = 
phpgw::get_var('type','string', 'REQUEST' , 'project');
                        $ecodimb                = phpgw::get_var('ecodimb');
-                       $id_to_update   = phpgw::get_var('id_to_update');
+                       $ids                    = phpgw::get_var('ids');
                        $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');
                        $b_account_id   = phpgw::get_var('b_account_id', 
'integer');
                        $b_account_name = phpgw::get_var('b_account_name');
 
-                       $_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);
-
                        if(isset($_POST['user_id']))
                        {
                                $user_id        = phpgw::get_var('user_id', 
'int');
@@ -2340,14 +2328,16 @@
                                $user_id        = $this->account;
                        }
 
-                       if($id_to_update)
-                       {
-                               $ids = 
array_values(explode(',',trim($id_to_update,',')));
-                       }
+                       $ids = $ids ? $ids : array();
 
-                       else
+                       $new_budget = array();
+
+                       foreach($ids as $id)
                        {
-                               $ids = array();
+                               $new_budget[$id]['budget_amount']       = 
phpgw::get_var("{$id}::budget_amount");
+                               $new_budget[$id]['obligation']          = 
phpgw::get_var("{$id}::obligation");
+                               $new_budget[$id]['order_amount']        = 
phpgw::get_var("{$id}::order_amount");
+                               $new_budget[$id]['latest_year']         = 
phpgw::get_var("{$id}::latest_year");
                        }
 
                        $link_data = array
@@ -2396,11 +2386,10 @@
 
                                                $_obligation = 
round($_obligation);
 
-                                               $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['new_budget'] = "<input 
type='text'     name='{$entry['id']}::budget_amount' value='{$_obligation}' 
title=''></input>";
+                                               $entry['new_budget'] .= "<input 
type='hidden'  name='{$entry['id']}::obligation' value='{$_obligation}' 
></input>";
+                                               $entry['new_budget'] .= "<input 
type='hidden'  name='{$entry['id']}::order_amount' value='{$_order}'></input>";
+                                               $entry['new_budget'] .= "<input 
type='hidden'  name='{$entry['id']}::latest_year' 
value='{$entry['latest_year']}'></input>";
                                        }
                                }
                                else if ($entry['project_type_id'] == 2)

Modified: 
branches/dev-syncromind/property/js/portico/project.bulk_update_status.js
===================================================================
--- branches/dev-syncromind/property/js/portico/project.bulk_update_status.js   
2015-04-09 04:24:03 UTC (rev 12971)
+++ branches/dev-syncromind/property/js/portico/project.bulk_update_status.js   
2015-04-09 10:38:39 UTC (rev 12972)
@@ -1,36 +1,10 @@
 
-var values_tophp = [];
-
 var myFormatterCheck = function(key, oData)
 {
-       return  "<input type='checkbox' class='mychecks' value='"+ oData['id'] 
+"' name='dummy'/>";
+       return  "<input type='checkbox' class='mychecks' value='"+ oData['id'] 
+"' name='ids[]'/>";
 };
 
 var onActionsClick = function()
 {
-       //array_checks = YAHOO.util.Dom.getElementsByClassName('mychecks');
-       array_checks = $('.mychecks');
 
-       for(i=0;i<array_checks.length;i++)
-       {
-               if((array_checks[i].checked) )
-               {
-                       values_tophp[i] = array_checks[i].value;
-               }
-       }
-       $('#id_to_update').val(values_tophp);
-       valuesForPHP = $('.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;
-       }
-       $('#new_budget').val(values_tophp);
-};
\ No newline at end of file
+};




reply via email to

[Prev in Thread] Current Thread [Next in Thread]