[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11200] controller: assigned to
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11200] controller: assigned to |
Date: |
Mon, 24 Jun 2013 12:58:07 +0000 |
Revision: 11200
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11200
Author: sigurdne
Date: 2013-06-24 12:58:04 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
controller: assigned to
Modified Paths:
--------------
trunk/controller/inc/class.hook_helper.inc.php
trunk/controller/inc/class.socontrol.inc.php
Modified: trunk/controller/inc/class.hook_helper.inc.php
===================================================================
--- trunk/controller/inc/class.hook_helper.inc.php 2013-06-24 12:15:19 UTC
(rev 11199)
+++ trunk/controller/inc/class.hook_helper.inc.php 2013-06-24 12:58:04 UTC
(rev 11200)
@@ -303,18 +303,6 @@
// 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
@@ -380,16 +368,29 @@
{
$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'] );
- }
- }
}
+
}
+ //Add assigned
+ $my_check_lists =
$this->get_my_assigned_check_list($from_date_ts, $to_date_ts, $repeat_type,
true);
+
+ $_assigned_list = array();
+ foreach ($my_check_lists as $_key => $my_check_list)
+ {
+
$_assigned_list[$my_check_list['location_code']][$_key] = $my_check_list;
+ }
+
+ 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'] );
+ }
+
+ ksort($my_undone_controls);
+
+
$my_undone_controls_HTML = "<div
class='home_portal'><h2><div class='date heading'>Fristdato</div><div
class='control heading'>Tittel på kontroll</div><div class='title
heading'>Lokasjonsnavn</div><div class='control-area
heading'>Kontrollområde</div></h2>";
// Sorts my_undone_controls by deadline date
@@ -713,14 +714,14 @@
/* ================================ FUNCTIONS
======================================== */
- function get_my_assigned_check_list($from_date_ts, $to_date_ts,
$repeat_type)
+ function get_my_assigned_check_list($from_date_ts, $to_date_ts,
$repeat_type, $completed = null)
{
$check_list_array = array();
$so_control = CreateObject('controller.socontrol');
$user_id = $GLOBALS['phpgw_info']['user']['account_id'];
- $assigned_check_list_at_location =
$so_control->get_assigned_check_list_at_location( $from_date_ts, $to_date_ts,
$repeat_type, $user_id,"return_array");
+ $assigned_check_list_at_location =
$so_control->get_assigned_check_list_at_location( $from_date_ts, $to_date_ts,
$repeat_type, $user_id,$completed, 'return_array');
foreach ($assigned_check_list_at_location as
$assigned_check_list)
{
@@ -728,7 +729,7 @@
}
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");
+ $assigned_check_list_at_component =
$so_control->get_assigned_check_list_by_component( $from_date_ts, $to_date_ts,
$repeat_type, $user_id, $completed, 'return_array');
foreach ($assigned_check_list_at_component as
$assigned_check_list)
{
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2013-06-24 12:15:19 UTC
(rev 11199)
+++ trunk/controller/inc/class.socontrol.inc.php 2013-06-24 12:58:04 UTC
(rev 11200)
@@ -124,14 +124,14 @@
* @param $role_id responsible role for carrying out the
control
* @return array with controls as objects or arrays
*/
- public function get_assigned_check_list_at_location($from_date,
$to_date, $repeat_type, $user_id, $return_type = "return_object")
+ public function get_assigned_check_list_at_location($from_date,
$to_date, $repeat_type, $user_id,$completed = null, $return_type =
"return_object")
{
$user_id = (int) $user_id;
$repeat_type = (int) $repeat_type;
$check_list_array = array();
- $sql = "SELECT controller_check_list.location_code,
controller_check_list.control_id, controller_check_list.id AS check_list_id,"
+ $sql = "SELECT DISTINCT
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,planned_date, completed_date,"
. " control_area_id,
repeat_type,repeat_interval, title"
. " FROM controller_check_list"
@@ -146,8 +146,13 @@
}
- $sql .= "AND ((controller_control.start_date <=
$to_date AND controller_control.end_date IS NULL) ";
- $sql .= "OR (controller_control.start_date <= $to_date
AND controller_control.end_date > $from_date ))";
+ $sql .= " AND ((controller_control.start_date <=
$to_date AND controller_control.end_date IS NULL) ";
+ $sql .= " OR (controller_control.start_date <= $to_date
AND controller_control.end_date > $from_date ))";
+
+ if($completed)
+ {
+ $sql .= " AND
controller_check_list.completed_date IS NULL ";
+ }
//_debug_array($sql);
$this->db->query($sql);
@@ -197,13 +202,13 @@
* @param $role_id responsible role for carrying out the
control
* @return array of components as objects or arrays
*/
- public function
get_assigned_check_list_by_component($from_date, $to_date, $repeat_type,
$user_id, $return_type = "return_object")
+ public function
get_assigned_check_list_by_component($from_date, $to_date, $repeat_type,
$user_id, $completed = null, $return_type = "return_object")
{
$repeat_type = $repeat_type;
$user_id = (int)$user_id;
- $sql = "SELECT controller_check_list.location_code,
controller_check_list.control_id, controller_check_list.id AS check_list_id,"
+ $sql = "SELECT DISTINCT
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,
controller_control.description, start_date, end_date, deadline,"
. " control_area_id,
repeat_type,repeat_interval, title,"
. " bim_item.guid,bim_item.type as
component_type, bim_item.id as component_id, bim_item.address,"
@@ -220,9 +225,14 @@
// $sql .= "AND controller_control.repeat_type =
$repeat_type ";
}
- $sql .= "AND ((controller_control.start_date <=
$to_date AND controller_control.end_date IS NULL) ";
- $sql .= "OR (controller_control.start_date <= $to_date
AND controller_control.end_date > $from_date ))";
- $sql .= "ORDER BY bim_item.id ";
+ if($completed)
+ {
+ $sql .= " AND
controller_check_list.completed_date IS NULL ";
+ }
+
+ $sql .= " AND ((controller_control.start_date <=
$to_date AND controller_control.end_date IS NULL) ";
+ $sql .= " OR (controller_control.start_date <= $to_date
AND controller_control.end_date > $from_date ))";
+ $sql .= " ORDER BY bim_item.id ";
$this->db->query($sql);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11200] controller: assigned to,
Sigurd Nes <=