[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10902] Deleted function view_cases_for_check_list
From: |
Torstein |
Subject: |
[Fmsystem-commits] [10902] Deleted function view_cases_for_check_list |
Date: |
Sun, 17 Feb 2013 17:12:49 +0000 |
Revision: 10902
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10902
Author: vator
Date: 2013-02-17 17:12:49 +0000 (Sun, 17 Feb 2013)
Log Message:
-----------
Deleted function view_cases_for_check_list
Modified Paths:
--------------
trunk/controller/inc/class.socheck_item.inc.php
trunk/controller/inc/class.uicase.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
Modified: trunk/controller/inc/class.socheck_item.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_item.inc.php 2013-02-17 16:33:28 UTC
(rev 10901)
+++ trunk/controller/inc/class.socheck_item.inc.php 2013-02-17 17:12:49 UTC
(rev 10902)
@@ -267,10 +267,9 @@
* @param $type control item registration type
COMMENT/TEXTFIELD/CHECKLIST/RADIOBUTTONS
* @param $status status for cases OPEN/CLOSED/PENDING
* @param $messageStatus is there a message registered
for the case
- * @param $returnType data returned as objects or arrays
* @return check item objects
*/
- public function get_check_items_with_cases($check_list_id,
$type = "control_item_type_1", $status = "open", $messageStatus = null,
$return_type = "return_object")
+ public function get_check_items_with_cases($check_list_id,
$type = "control_item_type_1", $status = "open", $messageStatus = null,
$location_code = null)
{
$check_list_id = (int) $check_list_id;
$sql = "SELECT ci.id as ci_id, control_item_id,
check_list_id, ";
@@ -311,6 +310,11 @@
{
$sql .= "AND cic.location_item_id > 0 ";
}
+
+ if($location_code != null)
+ {
+ $sql .= "AND cic.location_code =
'$location_code' ";
+ }
$sql .= "ORDER BY ci.id";
@@ -325,15 +329,8 @@
if($check_item_id)
{
$check_item->set_cases_array($cases_array);
-
- if($return_type ==
"return_array")
- {
- $check_items_array[] =
$check_item->toArray();
- }
- else
- {
- $check_items_array[] =
$check_item;
- }
+
+ $check_items_array[] =
$check_item;
}
$check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id'), 'int'));
@@ -348,15 +345,8 @@
$control_item->set_control_group_id($this->db->f('control_group_id'), 'int');
$control_item->set_type($this->db->f('type', true), 'string');
- if($return_type == "return_array")
- {
-
$check_item->set_control_item($control_item->toArray());
- }
- else
- {
-
$check_item->set_control_item($control_item);
- }
-
+
$check_item->set_control_item($control_item);
+
$cases_array = array();
}
@@ -374,14 +364,8 @@
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement', true),
'string'));
- if($return_type == "return_array")
- {
- $cases_array[] =
$case->toArray();
- }
- else
- {
- $cases_array[] = $case;
- }
+ $cases_array[] = $case;
+
}
$check_item_id = $check_item->get_id();
@@ -390,15 +374,9 @@
if($check_item != null)
{
$check_item->set_cases_array($cases_array);
+
+ $check_items_array[] = $check_item;
- if($return_type == "return_array")
- {
- $check_items_array[] =
$check_item->toArray();
- }
- else
- {
- $check_items_array[] = $check_item;
- }
return $check_items_array;
}
else
Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php 2013-02-17 16:33:28 UTC (rev
10901)
+++ trunk/controller/inc/class.uicase.inc.php 2013-02-17 17:12:49 UTC (rev
10902)
@@ -287,7 +287,7 @@
$check_list_id = phpgw::get_var('check_list_id');
$check_list =
$this->so_check_list->get_single($check_list_id);
- $check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open",
"no_message_registered", "return_array");
+ $check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open",
"no_message_registered");
$control_id = $check_list->get_control_id();
$control = $this->so_control->get_single( $control_id );
@@ -617,16 +617,6 @@
{
$check_list_id = phpgw::get_var('check_list_id');
- $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, 'return_array');
-
- foreach($open_check_items_and_cases as $key =>
$check_item)
- {
- $control_item_with_options =
$this->so_control_item->get_single_with_options($check_item['control_item_id']);
-
- $check_item['control_item']['options_array'] =
$control_item_with_options->get_options_array();
- $open_check_items_and_cases[$key] = $check_item;
- }
-
$check_list =
$this->so_check_list->get_single($check_list_id);
$control =
$this->so_control->get_single($check_list->get_control_id());
@@ -668,23 +658,34 @@
// Fetches buildings on property
$buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
- // Check list top section info
+ if( count($buildings_on_property) > 0 )
+ {
+ $building_location_code = $buildings_on_property[0]['id'];
+ $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, $building_location_code);
+ }
+ foreach($open_check_items_and_cases as $key =>
$check_item)
+ {
+ $control_item_with_options =
$this->so_control_item->get_single_with_options(
$check_item->get_control_item_id() );
+
+ $check_item->get_control_item()->set_options_array(
$control_item_with_options->get_options_array() );
+ $open_check_items_and_cases[$key] = $check_item;
+ }
$data = array
(
- 'control'
=> $control,
- 'check_list'
=> $check_list,
- 'buildings_on_property' =>
$buildings_on_property,
- 'location_array'
=> $location_array,
- 'component_array'
=> $component_array,
- 'type'
=>
$type,
- 'location_level'
=> $level,
- 'building_location_code'
=> $building_location_code,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month,
- 'open_check_items_and_cases' =>
$open_check_items_and_cases,
- 'cases_view' => 'open_cases',
+ 'control'
=> $control,
+ 'check_list'
=> $check_list,
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'location_array'
=> $location_array,
+ 'component_array'
=> $component_array,
+ 'type'
=> $type,
+ 'location_level'
=> $level,
+ 'building_location_code'
=> $building_location_code,
+ 'current_year'
=> $year,
+ 'current_month_nr'
=> $month,
+ 'open_check_items_and_cases' =>
$open_check_items_and_cases,
+ 'cases_view' => 'open_cases'
);
phpgwapi_jquery::load_widget('core');
@@ -700,21 +701,10 @@
$check_list_id = phpgw::get_var('check_list_id');
$check_list =
$this->so_check_list->get_single($check_list_id);
- $closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null,
'closed', null, 'return_array');
-
// Check list top section info
$control =
$this->so_control->get_single($check_list->get_control_id());
$location_code = $check_list->get_location_code();
- $level = $this->location_finder->get_location_level($location_code);
- $year = date("Y", $check_list->get_deadline());
- $month = date("n", $check_list->get_deadline());
-
- $user_role = true;
-
- // Fetches buildings on property
- $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
-
$component_id = $check_list->get_component_id();
if($component_id > 0)
@@ -741,6 +731,21 @@
}
// Check list top section info
+ $level = $this->location_finder->get_location_level($location_code);
+ $year = date("Y", $check_list->get_deadline());
+ $month = date("n", $check_list->get_deadline());
+
+ $user_role = true;
+
+ // Fetches buildings on property
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
+
+ if( count($buildings_on_property) > 0 )
+ {
+ $building_location_code = $buildings_on_property[0]['id'];
+ $closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null,
'closed', null, $building_location_code);
+ }
+
$data = array
(
'control'
=> $control,
@@ -755,7 +760,8 @@
'current_month_nr'
=> $month,
'closed_check_items_and_cases' =>
$closed_check_items_and_cases,
'check_list' => $check_list,
- 'cases_view' => 'closed_cases'
+ 'cases_view' => 'closed_cases',
+ 'building_location_code' => $building_location_code
);
phpgwapi_jquery::load_widget('core');
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2013-02-17 16:33:28 UTC
(rev 10901)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2013-02-17 17:12:49 UTC
(rev 10902)
@@ -608,7 +608,7 @@
{
$check_list_id = phpgw::get_var('check_list_id');
- $check_items_with_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open",
null, "return_array");
+ $check_items_with_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open",
null);
return json_encode( $check_items_with_cases );
}
Modified:
trunk/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
===================================================================
---
trunk/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
2013-02-17 16:33:28 UTC (rev 10901)
+++
trunk/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
2013-02-17 17:12:49 UTC (rev 10902)
@@ -1,19 +1,19 @@
<!-- $Id: view_calendar_month.xsl 9200 2012-04-21 20:05:34Z vator $ -->
<xsl:template name="select_buildings_on_property">
- <select id="choose_building_on_property" class="selectLocation">
- <option value="">Velg bygg</option>
- <xsl:for-each select="buildings_on_property">
- <option>
- <xsl:if test="id = //current_location/location_code">
- <xsl:attribute name="selected">selected</xsl:attribute>
- </xsl:if>
- <xsl:attribute name="value">
- <xsl:value-of select="id"/>
- </xsl:attribute>
- <xsl:value-of select="name" />
- </option>
- </xsl:for-each>
- </select>
-
+ <select id="choose_building_on_property" class="selectLocation">
+ <xsl:for-each select="buildings_on_property">
+ <option>
+ <xsl:if test="id = //building_location_code">
+ <xsl:attribute name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="value">
+ <xsl:value-of select="id"/>
+ </xsl:attribute>
+ <xsl:value-of select="name" />
+ </option>
+ </xsl:for-each>
+ </select>
+
+
</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10902] Deleted function view_cases_for_check_list,
Torstein <=