fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11098] controller: assign task, billable hours


From: Sigurd Nes
Subject: [Fmsystem-commits] [11098] controller: assign task, billable hours
Date: Thu, 09 May 2013 21:37:04 +0000

Revision: 11098
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11098
Author:   sigurdne
Date:     2013-05-09 21:37:04 +0000 (Thu, 09 May 2013)
Log Message:
-----------
controller: assign task, billable hours

Modified Paths:
--------------
    trunk/controller/inc/class.socheck_list.inc.php
    trunk/controller/inc/class.uicheck_list.inc.php
    trunk/controller/inc/model/class.check_list.inc.php
    trunk/controller/setup/setup.inc.php
    trunk/controller/setup/tables_current.inc.php
    trunk/controller/setup/tables_update.inc.php
    trunk/controller/templates/base/check_list/add_check_list.xsl
    trunk/controller/templates/base/check_list/edit_check_list.xsl

Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php     2013-05-09 20:55:43 UTC 
(rev 11097)
+++ trunk/controller/inc/class.socheck_list.inc.php     2013-05-09 21:37:04 UTC 
(rev 11098)
@@ -61,7 +61,7 @@
        public function get_single($check_list_id)
        {
                $check_list_id = (int) $check_list_id;
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.control_id, cl.comment as cl_comment, deadline, planned_date, "; 
+               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.control_id, cl.comment as cl_comment, deadline, planned_date,assigned_to, 
billable_hours, "; 
                $sql .= "completed_date, location_code, component_id, 
num_open_cases, num_pending_cases, location_id, ci.id as ci_id, control_item_id 
"; 
                $sql .= "FROM controller_check_list cl ";
                $sql .= "LEFT JOIN controller_check_item as ci ON cl.id = 
ci.check_list_id ";
@@ -81,7 +81,10 @@
                
$check_list->set_component_id($this->unmarshal($this->db->f('component_id'), 
'int'));
                
$check_list->set_location_id($this->unmarshal($this->db->f('location_id'), 
'int'));
                
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));       
-               
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int')); 
+               
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
+               
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
+               $check_list->set_billable_hours($this->db->f('billable_hours'));
+
                        
                if($check_list != null)
                {
@@ -104,7 +107,7 @@
        public function get_single_with_check_items($check_list_id, $status, 
$type)
        {
                $check_list_id = (int) $check_list_id;
-               $sql  = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.control_id, cl.comment as cl_comment, deadline, planned_date, 
completed_date, num_open_cases, location_code, num_pending_cases, ";
+               $sql  = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.control_id, cl.comment as cl_comment, deadline, planned_date, 
completed_date,assigned_to, num_open_cases, location_code, num_pending_cases, ";
                $sql .= "ci.id as ci_id, control_item_id, check_list_id, "; 
                $sql .= "coi.title as coi_title, coi.required as coi_required, 
";
                $sql .= "coi.what_to_do as coi_what_to_do, coi.how_to_do as 
coi_how_to_do, coi.control_group_id as coi_control_group_id, coi.type "; 
@@ -145,6 +148,8 @@
                                
$check_list->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                                
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));       
                                
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
+                               
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
+                               
                        }
                                                
                        if($this->db->f('ci_id'))
@@ -189,7 +194,7 @@
        {
                $control_id = (int) $control_id;
 
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, "; 
+               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, assigned_to, "; 
                $sql .= "completed_date, component_id, location_code, 
num_open_cases, num_pending_cases ";
                $sql .= "ci.id as ci_id, control_item_id, check_list_id ";
                $sql .= "FROM controller_check_list cl, controller_check_item 
ci ";
@@ -221,6 +226,7 @@
                                
$check_list->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                                
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));
                                
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
+                               
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
                                
                                $check_items_array = array();
                        }
@@ -266,7 +272,7 @@
                {
                        $sql .= "AND status = {$status} ";
                }  
-    
+       
                $this->db->query($sql);
                
                $check_list = null;
@@ -282,6 +288,7 @@
                        
$check_list->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                        
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));       
                        
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
+                       
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
                }
                                
                return $check_list;
@@ -308,7 +315,7 @@
                        $component_filter = " AND component_id = 
{$component_id} AND location_id = {$location_id} ";
                }
 
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, "; 
+               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, assigned_to,"; 
                $sql .= "completed_date, component_id, location_code, 
num_open_cases, num_pending_cases ";
                $sql .= "FROM controller_check_list cl ";
                $sql .= "WHERE cl.control_id = {$control_id} ";
@@ -340,6 +347,7 @@
                                
$check_list->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                                
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));       
                                
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
+                               
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
                        }
                        $check_list_id =  $check_list->get_id();
                }
@@ -371,12 +379,12 @@
                
                if($cl_criteria->get_component_id() > 0 && 
$cl_criteria->get_location_id() > 0)
                {
-                   $sql .= "WHERE cl.component_id = 
{$cl_criteria->get_component_id()} ";
-                   $sql .= "AND cl.location_id = 
{$cl_criteria->get_location_id()} ";
+                       $sql .= "WHERE cl.component_id = 
{$cl_criteria->get_component_id()} ";
+                       $sql .= "AND cl.location_id = 
{$cl_criteria->get_location_id()} ";
                }
                else
                {
-                   $sql .= "WHERE cl.location_code = 
'{$cl_criteria->get_location_code()}' ";
+                       $sql .= "WHERE cl.location_code = 
'{$cl_criteria->get_location_code()}' ";
                }
                
                $sql .= "AND c.id = {$cl_criteria->get_control_id()} ";
@@ -410,7 +418,7 @@
        function get_check_lists_for_location( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr = null )
        {
                $sql =  "SELECT c.id as c_id, ";
-               $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as 
cl_comment, deadline, planned_date, completed_date, ";
+               $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as 
cl_comment, deadline, planned_date, completed_date, assigned_to, ";
                $sql .= "cl.component_id as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases, num_pending_cases "; 
                $sql .= "FROM controller_control c ";
                $sql .= "LEFT JOIN controller_check_list cl on cl.control_id = 
c.id ";
@@ -454,6 +462,7 @@
                        
$check_list->set_location_code($this->unmarshal($this->db->f('cl_location_code',
 true), 'string'));
                        
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));
                        
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
+                       
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
                        
                        $check_lists_array[] = $check_list;
 
@@ -484,7 +493,7 @@
                $component_id = (int) $component_id;
 
                $sql =  "SELECT c.id as c_id, ";
-               $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as 
cl_comment, deadline, planned_date, completed_date, ";
+               $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as 
cl_comment, deadline, planned_date, completed_date, assigned_to, ";
                $sql .= "cl.component_id, cl.location_id, cl.location_code as 
cl_location_code, num_open_cases, num_pending_cases "; 
                $sql .= "FROM controller_control c ";
                $sql .= "LEFT JOIN controller_check_list cl on cl.control_id = 
c.id ";
@@ -530,7 +539,8 @@
                        
$check_list->set_location_code($this->unmarshal($this->db->f('cl_location_code',
 true), 'string'));
                        
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));
                        
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
-                       
+                       
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
+
                        $check_lists_array[] = $check_list;
 
                        $control_id =  $control->get_id();
@@ -559,7 +569,7 @@
        {
                $control_id = (int) $control_id;
 
-               $sql =  "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, completed_date, ";
+               $sql =  "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, completed_date, assigned_to, 
";
                $sql .= "cl.component_id as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases, num_pending_cases "; 
                $sql .= "FROM controller_check_list cl ";
                $sql .= "LEFT JOIN controller_control c on cl.control_id = c.id 
";
@@ -587,6 +597,7 @@
                        
$check_list->set_location_code($this->unmarshal($this->db->f('cl_location_code',
 true), 'string'));
                        
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));
                        
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
+                       
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
                        
                        $check_lists_array[] = $check_list;
                }
@@ -610,7 +621,7 @@
                $location_id = (int) $location_id;
                $component_id = (int) $component_id;
 
-               $sql =  "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, completed_date, ";
+               $sql =  "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, completed_date, assigned_to, 
";
                $sql .= "cl.component_id as cl_component_id, cl.location_id as 
cl_location_id, cl.location_code as cl_location_code, num_open_cases, 
num_pending_cases "; 
                $sql .= "FROM controller_check_list cl ";
                $sql .= "LEFT JOIN controller_control c on cl.control_id = c.id 
";
@@ -640,6 +651,7 @@
                        
$check_list->set_location_code($this->unmarshal($this->db->f('cl_location_code',
 true), 'string'));
                        
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));
                        
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
+                       
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'), 
'int'));
                        
                        $check_lists_array[] = $check_list;
                }
@@ -753,7 +765,8 @@
                                'num_open_cases',
                                'num_pending_cases',
                                'location_id',
-                               'status'
+                               'status',
+                               'assigned_to'
                );
                                
                $values = array(
@@ -767,7 +780,8 @@
                        $this->marshal($check_list->get_num_open_cases(), 
'int'),
                        $this->marshal($check_list->get_num_pending_cases(), 
'int'),
                        $this->marshal($check_list->get_location_id(), 'int'),
-                       $check_list->get_status()
+                       $check_list->get_status(),
+                       $this->marshal($check_list->get_assigned_to(), 'int'),
                );
                
                $result = $this->db->query('INSERT INTO controller_check_list 
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
@@ -777,8 +791,51 @@
        
        function update($check_list)
        {
-               $id = intval($check_list->get_id());
+               $id = (int)$check_list->get_id();
 
+               $sql = "SELECT billable_hours FROM controller_check_list WHERE 
controller_check_list.id = {$id}";
+               
+               $this->db->query($sql);
+               $this->db->next_record();
+                       
+               $old_billable_hours = (float) $this->db->f('billable_hours');
+
+               $billable_hours = $old_billable_hours + 
$check_list->get_billable_hours();
+
+//--------
+               $so_check_item = CreateObject('controller.socheck_item');
+               $check_items = $so_check_item->get_check_items_with_cases($id, 
$control_item_type = null, $status = null, $messageStatus = null);
+       
+               $num_open_cases = 0;
+               $num_pending_cases = 0;
+                                       
+               foreach($check_items as $check_item)
+               {
+                       foreach($check_item->get_cases_array() as $case)
+                       {
+                               
+                               if($case->get_status() == 
controller_check_item_case::STATUS_OPEN)
+                               {
+                                       $num_open_cases++;
+                               }
+                                       
+                               if($case->get_status() == 
controller_check_item_case::STATUS_PENDING)
+                               {
+                                       $num_pending_cases++;
+                               }
+                       }       
+               }
+                       
+               if($num_open_cases > 0)
+               {
+                       
$check_list->set_status(controller_check_list::STATUS_DONE);
+               }
+         
+               $check_list->set_num_open_cases($num_open_cases);
+               $check_list->set_num_pending_cases($num_pending_cases);
+
+//-------
+
                $values = array(
                        'control_id = ' . 
$this->marshal($check_list->get_control_id(), 'int'),
                        'status = ' . $check_list->get_status(),
@@ -790,11 +847,16 @@
                        'component_id = ' . 
$this->marshal($check_list->get_component_id(), 'int'),
                        'location_id = ' . 
$this->marshal($check_list->get_location_id(), 'int'),
                        'num_open_cases = ' . 
$this->marshal($check_list->get_num_open_cases(), 'int'),
-                       'num_pending_cases = ' . 
$this->marshal($check_list->get_num_pending_cases(), 'int')
+                       'num_pending_cases = ' . 
$this->marshal($check_list->get_num_pending_cases(), 'int'),
+                       'assigned_to = ' . 
$this->marshal($check_list->get_assigned_to(), 'int'),
+                       'billable_hours = ' . $billable_hours 
                );
 
-               $result = $this->db->query('UPDATE controller_check_list SET ' 
. join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+               $sql = 'UPDATE controller_check_list SET ' . join(',', $values) 
. " WHERE id = {$id}";
 
+_debug_array($sql);
+               $result = $this->db->query($sql, __LINE__,__FILE__);
+
                if($result)
                {
                        return $id;                     

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2013-05-09 20:55:43 UTC 
(rev 11097)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2013-05-09 21:37:04 UTC 
(rev 11098)
@@ -64,6 +64,7 @@
                private $add;
                private $edit;
                private $delete;
+               private $acl_location;
 
                var $public_functions = array(
                        'index' => true,
@@ -94,6 +95,8 @@
 
                        $this->location_finder = new location_finder();
 
+                       $this->acl_location = '.control';
+
                        $this->read     = 
$GLOBALS['phpgw']->acl->check('.control', PHPGW_ACL_READ, 'controller');//1 
                        $this->add       = 
$GLOBALS['phpgw']->acl->check('.control', PHPGW_ACL_ADD, 'controller');//2 
                        $this->edit     = 
$GLOBALS['phpgw']->acl->check('.control', PHPGW_ACL_EDIT, 'controller');//4 
@@ -267,6 +270,14 @@
 
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
 
+                       $responsible_user_id = 
execMethod('property.soresponsible.get_responsible_user_id',
+                                       array
+                                       (
+                                               'responsibility_id' => 
$control->get_responsibility_id(),
+                                               'location_code' => 
$location_code
+                                       )
+                               );
+
                        $year = date("Y", $deadline_ts);
                        $month_nr = date("n", $deadline_ts);
 
@@ -276,8 +287,22 @@
                        // Fetches buildings on property
                        $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
 
+                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_ADD, $this->acl_location);
+
+                       $user_list_options = array();
+                       foreach ($users as $user)
+                       {
+                               $user_list_options[] = array
+                               (
+                                       'id' => $user['account_id'],
+                                       'name' => $user['account_lastname'] . 
', ' . $user['account_firstname'],
+                                       'selected'      => $responsible_user_id 
== $user['account_id'] ? 1 : 0
+                               );
+                       }
+                       
                        $data = array
                        (
+                               'user_list' => array('options' => 
$user_list_options),
                                'location_array' => $location_array,
                                'component_array' => $component_array,
                                'control' => $control,
@@ -354,8 +379,24 @@
                        // Fetches buildings on property
                        $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
 
+                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_ADD, $this->acl_location);
+
+                       $responsible_user_id = $check_list->get_assigned_to();
+
+                       $user_list_options = array();
+                       foreach ($users as $user)
+                       {
+                               $user_list_options[] = array
+                               (
+                                       'id' => $user['account_id'],
+                                       'name' => $user['account_lastname'] . 
', ' . $user['account_firstname'],
+                                       'selected'      => $responsible_user_id 
== $user['account_id'] ? 1 : 0
+                               );
+                       }
+                       
                        $data = array
                        (
+                               'user_list' => array('options' => 
$user_list_options),
                                'control' => $control,
                                'check_list' => $check_list,
                                '$buildings_on_property' => 
$buildings_on_property,
@@ -403,6 +444,8 @@
                        $planned_date = phpgw::get_var('planned_date', 
'string');
                        $completed_date = phpgw::get_var('completed_date', 
'string');
                        $comment = phpgw::get_var('comment', 'string');
+                       $assigned_to = phpgw::get_var('assigned_to', 'int');
+                       $billable_hours = phpgw::get_var('billable_hours', 
'float');
 
                        $deadline_date_ts = 
date_converter::date_to_timestamp($deadline_date);
 
@@ -450,14 +493,16 @@
                        $check_list->set_deadline($deadline_date_ts);
                        $check_list->set_planned_date($planned_date_ts);
                        $check_list->set_completed_date($completed_date_ts);
+                       $check_list->set_assigned_to($assigned_to);
+                       $check_list->set_billable_hours($billable_hours);
 
                        if($check_list->validate())
                        {
                                $check_list_id = $this->so->store($check_list);
 
-                               $cl_status_updater = new 
check_list_status_updater();
-                               
$cl_status_updater->update_check_list_status($check_list_id);
-
+//                             $cl_status_updater = new 
check_list_status_updater();
+//                             
$cl_status_updater->update_check_list_status($check_list_id);
+//die();
                                if($check_list_id > 0)
                                {
                                        $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
@@ -472,7 +517,8 @@
                                if($check_list->get_id() > 0)
                                {
                                        $this->edit_check_list($check_list);
-                               } else
+                               }
+                               else
                                {
                                        $this->add_check_list($check_list);
                                }

Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2013-05-09 20:55:43 UTC 
(rev 11097)
+++ trunk/controller/inc/model/class.check_list.inc.php 2013-05-09 21:37:04 UTC 
(rev 11098)
@@ -48,6 +48,8 @@
                protected $location_code;
                protected $component_id;
                protected $location_id;
+               protected $assigned_to;
+               protected $billable_hours;
                
                // Aggregate fields. Fields not in a table
                protected $num_open_cases;
@@ -175,21 +177,43 @@
                {
                        $this->error_msg_array = $error_msg_array;
                }
+
+               public function set_assigned_to($assigned_to)
+               {
+                       $this->assigned_to = $assigned_to;
+               }
                
+               public function get_assigned_to()
+               {
+                       return $this->assigned_to;
+               }
+
+               public function set_billable_hours($billable_hours)
+               {
+                       $this->billable_hours = $billable_hours;
+               }
+               
+               public function get_billable_hours()
+               {
+                       return $this->billable_hours;
+               }
+               
                public function serialize()
                {
                        return array(
-                               'id'                                            
        => $this->get_id(),
-                               'control_id'                    => 
$this->get_control_id(),
-                               'status'                                        
=> $this->get_status(),
-                               'comment'                               => 
$this->get_comment(),
-                               'deadline'                              => 
$this->get_deadline(),
+                               'id'                            => 
$this->get_id(),
+                               'control_id'            => 
$this->get_control_id(),
+                               'status'                        => 
$this->get_status(),
+                               'comment'                       => 
$this->get_comment(),
+                               'deadline'                      => 
$this->get_deadline(),
                                'planned_date'          => 
$this->get_planned_date(),
                                'completed_date'        => 
$this->get_completed_date(),
                                'location_code'         => 
$this->get_location_code(),
                                'component_id'          => 
$this->get_component_id(),
                                'location_id'           => 
$this->get_location_id(),
-                               'num_open_cases'        => 
$this->get_num_open_cases()
+                               'num_open_cases'        => 
$this->get_num_open_cases(),
+                               'assigned_to'           => 
$this->get_assigned_to(),
+                               'billable_hours'        => 
$this->get_billable_hours()
                        );
                }
                
@@ -199,40 +223,40 @@
        
                        // Validate CONTROL ID
                        if( empty( $this->control_id ) )
-                 {
-                       $status = false;
-                       $this->error_msg_array['control_id'] = "error_msg_4";
-                 }
+                       {
+                               $status = false;
+                               $this->error_msg_array['control_id'] = 
"error_msg_4";
+                       }
                 
-                 // Validate STATUS                              
+                       // Validate STATUS                                
                        if( ($this->status != 
controller_check_list::STATUS_NOT_DONE) && ($this->status != 
controller_check_list::STATUS_DONE) && ($this->status != 
controller_check_list::STATUS_CANCELED))
-                 { 
-                       $status = false;
-                       $this->error_msg_array['status'] = "error_msg_2";
-                 }
+                       { 
+                               $status = false;
+                               $this->error_msg_array['status'] = 
"error_msg_2";
+                       }
                    
-                 // Validate COMPLETED DATE when STATUS:DONE                   
          
+                       // Validate COMPLETED DATE when STATUS:DONE             
                  
                        if( ($this->status == 
controller_check_list::STATUS_DONE) && empty($this->completed_date) )
-                 {
-                       $status = false;
-                       $this->error_msg_array['completed_date'] = 
"error_msg_5";
-                 }
+                       {
+                               $status = false;
+                               $this->error_msg_array['completed_date'] = 
"error_msg_5";
+                       }
        
-                 // Validate DEADLINE                    
+                       // Validate DEADLINE                      
                        if( empty( $this->deadline ) )
-                 {
-                       $status = false;
-                       $this->error_msg_array['deadline'] = "error_msg_1";
-                 }
+                       {
+                               $status = false;
+                               $this->error_msg_array['deadline'] = 
"error_msg_1";
+                       }
        
                        // Validate connection to COMPONENT/LOCATION
                        if( empty( $this->location_code ) && empty( 
$this->component_id ) )
-                 {
-                       echo "FAILED: " . $this->location_code; 
-                       $status = false;
-                       $this->error_msg_array['location_code'] = "error_msg_6";
-                 }
+                       {
+                               echo "FAILED: " . $this->location_code; 
+                               $status = false;
+                               $this->error_msg_array['location_code'] = 
"error_msg_6";
+                       }
        
-                 return $status;
+                       return $status;
                }
        }

Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php        2013-05-09 20:55:43 UTC (rev 
11097)
+++ trunk/controller/setup/setup.inc.php        2013-05-09 21:37:04 UTC (rev 
11098)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.43';
+       $setup_info['controller']['version'] = '0.1.44';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';

Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php       2013-05-09 20:55:43 UTC 
(rev 11097)
+++ trunk/controller/setup/tables_current.inc.php       2013-05-09 21:37:04 UTC 
(rev 11098)
@@ -73,7 +73,9 @@
                                'location_code' => array('type' => 'varchar', 
'precision' => 30, 'nullable' => True),
                                'location_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => true),
                                'num_open_cases' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'num_pending_cases' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                               'num_pending_cases' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'assigned_to' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'billable_hours' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php        2013-05-09 20:55:43 UTC 
(rev 11097)
+++ trunk/controller/setup/tables_update.inc.php        2013-05-09 21:37:04 UTC 
(rev 11098)
@@ -865,4 +865,27 @@
                }
        }
 
+       $test[] = '0.1.43';
+       function controller_upgrade0_1_43()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','assigned_to',array(
+                       'type' => 'int', 
+                       'precision' => '4',
+                       'nullable' => true
+               ));
 
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','billable_hours',array(
+                       'type' => 'decimal', 
+                       'precision' => '20',
+                       'scale' => '2',
+                       'nullable' => true
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.44';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }
+       }

Modified: trunk/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/add_check_list.xsl       
2013-05-09 20:55:43 UTC (rev 11097)
+++ trunk/controller/templates/base/check_list/add_check_list.xsl       
2013-05-09 21:37:04 UTC (rev 11098)
@@ -1,158 +1,181 @@
 <!-- $Id$ -->
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
-    <xsl:variable name="date_format">
-        <xsl:value-of select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')" />
-    </xsl:variable>
+       <xsl:variable name="date_format">
+               <xsl:value-of select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')" />
+       </xsl:variable>
 
-    <!-- ==================  ADD CHECKLIST  ========================= -->
-    <div id="main_content" class="medium">
-        
-        <!-- ==================  CHECK LIST TOP SECTION  ===================== 
-->
-        <xsl:call-template name="check_list_top_section" />
+       <!-- ==================  ADD CHECKLIST  ========================= -->
+       <div id="main_content" class="medium">
+               
+               <!-- ==================  CHECK LIST TOP SECTION  
===================== -->
+               <xsl:call-template name="check_list_top_section" />
        
-        <!-- ==================  CHECKLIST DETAILS  ===================== -->
-        <div id="check_list_details">
-            <h3 class="box_header">Sjekklistedetaljer</h3>
+               <!-- ==================  CHECKLIST DETAILS  
===================== -->
+               <div id="check_list_details">
+                       <h3 class="box_header">Sjekklistedetaljer</h3>
                
-            <xsl:variable name="action_url">
-                <xsl:value-of select="php:function('get_phpgw_link', 
'/index.php', 'menuaction:controller.uicheck_list.save_check_list')" />
-            </xsl:variable>
+                       <xsl:variable name="action_url">
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicheck_list.save_check_list')" />
+                       </xsl:variable>
                
-            <form id="frm_add_check_list" action="{$action_url}" method="post">
-                <xsl:variable name="control_id">
-                    <xsl:value-of select="control/id"/>
-                </xsl:variable>
-                <input type="hidden" name="control_id" value="{$control_id}" />
-                <xsl:variable name="type">
-                    <xsl:value-of select="type"/>
-                </xsl:variable>
-                <input type="hidden" name="type" value="{$type}" />
+                       <form id="frm_add_check_list" action="{$action_url}" 
method="post">
+                               <xsl:variable name="control_id">
+                                       <xsl:value-of select="control/id"/>
+                               </xsl:variable>
+                               <input type="hidden" name="control_id" 
value="{$control_id}" />
+                               <xsl:variable name="type">
+                                       <xsl:value-of select="type"/>
+                               </xsl:variable>
+                               <input type="hidden" name="type" 
value="{$type}" />
 
-                <xsl:variable name="location_code">
-                    <xsl:value-of select="location_array/location_code"/>
-                </xsl:variable>                
+                               <xsl:variable name="location_code">
+                                       <xsl:value-of 
select="location_array/location_code"/>
+                               </xsl:variable>         
 
-                <xsl:choose>
-                    <xsl:when test="type = 'component'">
-                        <xsl:variable name="location_id">
-                            <xsl:value-of select="check_list/location_id"/>
-                        </xsl:variable>
-                        <input type="hidden" name="location_id" 
value="{$location_id}" />
-                        <xsl:variable name="component_id">
-                            <xsl:value-of select="check_list/component_id"/>
-                        </xsl:variable>
-                        <input type="hidden" name="component_id" 
value="{$component_id}" />
-                        <input type="hidden" name="location_code" 
value="{$location_code}" />
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <input type="hidden" name="location_code" 
value="{$location_code}" />
-                    </xsl:otherwise>
-                </xsl:choose>
+                               <xsl:choose>
+                                       <xsl:when test="type = 'component'">
+                                               <xsl:variable 
name="location_id">
+                                                       <xsl:value-of 
select="check_list/location_id"/>
+                                               </xsl:variable>
+                                               <input type="hidden" 
name="location_id" value="{$location_id}" />
+                                               <xsl:variable 
name="component_id">
+                                                       <xsl:value-of 
select="check_list/component_id"/>
+                                               </xsl:variable>
+                                               <input type="hidden" 
name="component_id" value="{$component_id}" />
+                                               <input type="hidden" 
name="location_code" value="{$location_code}" />
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <input type="hidden" 
name="location_code" value="{$location_code}" />
+                                       </xsl:otherwise>
+                               </xsl:choose>
                        
-                <fieldset>
-                    <!-- STATUS -->
-                    <div class="row">
-                        <xsl:if test="check_list/error_msg_array/status != ''">
-                            <xsl:variable name="error_msg">
-                                <xsl:value-of 
select="check_list/error_msg_array/status" />
-                            </xsl:variable>
-                            <div class='input_error_msg'>
-                                <xsl:value-of select="php:function('lang', 
$error_msg)" />
-                            </div>
-                        </xsl:if>
-                        <label>Status</label>
-                        <xsl:variable name="status">
-                            <xsl:value-of select="check_list/status"/>
-                        </xsl:variable>
-                        <select id="status" name="status">
-                            <xsl:choose>
-                                <xsl:when test="check_list/status = 0">
-                                    <option value="1">Utført</option>
-                                    <option value="0" SELECTED="SELECTED">Ikke 
utført</option>
-                                    <option value="3">Kansellert</option>
-                                </xsl:when>
-                                <xsl:when test="check_list/status = 1">
-                                    <option value="1" 
SELECTED="SELECTED">Utført</option>
-                                    <option value="0">Ikke utført</option>
-                                    <option value="3">Kansellert</option>
-                                </xsl:when>
-                                <xsl:when test="check_list/status = 3">
-                                    <option value="3" 
SELECTED="SELECTED">Kansellert</option>
-                                    <option value="0">Ikke utført</option>
-                                    <option value="1">Utført</option>
-                                </xsl:when>
-                                <xsl:otherwise>
-                                    <option value="0" SELECTED="SELECTED">Ikke 
utført</option>
-                                    <option value="1">Utført</option>
-                                    <option value="3">Kansellert</option>
-                                </xsl:otherwise>
-                            </xsl:choose>
-                        </select>
-                    </div>
-                    <!-- DEADLINE -->
-                    <div class="row">
-                        <xsl:if test="check_list/error_msg_array/deadline != 
''">
-                            <xsl:variable name="error_msg">
-                                <xsl:value-of 
select="check_list/error_msg_array/deadline" />
-                            </xsl:variable>
-                            <div class='input_error_msg'>
-                                <xsl:value-of select="php:function('lang', 
$error_msg)" />
-                            </div>
-                        </xsl:if>
-                        <label>Fristdato</label>
-                        <input type="text" id="deadline_date" 
name="deadline_date" class="date" readonly="readonly" >
-                            <xsl:attribute name="value">
-                                <xsl:value-of select="php:function('date', 
$date_format, number(check_list/deadline))"/>
-                            </xsl:attribute>
-                        </input>
-                    </div>
-                    <!-- PLANNED DATE -->
-                    <div class="row">
-                        <label>Planlagt dato</label>
-                        <input type="text" id="planned_date" 
name="planned_date" class="date" readonly="readonly">
-                            <xsl:if test="check_list/planned_date != 0 and 
check_list/planned_date != ''">
-                                <xsl:attribute name="value">
-                                    <xsl:value-of select="php:function('date', 
$date_format, number(check_list/planned_date))"/>
-                                </xsl:attribute>
-                            </xsl:if>
-                        </input>
-                    </div>
-                    <!-- COMPLETED DATE -->
-                    <div class="row">
-                        <xsl:if 
test="check_list/error_msg_array/completed_date != ''">
-                            <xsl:variable name="error_msg">
-                                <xsl:value-of 
select="check_list/error_msg_array/completed_date" />
-                            </xsl:variable>
-                            <div class='input_error_msg'>
-                                <xsl:value-of select="php:function('lang', 
$error_msg)" />
-                            </div>
-                        </xsl:if>
-                        <label>Utført dato</label>
-                        <input type="text" id="completed_date" 
name="completed_date" class="date" readonly="readonly" >
-                            <xsl:if test="check_list/completed_date != 0 and 
check_list/completed_date != ''">
-                                <xsl:attribute name="value">
-                                    <xsl:value-of select="php:function('date', 
$date_format, number(check_list/completed_date))"/>
-                                </xsl:attribute>
-                            </xsl:if>
-                        </input>
-                    </div>
-                </fieldset>
-                <!-- COMMENT -->
-                <div class="comment">
-                    <label>Kommentar</label>
-                    <textarea>
-                        <xsl:attribute name="name">comment</xsl:attribute>
-                        <xsl:value-of select="check_list/comment"/>
-                    </textarea>
-                </div>
+                               <fieldset>
+                                       <!-- STATUS -->
+                                       <div class="row">
+                                               <xsl:if 
test="check_list/error_msg_array/status != ''">
+                                                       <xsl:variable 
name="error_msg">
+                                                               <xsl:value-of 
select="check_list/error_msg_array/status" />
+                                                       </xsl:variable>
+                                                       <div 
class='input_error_msg'>
+                                                               <xsl:value-of 
select="php:function('lang', $error_msg)" />
+                                                       </div>
+                                               </xsl:if>
+                                               <label>Status</label>
+                                               <xsl:variable name="status">
+                                                       <xsl:value-of 
select="check_list/status"/>
+                                               </xsl:variable>
+                                               <select id="status" 
name="status">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="check_list/status = 0">
+                                                                       <option 
value="1">Utført</option>
+                                                                       <option 
value="0" SELECTED="SELECTED">Ikke utført</option>
+                                                                       <option 
value="3">Kansellert</option>
+                                                               </xsl:when>
+                                                               <xsl:when 
test="check_list/status = 1">
+                                                                       <option 
value="1" SELECTED="SELECTED">Utført</option>
+                                                                       <option 
value="0">Ikke utført</option>
+                                                                       <option 
value="3">Kansellert</option>
+                                                               </xsl:when>
+                                                               <xsl:when 
test="check_list/status = 3">
+                                                                       <option 
value="3" SELECTED="SELECTED">Kansellert</option>
+                                                                       <option 
value="0">Ikke utført</option>
+                                                                       <option 
value="1">Utført</option>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <option 
value="0" SELECTED="SELECTED">Ikke utført</option>
+                                                                       <option 
value="1">Utført</option>
+                                                                       <option 
value="3">Kansellert</option>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                               </select>
+                                       </div>
+                                       <!-- DEADLINE -->
+                                       <div class="row">
+                                               <xsl:if 
test="check_list/error_msg_array/deadline != ''">
+                                                       <xsl:variable 
name="error_msg">
+                                                               <xsl:value-of 
select="check_list/error_msg_array/deadline" />
+                                                       </xsl:variable>
+                                                       <div 
class='input_error_msg'>
+                                                               <xsl:value-of 
select="php:function('lang', $error_msg)" />
+                                                       </div>
+                                               </xsl:if>
+                                               <label>Fristdato</label>
+                                               <input type="text" 
id="deadline_date" name="deadline_date" class="date" readonly="readonly" >
+                                                       <xsl:attribute 
name="value">
+                                                               <xsl:value-of 
select="php:function('date', $date_format, number(check_list/deadline))"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </div>
+                                       <!-- PLANNED DATE -->
+                                       <div class="row">
+                                               <label>Planlagt dato</label>
+                                               <input type="text" 
id="planned_date" name="planned_date" class="date" readonly="readonly">
+                                                       <xsl:if 
test="check_list/planned_date != 0 and check_list/planned_date != ''">
+                                                               <xsl:attribute 
name="value">
+                                                                       
<xsl:value-of select="php:function('date', $date_format, 
number(check_list/planned_date))"/>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                       </div>
+                                       <!-- COMPLETED DATE -->
+                                       <div class="row">
+                                               <xsl:if 
test="check_list/error_msg_array/completed_date != ''">
+                                                       <xsl:variable 
name="error_msg">
+                                                               <xsl:value-of 
select="check_list/error_msg_array/completed_date" />
+                                                       </xsl:variable>
+                                                       <div 
class='input_error_msg'>
+                                                               <xsl:value-of 
select="php:function('lang', $error_msg)" />
+                                                       </div>
+                                               </xsl:if>
+                                               <label>Utført dato</label>
+                                               <input type="text" 
id="completed_date" name="completed_date" class="date" readonly="readonly" >
+                                                       <xsl:if 
test="check_list/completed_date != 0 and check_list/completed_date != ''">
+                                                               <xsl:attribute 
name="value">
+                                                                       
<xsl:value-of select="php:function('date', $date_format, 
number(check_list/completed_date))"/>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                       </div>
+                               </fieldset>
+                               <!-- ASSIGNMET -->
+                               <div class="row">
+                                       <label>Tildelt</label>
+                                       <select name="assigned_to">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'select')"/>
+                                               </xsl:attribute>
+                                               <option value="0">
+                                                       <xsl:value-of 
select="php:function('lang', 'select')"/>
+                                               </option>
+                                               <xsl:apply-templates 
select="user_list/options"/>
+                                       </select>
+                               </div>
+                               <!-- COMMENT -->
+                               <div class="comment">
+                                       <label>Kommentar</label>
+                                       <textarea>
+                                               <xsl:attribute 
name="name">comment</xsl:attribute>
+                                               <xsl:value-of 
select="check_list/comment"/>
+                                       </textarea>
+                               </div>
                        
-                <div class="form-buttons">
-                    <xsl:variable name="lang_save">
-                        <xsl:value-of select="php:function('lang', 
'save_check_list')" />
-                    </xsl:variable>
-                    <input class="btn" type="submit" value="Lagre detaljer" />
-                </div>
-            </form>    
-        </div>
-    </div>
+                               <div class="form-buttons">
+                                       <xsl:variable name="lang_save">
+                                               <xsl:value-of 
select="php:function('lang', 'save_check_list')" />
+                                       </xsl:variable>
+                                       <input class="btn" type="submit" 
value="Lagre detaljer" />
+                               </div>
+                       </form> 
+               </div>
+       </div>
 </xsl:template>
+
+       <!-- New template-->
+       <xsl:template match="options">
+               <option value="{id}">
+                       <xsl:if test="selected != 0">
+                               <xsl:attribute name="selected" 
value="selected"/>
+                       </xsl:if>
+                       <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+               </option>
+       </xsl:template>

Modified: trunk/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/edit_check_list.xsl      
2013-05-09 20:55:43 UTC (rev 11097)
+++ trunk/controller/templates/base/check_list/edit_check_list.xsl      
2013-05-09 21:37:04 UTC (rev 11098)
@@ -77,6 +77,30 @@
                              </xsl:if>
                            </input>
                    </div>
+                               <!-- ASSIGNMET -->
+                               <div class="row">
+                                       <label>Tildelt</label>
+                                       <select name="assigned_to">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'select')"/>
+                                               </xsl:attribute>
+                                               <option value="0">
+                                                       <xsl:value-of 
select="php:function('lang', 'select')"/>
+                                               </option>
+                                               <xsl:apply-templates 
select="user_list/options"/>
+                                       </select>
+                               </div>
+                   <div class="row">
+                               <label>Egne Timer</label>
+                               <input class="date">
+                             <xsl:attribute 
name="id">billable_hours</xsl:attribute>
+                             <xsl:attribute 
name="name">billable_hours</xsl:attribute>
+                             <xsl:attribute name="type">text</xsl:attribute>
+                           </input>
+                               <xsl:text> </xsl:text>
+                               <xsl:value-of 
select="check_list/billable_hours"/>
+                   </div>
+
                    </fieldset>
                    <fieldset class="col_2">
                            <div class="row">
@@ -105,3 +129,14 @@
                </div>
        </div>
 </xsl:template>
+
+
+       <!-- New template-->
+       <xsl:template match="options">
+               <option value="{id}">
+                       <xsl:if test="selected != 0">
+                               <xsl:attribute name="selected" 
value="selected"/>
+                       </xsl:if>
+                       <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+               </option>
+       </xsl:template>




reply via email to

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