fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11630] property: more on project/workorder bulk_upda


From: Sigurd Nes
Subject: [Fmsystem-commits] [11630] property: more on project/workorder bulk_update
Date: Sun, 26 Jan 2014 16:17:30 +0000

Revision: 11630
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11630
Author:   sigurdne
Date:     2014-01-26 16:17:29 +0000 (Sun, 26 Jan 2014)
Log Message:
-----------
property: more on project/workorder bulk_update

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/templates/base/project.xsl

Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php  2014-01-24 14:57:30 UTC (rev 
11629)
+++ trunk/property/inc/class.boproject.inc.php  2014-01-26 16:17:29 UTC (rev 
11630)
@@ -885,9 +885,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)
+               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)
                {
-                       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);
+                       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);
                }
 
                public function get_user_list($selected = 0)

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2014-01-24 14:57:30 UTC (rev 
11629)
+++ trunk/property/inc/class.soproject.inc.php  2014-01-26 16:17:29 UTC (rev 
11630)
@@ -2236,7 +2236,7 @@
                                }
 
                                $entry['deviation_acc'] = abs($deviation) > 0 ? 
$deviation_acc : 0;
-                               
+
                                $entry['deviation_percent_period'] = $corretion 
* $deviation/$entry['budget'] * 100;
                                $entry['deviation_percent_acc'] = $corretion * 
$entry['deviation_acc']/$total_sum * 100;
                                $entry['closed'] = 
$closed_period[$entry['period']];
@@ -2263,7 +2263,7 @@
                        $project_id = (int) $project_id;
                        $closed_orig_b_period = 
isset($data['closed_orig_b_period']) && $data['closed_orig_b_period'] ? 
$data['closed_orig_b_period'] : array();
                        $closed_b_period = isset($data['closed_b_period']) && 
$data['closed_b_period'] ? $data['closed_b_period'] : array();
-                       
+
                        $close_period = array();
                        $open_period = array();
 
@@ -2412,7 +2412,7 @@
 
                                        if($request_project_hookup_status)
                                        {
-                                               $this->db->query("UPDATE 
fm_request SET status='{$request_project_hookup_status}' WHERE id='". 
$add_request['request_id'][$i] . "'",__LINE__,__FILE__);                        
         
+                                               $this->db->query("UPDATE 
fm_request SET status='{$request_project_hookup_status}' WHERE id='". 
$add_request['request_id'][$i] . "'",__LINE__,__FILE__);
                                        }
 
                                        $receipt['message'][] = 
array('msg'=>lang('request %1 has been added',$add_request['request_id'][$i]));
@@ -2551,7 +2551,7 @@
                }
 
 
-               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())
+               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)
                {
                        if($transfer_budget_year && $execute && $new_budget)
                        {
@@ -2660,6 +2660,11 @@
                                        $sql_budget = "SELECT DISTINCT year, 
month, active, sum(combined_cost) as amount FROM fm_workorder_budget WHERE ";
                                        $sql_budget .= 'order_id = %d GROUP BY 
year, month, active ORDER BY year';
 
+                                       if($b_account_id)
+                                       {
+                                               $filter .=  " AND 
fm_workorder.account_id = '{$b_account_id}'";
+                                       }
+
                                        $table = 'fm_workorder';
                                        $status_table = 'fm_workorder_status';
                                        $title_field = 'fm_workorder.title';
@@ -2680,11 +2685,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_status.closed,fm_workorder_status.descr,fm_project.project_type_id";
+                                               $group_method = "GROUP BY 
fm_workorder.id, fm_workorder.account_id, 
fm_workorder_status.closed,fm_workorder_status.descr,fm_project.project_type_id";
                                        }
 
                                        
$this->_update_status_workorder($execute, $status_new, $ids);
-                                       $sql = "SELECT {$table}.id, 
{$table}.project_id,{$status_table}.closed, {$status_table}.descr as status 
,{$title_field},{$table}.start_date {$actual_cost},"
+                                       $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},"
                                        . " 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"
@@ -2720,6 +2725,7 @@
                                        'project_type_id'       => 
$this->db->f('project_type_id'),
                                        'continuous'            => 
$this->db->f('continuous') ? X : '',
                                        'project_type'          => 
$project_types[$this->db->f('project_type_id')],
+                                       'b_account_id'          => 
$this->db->f('account_id')// only applies to workorders
                                );
                        }
 

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2014-01-24 14:57:30 UTC (rev 
11629)
+++ trunk/property/inc/class.uiproject.inc.php  2014-01-26 16:17:29 UTC (rev 
11630)
@@ -2545,6 +2545,8 @@
                        $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, ','));
 
@@ -2587,7 +2589,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);
+                               $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);
                        }
 
                        foreach ($list as &$entry)
@@ -2673,6 +2675,8 @@
                                                                                
                                array('key' => 'select','label'=> 
lang('select'), 
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>30)
                                                                                
                                ))
                                        );
+                                       $b_account_data = array();
+                                       $td_count = 9;
                                        break;
                                case 'workorder':
                                        $lang_actual_cost = $paid ? 
lang('actual cost') . ' ' . lang('total') : lang('actual cost') . ' ' . 
(date('Y')-1);
@@ -2687,6 +2691,7 @@
                                                                                
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'project_type','label'=>lang('project 
type'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'b_account_id','label'=>lang('budget 
account'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true),
                                                                                
                                array('key' => 
'obligation','label'=>lang('obligation'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterRight'),
                                                                                
                                array('key' => 
'continuous','label'=>lang('continuous'),'sortable'=>true,'resizeable'=>true),
@@ -2696,6 +2701,16 @@
                                                                                
                                ))
                                        );
 
+
+                                       $b_account_data = 
$this->bocommon->initiate_ui_budget_account_lookup(array(
+                                               'b_account_id'          => 
$b_account_id,
+                               //              'b_account_name'        => 
$b_account_name,
+                                               'disabled'                      
=> '',
+                                               'parent'                        
=> $project['b_account_id'],
+                                               'type'                          
=> 'form'
+                                               )
+                                       );
+                                       $td_count = 12;
                                        break;
                        }
 
@@ -2792,7 +2807,10 @@
                                'paid'                                  => 
$paid,
                                'closed_orders'                 => 
$closed_orders,
                                'check_paid'                    => $type == 
'workorder' ? 1 : 0,
-                               'check_closed_orders'   => $type == 'project' ? 
1 : 0
+                               'check_closed_orders'   => $type == 'project' ? 
1 : 0,
+                               'type'                                  => 
$type,
+                               'b_account_data'                => 
$b_account_data,
+                               'td_count'                              => 
$td_count
                        );
 
 

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2014-01-24 14:57:30 UTC (rev 
11629)
+++ trunk/property/templates/base/project.xsl   2014-01-26 16:17:29 UTC (rev 
11630)
@@ -1025,6 +1025,11 @@
                                                        </select>
                                                </td>
                                        </tr>
+                                       <xsl:choose>
+                                               <xsl:when 
test="type='workorder'">
+                                                       <xsl:call-template 
name="b_account_form"/>
+                                               </xsl:when>
+                                       </xsl:choose>
                                        <tr>
                                                <td>
                                                        <xsl:value-of 
select="php:function('lang', 'status filter')"/>
@@ -1147,7 +1152,7 @@
                        //var base_java_url = <xsl:value-of 
select="base_java_url"/>;
                        var datatable = new Array();
                        var myColumnDefs = new Array();
-                       var td_count = 5;
+                       var td_count = <xsl:value-of select="td_count"/>;
                        <xsl:for-each select="datatable">
                                datatable[<xsl:value-of select="name"/>] = [
                                        {




reply via email to

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