fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6516] Property: fix order-from-template


From: Sigurd Nes
Subject: [Fmsystem-commits] [6516] Property: fix order-from-template
Date: Wed, 27 Oct 2010 13:13:35 +0000

Revision: 6516
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6516
Author:   sigurdne
Date:     2010-10-27 13:13:35 +0000 (Wed, 27 Oct 2010)
Log Message:
-----------
Property: fix order-from-template

Modified Paths:
--------------
    trunk/property/inc/class.bowo_hour.inc.php
    trunk/property/inc/class.uiwo_hour.inc.php

Modified: trunk/property/inc/class.bowo_hour.inc.php
===================================================================
--- trunk/property/inc/class.bowo_hour.inc.php  2010-10-27 12:57:39 UTC (rev 
6515)
+++ trunk/property/inc/class.bowo_hour.inc.php  2010-10-27 13:13:35 UTC (rev 
6516)
@@ -289,7 +289,7 @@
                                }
                                $quantity               = 
str_replace(",",".",$quantity);
 
-                               
$cost=($values['total_cost'][$n]*$values['quantity'][$n]);
+                               $cost=($values['total_cost'][$n]*$quantity);
 
                                $hour[]=array(
                                        'activity_id'           => 
$values['activity_id'][$n],
@@ -325,45 +325,42 @@
 
 //_debug_array($values);
 
-                       if ($values['select']) 
+                       foreach($values['quantity'] as $n => $quantity)
                        {
-                               foreach($values['select'] as $n)
+                               if(!$quantity)
                                {
-                                                                               
                        
-                                       if(!$values['quantity'][$n])
-                                       {
-                                               $values['quantity'][$n]=1;
-                                       }
+                                       continue;
+                               }
+
+                               if ($values['wo_hour_cat'][$n] && 
!$values['cat_per_cent'][$n])
+                               {
+                                       $values['cat_per_cent'][$n] = 100;
+                               }
        
-                                       if ($values['wo_hour_cat'][$n] && 
!$values['cat_per_cent'][$n])
-                                       {
-                                               $values['cat_per_cent'][$n] = 
100;
-                                       }
+                               $quantity               = 
str_replace(",",".",$quantity);
+                               $cost=($values['billperae'][$n]*$quantity);
        
-                                       $values['quantity'][$n]         = 
str_replace(",",".",$values['quantity'][$n]);
-                                       
$cost=($values['billperae'][$n]*$values['quantity'][$n]);
+                               $hour[]= array
+                               (
+                                       'chapter_id'            => 
$values['chapter_id'][$n],
+                                       'activity_id'           => 
$values['activity_id'][$n],
+                                       'activity_num'          => 
$values['activity_num'][$n],
+                                       'hours_descr'           => 
$values['hours_descr'][$n],
+                                       'remark'                        => 
$values['remark'][$n],
+                                       'unit'                          => 
$values['unit'][$n],
+                                       'cost'                          => 
$cost,
+                                       'quantity'                      => 
$quantity,
+                                       'new_grouping'          => 
$values['grouping_descr'][$n],
+                                       'billperae'                     => 
$values['billperae'][$n],
+                                       'ns3420_id'                     => 
$values['ns3420_id'][$n],
+                                       'tolerance'                     => 
$values['tolerance'][$n],
+                                       'building_part'         => 
$values['building_part'][$n],
+                                       'dim_d'                         => 
$values['dim_d'][$n],
+                                       'workorder_id'          => 
$workorder_id,
+                                       'wo_hour_cat'           => 
$values['wo_hour_cat'][$n],
+                                       'cat_per_cent'          => 
$values['cat_per_cent'][$n]
+                               );
        
-                                       $hour[]=array(
-                                               'chapter_id'            => 
$values['chapter_id'][$n],
-                                               'activity_id'           => 
$values['activity_id'][$n],
-                                               'activity_num'          => 
$values['activity_num'][$n],
-                                               'hours_descr'           => 
$values['hours_descr'][$n],
-                                               'remark'                => 
$values['remark'][$n],
-                                               'unit'                  => 
$values['unit'][$n],
-                                               'cost'                  => 
$cost,
-                                               'quantity'              => 
$values['quantity'][$n],
-                                               'new_grouping'          => 
$values['grouping_descr'][$n],
-                                               'billperae'             => 
$values['billperae'][$n],
-                                               'ns3420_id'             => 
$values['ns3420_id'][$n],
-                                               'tolerance'             => 
$values['tolerance'][$n],
-                                               'building_part'         => 
$values['building_part'][$n],
-                                               'dim_d'                 => 
$values['dim_d'][$n],
-                                               'workorder_id'          => 
$workorder_id,
-                                               'wo_hour_cat'           => 
$values['wo_hour_cat'][$n],
-                                               'cat_per_cent'          => 
$values['cat_per_cent'][$n]
-                                       );
-       
-                               }
                        }
 //_debug_array($hour);
 

Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php  2010-10-27 12:57:39 UTC (rev 
6515)
+++ trunk/property/inc/class.uiwo_hour.inc.php  2010-10-27 13:13:35 UTC (rev 
6516)
@@ -2472,7 +2472,7 @@
                        $workorder_id = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $template_id = phpgw::get_var('template_id', 'int');
 
-                       $values = phpgw::get_var('values');
+                       $values = $_POST['values'] ? phpgw::get_var('values') : 
array();
 
                        if($delete && $hour_id)
                        {
@@ -2486,7 +2486,7 @@
 
                        if($values['add'])
                        {
-                               
$receipt=$this->bo->add_hour_from_template($values,$workorder_id);
+                               $receipt = 
$this->bo->add_hour_from_template($values,$workorder_id);
                        }
 
                        $common_data=$this->common_data($workorder_id);
@@ -2575,12 +2575,12 @@
                        }
                                                                                
                                                                                
                        $uicols = array (
-                               'input_type'    =>      
array('text','text','text','text','text','varchar','select','combo','varchar','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden'),
-                               'type'                  =>      
array('','','','','','text','','','','text','','','',''),                       
        
-                               'name'                  =>      
array('building_part','code,hours_descr','unit','billperae','quantity','select','wo_hour_cat','cat_per_cent','chapter_id','grouping_descr','new_grouping','activity_id','activity_num','remark','ns3420_id','tolerance','cost','dim_d'),
+                               'input_type'    =>      
array('text','text','text','text','text','varchar','combo','varchar','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden'),
+                               'type'                  =>      
array('','','','','','text','','','text','','','',''),                          
+                               'name'                  =>      
array('building_part','code','hours_descr','unit','billperae','quantity','wo_hour_cat','cat_per_cent','chapter_id','grouping_descr','new_grouping','activity_id','activity_num','remark','ns3420_id','tolerance','cost','dim_d'),
                                'formatter'             =>      
array('','','','','','','','','','','','','','','','','','',''),
-                               'descr'                 =>      
array(lang('Building 
part'),lang('Code'),lang('Description'),lang('Unit'),lang('Bill per 
unit'),lang('Quantity'),lang('Select'),'','','','','','','','','','','',''),
-                               'className'             =>      
array('','','','','rightClasss','','centerClasss','','','','','','','','','','','','')
+                               'descr'                 =>      
array(lang('Building 
part'),lang('Code'),lang('Description'),lang('Unit'),lang('Bill per 
unit'),lang('Quantity'),'','','','','','','','','','','',''),
+                               'className'             =>      
array('','','','','rightClasss','','','','','','','','','','','','','')
                        );
                        
                        $values_combo_box       = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
@@ -2658,7 +2658,7 @@
                                                
                                                if 
($uicols['input_type'][$i]=='varchar') 
                                                {
-                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input 
name='values[".$uicols['name'][$i]."][".$j."]' 
id='values[".$uicols['name'][$i]."][".$j."]' size='4' class='myValuesForPHP'/>";
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input 
name='values[{$uicols['name'][$i]}][{$j}]' 
id='values[{$uicols['name'][$i]}][{$j}]' size='4' class='myValuesForPHP'/>";
                                                }
                                                                                
        
                                                if 
($uicols['input_type'][$i]=='select') 




reply via email to

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