fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6746] property: adjust status filter on project/orde


From: Sigurd Nes
Subject: [Fmsystem-commits] [6746] property: adjust status filter on project/order
Date: Mon, 10 Jan 2011 21:46:15 +0000

Revision: 6746
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6746
Author:   sigurdne
Date:     2011-01-10 21:46:14 +0000 (Mon, 10 Jan 2011)
Log Message:
-----------
property: adjust status filter on project/order

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

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2011-01-10 15:15:41 UTC (rev 
6745)
+++ trunk/property/inc/class.soproject.inc.php  2011-01-10 21:46:14 UTC (rev 
6746)
@@ -108,7 +108,7 @@
                        $sort                   = 
isset($data['sort'])?$data['sort']:'DESC';
                        $order                  = 
isset($data['order'])?$data['order']:'';
                        $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id'] : 0;
-                       $status_id              = 
isset($data['status_id'])?$data['status_id']:'';
+                       $status_id              = isset($data['status_id']) && 
$data['status_id'] ? $data['status_id'] : 'open';
                        $start_date             = isset($data['start_date']) && 
$data['start_date'] ? (int)$data['start_date'] : 0;
                        $end_date               = isset($data['end_date']) && 
$data['end_date'] ? (int)$data['end_date'] : 0;
                        $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
@@ -371,12 +371,27 @@
                                $where= 'AND';
                        }
 
-                       if ($status_id)
+                       if ($status_id && $status_id != 'all')
                        {
-                               $filtermethod .= " $where 
fm_project.status='$status_id' ";
+
+                               if($status_id == 'open')
+                               {
+                                       $_status_filter = array();
+                                       $this->db->query("SELECT * FROM 
fm_project_status WHERE closed IS NULL");
+                                       while($this->db->next_record())
+                                       {
+                                               $_status_filter[] = 
$this->db->f('id');
+                                       }
+                                       $filtermethod .= " $where 
fm_project.status IN ('" . implode("','", $_status_filter) . "')"; 
+                               }
+                               else
+                               {
+                                       $filtermethod .= " $where 
fm_project.status='$status_id' ";
+                               }
                                $where= 'AND';
                        }
 
+
                        if($wo_hour_cat_id)
                        {
                                $filtermethod .= " $where 
fm_wo_hours_category.id=$wo_hour_cat_id ";

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2011-01-10 15:15:41 UTC 
(rev 6745)
+++ trunk/property/inc/class.soworkorder.inc.php        2011-01-10 21:46:14 UTC 
(rev 6746)
@@ -130,7 +130,7 @@
                        $sort                   = isset($data['sort']) && 
$data['sort'] ? $data['sort'] : 'DESC';
                        $order                  = isset($data['order']) ? 
$data['order'] : '';
                        $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id'] : 0;
-                       $status_id              = isset($data['status_id']) && 
$data['status_id'] ? $data['status_id'] : 0;
+                       $status_id              = isset($data['status_id']) && 
$data['status_id'] ? $data['status_id'] : 'open';
                        $start_date             = isset($data['start_date']) && 
$data['start_date'] ? (int)$data['start_date'] : 0;
                        $end_date               = isset($data['end_date']) && 
$data['end_date'] ? (int)$data['end_date'] : 0;
                        $allrows                = isset($data['allrows']) ? 
$data['allrows'] : '';
@@ -366,11 +366,18 @@
 
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
+                               if($order == 'workorder_id')
+                               {
+                                       $ordermethod = " ORDER BY 
fm_workorder.project_id {$sort},fm_workorder.id {$sort}";     
+                               }
+                               else
+                               {
+                                       $ordermethod = " ORDER BY $order $sort";
+                               }
                        }
                        else
                        {
-                               $ordermethod = ' order by fm_workorder.id DESC';
+                               $ordermethod = ' ORDER BY 
fm_workorder.project_id DESC,fm_workorder.id DESC';
                        }
 
                        $where= 'WHERE';
@@ -400,9 +407,23 @@
                                $where= 'AND';
                        }
 
-                       if ($status_id)
+                       if ($status_id && $status_id != 'all')
                        {
-                               $filtermethod .= " $where 
fm_workorder.status='$status_id' ";
+
+                               if($status_id == 'open')
+                               {
+                                       $_status_filter = array();
+                                       $this->db->query("SELECT * FROM 
fm_workorder_status WHERE delivered IS NULL AND closed IS NULL");
+                                       while($this->db->next_record())
+                                       {
+                                               $_status_filter[] = 
$this->db->f('id');
+                                       }
+                                       $filtermethod .= " $where 
fm_workorder.status IN ('" . implode("','", $_status_filter) . "')"; 
+                               }
+                               else
+                               {
+                                       $filtermethod .= " $where 
fm_workorder.status='$status_id' ";
+                               }
                                $where= 'AND';
                        }
 

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2011-01-10 15:15:41 UTC (rev 
6745)
+++ trunk/property/inc/class.uiproject.inc.php  2011-01-10 21:46:14 UTC (rev 
6746)
@@ -248,8 +248,8 @@
                                array_unshift 
($values_combo_box[1]['cat_list'],$default_value);
 
                                $values_combo_box[2]  = 
$this->bo->select_status_list('filter',$this->status_id);
-                               $default_value = array 
('id'=>'','name'=>lang('no status'));
-                               array_unshift 
($values_combo_box[2],$default_value);
+                               array_unshift ($values_combo_box[2],array 
('id'=>'all','name'=> lang('all')));
+                               array_unshift ($values_combo_box[2],array 
('id'=>'open','name'=> lang('open')));
 
                                $values_combo_box[3]  = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
                                $default_value = array 
('id'=>'','name'=>lang('no hour category'));
@@ -618,6 +618,17 @@
                                                        )),
                                                        'parameters'    => 
$parameters
                                                );
+                                       $datatable['rowactions']['action'][] = 
array
+                                               (
+                                                       'my_name'               
        => 'edit',
+                                                       'statustext'            
=> lang('Add a workorder to this project'),
+                                                       'text'                  
        => lang('Add a workorder to this project'),
+                                                       'action'                
        => $GLOBALS['phpgw']->link('/index.php',array
+                                                       (
+                                                               'menuaction'    
=> 'property.uiworkorder.edit',
+                                                       )),
+                                                       'parameters'    => 
$parameters2
+                                               );
                                }
                                else
                                {
@@ -1710,6 +1721,7 @@
 
                                unset($values['location_data']);
 
+
                                unset($values['p']);
 
                                $receipt = $this->bo->save($values, 'add', 
array());

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2011-01-10 15:15:41 UTC 
(rev 6745)
+++ trunk/property/inc/class.uiworkorder.inc.php        2011-01-10 21:46:14 UTC 
(rev 6746)
@@ -262,8 +262,8 @@
                                array_unshift 
($values_combo_box[1]['cat_list'],$default_value);
 
                                $values_combo_box[2]  = 
$this->bo->select_status_list('filter',$this->status_id);
-                               $default_value = array ('id'=>'','name'=> 
lang('no status'));
-                               array_unshift 
($values_combo_box[2],$default_value);
+                               array_unshift ($values_combo_box[2],array 
('id'=>'all','name'=> lang('all')));
+                               array_unshift ($values_combo_box[2],array 
('id'=>'open','name'=> lang('open')));
 
                                $values_combo_box[3] =  
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
                                $default_value = array ('id'=>'','name'=> 
lang('no hour category'));




reply via email to

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