[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9830] controller: register location_code also to che
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9830] controller: register location_code also to checklist for components in ordre to list ' planned task' |
Date: |
Fri, 03 Aug 2012 12:18:09 +0000 |
Revision: 9830
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9830
Author: sigurdne
Date: 2012-08-03 12:18:08 +0000 (Fri, 03 Aug 2012)
Log Message:
-----------
controller: register location_code also to checklist for components in ordre to
list 'planned task'
Modified Paths:
--------------
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/inc/hook_home.inc.php
trunk/controller/templates/base/check_list/add_check_list.xsl
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2012-08-03 10:31:08 UTC
(rev 9829)
+++ trunk/controller/inc/class.socheck_list.inc.php 2012-08-03 12:18:08 UTC
(rev 9830)
@@ -221,10 +221,21 @@
* Get check list objects for a control on a location with set planned
date
*
* @param $control_id control id
- * @param $location_code location code
+ * @param $location_code location code representing physical locations
+ * @param $location_id location id representing logical system locations
+ * @param $component_id component id: entity within logical location
* @return array with check list objects
*/
- function get_planned_check_lists_for_control($control_id,
$location_code){
+ function get_planned_check_lists_for_control($control_id,
$location_code,$location_id, $component_id)
+ {
+ $component_filter = ' AND component_id IS NULL ';
+ if($component_id)
+ {
+ $location_id = (int)$location_id;
+ $component_id = (int)$component_id;
+ $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 .= "completed_date, component_id, location_code,
num_open_cases, num_pending_cases ";
$sql .= "FROM controller_check_list cl ";
@@ -232,6 +243,7 @@
$sql .= "AND cl.location_code = '{$location_code}' ";
$sql .= "AND NOT cl.planned_date IS NULL ";
$sql .= "AND cl.completed_date IS NULL ";
+ $sql .= $component_filter;
$sql .= "ORDER BY cl.id;";
$this->db->query($sql);
@@ -835,4 +847,4 @@
return $ret;
}
-}
\ No newline at end of file
+}
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2012-08-03 10:31:08 UTC
(rev 9829)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2012-08-03 12:18:08 UTC
(rev 9830)
@@ -208,6 +208,14 @@
}
}
+ if(!$location_code = $check_list->get_location_code())
+ {
+ $location_code =
phpgw::get_var('location_code');
+ $check_list->set_location_code($location_code);
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$check_list->get_location_code()));
+ $level =
$this->get_location_level($location_code);
+ }
+
if($type == "component")
{
if($check_list != null)
@@ -223,7 +231,7 @@
$component = new controller_component();
$component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
+ $component->set_xml_short_desc( $short_desc );
$component_array = $component->toArray();
$building_location_code =
$this->get_building_location_code($component_arr['location_code']);
@@ -231,13 +239,6 @@
}
else
{
- if($check_list->get_location_code() == '')
- {
- $location_code =
phpgw::get_var('location_code');
-
$check_list->set_location_code($location_code);
- }
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$check_list->get_location_code()));
- $level =
$this->get_location_level($location_code);
$type = "location";
}
@@ -248,16 +249,16 @@
$data = array
(
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'control'
=> $control->toArray(),
- 'date_format'
=> $date_format,
- 'check_list'
=> $check_list->toArray(),
- 'type'
=> $type,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month_nr,
+ 'location_array' =>
$location_array,
+ 'component_array' =>
$component_array,
+ 'control'
=> $control->toArray(),
+ 'date_format' =>
$date_format,
+ 'check_list' =>
$check_list->toArray(),
+ 'type'
=> $type,
+ 'current_year' =>
$year,
+ 'current_month_nr' =>
$month_nr,
'building_location_code' =>
$building_location_code,
- 'location_level'
=> $level
+ 'location_level' =>
$level
);
self::add_javascript('controller', 'controller',
'jquery.js');
@@ -383,15 +384,15 @@
{
$check_list = new controller_check_list();
$check_list->set_control_id($control_id);
+ $location_code =
phpgw::get_var('location_code');
+ $check_list->set_location_code( $location_code
);
- if($type == "component"){
+ if($type == "component")
+ {
$location_id =
phpgw::get_var('location_id');
$component_id =
phpgw::get_var('component_id');
$check_list->set_location_id(
$location_id );
$check_list->set_component_id(
$component_id );
- }else {
- $location_code =
phpgw::get_var('location_code');
- $check_list->set_location_code(
$location_code );
}
}
Modified: trunk/controller/inc/hook_home.inc.php
===================================================================
--- trunk/controller/inc/hook_home.inc.php 2012-08-03 10:31:08 UTC (rev
9829)
+++ trunk/controller/inc/hook_home.inc.php 2012-08-03 12:18:08 UTC (rev
9830)
@@ -227,7 +227,7 @@
{
$curr_location = $control_instance[0];
$current_control = $control_instance[1];
- $check_lists =
$so->get_planned_check_lists_for_control($current_control["id"],
$curr_location);
+ $check_lists =
$so->get_planned_check_lists_for_control($current_control["id"],
$curr_location, $current_control['location_id'],
$current_control['component_id']);
$location_array = execMethod('property.bolocation.read_single',
array('location_code' => $curr_location));
$location_name = $location_array["loc1_name"];
if(isset($current_control['component_id']) &&
$current_control['component_id'])
Modified: trunk/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/add_check_list.xsl
2012-08-03 10:31:08 UTC (rev 9829)
+++ trunk/controller/templates/base/check_list/add_check_list.xsl
2012-08-03 12:18:08 UTC (rev 9830)
@@ -104,16 +104,18 @@
<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: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>
- <xsl:variable
name="location_code"><xsl:value-of
select="location_array/location_code"/></xsl:variable>
<input type="hidden"
name="location_code" value="{$location_code}" />
</xsl:otherwise>
</xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9830] controller: register location_code also to checklist for components in ordre to list ' planned task',
Sigurd Nes <=