[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11398] controller: list component info on messages
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11398] controller: list component info on messages |
Date: |
Sun, 27 Oct 2013 15:34:09 +0000 |
Revision: 11398
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11398
Author: sigurdne
Date: 2013-10-27 15:34:08 +0000 (Sun, 27 Oct 2013)
Log Message:
-----------
controller: list component info on messages
Modified Paths:
--------------
trunk/controller/inc/class.hook_helper.inc.php
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/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
Modified: trunk/controller/inc/class.hook_helper.inc.php
===================================================================
--- trunk/controller/inc/class.hook_helper.inc.php 2013-10-25 13:50:03 UTC
(rev 11397)
+++ trunk/controller/inc/class.hook_helper.inc.php 2013-10-27 15:34:08 UTC
(rev 11398)
@@ -100,6 +100,7 @@
$styling .= " h2.heading { font-size: 22px;
font-weight: normal;margin: 0 0 0 20px;}";
$styling .= " th.heading { font-size: 22px;
font-weight: normal;margin: 0 0 0 20px;}";
+ $styling .= " tr.off {background: #DEEAF8 }";
$styling .= " h4.expand_trigger {
clear:both;overflow:hidden;font-size: 12px;color:#031647;background:
#DEEAF8;padding:2px 4px;margin:0; }";
$styling .= " h4.expand_trigger img {
float:left;vertical-align:middle;margin-right:3px; }";
@@ -267,12 +268,14 @@
// $my_planned_controls_HTML .= "<ul
style='overflow:hidden;'>";
+ $_row_class = '"on"';
foreach($my_planned_controls as $planned_date_ts =>
$planned_controls_on_date)
{
foreach($planned_controls_on_date as
$my_planned_control)
{
+ $my_planned_controls_HTML .= "<tr class
= {$_row_class}>";
+ $_row_class = $_row_class = '"on"' ?
'"off"' : '"on"';
- $my_planned_controls_HTML .= "<tr>";
$deadline_ts = $my_planned_control[0];
$my_control = $my_planned_control[1];
@@ -311,7 +314,6 @@
if(count( $planned_controls_on_date ) > 1 )
{
// $my_planned_controls_HTML .= "</li></ul>";
-// $my_planned_controls_HTML .= "</tr>";
}
$my_planned_controls_HTML .= "</table></div>"; //
home_portal
Modified: trunk/controller/inc/class.socase.inc.php
===================================================================
--- trunk/controller/inc/class.socase.inc.php 2013-10-25 13:50:03 UTC (rev
11397)
+++ trunk/controller/inc/class.socase.inc.php 2013-10-27 15:34:08 UTC (rev
11398)
@@ -85,6 +85,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_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
return $case;
@@ -112,6 +113,8 @@
$this->db->query($sql);
+ $cases_array = array();
+
while ($this->db->next_record())
{
$case = new
controller_check_item_case($this->unmarshal($this->db->f('id'), 'int'));
@@ -126,6 +129,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_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
$cases_array[] = $case;
@@ -133,6 +137,44 @@
return $cases_array;
}
+
+
+ /**
+ * Get cases for component
+ *
+ * @param $location_id location id
+ * @param $location_item_id location item id
+ * @return array of case object represented as objects or arrays
+ */
+ public function get_cases_by_component($component_location_id,
$component_id)
+ {
+ $component_location_id = (int) $component_location_id;
+ $component_id = (int) $component_id;
+
+ $sql = "SELECT controller_check_item_case.*,
check_list_id FROM controller_check_item_case "
+ . " {$this->join} controller_check_item ON
controller_check_item_case.check_item_id = controller_check_item.id"
+ . " WHERE
controller_check_item_case.component_location_id = {$component_location_id} AND
controller_check_item_case.component_id = {$component_id}";
+
+ $this->db->query($sql);
+
+ $values = array();
+ while ($this->db->next_record())
+ {
+ $values[] = array
+ (
+ 'id' =>
$this->db->f('id'),
+ 'check_list_id' =>
$this->db->f('check_list_id'),
+ 'descr' =>
$this->db->f('descr', true),
+ 'user_id' =>
$this->db->f('user_id'),
+ 'status' =>
$this->db->f('status'),
+ 'modified_date' =>
$this->db->f('modified_date')
+ );
+ }
+
+ return $values;
+ }
+
+
/**
* Inserts a new case in database
@@ -156,6 +198,7 @@
'modified_by',
'measurement',
'location_code',
+ 'component_location_id',
'component_id'
);
@@ -171,6 +214,7 @@
$this->marshal($case->get_modified_by(), 'int'),
$this->marshal($case->get_measurement(),
'string'),
$this->marshal($case->get_location_code(),
'string'),
+
$this->marshal($case->get_component_location_id(), 'int'),
$this->marshal($case->get_component_id(),
'int'),
);
@@ -240,7 +284,7 @@
}
$value_set = $this->db->validate_update($values);
- $this->db->query("UPDATE controller_check_list SET
{$value_set} WHERE id = '{$check_list_id}'",__LINE__,__FILE__);
+ return $this->db->query("UPDATE controller_check_list
SET {$value_set} WHERE id = '{$check_list_id}'",__LINE__,__FILE__);
}
/**
Modified: trunk/controller/inc/class.socheck_item.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_item.inc.php 2013-10-25 13:50:03 UTC
(rev 11397)
+++ trunk/controller/inc/class.socheck_item.inc.php 2013-10-27 15:34:08 UTC
(rev 11398)
@@ -272,7 +272,7 @@
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, component_location_id,";
+ $sql = "SELECT ci.id as ci_id, control_item_id,
check_list_id, cic.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 ";
@@ -349,7 +349,6 @@
$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);
@@ -370,6 +369,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_location_id($this->db->f('component_location_id'), 'int');
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
$cases_array[] = $case;
@@ -398,7 +398,7 @@
{
$message_ticket_id = (int) $message_ticket_id;
- $sql = "SELECT ci.id as ci_id, control_item_id,
component_location_id,";
+ $sql = "SELECT ci.id as ci_id, control_item_id,
cic.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_control_group JOIN
controller_control_item ON
controller_control_item.control_group_id=controller_control_group.id ";
Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php 2013-10-25 13:50:03 UTC (rev
11397)
+++ trunk/controller/inc/class.uicase.inc.php 2013-10-27 15:34:08 UTC (rev
11398)
@@ -155,15 +155,19 @@
$cases_at_component_group = array();
$existing_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $_type = null,
'all', null, null);//$location_code_search_components);
+
foreach($existing_check_items_and_cases as $check_item)
{
foreach($check_item->get_cases_array() as $case)
{
- $component_id =
$case->get_component_id();
- if($component_id)
+ $_component_location_id =
$case->get_component_location_id();
+ $_component_id =
$case->get_component_id();
+ if($_component_id)
{
-
$cases_at_component_group[$check_item->get_control_item()->get_control_group_id()][$component_id]
++;
+
$cases_at_component_group[$check_item->get_control_item()->get_control_group_id()][$_component_location_id][$_component_id]
++;
}
+ unset ($_component_location_id );
+ unset ($_ocation_id );
}
}
@@ -221,9 +225,9 @@
{
foreach($_components_at_location as &$_component_at_location)
{
-
if(isset($cases_at_component_group[$control_group->get_id()][$_component_at_location['id']]))
+
if(isset($cases_at_component_group[$control_group->get_id()][$_component_at_location['location_id']][$_component_at_location['id']]))
{
-
$_component_at_location['short_description'] .= ' (' .
$cases_at_component_group[$control_group->get_id()][$_component_at_location['id']]
. ')';
+
$_component_at_location['short_description'] .= ' (' .
$cases_at_component_group[$control_group->get_id()][$_component_at_location['location_id']][$_component_at_location['id']]
. ')';
}
}
@@ -299,8 +303,8 @@
$type = phpgw::get_var('type');
$status = phpgw::get_var('status');
$location_code = phpgw::get_var('location_code');
+ $component_location_id =
phpgw::get_var('component_location_id', 'int');
$component_id = phpgw::get_var('component_id', 'int');
-
$check_list =
$this->so_check_list->get_single($check_list_id);
@@ -336,6 +340,7 @@
$case->set_modified_by($user_id);
$case->set_status($status);
$case->set_location_code( $location_code );
+
$case->set_component_location_id($component_location_id);
$case->set_component_id($component_id);
// Saves selected value from or measurement
@@ -422,11 +427,10 @@
foreach ($check_items_and_cases as $check_item)
{
- $component_location_id =
$check_item->get_control_item()->get_component_location_id();
-
foreach($check_item->get_cases_array() as $case)
{
- $component_id =
$case->get_component_id();
+ $component_location_id =
$case->get_component_location_id();
+ $component_id =
$case->get_component_id();
if($component_id)
{
$short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component_location_id, 'id' => $component_id));
@@ -544,12 +548,22 @@
$message_details .= "Kontrollområde: " .
$control_area_name . "\n\n";
// Generates message details from comment field in
check item
+
$counter = 1;
foreach($case_ids as $case_id)
{
$case = $this->so->get_single($case_id);
- $message_details .= "Gjøremål $counter: ";
- $message_details .= $case->get_descr() .
"<br>";
+ $component_location_id =
$case->get_component_location_id();
+
+ $message_details .= "Gjøremål {$counter}: \n";
+
+ if($component_id = $case->get_component_id())
+ {
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component_location_id, 'id' => $component_id));
+ $message_details .= "Hvor:
{$short_desc}\n";
+ }
+
+ $message_details .= 'Hva: ' .
$case->get_descr() . "\n";
$counter++;
}
@@ -859,11 +873,10 @@
{
$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();
-
foreach($check_item->get_cases_array() as $case)
{
- $component_id =
$case->get_component_id();
+ $component_location_id =
$case->get_component_location_id();
+ $component_id =
$case->get_component_id();
if($component_id)
{
$short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component_location_id, 'id' => $component_id));
@@ -962,28 +975,19 @@
//---------
foreach($closed_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();
-
foreach($check_item->get_cases_array()
as $case)
{
- $component_id =
$case->get_component_id();
+ $component_location_id =
$case->get_component_location_id();
+ $component_id
= $case->get_component_id();
if($component_id)
{
$short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component_location_id, 'id' => $component_id));
$case->set_component_descr($short_desc);
}
}
-
- //
$check_item->get_control_item()->set_options_array(
$control_item_with_options->get_options_array() );
- // $closed_check_items_and_cases[$key] =
$check_item;
}
-
-
//-------
-
}
$data = array
Modified: trunk/controller/inc/model/class.check_item_case.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item_case.inc.php 2013-10-25
13:50:03 UTC (rev 11397)
+++ trunk/controller/inc/model/class.check_item_case.inc.php 2013-10-27
15:34:08 UTC (rev 11398)
@@ -50,6 +50,7 @@
protected $modified_by;
protected $measurement;
protected $location_code;
+ protected $component_location_id; // komponent type
protected $component_id;
protected $component_descr;
@@ -149,6 +150,16 @@
$this->location_code = $location_code;
}
+ public function get_component_location_id()
+ {
+ return $this->component_location_id;
+ }
+
+ public function
set_component_location_id($component_location_id)
+ {
+ $this->component_location_id = $component_location_id;
+ }
+
public function get_component_id()
{
return $this->component_id;
Modified: trunk/controller/js/controller/case.js
===================================================================
--- trunk/controller/js/controller/case.js 2013-10-25 13:50:03 UTC (rev
11397)
+++ trunk/controller/js/controller/case.js 2013-10-27 15:34:08 UTC (rev
11398)
@@ -13,7 +13,13 @@
$(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();
+ var component = $("#component_at_control_group_" + control_group_id).val();
+ var component_arr = component.split("_");
+
+ var component_location_id = component_arr[0];
+ var component_id = component_arr[1];
+
+
$(thisForm).find("input[name=component_location_id]").val(component_location_id);
$(thisForm).find("input[name=component_id]").val(component_id);
var validate_status = validate_form( thisForm );
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2013-10-25 13:50:03 UTC (rev
11397)
+++ trunk/controller/setup/phpgw_no.lang 2013-10-27 15:34:08 UTC (rev
11398)
@@ -366,6 +366,6 @@
error_msg_no_controls_for_component controller no Ingen
kontroller for komponent i denne perioden
role at location controller no Tildeling av rolle
Register new message controller no Registrer ny melding
-Show message controller no Vis melding
-Status not done controller no Status: Ikke utført
-Status done controller no Status: Utført
+Show message controller no Vis melding
+Status not done controller no Status: Ikke utført
+Status done controller no Status: Utført
Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php 2013-10-25 13:50:03 UTC (rev
11397)
+++ trunk/controller/setup/setup.inc.php 2013-10-27 15:34:08 UTC (rev
11398)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.47';
+ $setup_info['controller']['version'] = '0.1.48';
$setup_info['controller']['app_order'] = 100;
$setup_info['controller']['enable'] = 1;
$setup_info['controller']['app_group'] = 'office';
@@ -29,12 +29,12 @@
(
'menu' =>
'controller.menu.get_menu',
'config',
- 'home' => 'controller.hook_helper.home_backend',
+ 'home' =>
'controller.hook_helper.home_backend',
'home_mobilefrontend' =>
'controller.hook_helper.home_mobilefrontend',
'settings',
'cat_add' =>
'controller.cat_hooks.cat_add',
- 'cat_delete' => 'controller.cat_hooks.cat_delete',
- 'cat_edit' =>
'controller.cat_hooks.cat_edit'
+ 'cat_delete' =>
'controller.cat_hooks.cat_delete',
+ 'cat_edit' =>
'controller.cat_hooks.cat_edit'
);
$setup_info['controller']['tables'] = array
Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php 2013-10-25 13:50:03 UTC
(rev 11397)
+++ trunk/controller/setup/tables_current.inc.php 2013-10-27 15:34:08 UTC
(rev 11398)
@@ -205,7 +205,8 @@
'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),
+ 'component_location_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => True),// register type
+ 'component_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => true), // forekomst av type
),
'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-10-25 13:50:03 UTC
(rev 11397)
+++ trunk/controller/setup/tables_update.inc.php 2013-10-27 15:34:08 UTC
(rev 11398)
@@ -942,3 +942,26 @@
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
+
+
+ /**
+ * Allow controlgroup assigned to parent level of components
+ **/
+ $test[] = '0.1.47';
+ function controller_upgrade0_1_47()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item_case','component_location_id',array(
+ 'type' => 'int',
+ 'precision' => '4',
+ 'nullable' => true
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['controller']['currentver'] =
'0.1.48';
+ return
$GLOBALS['setup_info']['controller']['currentver'];
+ }
+ }
+
Modified: trunk/controller/templates/base/case/add_case.xsl
===================================================================
--- trunk/controller/templates/base/case/add_case.xsl 2013-10-25 13:50:03 UTC
(rev 11397)
+++ trunk/controller/templates/base/case/add_case.xsl 2013-10-27 15:34:08 UTC
(rev 11398)
@@ -50,6 +50,7 @@
</xsl:if>
</input>
<input
type="hidden" name="control_group_id" value="{$control_group_id}" />
+ <input
type="hidden" name="component_location_id" value="" />
<input
type="hidden" name="component_id" value="" />
<xsl:variable name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
<input type="hidden" name="control_item_id" value="{$control_item_id}" />
@@ -237,7 +238,7 @@
</xsl:template>
<xsl:template match="component_options">
- <option value="{id}">
+ <option value="{location_id}_{id}">
<xsl:if test="selected != 0">
<xsl:attribute name="selected" value="selected" />
</xsl:if>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11398] controller: list component info on messages,
Sigurd Nes <=