[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11198] controller: assigned to
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11198] controller: assigned to |
Date: |
Mon, 24 Jun 2013 12:05:49 +0000 |
Revision: 11198
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11198
Author: sigurdne
Date: 2013-06-24 12:05:28 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
controller: assigned to
Modified Paths:
--------------
trunk/controller/inc/class.hook_helper.inc.php
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/inc/component/class.date_generator.inc.php
Modified: trunk/controller/inc/class.hook_helper.inc.php
===================================================================
--- trunk/controller/inc/class.hook_helper.inc.php 2013-06-24 11:02:44 UTC
(rev 11197)
+++ trunk/controller/inc/class.hook_helper.inc.php 2013-06-24 12:05:28 UTC
(rev 11198)
@@ -174,6 +174,17 @@
$my_check_lists =
$this->get_my_assigned_check_list($from_date_ts, $to_date_ts, $repeat_type);
+ $_assigned_list = array();
+ foreach ($my_check_lists as $_key => $my_check_list)
+ {
+
$_assigned_list[$my_check_list['location_code']][$_key] = $my_check_list;
+ }
+
+ foreach ($_assigned_list as $location_code =>
$controls_at_location)
+ {
+ $my_controls[] = array( $location_code,
'assigned', $controls_at_location );
+ }
+
$my_planned_controls = array();
// Generates an array with planned controls
@@ -200,8 +211,7 @@
if($control_type == "location")
{
- $check_list_array =
$so_check_list->get_check_lists_for_control_and_location( $my_control['id'],
$location_code, $from_date_ts, $to_date_ts, $repeat_type = null);
-
+ $check_list_array =
$so_check_list->get_check_lists_for_control_and_location( $my_control['id'],
$location_code, $from_date_ts, $to_date_ts, $repeat_type = null,
$filter_assigned_to = true);
foreach($check_list_array as
$check_list)
{
$planned_date_for_check_list = $check_list->get_planned_date();
@@ -227,6 +237,19 @@
}
}
}
+ else if($control_type == "assigned")
+ {
+ $check_list_array =
$container_arr[2];
+ foreach($check_list_array as
$check_list)
+ {
+
$planned_date_for_check_list = $check_list['planned_date'];
+
+
if($planned_date_for_check_list > 0)
+ {
+
$my_planned_controls[$planned_date_for_check_list][] = array(
$check_list['deadline'], $my_control, $check_list['id'], "location",
$location_code );
+ }
+ }
+ }
}
}
@@ -281,8 +304,17 @@
// Fetches controls current user is responsible for 3 months
back in time
$my_controls = $this->get_my_controls($my_locations,
$from_date_ts, $to_date_ts, $repeat_type);
+//
$my_check_lists =
$this->get_my_assigned_check_list($from_date_ts, $to_date_ts, $repeat_type);
+ $_assigned_list = array();
+ foreach ($my_check_lists as $_key => $my_check_list)
+ {
+
$_assigned_list[$my_check_list['location_code']][$_key] = $my_check_list;
+ }
+
+//
+
$my_undone_controls = array();
// Generates an array containing undone controls
@@ -348,6 +380,12 @@
{
$my_undone_controls[$deadline_ts][] = array("edit", $deadline_ts, $my_control,
$check_list->get_id(), $location_code );
}
+
+ //Add assigned
+ foreach ($my_check_lists as
$_key => $my_check_list)
+ {
+
$my_undone_controls[$my_check_list['deadline']][] = array("edit",
$my_check_list['deadline'], $my_check_list, $_key,
$my_check_list['location_code'] );
+ }
}
}
}
@@ -376,7 +414,7 @@
$my_control =
$my_undone_control[2];
$control_area_name =
$this->get_control_area_name( $my_control["control_area_id"] );
-
+
$date_str = date($dateformat,
$deadline_ts);
if($check_list_status == "add")
@@ -454,14 +492,14 @@
{
$link = "";
$link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
-
+
$my_undone_controls_HTML .= "<li><a href='{$link}'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a></li>";
}
else
{
$link = "";
$link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
-
+
$my_undone_controls_HTML .= "<a href='{$link}'><div
class='date'>{$date_str}</div><div
class='control'>{$my_control['title']}</div><div
class='title'>{$location_name}</div><div
class='control-area'>{$control_area_name}</div></a>";
}
}
@@ -556,7 +594,7 @@
// Do not put checklist with
status planned in list
else if(
($check_list->get_planned_date() == '' || $check_list->get_planned_date() == 0
) && ( $check_list->get_status() == controller_check_list::STATUS_NOT_DONE ||
($check_list->get_status() == controller_check_list::STATUS_CANCELED)) )
{
- $my_assigned_controls[$deadline_ts][] =
array("edit", $deadline_ts, $my_control, $check_list->get_id(), $location_code
);
+
$my_assigned_controls[$deadline_ts][] = array("edit", $deadline_ts,
$my_control, $check_list->get_id(), $location_code );
}
}
}
@@ -650,7 +688,7 @@
$location_array[$location_code] = execMethod('property.bolocation.read_single',
array('location_code' => $location_code));
}
$location_name =
$location_array[$location_code]["loc1_name"];
-
+
$link = "";
$link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
@@ -688,13 +726,18 @@
{
$check_list_array[$assigned_check_list['id']] =
$assigned_check_list;
}
+ unset($assigned_check_list);
$assigned_check_list_at_component =
$so_control->get_assigned_check_list_by_component( $from_date_ts, $to_date_ts,
$repeat_type, $user_id,"return_array");
+ foreach ($assigned_check_list_at_component as
$assigned_check_list)
+ {
+ $check_list_array[$assigned_check_list['id']] =
$assigned_check_list;
+ }
+
//_debug_array($check_list_array);
//_debug_array($assigned_check_list_at_component);
-
-
+ return $check_list_array;
}
@@ -702,10 +745,12 @@
{
$so_control = CreateObject('controller.socontrol');
+ $my_controls = array();
+
foreach($my_locations as $location)
{
- $my_controls = array();
- // $components_with_controls_array = array();
+ $components_with_controls_array = array();
+ $controls_at_location = array();
$location_code = $location["location_code"];
$controls_at_location =
$so_control->get_controls_by_location( $location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_array", $location["role_id"] );
@@ -725,13 +770,13 @@
$components_with_controls_array =
$so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_array", $location["role_id"], $filter);
}
- if( count($controls_at_location) > 0 )
+ if( $controls_at_location )
{
// Saves location code, location type
and an array containing controls at locations
$my_controls[] = array( $location_code,
'location', $controls_at_location );
}
- if( count($components_with_controls_array) > 0 )
+ if( $components_with_controls_array )
{
foreach($components_with_controls_array
as $component)
{
@@ -741,8 +786,6 @@
}
}
-
-
return $my_controls;
}
@@ -754,12 +797,12 @@
$control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' => '','globals'
=> true,'use_acl' => 0));
foreach($control_areas['cat_list'] as $area)
+ {
+ if( $area['cat_id'] == $control_area_id )
{
- if( $area['cat_id'] == $control_area_id )
- {
- $control_area_name =
$area['name'];
- }
+ $control_area_name = $area['name'];
}
+ }
return $control_area_name;
}
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2013-06-24 11:02:44 UTC
(rev 11197)
+++ trunk/controller/inc/class.socheck_list.inc.php 2013-06-24 12:05:28 UTC
(rev 11198)
@@ -273,6 +273,8 @@
$sql .= "AND status = {$status} ";
}
+ $sql .= "AND assigned_to IS NULL";
+
$this->db->query($sql);
$check_list = null;
@@ -565,7 +567,7 @@
* @param $repeat_type_expr repeat type expression
* @return array with check list objects
*/
- function get_check_lists_for_control_and_location( $control_id,
$location_code, $from_date_ts, $to_date_ts, $repeat_type = null )
+ function get_check_lists_for_control_and_location( $control_id,
$location_code, $from_date_ts, $to_date_ts, $repeat_type = null ,
$filter_assigned_to = null)
{
$control_id = (int) $control_id;
@@ -582,7 +584,11 @@
}
$sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
-
+ if($filter_assigned_to)
+ {
+ $sql .= "AND assigned_to IS NULL";
+ }
+
$this->db->query($sql);
while ($this->db->next_record())
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2013-06-24 11:02:44 UTC
(rev 11197)
+++ trunk/controller/inc/class.socontrol.inc.php 2013-06-24 12:05:28 UTC
(rev 11198)
@@ -132,7 +132,7 @@
$check_list_array = array();
$sql = "SELECT controller_check_list.location_code,
controller_check_list.control_id, controller_check_list.id AS check_list_id,"
- . "
procedure_id,requirement_id,costresponsibility_id,control_area_id,description,
start_date, end_date,deadline,"
+ . "
procedure_id,requirement_id,costresponsibility_id,control_area_id,description,
start_date, end_date,deadline,planned_date, completed_date,"
. " control_area_id,
repeat_type,repeat_interval, title"
. " FROM controller_check_list"
. " {$this->join} controller_control ON
controller_check_list.control_id = controller_control.id"
@@ -161,13 +161,13 @@
$check_list->set_start_date($this->unmarshal($this->db->f('start_date'),
'int'));
$check_list->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
$check_list->set_deadline($this->unmarshal($this->db->f('deadline'), 'int'));
- //
$check_list->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
- //
$check_list->set_requirement_id($this->unmarshal($this->db->f('requirement_id'),
'int'));
- //
$check_list->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id'),
'int'));
+
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date'),
'int'));
+
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date'),
'int'));
$check_list->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
//
$check_list->set_repeat_type($this->unmarshal($this->db->f('repeat_type'),
'int'));
//
$check_list->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type'),
'int'));
//
$check_list->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'),
'int'));
+
$check_list->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
$check_list->set_assigned_to($this->unmarshal($user_id, 'int'));
if($return_type == "return_object")
Modified: trunk/controller/inc/component/class.date_generator.inc.php
===================================================================
--- trunk/controller/inc/component/class.date_generator.inc.php 2013-06-24
11:02:44 UTC (rev 11197)
+++ trunk/controller/inc/component/class.date_generator.inc.php 2013-06-24
12:05:28 UTC (rev 11198)
@@ -31,12 +31,15 @@
{
$control_start_date = $this->find_control_start_date();
$control_end_date = $this->end_date;
-
+
if($control_end_date == null)
{
$control_end_date = $this->period_end_date;
}
-
+/*
+_debug_array($control_start_date);
+_debug_array($control_end_date);
+*/
$period_start_date = $this->find_start_date_for_period(
$control_start_date );
$interval_date = $period_start_date;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11198] controller: assigned to,
Sigurd Nes <=