[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13440] more on controller
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13440] more on controller |
Date: |
Tue, 16 Jun 2015 13:37:31 +0000 |
Revision: 13440
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13440
Author: sigurdne
Date: 2015-06-16 13:37:30 +0000 (Tue, 16 Jun 2015)
Log Message:
-----------
more on controller
Modified Paths:
--------------
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/inc/class.uicomponent.inc.php
trunk/controller/setup/phpgw_no.lang
trunk/controller/templates/base/component.xsl
trunk/property/inc/class.soentity.inc.php
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2015-06-15 23:04:56 UTC
(rev 13439)
+++ trunk/controller/inc/class.socheck_list.inc.php 2015-06-16 13:37:30 UTC
(rev 13440)
@@ -638,7 +638,7 @@
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, completed_date,
cl.assigned_to, ";
$sql .= "cl.component_id as cl_component_id, cl.location_id as
cl_location_id,"
- . " cl.location_code as cl_location_code, num_open_cases,
num_pending_cases ,cl.serie_id, cs.repeat_type ";
+ . " cl.location_code as cl_location_code, num_open_cases,
num_pending_cases ,cl.serie_id, cl.billable_hours, cs.repeat_type ";
$sql .= "FROM controller_check_list cl ";
$sql .= "LEFT JOIN controller_control c on cl.control_id = c.id
";
$sql .= "LEFT JOIN controller_control_serie cs on cl.serie_id =
cs.id ";
@@ -677,7 +677,7 @@
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
$check_list->set_serie_id($this->db->f('serie_id'));
$check_list->set_repeat_type($this->db->f('repeat_type'));
-
+
$check_list->set_billable_hours((float)$this->db->f('billable_hours'));
$check_lists_array[] = $check_list;
}
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2015-06-15 23:04:56 UTC
(rev 13439)
+++ trunk/controller/inc/class.socontrol.inc.php 2015-06-16 13:37:30 UTC
(rev 13440)
@@ -775,17 +775,44 @@
$control_id = (int) $control_id;
$location_id = (int) $location_id;
$component_id = (int) $component_id;
-
+
$sql = "SELECT * ";
$sql .= "FROM controller_control_component_list ";
$sql .= "WHERE control_id = {$control_id} ";
$sql .= "AND location_id = {$location_id} ";
$sql .= "AND component_id = {$component_id}";
-
+
$this->db->query($sql, __LINE__, __FILE__);
return $this->db->next_record();
}
+ public function get_assigned_control_components($from_date,
$to_date, $assigned_to = 0)
+ {
+ $assigned_to = (int) $assigned_to;
+ $location_id = (int) $location_id;
+ $component_id = (int) $component_id;
+
+ $sql = "SELECT DISTINCT ccl.component_id,
ccl.location_id";
+ $sql .= " FROM controller_control_component_list ccl ,
controller_control_serie cs";
+ $sql .= " WHERE ccl.id = cs.control_relation_id";
+ $sql .= " AND cs.control_relation_type = 'component'";
+ $sql .= " AND cs.assigned_to = {$assigned_to}";
+ $sql .= " AND cs.enabled = 1";
+// $sql .= " AND ((cs.start_date <= $to_date AND
cs.end_date IS NULL) ";
+// $sql .= " OR (cs.start_date <= $to_date AND cs.end_date
> $from_date ))";
+ $sql .= " AND cs.start_date <= $to_date";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+ $components = array();
+
+ while($this->db->next_record())
+ {
+ $location_id = $this->db->f('location_id');
+ $components[$location_id][] =
$this->db->f('component_id');
+ }
+ return $components;
+ }
+
/**
* Register that a control should be carried out on a location
*
Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php 2015-06-15 23:04:56 UTC
(rev 13439)
+++ trunk/controller/inc/class.uicomponent.inc.php 2015-06-16 13:37:30 UTC
(rev 13440)
@@ -155,9 +155,21 @@
(
'id' => $user['account_id'],
'name' =>
"{$user['account_lastname']}, {$user['account_firstname']}",
- 'selected' => $this->account ==
$user['account_id'] ? 1 : 0
+ 'selected' => 0 //$this->account
== $user['account_id'] ? 1 : 0
);
}
+
+ $_my_negative_self = -1 * $this->account;
+
+ $default_value = array
+ (
+ 'id' => $_my_negative_self,
+ 'name' => lang('my assigned controls'),
+ 'selected' => $_my_negative_self ==
($this->account * -1)
+ );
+
+ unset($_my_negative_self);
+ array_unshift ($user_list,$default_value);
array_unshift($user_list, array('id' => '', 'name' =>
lang('select')));
// Sigurd: Start categories
@@ -277,7 +289,7 @@
'field' =>
$this->get_fields($filter_component),
),
);
- self::render_template_xsl(array('component'), $data);
+
self::render_template_xsl(array('component','calendar/icon_color_map'), $data);
}
private function get_fields($filter_component = '')
@@ -407,10 +419,30 @@
}
// _debug_array($location_type_name);
$components = array();
+ $keep_only_assigned_to = 0;
$lookup_stray_items = false;
+ if($user_id < 0)
+ {
+ $user_id = $user_id * -1;
- if(!$location_id)
+ $keep_only_assigned_to = $user_id;
+ $assigned_components =
$so_control->get_assigned_control_components($from_date_ts, $to_date_ts,
$assigned_to = $user_id);
+ foreach($assigned_components as $_location_id
=> $component_list)
+ {
+ $_components =
execMethod('property.soentity.read',array(
+ 'filter_entity_group'
=> $entity_group_id,
+ 'location_id'
=> $_location_id,
+ 'district_id'
=> $district_id,
+ 'allrows'
=> true,
+ 'filter_item'
=> $component_list
+ )
+ );
+ $components = array_merge($components,
$_components);
+
+ }
+ }
+ else if(!$location_id)
{
//nothing
}
@@ -443,7 +475,7 @@
'allrows'
=> true,
'control_registered'
=> !$all_items,
'check_for_control'
=> true,
- 'filter_item'
=> $filter_component
+ 'filter_item'
=> $filter_component ? array($filter_component) : array()
)
);
$components = array_merge($components,
$_components);
@@ -482,7 +514,7 @@
{
continue;
}
- $controls =
execMethod('controller.socontrol.get_controls_at_component',
array('location_id' => $location_id, 'component_id' => $component_id));
+ $controls =
$so_control->get_controls_at_component(array('location_id' => $location_id,
'component_id' => $component_id));
//_debug_array($controls);
foreach($controls as $_control)
{
@@ -686,6 +718,7 @@
{
$row = array();
$row_sum = array();
+ $row_sum_actual = array();//billable_hours
$row['component_id'] = $entry['component_id'];
$row['year'] = '';
$row['descr'] = '';
@@ -707,19 +740,22 @@
$found_at_least_one = false;
for ( $_month=1; $_month < 13; $_month++ )
{
- $row[$_month] =
$this->translate_calendar_info($entry[$_month],$year, $_month, $filter_status,
$found_at_least_one);
- if( !$user_id ||
$entry[$_month]['info']['assigned_to'] == $user_id)
+ $row[$_month] =
$this->translate_calendar_info($entry[$_month],$year, $_month, $filter_status,
$found_at_least_one, $keep_only_assigned_to);
+ if($row[$_month] &&( !$user_id ||
$entry[$_month]['info']['assigned_to'] == $user_id))
{
$row_sum[$_month] =
$entry[$_month]['info']['service_time'] +
$entry[$_month]['info']['controle_time'];
+ $row_sum_actual[$_month] = +
$entry[$_month]['info']['billable_hours'];
}
else
{
$row_sum[$_month] = 0;
+ $row_sum_actual[$_month] = 0;
}
}
if(!$filter_status || $found_at_least_one)
{
$total_time[] = $row_sum;
+ $total_time_actual[] = $row_sum_actual;
$data_set[] = $row;
}
}
@@ -748,6 +784,7 @@
unset($_month);
$sum_year = 0;
+ $sum_year_actual = 0;
if(!$total_time)
{
@@ -766,22 +803,47 @@
$sum_year += $_row[$_month];
}
}
+ unset($_row);
}
$result['time_sum'][0] = $sum_year;
+
+ if(!$total_time_actual)
+ {
+ for ( $_month=1; $_month < 13; $_month++ )
+ {
+ $result['time_sum_actual'][$_month] = 0;
+ }
+ }
+ else
+ {
+ foreach ($total_time_actual as $_row)
+ {
+ for ( $_month=1; $_month < 13;
$_month++ )
+ {
+
$result['time_sum_actual'][$_month] += $_row[$_month];
+ $sum_year_actual +=
$_row[$_month];
+ }
+ }
+ }
+ $result['time_sum_actual'][0] = $sum_year_actual;
$result['total_records'] = $total_records;
-
$result['location_filter'] = $location_filter;
return $result;
}
- private function translate_calendar_info($param = array(),
$year, $month, $filter_status = '', &$found_at_least_one = false)
+ private function translate_calendar_info($param = array(),
$year, $month, $filter_status = '', &$found_at_least_one = false,
$keep_only_assigned_to)
{
if(!isset($param['repeat_type']))
{
return '';
}
+ if($keep_only_assigned_to && $keep_only_assigned_to !=
$param['info']['assigned_to'])
+ {
+ return '';
+ }
+
if($filter_status)
{
if($filter_status == 'not_performed')
@@ -885,6 +947,10 @@
// $controle_time = $param['info']['controle_time'] ?
$param['info']['controle_time'] : ' ';
$time = $param['info']['service_time'] +
$param['info']['controle_time'];
$time = $time ? $time : ' ';
+ $billable_hours =
(float)$param['info']['billable_hours'];
+ {
+ $time .= " / {$billable_hours}";
+ }
return
"{$repeat_type}<br/>{$link}<br/>{$assigned_to}<br/>{$time}";
}
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2015-06-15 23:04:56 UTC (rev
13439)
+++ trunk/controller/setup/phpgw_no.lang 2015-06-16 13:37:30 UTC (rev
13440)
@@ -1,3 +1,4 @@
+my assigned controls controller no Mine kontroller
add case controller no Registrer sak
add ticket controller no Registrer melding
add_check_list_to_location controller no Registrer kontroll for
bygg
Modified: trunk/controller/templates/base/component.xsl
===================================================================
--- trunk/controller/templates/base/component.xsl 2015-06-15 23:04:56 UTC
(rev 13439)
+++ trunk/controller/templates/base/component.xsl 2015-06-16 13:37:30 UTC
(rev 13440)
@@ -20,6 +20,7 @@
<h2>
<xsl:value-of select="datatable_name"/>
</h2>
+ <xsl:call-template name="icon_color_map" />
<xsl:apply-templates select="form" />
<xsl:apply-templates select="paging"/>
<div id="list_flash">
@@ -180,6 +181,38 @@
<xsl:template name="datasource-definition">
<script type="text/javascript">
<![CDATA[
+
+ /**
+ * Detect if browsertab is active - and update when revisit
+ */
+ var vis = (function(){
+ var stateKey, eventKey, keys = {
+ hidden: "visibilitychange",
+ webkitHidden: "webkitvisibilitychange",
+ mozHidden: "mozvisibilitychange",
+ msHidden: "msvisibilitychange"
+ };
+ for (stateKey in keys) {
+ if (stateKey in document) {
+ eventKey = keys[stateKey];
+ break;
+ }
+ }
+ return function(c) {
+ if (c) document.addEventListener(eventKey, c);
+ return !document[stateKey];
+ }
+ })();
+
+ vis(function(){
+ if(vis())
+ {
+ update_table();
+ }
+ });
+
+
+
$(document).ready(function(){
update_table();
});
@@ -191,6 +224,26 @@
};
update_table = function()
{
+ var user_id = $("#user_id").val();
+ if(user_id < 0)
+ {
+ $( "#entity_group_id" ).hide();
+ $("[for='entity_group_id']").hide();
+ $( "#location_id" ).hide();
+ $("[for='location_id']").hide();
+ $("[name='all_items']").hide();
+ $("[for='all_items']").hide();
+ }
+ else
+ {
+ $( "#entity_group_id" ).show();
+ $("[for='entity_group_id']").show();
+ $( "#location_id" ).show();
+ $("[for='location_id']").show();
+ $("[name='all_items']").show();
+ $("[for='all_items']").show();
+ }
+
var requestUrl = $("#queryForm").attr("action");
requestUrl += '&phpgw_return_as=json' + "&" +
$("#queryForm").serialize();
@@ -203,22 +256,23 @@
{
$("#tbody").html(data.tbody);
var time_sum = data.time_sum;
+ var time_sum_actual =
data.time_sum_actual;
$("#total_records").html(data.total_records);
$("#sum_text").html('Sum');
- $("#month0").html(time_sum[0]);
- $("#month1").html(time_sum[1]);
- $("#month2").html(time_sum[2]);
- $("#month3").html(time_sum[3]);
- $("#month4").html(time_sum[4]);
- $("#month5").html(time_sum[5]);
- $("#month6").html(time_sum[6]);
- $("#month7").html(time_sum[7]);
- $("#month8").html(time_sum[8]);
- $("#month9").html(time_sum[9]);
-
$("#month10").html(time_sum[10]);
-
$("#month11").html(time_sum[11]);
-
$("#month12").html(time_sum[12]);
+ $("#month0").html(time_sum[0] +
'/' + time_sum_actual[0]);
+ $("#month1").html(time_sum[1] +
'/' + time_sum_actual[1]);
+ $("#month2").html(time_sum[2] +
'/' + time_sum_actual[2]);
+ $("#month3").html(time_sum[3] +
'/' + time_sum_actual[3]);
+ $("#month4").html(time_sum[4] +
'/' + time_sum_actual[4]);
+ $("#month5").html(time_sum[5] +
'/' + time_sum_actual[5]);
+ $("#month6").html(time_sum[6] +
'/' + time_sum_actual[6]);
+ $("#month7").html(time_sum[7] +
'/' + time_sum_actual[7]);
+ $("#month8").html(time_sum[8] +
'/' + time_sum_actual[8]);
+ $("#month9").html(time_sum[9] +
'/' + time_sum_actual[9]);
+ $("#month10").html(time_sum[10]
+ '/' + time_sum_actual[10]);
+ $("#month11").html(time_sum[11]
+ '/' + time_sum_actual[11]);
+ $("#month12").html(time_sum[12]
+ '/' + time_sum_actual[12]);
if(data.location_filter)
{
var obj =
data.location_filter;
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2015-06-15 23:04:56 UTC (rev
13439)
+++ trunk/property/inc/class.soentity.inc.php 2015-06-16 13:37:30 UTC (rev
13440)
@@ -447,7 +447,7 @@
$location_id = isset($data['location_id'])
&& $data['location_id'] ? (int)$data['location_id'] : 0;
$entity_group_id =
isset($data['entity_group_id']) && $data['entity_group_id'] ?
(int)$data['entity_group_id'] : 0;
$filter_entity_group=
isset($data['filter_entity_group']) && $data['filter_entity_group'] ?
(int)$data['filter_entity_group'] : 0;
- $filter_item = isset($data['filter_item'])
&& $data['filter_item'] ? (int)$data['filter_item'] : 0;
+ $filter_item = isset($data['filter_item'])
&& $data['filter_item'] ? $data['filter_item'] : array();
if($location_id)
@@ -615,9 +615,9 @@
$where= 'AND';
}
- if ($filter_item)
+ if (is_array($filter_item) && count($filter_item))
{
- $filtermethod .= " {$where} {$entity_table}.id
= {$filter_item}";
+ $filtermethod .= " {$where} {$entity_table}.id
IN (" . implode(',', $filter_item) . ')';
$where= 'AND';
}
@@ -1346,8 +1346,8 @@
$location_id = isset($data['location_id']) &&
$data['location_id'] ? (int)$data['location_id'] : 0;
$entity_group_id= isset($data['entity_group_id']) &&
$data['entity_group_id'] ? (int)$data['entity_group_id'] : 0;
$filter_entity_group=
isset($data['filter_entity_group']) && $data['filter_entity_group'] ?
(int)$data['filter_entity_group'] : 0;
+ $filter_item = isset($data['filter_item'])
&& $data['filter_item'] ? $data['filter_item'] : array();
-
if($location_id)
{
$loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
@@ -1543,6 +1543,12 @@
$where= 'AND';
}
+ if (is_array($filter_item) && count($filter_item))
+ {
+ $filtermethod .= " {$where} {$entity_table}.id
IN (" . implode(',', $filter_item) . ')';
+ $where= 'AND';
+ }
+
$_querymethod = array();
$__querymethod = array();
$_joinmethod_datatype = array();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13440] more on controller,
Sigurd Nes <=