[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13655] Syncromind: Merge 13603:13653 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13655] Syncromind: Merge 13603:13653 from trunk |
Date: |
Tue, 14 Jul 2015 11:00:27 +0000 |
Revision: 13655
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13655
Author: sigurdne
Date: 2015-07-14 11:00:27 +0000 (Tue, 14 Jul 2015)
Log Message:
-----------
Syncromind: Merge 13603:13653 from trunk
Modified Paths:
--------------
branches/dev-syncromind/controller/inc/class.socheck_list.inc.php
branches/dev-syncromind/controller/inc/class.uicheck_list.inc.php
branches/dev-syncromind/controller/inc/model/class.check_list.inc.php
branches/dev-syncromind/controller/setup/phpgw_no.lang
branches/dev-syncromind/controller/templates/base/check_list/add_check_list.xsl
branches/dev-syncromind/controller/templates/base/check_list/edit_check_list.xsl
branches/dev-syncromind/controller/templates/base/config.tpl
branches/dev-syncromind/property/inc/class.soentity.inc.php
Property Changed:
----------------
branches/dev-syncromind/
Property changes on: branches/dev-syncromind
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602
+ /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653
Modified: branches/dev-syncromind/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.socheck_list.inc.php
2015-07-14 10:56:41 UTC (rev 13654)
+++ branches/dev-syncromind/controller/inc/class.socheck_list.inc.php
2015-07-14 11:00:27 UTC (rev 13655)
@@ -820,15 +820,17 @@
function update($check_list)
{
$id = (int)$check_list->get_id();
-
+/*
$sql = "SELECT billable_hours FROM controller_check_list WHERE
controller_check_list.id = {$id}";
$this->db->query($sql);
$this->db->next_record();
$old_billable_hours = (float) $this->db->f('billable_hours');
+*/
+ $old_billable_hours = (float) $check_list->get_billable_hours();
- $billable_hours = $old_billable_hours +
$check_list->get_billable_hours();
+ $billable_hours = $old_billable_hours +
$check_list->get_delta_billable_hours();
//--------
$so_check_item = CreateObject('controller.socheck_item');
Modified: branches/dev-syncromind/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/class.uicheck_list.inc.php
2015-07-14 10:56:41 UTC (rev 13654)
+++ branches/dev-syncromind/controller/inc/class.uicheck_list.inc.php
2015-07-14 11:00:27 UTC (rev 13655)
@@ -320,6 +320,11 @@
);
}
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+
$data = array
(
'user_list' => array('options' =>
$user_list_options),
@@ -334,7 +339,10 @@
'building_location_code' =>
$building_location_code,
'location_level' => $level,
'check_list_type' => 'add_check_list',
- 'serie_id' => $serie_id
+ 'serie_id' => $serie_id,
+ 'required_actual_hours' =>
$required_actual_hours,
+ 'integration' =>
$this->_get_component_integration($location_id, $component_arr)
+
);
$GLOBALS['phpgw']->jqcal->add_listener('planned_date');
@@ -419,6 +427,11 @@
);
}
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+
$data = array
(
'user_list' => array('options' =>
$user_list_options),
@@ -431,7 +444,9 @@
'current_year' => $year,
'current_month_nr' => $month,
'building_location_code' =>
$building_location_code,
- 'location_level' => $level
+ 'location_level' => $level,
+ 'required_actual_hours' =>
$required_actual_hours,
+ 'integration' =>
$this->_get_component_integration($location_id, $component_arr)
);
$GLOBALS['phpgw']->jqcal->add_listener('planned_date');
@@ -449,6 +464,136 @@
}
/**
+ * Get linked information from external systems - as pictures
+ * @param integer $location_id
+ * @param array $component_arr
+ * @return array integration info
+ */
+ private function _get_component_integration($location_id,
$_component_arr = array())
+ {
+ if(isset($_component_arr['id']) &&
$_component_arr['id'])
+ {
+ $component_id = $_component_arr['id'];
+ }
+ else
+ {
+ return array();
+ }
+ $attributes =
$GLOBALS['phpgw']->custom_fields->find2($location_id, 0, '',
'ASC','attrib_sort', $allrows = true);
+
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id, 'values' => array('attributes' =>
$attributes)));
+
+ $_custom_config =
CreateObject('admin.soconfig',$location_id);
+ $_config = isset($_custom_config->config_data) &&
$_custom_config->config_data ? $_custom_config->config_data : array();
+
+ $integration = array();
+ foreach ($_config as $_config_section =>
$_config_section_data)
+ {
+ if(isset($_config_section_data['tab']) &&
$component_arr['id'])
+ {
+ if(!isset($_config_section_data['url']))
+ {
+
phpgwapi_cache::message_set("'url' is a required setting for integrations,
'{$_config_section}' is disabled", 'error');
+ break;
+ }
+
+ //get session key from remote system
+ $arguments =
array($_config_section_data['auth_hash_name'] =>
$_config_section_data['auth_hash_value']);
+ $query = http_build_query($arguments);
+ $auth_url =
$_config_section_data['auth_url'];
+ $request = "{$auth_url}?{$query}";
+
+ $aContext = array
+ (
+ 'http' => array
+ (
+ 'request_fulluri' =>
true,
+ ),
+ );
+
+
if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
+ {
+ $aContext['http']['proxy'] =
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
+ }
+
+ $cxContext =
stream_context_create($aContext);
+ $response =
trim(file_get_contents($request, False, $cxContext));
+
+ $_config_section_data['url']
= htmlspecialchars_decode($_config_section_data['url']);
+ $_config_section_data['parametres']
= htmlspecialchars_decode($_config_section_data['parametres']);
+
+
parse_str($_config_section_data['parametres'], $output);
+
+ foreach ($output as $_dummy =>
$_substitute)
+ {
+ $_keys[] = $_substitute;
+
+ $__value = false;
+ if(!$__value =
urlencode($component_arr[str_replace(array('__','*'),array('',''),
$_substitute)]))
+ {
+ foreach
($component_arr['attributes'] as $_attribute)
+ {
+
if(str_replace(array('__','*'),array('',''), $_substitute) ==
$_attribute['name'])
+ {
+
$__value = urlencode($_attribute['value']);
+ break;
+ }
+ }
+ }
+
+ if($__value)
+ {
+ $_values[] = $__value;
+ }
+ }
+
+ unset($output);
+ unset($__value);
+ $_sep = '?';
+ if
(stripos($_config_section_data['url'],'?'))
+ {
+ $_sep = '&';
+ }
+ $_param = str_replace($_keys, $_values,
$_config_section_data['parametres']);
+ unset($_keys);
+ unset($_values);
+ $integration_src =
"{$_config_section_data['url']}{$_sep}{$_param}";
+ if($_config_section_data['action'])
+ {
+ $_sep = '?';
+ if
(stripos($integration_src,'?'))
+ {
+ $_sep = '&';
+ }
+ $integration_src .=
"{$_sep}{$_config_section_data['action']}=" .
$_config_section_data["action_{$mode}"];
+ }
+
+
if(isset($_config_section_data['location_data']) &&
$_config_section_data['location_data'])
+ {
+
$_config_section_data['location_data'] =
htmlspecialchars_decode($_config_section_data['location_data']);
+
parse_str($_config_section_data['location_data'], $output);
+ foreach ($output as $_dummy =>
$_substitute)
+ {
+ $_keys[] = $_substitute;
+ $_values[] =
urlencode($component_arr['location_data'][trim($_substitute, '_')]);
+ }
+ $integration_src .= '&' .
str_replace($_keys, $_values, $_config_section_data['location_data']);
+ }
+
+ $integration_src .=
"&{$_config_section_data['auth_key_name']}={$response}";
+
+ $integration[] = array
+ (
+ 'section' =>
$_config_section,
+ 'height' =>
isset($_config_section_data['height']) && $_config_section_data['height'] ?
$_config_section_data['height'] : 500,
+ 'src' =>
$integration_src
+ );
+ }
+ }
+ return $integration;
+ }
+
+ /**
* Public function for saving a check list
*
* @param HTTP:: location code, control id, status etc.. (check
list details)
@@ -476,6 +621,8 @@
$deadline_date_ts =
date_converter::date_to_timestamp($deadline_date);
+ $error = false;
+
if($planned_date != '')
{
$planned_date_ts =
date_converter::date_to_timestamp($planned_date);
@@ -514,6 +661,7 @@
$status =
controller_check_list::STATUS_NOT_DONE;
$completed_date_ts = 0;
$error_message = "Status kunne ikke
settes til utført - prøv igjen";
+ $error = true;
phpgwapi_cache::message_set($error_message, 'error');
}
@@ -533,17 +681,33 @@
}
}
- $check_list->set_status($status);
$check_list->set_comment($comment);
$check_list->set_deadline($deadline_date_ts);
$check_list->set_planned_date($planned_date_ts);
$check_list->set_completed_date($completed_date_ts);
$check_list->set_assigned_to($assigned_to);
- $check_list->set_billable_hours($billable_hours);
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
- if($check_list->validate())
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+
+ if($status == controller_check_list::STATUS_DONE &&
$required_actual_hours && $check_list->get_billable_hours() == 0 &&
!$billable_hours)
{
+ phpgwapi_cache::message_set(lang("Please enter
billable hours"), 'error');
+ $error = true;
+ }
+ else
+ {
+
$check_list->set_delta_billable_hours($billable_hours);
+ }
+ if ( $this->_check_for_required($check_list) && !$error)
+ {
+ $check_list->set_status($status);
+ }
+
+ if(!$error && $check_list->validate())
+ {
$check_list_id = $this->so->store($check_list);
if($check_list_id > 0)
@@ -563,7 +727,17 @@
}
else
{
- $this->add_check_list($check_list);
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list.add_check_list',
+ 'control_id' =>
$control_id,
+ 'location_id' =>
$location_id,
+ 'component_id' =>
$component_id,
+ 'serie_id'
=> $serie_id,
+ 'deadline_ts' =>
$deadline_date_ts,
+ 'type'
=> $type,
+ 'assigned_to' =>
$assigned_to,
+ 'status'
=> $status,
+ // 'billable_hours' =>
$billable_hours
+ ));
}
}
}
@@ -887,21 +1061,33 @@
$check_list_id = phpgw::get_var('check_list_id');
$check_list_status = phpgw::get_var('status');
+ $check_list = $this->so->get_single($check_list_id);
- $check_list = $this->so->get_single($check_list_id);
- if ( !$this->_check_for_required($check_list) )
+//
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+ $ok = true;
+
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+ if($check_list_status ==
controller_check_list::STATUS_DONE && $required_actual_hours &&
$check_list->get_billable_hours() == 0)
{
+ phpgwapi_cache::message_set(lang("Please enter
billable hours"), 'error');
+ $ok = false;
+ }
+//
+ if ( !$this->_check_for_required($check_list) || !$ok)
+ {
$messages = phpgwapi_cache::message_get(true);
$message = '';
foreach($messages as $_type => $_message)
{
if($_type == 'error')
{
+ $i = 1;
foreach($_message as $__message)
{
- // $message.=
strip_tags($__message['msg']);
- $message.=
preg_replace("/<\/br[^>]*>\s*\r*\n*/is", "\n", $__message['msg']);
-
+ $message.= "#{$i}: " .
preg_replace("/<\/br[^>]*>\s*\r*\n*/is", "\n", $__message['msg']) . "\n";
+ $i++;
}
}
@@ -979,11 +1165,11 @@
foreach ($required_control_items as
$required_control_item)
{
- $_ok =
$this->so_case->get_cases_by_component($location_id, $component_id,
$required_control_item['id']);
+ $_ok =
$this->so_case->get_cases_by_component($location_id, $component_id,
$required_control_item['id'],$check_list->get_id());
if(!$_ok)
{
- $error_message = "mangler
registrering for required</br>";
- $error_message .=
"{$required_control_item['title']}</br>";
+ $error_message = lang('missing
value for required') . "</br>";
+ $error_message .=
"\"{$required_control_item['title']}\"</br>";
$error_message .=
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
$error_message .= "</br>";
phpgwapi_cache::message_set($error_message, 'error');
@@ -1052,6 +1238,17 @@
}
}
}
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+
+ $required_actual_hours =
isset($config->config_data['required_actual_hours']) &&
$config->config_data['required_actual_hours'] ?
$config->config_data['required_actual_hours'] : false;
+
+ if($check_list->get_status ==
controller_check_list::STATUS_DONE && $required_actual_hours &&
$check_list->get_billable_hours() == 0)
+ {
+ phpgwapi_cache::message_set(lang("Please enter
billable hours"), 'error');
+ $ok = false;
+ }
+
return $ok;
}
}
Modified: branches/dev-syncromind/controller/inc/model/class.check_list.inc.php
===================================================================
--- branches/dev-syncromind/controller/inc/model/class.check_list.inc.php
2015-07-14 10:56:41 UTC (rev 13654)
+++ branches/dev-syncromind/controller/inc/model/class.check_list.inc.php
2015-07-14 11:00:27 UTC (rev 13655)
@@ -56,6 +56,7 @@
protected $location_id;
protected $assigned_to;
protected $billable_hours;
+ protected $delta_billable_hours;
protected $control_area_id;
// Aggregate fields. Fields not in a table
@@ -268,11 +269,20 @@
{
$this->billable_hours = $billable_hours;
}
-
+
public function get_billable_hours()
{
return $this->billable_hours;
}
+ public function set_delta_billable_hours($delta_billable_hours)
+ {
+ $this->delta_billable_hours = $delta_billable_hours;
+ }
+
+ public function get_delta_billable_hours()
+ {
+ return (float)$this->delta_billable_hours;
+ }
public function serialize()
{
Modified: branches/dev-syncromind/controller/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/controller/setup/phpgw_no.lang 2015-07-14
10:56:41 UTC (rev 13654)
+++ branches/dev-syncromind/controller/setup/phpgw_no.lang 2015-07-14
11:00:27 UTC (rev 13655)
@@ -1,3 +1,5 @@
+missing value for required controller no Mangler registrering
for obligatorisk
+Please enter billable hours controller no Angi egne timer
my assigned controls controller no Mine kontroller
add case controller no Registrer sak
add ticket controller no Registrer melding
Modified:
branches/dev-syncromind/controller/templates/base/check_list/add_check_list.xsl
===================================================================
---
branches/dev-syncromind/controller/templates/base/check_list/add_check_list.xsl
2015-07-14 10:56:41 UTC (rev 13654)
+++
branches/dev-syncromind/controller/templates/base/check_list/add_check_list.xsl
2015-07-14 11:00:27 UTC (rev 13655)
@@ -153,6 +153,19 @@
<xsl:apply-templates
select="user_list/options"/>
</select>
</div>
+ <xsl:if test="required_actual_hours = 1">
+ <div class="row">
+ <label>Egne Timer</label>
+ <input class="date">
+ <xsl:attribute
name="id">billable_hours</xsl:attribute>
+ <xsl:attribute
name="name">billable_hours</xsl:attribute>
+ <xsl:attribute
name="type">text</xsl:attribute>
+ </input>
+ <xsl:text> </xsl:text>
+ <xsl:value-of
select="check_list/billable_hours"/>
+ </div>
+ </xsl:if>
+
<!-- COMMENT -->
<div class="comment">
<label>Kommentar</label>
@@ -170,6 +183,13 @@
</div>
</form>
</div>
+ <xsl:for-each select="integration">
+ <div id="{section}">
+ <iframe id="{section}_content" width="100%"
height="{height}" src="{src}">
+ <p>Your browser does not support
iframes.</p>
+ </iframe>
+ </div>
+ </xsl:for-each>
</div>
</xsl:template>
Modified:
branches/dev-syncromind/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
---
branches/dev-syncromind/controller/templates/base/check_list/edit_check_list.xsl
2015-07-14 10:56:41 UTC (rev 13654)
+++
branches/dev-syncromind/controller/templates/base/check_list/edit_check_list.xsl
2015-07-14 11:00:27 UTC (rev 13655)
@@ -93,17 +93,18 @@
<xsl:apply-templates
select="user_list/options"/>
</select>
</div>
- <div class="row">
- <label>Egne Timer</label>
- <input class="date">
- <xsl:attribute
name="id">billable_hours</xsl:attribute>
- <xsl:attribute
name="name">billable_hours</xsl:attribute>
- <xsl:attribute name="type">text</xsl:attribute>
- </input>
- <xsl:text> </xsl:text>
- <xsl:value-of
select="check_list/billable_hours"/>
- </div>
-
+ <xsl:if test="required_actual_hours = 1">
+ <div class="row">
+ <label>Egne Timer</label>
+ <input class="date">
+ <xsl:attribute
name="id">billable_hours</xsl:attribute>
+ <xsl:attribute
name="name">billable_hours</xsl:attribute>
+ <xsl:attribute
name="type">text</xsl:attribute>
+ </input>
+ <xsl:text> </xsl:text>
+ <xsl:value-of
select="check_list/billable_hours"/>
+ </div>
+ </xsl:if>
</fieldset>
<fieldset class="col_2">
<div class="row">
@@ -130,6 +131,13 @@
</div>
</form>
</div>
+ <xsl:for-each select="integration">
+ <div id="{section}">
+ <iframe id="{section}_content" width="100%"
height="{height}" src="{src}">
+ <p>Your browser does not support
iframes.</p>
+ </iframe>
+ </div>
+ </xsl:for-each>
</div>
</xsl:template>
Modified: branches/dev-syncromind/controller/templates/base/config.tpl
===================================================================
--- branches/dev-syncromind/controller/templates/base/config.tpl
2015-07-14 10:56:41 UTC (rev 13654)
+++ branches/dev-syncromind/controller/templates/base/config.tpl
2015-07-14 11:00:27 UTC (rev 13655)
@@ -23,18 +23,27 @@
</td>
</tr>
<tr class="row_off">
+ <td>{lang_required_actual_hours}.</td>
+ <td>
+ <select
name="newsettings[required_actual_hours]">
+ <option value=""
{selected_required_actual_hours_}>NO</option>
+ <option value="1"
{selected_required_actual_hours_1}>YES</option>
+ </select>
+ </td>
+ </tr>
+ <tr class="row_on">
<td>Antall planlagte kontroller som skal vises.</td>
<td>
<input type="text"
name="newsettings[no_of_planned_controls]"
value="{value_no_of_planned_controls}"/>
</td>
</tr>
- <tr class="row_on">
+ <tr class="row_off">
<td>Antall tildelte kontroller som skal vises</td>
<td>
<input type="text"
name="newsettings[no_of_assigned_controls]"
value="{value_no_of_assigned_controls}"/>
</td>
</tr>
- <tr class="row_off">
+ <tr class="row_on">
<td>{lang_document_category}:</td>
<td>
<!--to be able to blank the setting - need an empty value-->
Modified: branches/dev-syncromind/property/inc/class.soentity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.soentity.inc.php 2015-07-14
10:56:41 UTC (rev 13654)
+++ branches/dev-syncromind/property/inc/class.soentity.inc.php 2015-07-14
11:00:27 UTC (rev 13655)
@@ -1912,6 +1912,12 @@
function read_single_eav($data, $values = array())
{
+
+ if(!$values)
+ {
+ $values = isset($data['values']) &&
$data['values'] ? $data['values'] : array();
+ }
+
$sql = '';
if(isset($data['guid']) && $data['guid'])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13655] Syncromind: Merge 13603:13653 from trunk,
Sigurd Nes <=