[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11168] controller: add component to control group
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11168] controller: add component to control group |
Date: |
Wed, 12 Jun 2013 13:57:07 +0000 |
Revision: 11168
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11168
Author: sigurdne
Date: 2013-06-12 13:57:05 +0000 (Wed, 12 Jun 2013)
Log Message:
-----------
controller: add component to control group
Modified Paths:
--------------
trunk/controller/inc/class.socase.inc.php
trunk/controller/inc/class.socheck_item.inc.php
trunk/controller/inc/class.uicase.inc.php
trunk/controller/inc/model/class.check_item_case.inc.php
trunk/controller/inc/model/class.control_item.inc.php
trunk/controller/js/controller/case.js
trunk/controller/setup/phpgw_no.lang
trunk/controller/setup/setup.inc.php
trunk/controller/setup/tables_current.inc.php
trunk/controller/setup/tables_update.inc.php
trunk/controller/templates/base/case/add_case.xsl
trunk/controller/templates/base/check_list/edit_check_list.xsl
trunk/controller/templates/base/check_list/fragments/check_list_top_section.xsl
trunk/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
Modified: trunk/controller/inc/class.socase.inc.php
===================================================================
--- trunk/controller/inc/class.socase.inc.php 2013-06-12 05:04:09 UTC (rev
11167)
+++ trunk/controller/inc/class.socase.inc.php 2013-06-12 13:57:05 UTC (rev
11168)
@@ -84,6 +84,7 @@
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement'), 'string'));
$case->set_location_code($this->unmarshal($this->db->f('location_code'),
'string'));
+
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
return $case;
}
@@ -124,7 +125,8 @@
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement'), 'string'));
$case->set_location_code($this->unmarshal($this->db->f('location_code'),
'string'));
-
+
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
+
$cases_array[] = $case;
}
@@ -152,7 +154,8 @@
'modified_date',
'modified_by',
'measurement',
- 'location_code'
+ 'location_code',
+ 'component_id'
);
$values = array(
@@ -166,7 +169,8 @@
$this->marshal($case->get_modified_date(),
'int'),
$this->marshal($case->get_modified_by(), 'int'),
$this->marshal($case->get_measurement(),
'string'),
- $this->marshal($case->get_location_code(),
'string')
+ $this->marshal($case->get_location_code(),
'string'),
+ $this->marshal($case->get_component_id(),
'int'),
);
$sql = 'INSERT INTO controller_check_item_case (' .
join(',', $cols) . ') VALUES (' . join(',', $values) . ')';
@@ -287,16 +291,7 @@
function delete($case_id)
{
$case_id = (int) $case_id;
- $status = $this->db->query("DELETE FROM
controller_check_item_case WHERE id = $case_id");
-
- if( $status )
- {
- return true;
- }
- else
- {
- return false;
- }
+ return $this->db->query("DELETE FROM
controller_check_item_case WHERE id = $case_id");
}
function get_id_field_name(){}
Modified: trunk/controller/inc/class.socheck_item.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_item.inc.php 2013-06-12 05:04:09 UTC
(rev 11167)
+++ trunk/controller/inc/class.socheck_item.inc.php 2013-06-12 13:57:05 UTC
(rev 11168)
@@ -272,10 +272,14 @@
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, ";
+ $sql = "SELECT ci.id as ci_id, control_item_id,
check_list_id, component_location_id,";
$sql .= "cic.id as cic_id, cic.status as cic_status,
cic.*, ";
$sql .= "coi.id as coi_id, coi.* ";
- $sql .= "FROM controller_check_item ci ";
+ // $sql .= "FROM controller_check_item ci ";
+
+ $sql .= "FROM controller_control_group JOIN
controller_control_item ON
controller_control_item.control_group_id=controller_control_group.id ";
+ $sql .= "JOIN controller_check_item ci ON
ci.control_item_id = controller_control_item.id ";
+
$sql .= "LEFT JOIN controller_control_item as coi ON
ci.control_item_id = coi.id ";
$sql .= "LEFT JOIN controller_check_item_case as cic ON
ci.id = cic.check_item_id ";
$sql .= "WHERE ci.check_list_id = {$check_list_id} ";
@@ -311,7 +315,7 @@
$sql .= "AND cic.location_item_id > 0 ";
}
- if($location_code != null)
+ if($location_code != null)
{
$sql .= "AND cic.location_code =
'$location_code' ";
}
@@ -343,6 +347,7 @@
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
$control_item->set_control_group_id($this->db->f('control_group_id'), 'int');
+
$control_item->set_component_location_id($this->db->f('component_location_id'),
'int');
$control_item->set_type($this->db->f('type', true), 'string');
$check_item->set_control_item($control_item);
@@ -363,7 +368,7 @@
$case->set_modified_date($this->unmarshal($this->db->f('modified_date'),
'int'));
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement', true),
'string'));
-
+
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
$cases_array[] = $case;
}
@@ -395,10 +400,11 @@
{
$message_ticket_id = (int) $message_ticket_id;
- $sql = "SELECT ci.id as ci_id, control_item_id, ";
+ $sql = "SELECT ci.id as ci_id, control_item_id,
component_location_id,";
$sql .= "check_list_id, cic.id as cic_id, cic.status as
cic_status, cic.*, ";
$sql .= "coi.id as coi_id, coi.* ";
- $sql .= "FROM controller_check_item ci ";
+ $sql .= "FROM controller_control_group JOIN
controller_control_item ON
controller_control_item.control_group_id=controller_control_group.id ";
+ $sql .= "JOIN controller_check_item ci ON
ci.control_item_id = controller_control_item.id ";
$sql .= "LEFT JOIN controller_control_item as coi ON
ci.control_item_id = coi.id ";
$sql .= "LEFT JOIN controller_check_item_case as cic ON
ci.id = cic.check_item_id ";
$sql .= "WHERE cic.location_item_id =
{$message_ticket_id}";
@@ -428,6 +434,7 @@
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
$control_item->set_control_group_id($this->db->f('control_group_id'), 'int');
+
$control_item->set_component_location_id($this->db->f('component_location_id'),
'int');
$control_item->set_type($this->db->f('type', true), 'string');
$check_item->set_control_item($control_item);
Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php 2013-06-12 05:04:09 UTC (rev
11167)
+++ trunk/controller/inc/class.uicase.inc.php 2013-06-12 13:57:05 UTC (rev
11168)
@@ -67,9 +67,9 @@
private $delete;
var $public_functions = array(
- 'add_case' => true,
+ 'add_case' => true,
'save_case' => true,
- 'save_case_ajax' => true,
+ 'save_case_ajax' => true,
'create_case_message' => true,
'view_case_message' => true,
'send_case_message' => true,
@@ -77,7 +77,7 @@
'delete_case' => true,
'close_case' => true,
'open_case' => true,
- 'view_open_cases' => true,
+ 'view_open_cases' => true,
'view_closed_cases' => true
);
@@ -85,17 +85,17 @@
{
parent::__construct();
- $this->so =
CreateObject('controller.socase');
- $this->so_control =
CreateObject('controller.socontrol');
+ $this->so =
CreateObject('controller.socase');
+ $this->so_control =
CreateObject('controller.socontrol');
$this->so_control_item =
CreateObject('controller.socontrol_item');
$this->so_check_item =
CreateObject('controller.socheck_item');
$this->so_procedure =
CreateObject('controller.soprocedure');
$this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
$this->so_control_group =
CreateObject('controller.socontrol_group');
$this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
- $this->so_check_list =
CreateObject('controller.socheck_list');
+ $this->so_check_list =
CreateObject('controller.socheck_list');
- $this->location_finder = new location_finder();
+ $this->location_finder = new location_finder();
$this->read =
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_READ, 'controller');//1
$this->add =
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_ADD, 'controller');//2
@@ -106,8 +106,9 @@
function add_case()
{
$check_list_id = phpgw::get_var('check_list_id');
+ $selected_location_code =
phpgw::get_var('location_code');
$check_list =
$this->so_check_list->get_single($check_list_id);
- $control =
$this->so_control->get_single($check_list->get_control_id());
+ $control =
$this->so_control->get_single($check_list->get_control_id());
$saved_control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
@@ -125,7 +126,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();
$type = 'component';
@@ -134,12 +135,16 @@
else
{
$location_code =
$check_list->get_location_code();
+ $location_code_search_components =
$selected_location_code ? $selected_location_code : $location_code;
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
$type = 'location';
}
//_debug_array($saved_control_groups);
//Populating array with saved control items for each
group
+ //Cache result
+ $components_at_location = array();
+
foreach ($saved_control_groups as $control_group)
{
$saved_control_items =
$this->so_control_item_list->get_control_items_and_options_by_control_and_group($control->get_id(),
$control_group->get_id(), "return_array");
@@ -154,18 +159,24 @@
$criterias_array = array();
$loc_arr =
$GLOBALS['phpgw']->locations->get_name($component_location_id);
$criterias_array['location_id']
= $component_location_id;
-
$criterias_array['location_code'] = $location_code;
+
$criterias_array['location_code'] = $location_code_search_components;
$criterias_array['allrows'] =
true;
- $components_at_location =
execMethod('property.soentity.get_eav_list', $criterias_array);
+
+ if(
!isset($components_at_location[$component_location_id][$location_code_search_components])
|| !$_components_at_location =
$components_at_location[$component_location_id][$location_code_search_components])
+ {
+
$_components_at_location = execMethod('property.soentity.get_eav_list',
$criterias_array);
+
$components_at_location[$component_location_id][$location_code_search_components]
= $_components_at_location;
+ }
+
/// end components
- if($components_at_location)
+ if($_components_at_location)
{
$control_groups_with_items_array[] = array
(
'control_group'
=> $control_group->toArray(),
'control_items'
=> $saved_control_items,
-
'components_at_location' => array('component_options' =>
$components_at_location)
+
'components_at_location' => array('component_options' =>
$_components_at_location)
);
}
}
@@ -190,37 +201,41 @@
$year = date("Y", $check_list->get_deadline());
$month = date("n", $check_list->get_deadline());
- $user_role = true;
+ $user_role = true;
// Fetches buildings on property
$buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
-
+ foreach ( $buildings_on_property as &$building)
+ {
+ $building['selected'] = $building['id'] ==
$selected_location_code ? 1 : 0;
+ }
+//_debug_array($control_groups_with_items_array);
$data = array
(
'control'
=> $control,
'check_list'
=> $check_list,
- 'buildings_on_property' =>
$buildings_on_property,
- 'location_array' =>
$location_array,
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'location_array'
=> $location_array,
'component_array'
=> $component_array,
'control_groups_with_items_array' =>
$control_groups_with_items_array,
'type'
=> $type,
'location_level'
=> $level,
- 'building_location_code'
=> $building_location_code,
+ // 'building_location_code'
=> $building_location_code,
'current_year'
=> $year,
'current_month_nr'
=> $month,
- 'cases_view' => 'add_case',
+ 'cases_view'
=> 'add_case',
);
phpgwapi_jquery::load_widget('core');
self::add_javascript('controller', 'controller',
'custom_ui.js');
self::add_javascript('controller', 'controller',
'ajax.js');
- self::add_javascript('controller', 'controller', 'case.js');
- self::add_javascript('controller', 'controller', 'check_list.js');
+ self::add_javascript('controller', 'controller',
'case.js');
+ self::add_javascript('controller', 'controller',
'check_list.js');
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'check_list/fragments/nav_control_plan',
-
'check_list/fragments/check_list_top_section', 'case/add_case',
-
'check_list/fragments/select_buildings_on_property'), $data);
+
'check_list/fragments/check_list_top_section', 'case/add_case',
+
'check_list/fragments/select_buildings_on_property'), $data);
}
function save_case_ajax()
@@ -235,7 +250,9 @@
$case_descr = phpgw::get_var('case_descr');
$type = phpgw::get_var('type');
$status = phpgw::get_var('status');
- $location_code = phpgw::get_var('location_code');
+ $location_code = phpgw::get_var('location_code');
+ $component_id = phpgw::get_var('component_id', 'int');
+
$check_list =
$this->so_check_list->get_single($check_list_id);
@@ -268,7 +285,8 @@
$case->set_modified_by($user_id);
$case->set_modified_by($user_id);
$case->set_status($status);
- $case->set_location_code( $location_code );
+ $case->set_location_code( $location_code );
+ $case->set_component_id($component_id);
// Saves selected value from or measurement
if($type == 'control_item_type_2')
@@ -372,7 +390,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->location_finder->get_building_location_code($component_arr['location_code']);
@@ -555,7 +573,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();
$type = 'component';
@@ -574,18 +592,18 @@
$data = array
(
- 'control' =>
$control->toArray(),
+ 'control' =>
$control->toArray(),
'message_ticket_id' =>
$message_ticket_id,
- 'message_ticket' => $message_ticket,
- 'category' =>
$category[0]['name'],
- 'location_array' => $location_array,
+ 'message_ticket' =>
$message_ticket,
+ 'category' =>
$category[0]['name'],
+ 'location_array' =>
$location_array,
'component_array' => $component_array,
- 'control_array' =>
$control->toArray(),
- 'check_list' =>
$check_list->toArray(),
+ 'control_array' =>
$control->toArray(),
+ 'check_list' =>
$check_list->toArray(),
'check_items_and_cases' =>
$check_items_and_cases,
- 'current_year' => $year,
+ 'current_year' => $year,
'current_month_nr' => $month,
- 'type' => $type,
+ 'type' => $type,
'building_location_code' =>
$building_location_code,
'location_level' =>
$level
);
@@ -701,13 +719,13 @@
function view_open_cases()
{
- $check_list_id = phpgw::get_var('check_list_id');
- $case_location_code = phpgw::get_var('location_code');
+ $check_list_id = phpgw::get_var('check_list_id');
+ $case_location_code = phpgw::get_var('location_code');
$check_list =
$this->so_check_list->get_single($check_list_id);
$control =
$this->so_control->get_single($check_list->get_control_id());
- $check_list_location_code = $check_list->get_location_code();
+ $check_list_location_code =
$check_list->get_location_code();
$component_id = $check_list->get_component_id();
@@ -721,7 +739,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();
$type = 'component';
@@ -735,67 +753,76 @@
}
- $level =
$this->location_finder->get_location_level($check_list_location_code);
+ $level =
$this->location_finder->get_location_level($check_list_location_code);
$year = date("Y", $check_list->get_deadline());
$month = date("n", $check_list->get_deadline());
- $user_role = true;
+ $user_role = true;
// Fetches buildings on property
$buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role,
$check_list_location_code, $level);
- if( count($buildings_on_property) > 0 )
- {
- if($case_location_code == "")
- {
- $case_location_code = $buildings_on_property[0]['id'];
- }
+ if( count($buildings_on_property) > 0 )
+ {
+ $case_location_code = $case_location_code ?
$case_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, $case_location_code);
- }
+ $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, $case_location_code);
+
+ foreach ( $buildings_on_property as &$building)
+ {
+ $building['selected'] = $building['id']
== $case_location_code ? 1 : 0;
+ }
+
+ }
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() );
+
+ $component_location_id =
$check_item->get_control_item()->get_component_location_id();
+ //FIXME
+ //GET 'Short description' for component_id
- $check_item->get_control_item()->set_options_array(
$control_item_with_options->get_options_array() );
+ $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,
+ 'control' => $control,
'check_list'
=> $check_list,
'buildings_on_property' =>
$buildings_on_property,
- 'location_array' =>
$location_array,
+ 'location_array' =>
$location_array,
'component_array'
=> $component_array,
'type'
=> $type,
'location_level'
=> $level,
- 'building_location_code' =>
$case_location_code,
+ // 'building_location_code' =>
$case_location_code,
'current_year'
=> $year,
'current_month_nr'
=> $month,
'open_check_items_and_cases' =>
$open_check_items_and_cases,
- 'cases_view' => 'open_cases'
+ 'cases_view' =>
'open_cases'
);
- phpgwapi_jquery::load_widget('core');
- self::add_javascript('controller', 'controller', 'case.js');
+ phpgwapi_jquery::load_widget('core');
+ self::add_javascript('controller', 'controller',
'case.js');
self::render_template_xsl(
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu',
'case/view_open_cases', 'case/case_row',
-
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
-
'check_list/fragments/select_buildings_on_property'), $data );
+
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
+
'check_list/fragments/select_buildings_on_property'), $data );
}
function view_closed_cases()
{
$check_list_id = phpgw::get_var('check_list_id');
+ $case_location_code = phpgw::get_var('location_code');
+
$check_list =
$this->so_check_list->get_single($check_list_id);
- // Check list top section info
+ // Check list top section info
$control =
$this->so_control->get_single($check_list->get_control_id());
- $location_code = $check_list->get_location_code();
+ $location_code = $check_list->get_location_code();
- $component_id = $check_list->get_component_id();
+ $component_id = $check_list->get_component_id();
if($component_id > 0)
{
@@ -807,7 +834,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();
$type = 'component';
@@ -819,47 +846,51 @@
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
$type = 'location';
}
- // Check list top section info
+ // 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());
+ $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;
+ $user_role = true;
- // Fetches buildings on property
- $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
+ // 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);
- }
+ 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);
+ foreach ( $buildings_on_property as &$building)
+ {
+ $building['selected'] = $building['id']
== $case_location_code ? 1 : 0;
+ }
+ }
$data = array
(
- 'control' =>
$control,
+ 'control'
=> $control,
'check_list'
=> $check_list,
'buildings_on_property' =>
$buildings_on_property,
- 'location_array' =>
$location_array,
+ 'location_array' =>
$location_array,
'component_array'
=> $component_array,
'type'
=> $type,
'location_level'
=> $level,
- 'building_location_code' =>
$building_location_code,
+ // 'building_location_code' =>
$building_location_code,
'current_year'
=> $year,
'current_month_nr'
=> $month,
'closed_check_items_and_cases' =>
$closed_check_items_and_cases,
- 'check_list' => $check_list,
- 'cases_view' => 'closed_cases',
- 'building_location_code' => $building_location_code
+ 'check_list' =>
$check_list,
+ 'cases_view' =>
'closed_cases',
+ 'building_location_code' =>
$building_location_code
);
- phpgwapi_jquery::load_widget('core');
- self::add_javascript('controller', 'controller', 'case.js');
+ phpgwapi_jquery::load_widget('core');
+ self::add_javascript('controller', 'controller',
'case.js');
- self::render_template_xsl(
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu',
'case/view_closed_cases', 'case/case_row',
-
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
-
'check_list/fragments/select_buildings_on_property'), $data );
+ self::render_template_xsl(
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu',
'case/view_closed_cases', 'case/case_row',
+
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
+
'check_list/fragments/select_buildings_on_property'), $data );
}
public function query(){}
Modified: trunk/controller/inc/model/class.check_item_case.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item_case.inc.php 2013-06-12
05:04:09 UTC (rev 11167)
+++ trunk/controller/inc/model/class.check_item_case.inc.php 2013-06-12
13:57:05 UTC (rev 11168)
@@ -50,6 +50,7 @@
protected $modified_by;
protected $measurement;
protected $location_code;
+ protected $component_id;
/**
@@ -140,47 +141,57 @@
$this->measurement = $measurement;
}
- public function get_location_code() { return $this->location_code; }
+ public function get_location_code() { return $this->location_code; }
public function set_location_code($location_code)
{
$this->location_code = $location_code;
}
+
+ public function get_component_id()
+ {
+ return $this->component_id;
+ }
+
+ public function set_component_id($component_id)
+ {
+ $this->component_id = $component_id;
+ }
- public function validate()
+ public function validate()
{
$status = true;
// Validate DESCRIPTION
if( empty( $this->descr ) )
- {
- $status = false;
- $this->error_msg_array['descr'] = "error_msg_1";
- }
+ {
+ $status = false;
+ $this->error_msg_array['descr'] = "error_msg_1";
+ }
// Validate STATUS
if( empty( $this->status ) && ( (intval($this->status)
== self::STATUS_OPEN) || (intval($this->status) == self::STATUS_CLOSED) ||
(intval($this->status) == self::STATUS_PENDING)) )
- {
- $status = false;
- $this->error_msg_array['status'] = "error_msg_1";
- }
+ {
+ $status = false;
+ $this->error_msg_array['status'] =
"error_msg_1";
+ }
// Validate LOCATION CODE
- if( empty($this->location_code) )
- {
- $status = false;
- $this->error_msg_array['location_code'] = "error_msg_1";
- }
+ if( empty($this->location_code) )
+ {
+ $status = false;
+ $this->error_msg_array['location_code'] =
"error_msg_1";
+ }
// Validate CHECK ITEM ID
if( empty($this->check_item_id) )
- {
- $status = false;
- $this->error_msg_array['check_item_id'] = "error_msg_4";
- }
+ {
+ $status = false;
+ $this->error_msg_array['check_item_id'] =
"error_msg_4";
+ }
//to do: return $status;
- return true;
+ return true;
}
}
Modified: trunk/controller/inc/model/class.control_item.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_item.inc.php 2013-06-12
05:04:09 UTC (rev 11167)
+++ trunk/controller/inc/model/class.control_item.inc.php 2013-06-12
13:57:05 UTC (rev 11168)
@@ -46,6 +46,7 @@
protected $control_area_id;
protected $control_area_name;
protected $type;
+ protected $component_location_id;
protected $options_array;
protected $error_msg_array;
@@ -131,11 +132,22 @@
public function get_type() { return $this->type; }
+
+ public function
set_component_location_id($component_location_id)
+ {
+ $this->component_location_id = $component_location_id;
+ }
+
+ public function get_component_location_id()
+ {
+ return $this->component_location_id;
+ }
+
public function set_options_array($options_array)
{
$this->options_array = $options_array;
}
-
+
public function get_options_array() { return
$this->options_array; }
public function get_control_item_types()
@@ -209,4 +221,4 @@
}
return $status;
}
- }
\ No newline at end of file
+ }
Modified: trunk/controller/js/controller/case.js
===================================================================
--- trunk/controller/js/controller/case.js 2013-06-12 05:04:09 UTC (rev
11167)
+++ trunk/controller/js/controller/case.js 2013-06-12 13:57:05 UTC (rev
11168)
@@ -10,9 +10,12 @@
var requestUrl = $(thisForm).attr("action");
var location_code = $("#choose-building-on-property
option:selected").val();
+ $(thisForm).find("input[name=location_code]").val(location_code);
+
+ var control_group_id =
$(thisForm).find("input[name=control_group_id]").val();
+ var component_id = $("#component_at_control_group_" +
control_group_id).val();
+ $(thisForm).find("input[name=component_id]").val(component_id);
- $(thisForm).find("input[name=location_code]").val(location_code);
-
var validate_status = validate_form( thisForm );
if( validate_status ){
@@ -32,9 +35,13 @@
// Changes text on save button back
to original
window.setTimeout(function() {
if( type ==
"control_item_type_2")
+ {
$(submitBnt).val('Lagre måling');
+ }
else
+ {
$(submitBnt).val('Lagre sak');
+ }
$(submitBnt).addClass("not_active");
}, 1000);
@@ -255,14 +262,29 @@
return false;
});
+ $("#choose-building-on-property").change(function () {
+ var location_code = $(this).val();
+ var search = location.search.substring(1);
+ var oArgs = search?JSON.parse('{"' + search.replace(/&/g,
'","').replace(/=/g,'":"') + '"}',
+
function(key, value) { return key===""?value:decodeURIComponent(value) }):{}
+
+ oArgs.location_code = location_code;
+ delete oArgs.click_history;
+ var reloadPageUrl = phpGWLink('index.php', oArgs);
+ //var reloadPageUrl = location.pathname + location.search +
"&location_code=" + location_code;
+ location.href = reloadPageUrl;
+ });
+
+
+/*
$("#choose-building-on-property.view-cases").change(function () {
var location_code = $(this).val();
var reloadPageUrl = location.pathname + location.search +
"&location_code=" + location_code;
-
+alert(reloadPageUrl);
location.href = reloadPageUrl;
});
-
+ */
});
function validate_form( formObj )
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2013-06-12 05:04:09 UTC (rev
11167)
+++ trunk/controller/setup/phpgw_no.lang 2013-06-12 13:57:05 UTC (rev
11168)
@@ -237,6 +237,7 @@
status_date controller no den
status_unknown controller no Ukjent status
status controller no Status
+status not done controller no Ikke utført
Success controller no Suksess
sum controller no Sum
System setting for responsibility id for the current user must be 6
characters. controller no Systeminnstilling for ansvar må være
seks tegn.
Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php 2013-06-12 05:04:09 UTC (rev
11167)
+++ trunk/controller/setup/setup.inc.php 2013-06-12 13:57:05 UTC (rev
11168)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.45';
+ $setup_info['controller']['version'] = '0.1.46';
$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-06-12 05:04:09 UTC
(rev 11167)
+++ trunk/controller/setup/tables_current.inc.php 2013-06-12 13:57:05 UTC
(rev 11168)
@@ -109,7 +109,8 @@
'group_name' => array('type' =>
'varchar','precision' => '255','nullable' => false),
'procedure_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'control_area_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
- 'building_part_id' => array('type' =>
'varchar', 'precision' => 30, 'nullable' => True)
+ 'building_part_id' => array('type' =>
'varchar', 'precision' => 30, 'nullable' => True),
+ 'component_location_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => True),
),
'pk' => array('id'),
'fk' => array(),
@@ -174,10 +175,10 @@
),
'controller_document' => array(
'fd' => array(
- 'id' => array('type' => 'auto',
'nullable' => false),
- 'name' => array('type' => 'varchar',
'precision' => '255', 'nullable' => false),
+ 'id' => array('type' =>
'auto', 'nullable' => false),
+ 'name' => array('type' =>
'varchar', 'precision' => '255', 'nullable' => false),
'procedure_id' => array('type' => 'int',
'precision' => '4', 'nullable' => true),
- 'title' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
+ 'title' => array('type' =>
'varchar', 'precision' => '255', 'nullable' => true),
'description' => array('type' => 'text',
'nullable' => true),
'type_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false)
),
@@ -191,18 +192,19 @@
),
'controller_check_item_case' => array(
'fd' => array(
- 'id' => array('type'
=> 'auto', 'nullable' => false),
+ 'id' =>
array('type' => 'auto', 'nullable' => false),
'check_item_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
- 'status'
=> array('type' => 'int', 'precision' => '4', 'nullable' => false),
- 'measurement' => array('type' =>
'varchar', 'precision' => '50', 'nullable' => True),
+ 'status' =>
array('type' => 'int', 'precision' => '4', 'nullable' => false),
+ 'measurement' => array('type'
=> 'varchar', 'precision' => '50', 'nullable' => True),
'location_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => true), // representer
meldingsfregisteret
- 'location_item_id' => array('type' => 'int', 'precision' => '8',
'nullable' => true), //meldings id
- 'descr' => array('type'
=> 'text','nullable' => true),
- 'user_id' => array('type' =>
'int','precision' => '4','nullable' => true),
- 'entry_date' => array('type' => 'int',
'precision' => 8,'nullable' => false),
- 'modified_date' => array('type' => 'int',
'precision' => 8,'nullable' => True),
- 'modified_by' => array('type' => 'int', 'precision'
=> 4,'nullable' => True),
- 'location_code' => array('type'
=> 'varchar', 'precision' => 30, 'nullable' => True)
+ 'location_item_id' => array('type'
=> 'int', 'precision' => '8', 'nullable' => true), //meldings id
+ 'descr' =>
array('type' => 'text','nullable' => true),
+ 'user_id' =>
array('type' => 'int','precision' => '4','nullable' => true),
+ 'entry_date' => array('type'
=> 'int', 'precision' => 8,'nullable' => false),
+ 'modified_date' => array('type'
=> 'int', 'precision' => 8,'nullable' => True),
+ 'modified_by' => array('type'
=> 'int', 'precision' => 4,'nullable' => True),
+ 'location_code' => array('type'
=> 'varchar', 'precision' => 30, 'nullable' => True),
+ 'component_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
),
'pk' => array('id'),
'fk' => array('controller_check_item' => array('check_item_id' => 'id')),
Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php 2013-06-12 05:04:09 UTC
(rev 11167)
+++ trunk/controller/setup/tables_update.inc.php 2013-06-12 13:57:05 UTC
(rev 11168)
@@ -907,3 +907,22 @@
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
+
+ $test[] = '0.1.45';
+ function controller_upgrade0_1_45()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item_case','component_id',array(
+ 'type' => 'int',
+ 'precision' => '4',
+ 'nullable' => true
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['controller']['currentver'] =
'0.1.46';
+ return
$GLOBALS['setup_info']['controller']['currentver'];
+ }
+ }
+
Modified: trunk/controller/templates/base/case/add_case.xsl
===================================================================
--- trunk/controller/templates/base/case/add_case.xsl 2013-06-12 05:04:09 UTC
(rev 11167)
+++ trunk/controller/templates/base/case/add_case.xsl 2013-06-12 13:57:05 UTC
(rev 11168)
@@ -24,50 +24,53 @@
<li>
<h3 class="expand-trigger"><img
src="controller/images/arrow_right.png" /><xsl:value-of
select="control_group/group_name"/></h3>
<ul class="expand_list"
style="display:none;">
- <select
name="component_id" id="component_id">
+ <select
name="component_at_control_group_{control_group/id}"
id="component_at_control_group_{control_group/id}">
<xsl:apply-templates select="components_at_location/component_options"/>
</select>
-
+ <xsl:variable
name="control_group_id"><xsl:value-of select="control_group/id"/></xsl:variable>
<xsl:for-each
select="control_items">
<li>
<h4><img src="controller/images/arrow_right.png" /><span><xsl:value-of
select="title"/></span></h4>
+
<form class="frm_register_case expand_item" action="{$action_url}"
method="post">
+ <input
type="hidden" name="location_code" value="" class="required" />
+ <input
type="hidden" name="control_group_id" value="{$control_group_id}" />
+ <input
type="hidden" name="component_id" value="" />
+
<xsl:choose>
<xsl:when test="type = 'control_item_type_1'">
-
<form class="frm_register_case expand_item"
action="{$action_url}" method="post">
<xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
<input type="hidden" name="control_item_id"
value="{$control_item_id}" />
<input type="hidden"
name="check_list_id"><xsl:attribute name="value"><xsl:value-of
select="//check_list/id"/></xsl:attribute></input>
-
<input type="hidden" name="status" value="0" />
- <input type="hidden" name="type"
value="control_item_type_1" />
- <input type="hidden" name="location_code" value=""
class="required" />
+
<input type="hidden" name="status" value="0" />
+
<input type="hidden" name="type" value="control_item_type_1" />
- <!-- WHAT TO DO -->
- <div class="row what-to-do">
- <label>Hva skal sjekkes:</label>
- <div>
- <xsl:value-of disable-output-escaping="yes"
select="what_to_do"/>
- </div>
- </div>
+
<!-- WHAT TO DO -->
+
<div class="row what-to-do">
+
<label>Hva skal sjekkes:</label>
+
<div>
+
<xsl:value-of disable-output-escaping="yes"
select="what_to_do"/>
+
</div>
+
</div>
- <!-- HOW TO DO -->
- <div class="row how-to-do">
- <label>Utførelsesbeskrivelse:</label>
- <div>
- <xsl:value-of disable-output-escaping="yes"
select="how_to_do"/>
- </div>
- </div>
-
-
<div>
- <label class="comment">Beskrivelse av sak</label>
+
<!-- HOW TO DO -->
+
<div class="row how-to-do">
+
<label>Utførelsesbeskrivelse:</label>
+
<div>
+
<xsl:value-of disable-output-escaping="yes"
select="how_to_do"/>
+
</div>
+
</div>
+
+
<div>
+
<label class="comment">Beskrivelse av sak</label>
<textarea name="case_descr" class="required">
<xsl:value-of select="comment"/>
</textarea>
</div>
<input type="submit" class="btn" name="save_control"
value="Lagre sak" />
-
</form>
+
</xsl:when>
<xsl:when test="type = 'control_item_type_2'">
-
<form class="frm_register_case expand_item" action="{$action_url}"
method="post">
+
<xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
<input type="hidden" name="control_item_id"
value="{$control_item_id}" />
<input name="check_list_id"
type="hidden"><xsl:attribute name="value"><xsl:value-of
select="//check_list/id"/></xsl:attribute></input>
@@ -99,10 +102,10 @@
</div>
<xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'register_error')" /></xsl:variable>
<input type="submit" name="save_control" value="Lagre
måling" title="{$lang_save}" />
-
</form>
+
</xsl:when>
<xsl:when test="type = 'control_item_type_3'">
-
<form class="frm_register_case expand_item"
action="{$action_url}" method="post">
+
<xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
<input type="hidden" name="control_item_id"
value="{$control_item_id}" />
<input name="check_list_id"
type="hidden"><xsl:attribute name="value"><xsl:value-of
select="//check_list/id"/></xsl:attribute></input>
@@ -135,10 +138,10 @@
</div>
<xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'register_error')" /></xsl:variable>
<input type="submit" name="save_control" value="Lagre
sak/måling" title="{$lang_save}" />
-
</form>
+
</xsl:when>
<xsl:when test="type = 'control_item_type_4'">
-
<form class="frm_register_case expand_item"
action="{$action_url}" method="post">
+
<xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
<input type="hidden" name="control_item_id"
value="{$control_item_id}" />
<input name="check_list_id"
type="hidden"><xsl:attribute name="value"><xsl:value-of
select="//check_list/id"/></xsl:attribute></input>
@@ -171,9 +174,10 @@
</div>
<xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'register_error')" /></xsl:variable>
<input type="submit" name="save_control" value="Lagre
sak/måling" title="{$lang_save}" />
-
</form>
+
</xsl:when>
</xsl:choose>
+
</form>
</li>
</xsl:for-each>
</ul>
Modified: trunk/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/edit_check_list.xsl
2013-06-12 05:04:09 UTC (rev 11167)
+++ trunk/controller/templates/base/check_list/edit_check_list.xsl
2013-06-12 13:57:05 UTC (rev 11168)
@@ -68,7 +68,7 @@
</div>
<div class="row">
<label>Utført dato</label>
- <input class="date" readonly="readonly">
+ <input class="date" >
<xsl:attribute
name="id">completed_date</xsl:attribute>
<xsl:attribute
name="name">completed_date</xsl:attribute>
<xsl:attribute name="type">text</xsl:attribute>
Modified:
trunk/controller/templates/base/check_list/fragments/check_list_top_section.xsl
===================================================================
---
trunk/controller/templates/base/check_list/fragments/check_list_top_section.xsl
2013-06-12 05:04:09 UTC (rev 11167)
+++
trunk/controller/templates/base/check_list/fragments/check_list_top_section.xsl
2013-06-12 13:57:05 UTC (rev 11168)
@@ -46,7 +46,7 @@
<input
id='update-check-list-status-value' type="hidden" name="status" value="0" />
<input type="submit"
class="btn">
<xsl:attribute
name="value">
- <xsl:value-of
select="php:function('lang', 'Status done')" />
+ <xsl:value-of
select="php:function('lang', 'is_executed')" />
</xsl:attribute>
</input>
</xsl:otherwise>
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-06-12 05:04:09 UTC (rev 11167)
+++
trunk/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
2013-06-12 13:57:05 UTC (rev 11168)
@@ -15,7 +15,7 @@
<option value="">Velg bygg</option>
<xsl:for-each select="buildings_on_property">
<option>
- <xsl:if test="id = //building_location_code">
+ <xsl:if test="selected = 1">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:attribute name="value">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11168] controller: add component to control group,
Sigurd Nes <=