fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10624] Property: tweak bulk update


From: Sigurd Nes
Subject: [Fmsystem-commits] [10624] Property: tweak bulk update
Date: Sun, 30 Dec 2012 22:55:58 +0000

Revision: 10624
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10624
Author:   sigurdne
Date:     2012-12-30 22:55:55 +0000 (Sun, 30 Dec 2012)
Log Message:
-----------
Property: tweak bulk update

Modified Paths:
--------------
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.uiproject.inc.php

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2012-12-30 20:21:05 UTC (rev 
10623)
+++ trunk/property/inc/class.soproject.inc.php  2012-12-30 22:55:55 UTC (rev 
10624)
@@ -2244,8 +2244,15 @@
 
                        if($status_filter)
                        {
-                               $user_id = (int) $user_id;
-                               $filter .= "AND fm_{$type}.status = 
'{$status_filter}'";
+                               if($status_filter == 'open')
+                               {
+                                       $filter .= " AND 
fm_{$type}_status.closed IS NULL"; 
+
+                               }
+                               else
+                               {
+                                       $filter .= " AND 
fm_{$type}.status='{$status_filter}' ";
+                               }
                        }
 
                        switch($type)
@@ -2283,7 +2290,7 @@
                                        }
 
                                        
$this->_update_status_workorder($execute, $status_new, $ids);
-                                       $sql = "SELECT {$table}.id, 
$status_table.descr as status ,{$title_field},start_date {$actual_cost} FROM 
{$table}"
+                                       $sql = "SELECT {$table}.id, project_id, 
$status_table.descr as status ,{$title_field},start_date {$actual_cost} FROM 
{$table}"
                                        . " {$join_method}"
                                        . " WHERE ({$table}.start_date > 
{$start_date} AND {$table}.start_date < {$end_date} {$filter}) OR start_date is 
NULL"
                                        . " ORDER BY {$table}.id DESC";
@@ -2301,6 +2308,7 @@
                                $values[] = array
                                (
                                        'id'                    => 
$this->db->f('id'),
+                                       'project_id'    => 
$this->db->f('project_id'),
                                        'title'                 => 
htmlspecialchars_decode($this->db->f('title',true)),
                                        'status'                => 
$this->db->f('status',true),
                                        'actual_cost'   => 
(float)$this->db->f('actual_cost'),

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2012-12-30 20:21:05 UTC (rev 
10623)
+++ trunk/property/inc/class.uiproject.inc.php  2012-12-30 22:55:55 UTC (rev 
10624)
@@ -2218,7 +2218,7 @@
                        $execute                = phpgw::get_var('execute', 
'bool', 'POST');
                        $status_filter  = phpgw::get_var('status_filter');
                        $status_new     = phpgw::get_var('status_new');
-                       $type                   = phpgw::get_var('type');
+                       $type                   = 
phpgw::get_var('type','string', 'REQUEST' , 'project');
                        $ecodimb                = phpgw::get_var('ecodimb');
                        $id_to_update   = phpgw::get_var('id_to_update');
                        $paid                   = phpgw::get_var('paid', 
'bool', 'POST');
@@ -2271,30 +2271,37 @@
                        switch($type)
                        {
                                case 'project':
-                                       $_key = 'num_open';
-                                       $_label = lang('open');
+                                       $myColumnDefs[0] = array
+                                       (
+                                               'name'          => "0",
+                                               'values'        =>      
json_encode(array(      array('key' => 
'id','label'=>lang('id'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
+                                                                               
                                array('key' => 
'start_date','label'=>lang('date'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'num_open','label'=>lang('open'),'sortable'=>true,'resizeable'=>true 
,'formatter'=>'FormatterRight'),
+                                                                               
                                array('key' => 'select','label'=> 
lang('select'), 
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>30)
+                                                                               
                                ))
+                                       );
                                        break;
                                case 'workorder':
-                                       $_key = 'actual_cost';
-                                       $_label = lang('actual cost');
-                                       break;
-                               default:
-                                       $_key = 'num_open';
-                                       $_label = lang('open');
-                       }
-
-                       $myColumnDefs[0] = array
-                               (
-                                       'name'          => "0",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'id','label'=>lang('id'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
+                                       $myColumnDefs[0] = array
+                                       (
+                                               'name'          => "0",
+                                               'values'        =>      
json_encode(array(      
+                                                                               
                                array('key' => 
'project_id','label'=>lang('project'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'id','label'=>lang('id'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
                                                                                
                                array('key' => 
'start_date','label'=>lang('date'),'sortable'=>false,'resizeable'=>true),
                                                                                
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
$_key,'label'=>$_label,'sortable'=>true,'resizeable'=>true 
,'formatter'=>'FormatterRight'),
+                                                                               
                                array('key' => 
'actual_cost','label'=>lang('actual cost'),'sortable'=>true,'resizeable'=>true 
,'formatter'=>'FormatterRight'),
                                                                                
                                array('key' => 'select','label'=> 
lang('select'), 
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>30)
                                                                                
                                ))
-                               );
+                                       );
 
+                                       break;
+                       }
+
+
                        $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)
                        {
@@ -2305,17 +2312,24 @@
                        switch($type)
                        {
                                case 'project':
-                                       $status_list_filter = 
execMethod('property.bogeneric.get_list', array('type' => 'project_status',     
  'selected' => $status_filter));
+                                       $status_list_filter = 
execMethod('property.bogeneric.get_list', array('type' => 'project_status'));
                                        $status_list_new = 
execMethod('property.bogeneric.get_list', array('type' => 'project_status',  
'selected' => $status_new));
                                        break;
                                case 'workorder':
-                                       $status_list_filter = 
execMethod('property.bogeneric.get_list', array('type' => 'workorder_status',   
  'selected' => $status_filter));
+                                       $status_list_filter = 
execMethod('property.bogeneric.get_list', array('type' => 'workorder_status'));
                                        $status_list_new = 
execMethod('property.bogeneric.get_list', array('type' => 'workorder_status',   
     'selected' => $status_new));
                                        break;
                                default:
                                        $status_list_filter = array();
                        }
 
+                       if($status_list_filter)
+                       {
+                               array_unshift ($status_list_filter,array 
('id'=>'open','name'=> lang('open')));
+                       }
+                       
+                       $status_list_filter = 
$this->bocommon->select_list($status_filter,$status_list_filter);
+
                        $type_array = array
                        (
                                array




reply via email to

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