[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16615] Stable: Merge 6609:16614 from trunk
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16615] Stable: Merge 6609:16614 from trunk |
Date: |
Sun, 23 Apr 2017 06:01:37 -0400 (EDT) |
Revision: 16615
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16615
Author: sigurdne
Date: 2017-04-23 06:01:37 -0400 (Sun, 23 Apr 2017)
Log Message:
-----------
Stable: Merge 6609:16614 from trunk
Modified Paths:
--------------
branches/Version-2_0-branch/property/inc/class.hook_helper.inc.php
branches/Version-2_0-branch/property/inc/class.menu.inc.php
branches/Version-2_0-branch/property/inc/class.sodimb_role_user.inc.php
branches/Version-2_0-branch/property/inc/class.soentity.inc.php
branches/Version-2_0-branch/property/inc/class.sopending_action.inc.php
branches/Version-2_0-branch/property/inc/class.soproject.inc.php
branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php
branches/Version-2_0-branch/property/inc/class.uidimb_role_user.inc.php
branches/Version-2_0-branch/property/inc/class.uientity.inc.php
branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
branches/Version-2_0-branch/property/setup/setup.inc.php
branches/Version-2_0-branch/property/templates/base/attributes_view.xsl
branches/Version-2_0-branch/property/templates/base/entity.xsl
Property Changed:
----------------
branches/Version-2_0-branch/
Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch 2017-04-23 10:01:37 UTC (rev 16615)
Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
/branches/dev-syncromind:13653
/branches/dev-syncromind-2:14933-16587
/branches/stavangerkommune:12743-12875,12986
-/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608
\ No newline at end of property
+/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614
\ No newline at end of property
Modified: branches/Version-2_0-branch/property/inc/class.hook_helper.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.hook_helper.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.hook_helper.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -1003,12 +1003,15 @@
//
$portalbox->set_controls($key,$value);
}
+ $users_for_substitute =
CreateObject('property.sodimb_role_user')->get_users_for_substitute(
$accound_id);
+ $users_for_substitute[] = $accound_id;
+
+
$action_params = array
(
'appname' => 'property',
'location' => '.project',
- // 'id'
=> $id,
- 'responsible' => $accound_id,
+ 'responsible' => $users_for_substitute,
'responsible_type' => 'user',
'action' => 'approval',
'deadline' => '',
@@ -1170,4 +1173,38 @@
$GLOBALS['phpgw_info']['flags']['currentapp'] =
$save_app;
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] =
$maxmatches;
}
+
+ function after_navbar( )
+ {
+ $sodimb_role_user =
CreateObject('property.sodimb_role_user');
+ $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
+ $substitute_user_id =
$sodimb_role_user->get_substitute( $user_id);
+ $lang_substitute =
$GLOBALS['phpgw']->translation->translate('substitute', array(), false,
'property');
+ if($substitute_user_id)
+ {
+ echo '<div class="msg_good">';
+ echo $lang_substitute .': ' .
$GLOBALS['phpgw']->accounts->get($substitute_user_id)->__toString();
+ echo '</div>';
+ }
+
+ $users_for_substitute =
$sodimb_role_user->get_users_for_substitute( $user_id);
+ $names = array();
+ foreach ($users_for_substitute as $user_for_substitute)
+ {
+ $names[] =
$GLOBALS['phpgw']->accounts->get($user_for_substitute)->__toString();
+ }
+ if($names)
+ {
+ echo '<div class="msg_good">';
+ echo $lang_substitute .' for : ' . implode(',
', $names);
+ echo '</div>';
+ }
+
+ if(in_array($substitute_user_id, $users_for_substitute))
+ {
+ echo '<div class="error">';
+ echo $lang_substitute .': ' . lang('circle
reference');
+ echo '</div>';
+ }
+ }
}
\ No newline at end of file
Modified: branches/Version-2_0-branch/property/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.menu.inc.php 2017-04-23
09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.menu.inc.php 2017-04-23
10:01:37 UTC (rev 16615)
@@ -349,7 +349,14 @@
'dimb_role_user2' => array
(
'text' => lang('dimb role
user'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uidimb_role_user.index'))
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uidimb_role_user.index')),
+ 'children' => array(
+ 'substitute' => array
+ (
+ 'text' =>
lang('substitute'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uidimb_role_user.list_substitute')),
+ )
+ )
),
'accounting_dimd' => array
(
Modified:
branches/Version-2_0-branch/property/inc/class.sodimb_role_user.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.sodimb_role_user.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.sodimb_role_user.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -304,18 +304,39 @@
return $ok;
}
- public function update_substitute( $user_id,
$substitute_user_id )
+ /**
+ * A user can only have one substitute
+ * @param int $user_id
+ * @param int $substitute_user_id
+ * @return boolean true on success
+ */
+ public function update_substitute( $user_id,
$substitute_user_id = 0 )
{
$this->db->transaction_begin();
$this->db->query('DELETE FROM
fm_ecodimb_role_user_substitute WHERE user_id = ' . (int)$user_id, __LINE__,
__FILE__);
- $this->db->query('INSERT INTO
fm_ecodimb_role_user_substitute (user_id, substitute_user_id ) VALUES (' .
(int)$user_id . ',' . (int) $substitute_user_id . ')', __LINE__, __FILE__);
+ if($substitute_user_id)
+ {
+ $this->db->query('INSERT INTO
fm_ecodimb_role_user_substitute (user_id, substitute_user_id ) VALUES (' .
(int)$user_id . ',' . (int) $substitute_user_id . ')', __LINE__, __FILE__);
+ }
if($this->db->transaction_commit())
{
- phpgwapi_cache::message_set(lang('substitute')
.': ' . $GLOBALS['phpgw']->accounts->get($substitute_user_id)->__toString(),
'message');
+ if($substitute_user_id)
+ {
+
phpgwapi_cache::message_set(lang('substitute') .': ' .
$GLOBALS['phpgw']->accounts->get($substitute_user_id)->__toString(), 'message');
+ }
+ else
+ {
+
phpgwapi_cache::message_set(lang('substitute') . ' ' .lang('deleted'),
'message');
+ }
return true;
}
}
+ /**
+ * Get the substitute for a user
+ * @param int $user_id
+ * @return int $substitute_user_id
+ */
public function get_substitute( $user_id)
{
$this->db->query('SELECT substitute_user_id FROM
fm_ecodimb_role_user_substitute WHERE user_id = ' . (int)$user_id, __LINE__,
__FILE__);
@@ -322,4 +343,20 @@
$this->db->next_record();
return (int)$this->db->f('substitute_user_id');
}
+
+ /**
+ * Get the users that the substitute is given responsibility for
+ * @param int $substitute_user_id
+ * @return array $users
+ */
+ public function get_users_for_substitute( $substitute_user_id)
+ {
+ $this->db->query('SELECT user_id FROM
fm_ecodimb_role_user_substitute WHERE substitute_user_id = ' .
(int)$substitute_user_id, __LINE__, __FILE__);
+ $users = array();
+ while ($this->db->next_record())
+ {
+ $users[] = $this->db->f('user_id');
+ }
+ return $users;
+ }
}
\ No newline at end of file
Modified: branches/Version-2_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soentity.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.soentity.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -691,11 +691,11 @@
{
if($_int_query)
{
- $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id
= {$_int_query} OR address {$this->like} '%{$query}%')";
+ $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id
= {$_int_query} OR address {$this->like} '%{$query}%')";
}
else
{
- $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR address
{$this->like} '%{$query}%')";
+ $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR address
{$this->like} '%{$query}%')";
}
// $where= 'OR';
}
@@ -845,6 +845,7 @@
$cache_attribute_status[$location_id] =
$GLOBALS['phpgw']->custom_fields->find2($location_id, 0, '', 'ASC', '', true,
true,$filters);
}
+ $_querymethod_status = '';
if(!phpgw::get_var('status', 'int'))
{
if(!empty($cache_attribute_status[$location_id]))
@@ -924,6 +925,10 @@
$querymethod .= " AND
{$_querymethod_status}";
}
}
+ else if ($_querymethod_status)
+ {
+ $querymethod = " $where {$_querymethod_status}";
+ }
// $filtermethod .= "AND xmlexists('//location_code[text()
= ''5002-02'']' PASSING BY REF xml_representation)";
Modified:
branches/Version-2_0-branch/property/inc/class.sopending_action.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.sopending_action.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.sopending_action.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -223,7 +223,7 @@
$appname = isset($data['appname']) && $data['appname']
? $data['appname'] : '';
$location = isset($data['location']) &&
$data['location'] ? $data['location'] : '';
$item_id = isset($data['id']) && $data['id'] ?
$data['id'] : '';//possible bigint
- $responsible = (int)$data['responsible'];
+ $responsible = $data['responsible'];
$responsible_type = isset($data['responsible_type']) &&
$data['responsible_type'] ? $data['responsible_type'] : 'user';
$action = isset($data['action']) && $data['action'] ?
$this->db->db_addslashes($data['action']) : '';
$deadline = isset($data['deadline']) &&
$data['deadline'] ? (int)$data['deadline'] : 0;
@@ -249,10 +249,14 @@
$ret = array();
$condition = " WHERE num = '{$action}' AND location_id
= {$location_id}";
- if ($responsible)
+ if (is_array($responsible))
{
- $condition .= " AND responsible =
{$responsible}";
+ $condition .= ' AND responsible IN(' .
implode(', ', $responsible) . ')';
}
+ else if ((int)$responsible)
+ {
+ $condition .= " AND responsible = ".
(int)$responsible;
+ }
if ($item_id)
{
@@ -303,7 +307,7 @@
$this->db->query($sql . $ordermethod, __LINE__,
__FILE__);
}
- $ret = $this->db->resultSet;
+ $ret = (array)$this->db->resultSet;
$interlink = CreateObject('property.interlink');
Modified: branches/Version-2_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soproject.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.soproject.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -1759,12 +1759,16 @@
{
$close_pending_action = true;
+
+ $sodimb_role_user =
CreateObject('property.sodimb_role_user');
+ $users_for_substitute =
$sodimb_role_user->get_users_for_substitute($this->account);
+ $take_responsibility_for =
array($this->account);
+
$action_params = array
(
'appname' => 'property',
'location' => '.project',
'id' => (int)$project['id'],
- 'responsible' => $this->account,
'responsible_type' => 'user',
'action' => 'approval',
'remark' => '',
@@ -1771,7 +1775,21 @@
'deadline' => ''
);
-
execMethod('property.sopending_action.close_pending_action', $action_params);
+ $approvals =
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+ foreach ($approvals as $approval)
+ {
+
if(in_array($approval['responsible'],$users_for_substitute))
+ {
+
$take_responsibility_for[] = $approval['responsible'];
+ }
+ }
+
+ foreach ($take_responsibility_for as
$__account_id)
+ {
+ $action_params['responsible'] =
$__account_id;
+
execMethod('property.sopending_action.close_pending_action', $action_params);
+ }
unset($action_params);
$this->approve_related_workorders($project['id']);
@@ -3423,14 +3441,17 @@
}
$historylog = CreateObject('property.historylog',
'workorder');
+ $sodimb_role_user =
CreateObject('property.sodimb_role_user');
foreach ($ids as $order_id)
{
+ $users_for_substitute =
$sodimb_role_user->get_users_for_substitute($this->account);
+ $take_responsibility_for =
array($this->account);
+
$action_params = array(
'appname' => 'property',
'location' => '.project.workorder',
'id' => $order_id,
- 'responsible' => $this->account,
'responsible_type' => 'user',
'action' => 'approval',
'remark' => '',
@@ -3438,24 +3459,38 @@
'closed' => true
);
- //check for approved
-
if(execMethod('property.sopending_action.get_pending_action', $action_params))
+
+ $approvals =
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+ foreach ($approvals as $approval)
{
- continue;
+
if(in_array($approval['responsible'],$users_for_substitute))
+ {
+ $take_responsibility_for[] =
$approval['responsible'];
+ }
}
- unset($action_params['closed']);
- //approval_substitute
-
if(!execMethod('property.sopending_action.get_pending_action', $action_params))
+ foreach ($take_responsibility_for as
$__account_id)
{
-
execMethod('property.sopending_action.set_pending_action', $action_params);
- }
-
execMethod('property.sopending_action.close_pending_action', $action_params);
- $budget_amount =
execMethod('property.boworkorder.get_budget_amount', $order_id);
+ $action_params['responsible'] =
$__account_id;
+ //check for approved
+
if(execMethod('property.sopending_action.get_pending_action', $action_params))
+ {
+ continue;
+ }
+ unset($action_params['closed']);
+ //approval_substitute
+
if(!execMethod('property.sopending_action.get_pending_action', $action_params))
+ {
+
execMethod('property.sopending_action.set_pending_action', $action_params);
+ }
+
execMethod('property.sopending_action.close_pending_action', $action_params);
+ $budget_amount =
execMethod('property.boworkorder.get_budget_amount', $order_id);
- $historylog->add('OA', $order_id,
$GLOBALS['phpgw']->accounts->get($this->account)->__toString() .
"::{$budget_amount}");
+ $historylog->add('OA', $order_id,
$GLOBALS['phpgw']->accounts->get($this->account)->__toString() .
"::{$budget_amount}");
- phpgwapi_cache::message_set(lang('order %1
approved for amount %2', $order_id, $budget_amount),'message');
+ phpgwapi_cache::message_set(lang('order
%1 approved for amount %2', $order_id, $budget_amount),'message');
+ }
}
}
}
\ No newline at end of file
Modified: branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -1638,19 +1638,36 @@
$this->db->next_record();
if ($this->db->f('approved') ||
$workorder['approved'])
{
+ $sodimb_role_user =
CreateObject('property.sodimb_role_user');
+ $users_for_substitute =
$sodimb_role_user->get_users_for_substitute($this->account);
+ $take_responsibility_for =
array($this->account);
+
$action_params = array
- (
+ (
'appname' => 'property',
'location' =>
'.project.workorder',
'id' => $workorder['id'],
- 'responsible' => $this->account,
'responsible_type' => 'user',
'action' => 'approval',
'remark' => '',
'deadline' => ''
);
+ $approvals =
execMethod('property.sopending_action.get_pending_action', $action_params);
-
execMethod('property.sopending_action.close_pending_action', $action_params);
+ foreach ($approvals as $approval)
+ {
+
if(in_array($approval['responsible'],$users_for_substitute))
+ {
+
$take_responsibility_for[] = $approval['responsible'];
+ }
+ }
+
+ foreach ($take_responsibility_for as
$__account_id)
+ {
+ $action_params['responsible'] =
$__account_id;
+
execMethod('property.sopending_action.close_pending_action', $action_params);
+ }
+
unset($action_params);
}
//Sigurd: Consider remove
@@ -3027,12 +3044,15 @@
$this->db->next_record();
if ($this->db->f('approved'))
{
+ $sodimb_role_user =
CreateObject('property.sodimb_role_user');
+ $users_for_substitute =
$sodimb_role_user->get_users_for_substitute($this->account);
+ $take_responsibility_for =
array($this->account);
+
$action_params = array
- (
+ (
'appname' => 'property',
'location' =>
'.project.workorder',
'id' => $order_id,
- 'responsible' => $this->account,
'responsible_type' => 'user',
'action' => 'approval',
'remark' => '',
@@ -3039,7 +3059,21 @@
'deadline' => ''
);
-
execMethod('property.sopending_action.close_pending_action', $action_params);
+ $approvals =
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+ foreach ($approvals as $approval)
+ {
+
if(in_array($approval['responsible'],$users_for_substitute))
+ {
+
$take_responsibility_for[] = $approval['responsible'];
+ }
+ }
+
+ foreach ($take_responsibility_for as
$__account_id)
+ {
+ $action_params['responsible'] =
$__account_id;
+
execMethod('property.sopending_action.close_pending_action', $action_params);
+ }
unset($action_params);
}
//Sigurd: Consider remove
Modified:
branches/Version-2_0-branch/property/inc/class.uidimb_role_user.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uidimb_role_user.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.uidimb_role_user.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -311,8 +311,9 @@
{
$user_id = $this->account_id;
$substitute_user_id =
phpgw::get_var('substitute_user_id', 'int', 'POST');
+ $save = phpgw::get_var('save', 'string', 'POST');
- if($substitute_user_id)
+ if($save)
{
$this->bo->update_substitute($user_id,
$substitute_user_id);
}
Modified: branches/Version-2_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uientity.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.uientity.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -713,7 +713,7 @@
$link_data = array
(
- 'menuaction' => 'property.uientity.edit',
+ 'menuaction' => 'property.uientity.view',
'entity_id' => $this->entity_id,
'cat_id' => $this->cat_id,
'type' => $this->type
@@ -1021,54 +1021,55 @@
}
}
- if
(isset($GLOBALS['phpgw_info']['user']['apps']['controller']))
- {
+// $controller_cases = array();
+// if
(isset($GLOBALS['phpgw_info']['user']['apps']['controller']))
+// {
+//
+// $lang_controller =
$GLOBALS['phpgw']->translation->translate('controller', array(), false,
'controller');
+// $location_id =
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
+// $socase = CreateObject('controller.socase');
+// $controller_cases =
$socase->get_cases_by_component($location_id, $id);
+//
+// $_statustext = array();
+// $_statustext[0] = lang('open');
+// $_statustext[1] = lang('closed');
+// $_statustext[2] = lang('pending');
+// }
+//
+// foreach ($controller_cases as $case)
+// {
+// switch ($case['status'])
+// {
+// case 0:
+// case 2:
+// $_method = 'view_open_cases';
+// break;
+// case 1:
+// $_method = 'view_closed_cases';
+// break;
+// default:
+// $_method = 'view_open_cases';
+// }
+//
+// $_link = $GLOBALS['phpgw']->link('/index.php',
array
+// (
+// 'menuaction' =>
"controller.uicase.{$_method}",
+// 'check_list_id' =>
$case['check_list_id']
+// )
+// );
+//
+// $values[] = array
+// (
+// 'url' => "<a href=\"{$_link}\" >
{$case['check_list_id']}</a>",
+// 'type' => $lang_controller,
+// 'title' => $case['descr'],
+// 'status' =>
$_statustext[$case['status']],
+// 'user' =>
$GLOBALS['phpgw']->accounts->get($case['user_id'])->__toString(),
+// 'entry_date' =>
$GLOBALS['phpgw']->common->show_date($case['modified_date'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+// );
+// unset($_link);
+// }
- $lang_controller =
$GLOBALS['phpgw']->translation->translate('controller', array(), false,
'controller');
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
- $socase = CreateObject('controller.socase');
- $controller_cases =
$socase->get_cases_by_component($location_id, $id);
-
- $_statustext = array();
- $_statustext[0] = lang('open');
- $_statustext[1] = lang('closed');
- $_statustext[2] = lang('pending');
- }
-
- foreach ($controller_cases as $case)
- {
- switch ($case['status'])
- {
- case 0:
- case 2:
- $_method = 'view_open_cases';
- break;
- case 1:
- $_method = 'view_closed_cases';
- break;
- default:
- $_method = 'view_open_cases';
- }
-
- $_link = $GLOBALS['phpgw']->link('/index.php',
array
- (
- 'menuaction' =>
"controller.uicase.{$_method}",
- 'check_list_id' =>
$case['check_list_id']
- )
- );
-
- $values[] = array
- (
- 'url' => "<a href=\"{$_link}\" >
{$case['check_list_id']}</a>",
- 'type' => $lang_controller,
- 'title' => $case['descr'],
- 'status' =>
$_statustext[$case['status']],
- 'user' =>
$GLOBALS['phpgw']->accounts->get($case['user_id'])->__toString(),
- 'entry_date' =>
$GLOBALS['phpgw']->common->show_date($case['modified_date'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
- );
- unset($_link);
- }
-
$start = phpgw::get_var('start', 'int', 'REQUEST', 0);
$total_records = count($values);
@@ -2415,7 +2416,7 @@
$_case_def = array
(
- array('key' => 'url', 'label'
=> lang('id'), 'sortable' => false, 'resizeable' => true),
+ array('key' => 'url', 'label'
=> lang('id'), 'sortable' => true, 'resizeable' => true),
array('key' => 'type', 'label'
=> lang('type'), 'sortable' => true, 'resizeable' => true),
array('key' => 'title', 'label'
=> lang('title'), 'sortable' => false, 'resizeable' => true),
array('key' => 'value', 'label'
=> lang('value'), 'sortable' => false, 'resizeable' => true),
@@ -2433,7 +2434,7 @@
'data' => json_encode($_cases),
'config' => array(
array('disableFilter'
=> true),
-
array('disablePagination' => true)
+ //
array('disablePagination' => true)
)
);
}
@@ -2504,12 +2505,7 @@
'files' => isset($values['files']) ?
$values['files'] : '',
// 'jasperfiles'
=> isset($values['jasperfiles'])?$values['jasperfiles']:'',
'multiple_uploader' => $id ? true : '',
- /*'fileuploader_action' =>
"{menuaction:'property.fileuploader.add',"
- . "upload_target:'property.uientity.addfiles',"
- . "id:'{$id}',"
- . "_entity_id:'{$this->entity_id}',"
- . "_cat_id:'{$this->cat_id}',"
- . "_type:'{$this->type}'}",*/
+
'multi_upload_parans' =>
"{menuaction:'property.uientity.build_multi_upload_file',"
. "id:'{$id}',"
. "_entity_id:'{$this->entity_id}',"
@@ -2571,11 +2567,15 @@
self::add_javascript('property', 'portico',
'entity.edit.js');
- self::render_template_xsl(array('entity',
'datatable_inline', 'attributes_form',
+ $attribute_template = 'attributes_form';
+ if($mode == 'view')
+ {
+ $attribute_template = 'attributes_view';
+ }
+
+ self::render_template_xsl(array('entity',
'datatable_inline', $attribute_template,
'files'), array('edit' => $data));
- //phpgwapi_jquery::load_widget('treeview');
-
$criteria = array
(
'appname' => $this->type_app[$this->type],
@@ -3588,12 +3588,24 @@
)
);
+
+ $_value_arr = array();
+
+ if($case['measurement'])
+ {
+ $_value_arr[] = $case['measurement'];
+ }
+ if($case['descr'])
+ {
+ $_value_arr[] = $case['descr'];
+ }
+
$_cases[] = array
(
'url' => "<a href=\"{$_link}\" >
{$case['check_list_id']}</a>",
'type' => $_control_name,
'title' => "<a href=\"{$_link}\" >
{$case['title']}</a>",
- 'value' => $case['measurement'],
+ 'value' => implode('</br>',
$_value_arr),
'status' =>
$_statustext[$case['status']],
'user' =>
$GLOBALS['phpgw']->accounts->get($case['user_id'])->__toString(),
'entry_date' =>
$GLOBALS['phpgw']->common->show_date($case['modified_date'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
@@ -3665,13 +3677,23 @@
'check_list_id' =>
$check_list_id
)
);
+ $_value_arr = array();
+ if($case->get_measurement())
+ {
+ $_value_arr[] =
$case->get_measurement();
+ }
+ if($case->get_descr())
+ {
+ $_value_arr[] =
$case->get_descr();
+ }
+
$_cases[] = array
(
'url' => "<a href=\"{$_link}\"
> {$check_list_id}</a>",
'type' => $_control_name,
'title' => "<a
href=\"{$_link}\" >" . $check_item->get_control_item()->get_title() . "</a>",
- 'value' =>
$case->get_measurement(),
+ 'value' => implode('</br>',
$_value_arr),
'status' =>
$_statustext[$case->get_status()],
'user' =>
$GLOBALS['phpgw']->accounts->get($case->get_user_id())->__toString(),
'entry_date' =>
$GLOBALS['phpgw']->common->show_date($case->get_modified_date(),
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
Modified: branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -1044,6 +1044,10 @@
'deadline' => ''
);
+ /**
+ * For now - handled by
uiworkorder.
+ * consider remove - beware of
the substitute logic...see uiworkorder
+ */
if
(isset($values['mail_address']) && is_array($values['mail_address']))
{
foreach
($values['mail_address'] as $_account_id => $_address)
Modified: branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
2017-04-23 10:01:37 UTC (rev 16615)
@@ -913,9 +913,14 @@
}
$_budget_amount =
$this->bo->get_budget_amount($id);
+ $sodimb_role_user =
CreateObject('property.sodimb_role_user');
if (isset($values['approval']) &&
$values['approval'] && $config->config_data['workorder_approval'])
{
+ if
(empty($GLOBALS['phpgw_info']['server']['smtp_server']))
+ {
+ $receipt['error'][] =
array('msg' => lang('SMTP server is not set! (admin section)'));
+ }
$coordinator_name =
$GLOBALS['phpgw_info']['user']['fullname'];
$coordinator_email =
$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
@@ -955,6 +960,13 @@
if(!$approvals)
{
+
$substitute = $sodimb_role_user->get_substitute($_account_id);
+
+
if($substitute)
+ {
+
$_account_id = $substitute;
+ }
+
$_budget_amount =
$this->bo->get_accumulated_budget_amount($values['project_id']);
$pending_action->set_pending_action($action_params_approved);
@@ -1022,61 +1034,65 @@
$message = '<a href ="'
. $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
$approval_menuaction,
'id' => $id), false,
true) . '">' . lang('Workorder %1 needs approval', $id) . '</a>';
$_orders = array($id);
- break;
- }
- if
(empty($GLOBALS['phpgw_info']['server']['smtp_server']))
- {
- $receipt['error'][] =
array('msg' => lang('SMTP server is not set! (admin section)'));
- }
+ $action_params = array(
+ 'appname' =>
'property',
+ 'location' =>
'.project.workorder',
+ 'id' => $id,
+ 'responsible'
=> '',
+
'responsible_type' => 'user',
+ 'action' =>
'approval',
+ 'remark' => '',
+ 'deadline' => ''
+ );
+ $bcc =
'';//$coordinator_email;
+ foreach
($values['approval'] as $_account_id => $_address)
+ {
+ $substitute =
$sodimb_role_user->get_substitute($_account_id);
+ /**
+ * Alert the
substitute
+ */
+ if($substitute)
+ {
+
$_account_id = $substitute;
+ }
- $action_params = array(
- 'appname' => 'property',
- 'location' =>
'.project.workorder',
- 'id' => $id,
- 'responsible' => '',
- 'responsible_type' => 'user',
- 'action' => 'approval',
- 'remark' => '',
- 'deadline' => ''
- );
- $bcc = '';//$coordinator_email;
- foreach ($values['approval'] as
$_account_id => $_address)
- {
- $prefs =
$this->bocommon->create_preferences('property', $_account_id);
- if (!empty($prefs['email']))
- {
- $_address =
$prefs['email'];
- }
- else
- {
- $email_domain =
!empty($GLOBALS['phpgw_info']['server']['email_domain']) ?
$GLOBALS['phpgw_info']['server']['email_domain'] : 'bergen.kommune.no';
- $_address =
$GLOBALS['phpgw']->accounts->id2lid($_account_id) . "@{$email_domain}";
- }
+ $prefs =
$this->bocommon->create_preferences('property', $_account_id);
+ if
(!empty($prefs['email']))
+ {
+
$_address = $prefs['email'];
+ }
+ else
+ {
+
$email_domain = !empty($GLOBALS['phpgw_info']['server']['email_domain']) ?
$GLOBALS['phpgw_info']['server']['email_domain'] : 'bergen.kommune.no';
+
$_address = $GLOBALS['phpgw']->accounts->id2lid($_account_id) .
"@{$email_domain}";
+ }
- if($approval_level == 'order')
- {
- foreach ($_orders as
$_order_id)
- {
-
$action_params['responsible'] = $_account_id;
-
$action_params['id'] = $_order_id;
- try
+
if($approval_level == 'order')
{
-
$historylog->add('AP', $id,
$GLOBALS['phpgw']->accounts->get($_account_id)->__toString() .
"::{$_budget_amount}");
-
execMethod('property.sopending_action.set_pending_action', $action_params);
- $rcpt =
$GLOBALS['phpgw']->send->msg('email', $_address, $subject,
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name,
'html');
- if
($rcpt)
+ foreach
($_orders as $_order_id)
{
-
phpgwapi_cache::message_set(lang('%1 is notified', $_address),'message');
+
$action_params['responsible'] = $_account_id;
+
$action_params['id'] = $_order_id;
+
try
+
{
+
$historylog->add('AP', $id,
$GLOBALS['phpgw']->accounts->get($_account_id)->__toString() .
"::{$_budget_amount}");
+
execMethod('property.sopending_action.set_pending_action',
$action_params);
+
$rcpt = $GLOBALS['phpgw']->send->msg('email', $_address, $subject,
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name,
'html');
+
if ($rcpt)
+
{
+
phpgwapi_cache::message_set(lang('%1 is notified',
$_address),'message');
+
}
+
}
+
catch (Exception $exc)
+
{
+
phpgwapi_cache::message_set($exc->getMessage(),'error');
+
}
}
}
- catch
(Exception $exc)
- {
-
phpgwapi_cache::message_set($exc->getMessage(),'error');
- }
}
- }
+ break;
}
}
@@ -1095,13 +1111,29 @@
foreach ($values['do_approve'] as
$_account_id => $_dummy)
{
- $action_params['responsible'] =
$_account_id;
-
if(!execMethod('property.sopending_action.get_pending_action', $action_params))
+ $users_for_substitute =
$sodimb_role_user->get_users_for_substitute($_account_id);
+
+ $approvals =
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+ $take_responsibility_for =
array($_account_id);
+ foreach ($approvals as
$approval)
{
-
execMethod('property.sopending_action.set_pending_action', $action_params);
+
if(in_array($approval['responsible'],$users_for_substitute))
+ {
+
$take_responsibility_for[] = $approval['responsible'];
+ }
}
-
execMethod('property.sopending_action.close_pending_action', $action_params);
- $historylog->add('OA', $id,
$GLOBALS['phpgw']->accounts->get($_account_id)->__toString() .
"::{$_budget_amount}");
+ foreach
($take_responsibility_for as $__account_id)
+ {
+
$action_params['responsible'] = $__account_id;
+
if(!execMethod('property.sopending_action.get_pending_action', $action_params))
+ {
+
execMethod('property.sopending_action.set_pending_action', $action_params);
+ }
+
execMethod('property.sopending_action.close_pending_action', $action_params);
+ $historylog->add('OA',
$id, $GLOBALS['phpgw']->accounts->get($__account_id)->__toString() .
"::{$_budget_amount}");
+ }
+
unset($action_params['responsible']);
}
}
Modified: branches/Version-2_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-2_0-branch/property/setup/setup.inc.php 2017-04-23
09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/setup/setup.inc.php 2017-04-23
10:01:37 UTC (rev 16615)
@@ -239,7 +239,8 @@
'addgroup' =>
'property.hook_helper.clear_userlist',
'deletegroup' =>
'property.hook_helper.clear_userlist',
'editgroup' =>
'property.hook_helper.clear_userlist',
- 'registration' =>
'property.hook_helper.add_location_contact'
+ 'registration' =>
'property.hook_helper.add_location_contact',
+ 'after_navbar' =>
'property.hook_helper.after_navbar',
);
/* Dependencies for this app to work */
Modified:
branches/Version-2_0-branch/property/templates/base/attributes_view.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/attributes_view.xsl
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/templates/base/attributes_view.xsl
2017-04-23 10:01:37 UTC (rev 16615)
@@ -1,154 +1,515 @@
<!-- $Id$ -->
-<xsl:template match="attributes_view">
- <xsl:variable name="lang_attribute_statustext">
- <xsl:value-of select="lang_attribute_statustext"/>
- </xsl:variable>
- <tr>
- <xsl:attribute name="class">
+<xsl:template name="attributes_view">
+ <xsl:apply-templates select="attributes_values"/>
+</xsl:template>
+
+<!-- New template-->
+<xsl:template xmlns:php="http://php.net/xsl" name="attributes_values">
+ <script type="text/javascript">
+ help_Popup = function(requestUrl)
+ {
+ TINY.box.show({iframe:requestUrl,
boxid:"frameless",width:750,height:450,fixed:false,maskid:"darkmask",maskopacity:40,
mask:true, animate:true, close: true});
+ };
+ </script>
+ <xsl:variable name="lang_hour">
+ <xsl:value-of select="php:function('lang', 'hour')" />
+ </xsl:variable>
+ <xsl:variable name="lang_min">
+ <xsl:value-of select="php:function('lang', 'minute')" />
+ </xsl:variable>
+ <xsl:variable name="statustext">
+ <xsl:value-of select="statustext"/>
+ </xsl:variable>
+
+ <xsl:variable name="textareacols">
+ <xsl:value-of select="php:function('get_phpgw_info',
'user|preferences|property|textareacols')" />
+ </xsl:variable>
+ <xsl:variable name="textarearows">
+ <xsl:value-of select="php:function('get_phpgw_info',
'user|preferences|property|textarearows')" />
+ </xsl:variable>
+
+ <xsl:for-each select="attributes_group">
+ <div id="{link}">
+ <fieldset>
+ <xsl:apply-templates select="attributes">
+ <xsl:with-param name="lang_hour">
+ <xsl:value-of
select="$lang_hour" />
+ </xsl:with-param>
+ <xsl:with-param name="lang_min">
+ <xsl:value-of
select="$lang_min" />
+ </xsl:with-param>
+ <xsl:with-param name="statustext">
+ <xsl:value-of
select="$statustext" />
+ </xsl:with-param>
+ <xsl:with-param name="textareacols">
+ <xsl:value-of
select="$textareacols" />
+ </xsl:with-param>
+ <xsl:with-param name="textarearows">
+ <xsl:value-of
select="$textarearows" />
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </fieldset>
+ </div>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- New template-->
+<xsl:template xmlns:php="http://php.net/xsl" match="attributes">
+ <xsl:param name="lang_hour" />
+ <xsl:param name="lang_min" />
+ <xsl:param name="statustext" />
+ <xsl:param name="textareacols" />
+ <xsl:param name="textarearows" />
+
+ <xsl:choose>
+ <xsl:when test="datatype='section'">
+ <div class="pure-control-group">
+ <xsl:value-of select="descr"
disable-output-escaping="yes"/>
+ </div>
+ </xsl:when>
+ </xsl:choose>
+
+ <div class="pure-control-group">
+ <xsl:choose>
+ <xsl:when test="not(hide_row)">
+ <label id="label_{name}">
+ <xsl:choose>
+ <xsl:when test="helpmsg=1">
+ <xsl:variable
name="help_url">
+ <xsl:value-of
select="help_url"/>
+ </xsl:variable>
+ <a
href="javascript:help_Popup('{$help_url}');">
+
<xsl:text>[</xsl:text>
+ <xsl:value-of
select="input_text"/>
+
<xsl:text>]</xsl:text>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="input_text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="datatype='pwd'">
+ <br/>
+ <xsl:text>[ </xsl:text>
+ <xsl:choose>
+ <xsl:when
test="value!=''">
+
<xsl:value-of select="php:function('lang', 'edit')"/>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="php:function('lang', 'add')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> ]</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </label>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="name!=''">
+ <input type="hidden"
name="values_attribute[{id}][name]" value="{name}"/>
+ <input type="hidden"
name="values_attribute[{id}][datatype]" value="{datatype}"/>
+ <input type="hidden"
name="values_attribute[{id}][precision]" value="{precision}"/>
+ <input type="hidden"
name="values_attribute[{id}][history]" value="{history}"/>
+ <input type="hidden"
name="values_attribute[{id}][attrib_id]" value="{id}"/>
+ <input type="hidden"
name="values_attribute[{id}][nullable]" value="{nullable}"/>
+ <input type="hidden"
name="values_attribute[{id}][input_text]" value="{input_text}"/>
+ <input type="hidden"
name="values_attribute[{id}][disabled]" value="{disabled}"/>
<xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of select="@class"/>
+ <xsl:when test="datatype='R'">
+ <xsl:call-template
name="choice"/>
</xsl:when>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
+ <xsl:when test="datatype='CH'">
+ <xsl:call-template
name="choice"/>
</xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left" valign="top">
- <label>
- <xsl:value-of select="input_text"/>
- <xsl:choose>
- <xsl:when test="datatype='D'">
- <xsl:text>[</xsl:text>
- <xsl:value-of
select="//lang_dateformat"/>
- <xsl:text>]</xsl:text>
+ <xsl:when test="datatype='LB'">
+ <xsl:for-each select="choice">
+ <xsl:choose>
+ <xsl:when
test="checked='checked'">
+
<xsl:value-of disable-output-escaping="yes" select="value"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
</xsl:when>
- </xsl:choose>
- </label>
- </td>
- <td align="left">
- <xsl:choose>
- <xsl:when test="name!=''">
+ <xsl:when test="datatype='AB'">
+ <xsl:variable
name="contact_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_name</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="clear_function">
+
<xsl:text>clear_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <input type="hidden"
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly"
size="5">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input size="30" type="text"
name="{$contact_name}" value="{contact_name}" onClick="{$lookup_function}"
readonly="readonly">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input type="checkbox"
name="clear_{name}_box" onClick="{$clear_function}">
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="php:function('lang', 'delete')"/>
+ </xsl:attribute>
+ <xsl:attribute
name="readonly">
+
<xsl:text>readonly</xsl:text>
+ </xsl:attribute>
+ </input>
<xsl:choose>
- <xsl:when
test="datatype='R'">
-
<xsl:call-template name="choice_view"/>
+ <xsl:when
test="contact_tel!=''">
+ <xsl:value-of
select="contact_tel"/>
</xsl:when>
- <xsl:when
test="datatype='CH'">
-
<xsl:call-template name="choice_view"/>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="contact_email!=''">
+ <a
href="mailto:{contact_email}">
+
<xsl:value-of select="contact_email"/>
+ </a>
</xsl:when>
- <xsl:when
test="datatype='LB'">
- <xsl:for-each
select="choice[checked='checked']">
-
<xsl:value-of select="value"/>
- <xsl:if
test="position() != last()">, </xsl:if>
- </xsl:for-each>
- </xsl:when>
- <xsl:when
test="datatype='AB'">
- <input
type="text" value="{value}" readonly="readonly" size="5"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="title">
-
<xsl:value-of select="statustext"/>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="datatype='ABO'">
+ <xsl:variable name="org_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_name</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <input type="hidden"
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly"
size="5">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
</xsl:attribute>
- </input>
- <input
size="30" type="text" value="{contact_name}" readonly="readonly">
-
<xsl:attribute name="title">
-
<xsl:value-of select="statustext"/>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input size="30" type="text"
name="{$org_name}" value="{org_name}" onClick="{$lookup_function}"
readonly="readonly">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
</xsl:attribute>
- </input>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <xsl:choose>
+ <xsl:when
test="org_tel!=''">
+ <xsl:value-of
select="org_tel"/>
</xsl:when>
- <xsl:when
test="datatype='VENDOR'">
- <input
type="text" value="{value}" readonly="readonly" size="6"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="title">
-
<xsl:value-of select="statustext"/>
-
</xsl:attribute>
- </input>
- <input
size="30" type="text" value="{vendor_name}" readonly="readonly">
-
<xsl:attribute name="title">
-
<xsl:value-of select="statustext"/>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:when
test="datatype='D'">
- <xsl:value-of
select="value"/>
- <img
id="values_attribute_{counter}-trigger"/>
- </xsl:when>
- <xsl:when
test="datatype='link'">
- <xsl:choose>
-
<xsl:when test="value!=''">
-
<br/>
-
<a href="{value}" target="_blank">
-
<xsl:value-of select="value"/>
-
</a>
-
</xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="value"/>
- </xsl:otherwise>
</xsl:choose>
<xsl:choose>
- <xsl:when
test="history=1">
- <xsl:variable
name="link_history">
-
<xsl:value-of select="link_history"/>
- </xsl:variable>
- <xsl:variable
name="lang_history_help">
-
<xsl:value-of select="//lang_history_help"/>
- </xsl:variable>
- <xsl:variable
name="lang_history">
-
<xsl:value-of select="//lang_history"/>
- </xsl:variable>
- <a
href="javascript:var
w=window.open('{$link_history}','','left=50,top=100,width=550,height=400,scrollbars')"
onMouseOver="overlib('{$lang_history_help}', CAPTION, '{$lang_history}')"
onMouseOut="nd()">
-
<xsl:value-of select="//lang_history"/>
+ <xsl:when
test="org_email!=''">
+ <a
href="mailto:{org_email}">
+
<xsl:value-of select="org_email"/>
</a>
</xsl:when>
</xsl:choose>
</xsl:when>
- </xsl:choose>
- </td>
- </tr>
-</xsl:template>
+ <xsl:when test="datatype='VENDOR'">
+ <xsl:value-of select="value"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of
select="vendor_name"/>
+ </xsl:when>
+ <xsl:when test="datatype='custom1'">
+ <xsl:for-each select="choice">
+ <xsl:choose>
+ <xsl:when
test="checked='checked'">
+
<xsl:value-of disable-output-escaping="yes" select="value"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="datatype='custom2'">
+ <xsl:value-of select="value"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of
select="custom_name"/>
+ </xsl:when>
+ <xsl:when test="datatype='custom3'">
+ <xsl:value-of select="value"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of
select="custom_name"/>
+ </xsl:when>
+ <xsl:when test="datatype='user'">
+ <xsl:variable name="user_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_user_name</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <input type="text" id="{name}"
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly"
size="6">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input size="30" type="text"
id="{$user_name}" name="{$user_name}" value="{user_name}"
onClick="{$lookup_function}" readonly="readonly">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='D'">
+ <xsl:value-of select="value"/>
+ </xsl:when>
+ <xsl:when test="datatype='DT'">
+ <xsl:variable
name="clear_function">
+
<xsl:text>clear_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
-<!-- New template-->
-<xsl:template name="choice_view">
- <xsl:variable name="counter">
- <xsl:value-of select="counter"/>
- </xsl:variable>
- <table cellpadding="2" cellspacing="2" width="50%" align="left">
- <xsl:for-each select="choice">
- <tr>
- <xsl:attribute name="class">
+ <table>
+ <tr>
+ <td>
+ <input
type="text" id="values_attribute_{id}"
name="values_attribute[{id}][value][date]" value="{value/date}" size="12"
maxlength="12">
+
<xsl:attribute name="readonly">
+
<xsl:text> readonly</xsl:text>
+
</xsl:attribute>
+
<xsl:choose>
+
<xsl:when test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
<xsl:when test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
</xsl:choose>
+ </input>
+ </td>
+ <td>
+ <input
type="text" id="values_attribute_{id}_hour"
name="values_attribute[{id}][value][hour]" value="{value/hour}" size="2"
maxlength="2" title="{$lang_hour}">
+
<xsl:choose>
+
<xsl:when test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
</xsl:choose>
+ </input>
+ </td>
+ <td>
+
<xsl:text> : </xsl:text>
+ </td>
+ <td>
+ <input
type="text" id="values_attribute_{id}_min"
name="values_attribute[{id}][value][min]" value="{value/min}" size="2"
maxlength="2" title="{$lang_min}">
+
<xsl:choose>
+
<xsl:when test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
</xsl:choose>
+ </input>
+ </td>
+ <td>
+ <input
type="checkbox" name="clear_{name}_box" onClick="{$clear_function}">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'delete')"/>
+
</xsl:attribute>
+
<xsl:attribute name="readonly">
+
<xsl:text>readonly</xsl:text>
+
</xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ </table>
+ </xsl:when>
+ <xsl:when test="datatype='T'">
+ <xsl:value-of select="value"/>
+ </xsl:when>
+ <xsl:when test="datatype='pwd'">
+ <input type="password"
name="values_attribute[{id}][value]" size="30">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input type="password"
name="values_attribute[{id}][value2]" size="30">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='bolean'">
+ <input id="id_{name}"
type="checkbox" name="values_attribute[{id}][value]" value="1">
+ <xsl:choose>
+ <xsl:when
test="value!=''">
+
<xsl:attribute name="checked">
+
<xsl:text>checked</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='link'">
<xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
+ <xsl:when
test="value!=''">
+ <a
href="{value}" target="_blank">
+
<xsl:value-of select="value"/>
+ </a>
</xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
</xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="value"/>
- <xsl:text> </xsl:text>
- </td>
- <xsl:variable name="checked">
- <xsl:value-of select="checked"/>
- </xsl:variable>
- <td align="left">
+ </xsl:when>
+ <xsl:when test="datatype='event'">
<xsl:choose>
- <xsl:when
test="checked='checked'">
- <input
type="{input_type}" name="values_attribute[{$counter}][value][]" value="{id}"
checked="$checked" disabled="disabled"/>
+ <xsl:when
test="warning!=''">
+ <xsl:value-of
select="warning"/>
</xsl:when>
<xsl:otherwise>
- <input
type="{input_type}" name="values_attribute[{$counter}][value][]" value="{id}"
disabled="disabled"/>
+ <xsl:variable
name="event_descr">
+
<xsl:value-of select="name"/>
+
<xsl:text>_descr</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+
<xsl:value-of select="name"/>
+
<xsl:text>();</xsl:text>
+ </xsl:variable>
+ <div
class="pure-custom">
+ <input
type="text" name="{name}" value="{value}" onClick="{$lookup_function}"
readonly="readonly" size="6"/>
+ <input
size="30" type="text" name="{$event_descr}" value="{descr}"
onClick="{$lookup_function}" readonly="readonly">
+
<xsl:choose>
+
<xsl:when test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
</xsl:choose>
+ </input>
+
<xsl:choose>
+
<xsl:when test="next!=''">
+
<div>
+
<xsl:value-of select="lang_next_run"/>
+
<xsl:text>: </xsl:text>
+
<xsl:value-of select="next"/>
+
</div>
+
<div>
+
<xsl:value-of select="lang_enabled"/>
+
<xsl:text>: </xsl:text>
+
<xsl:value-of select="enabled"/>
+
</div>
+
</xsl:when>
+
</xsl:choose>
+ </div>
</xsl:otherwise>
</xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
+ </xsl:when>
+ <xsl:when test="datatype='I'">
+ <xsl:value-of select="value"/>
+ </xsl:when>
+ <xsl:when test="datatype='N'">
+ <xsl:value-of select="value"/>
+ </xsl:when>
+ <xsl:when test="datatype='email'">
+ <xsl:value-of select="value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="history=1">
+ <input type="text"
id="values_attribute_{id}_date" name="values_attribute[{id}][date]" value=""
size="12" maxlength="10" readonly="readonly">
+ </input>
+ <xsl:variable
name="link_history">
+ <xsl:value-of
select="link_history"/>
+ </xsl:variable>
+ <xsl:variable
name="lang_history_help">
+ <xsl:value-of
select="//lang_history_help"/>
+ </xsl:variable>
+ <xsl:variable
name="lang_history">
+ <xsl:value-of
select="php:function('lang', 'history')" />
+ </xsl:variable>
+ <a
href="javascript:JqueryPortico.showlightbox_history('{$link_history}')"
title="{$lang_history}">
+ <xsl:value-of
select="$lang_history"/>
+ </a>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </div>
</xsl:template>
+
+<!-- New template-->
+<xsl:template name="choice">
+ <xsl:variable name="attrib_id">
+ <xsl:value-of select="id"/>
+ </xsl:variable>
+ <xsl:variable name="name">
+ <xsl:value-of select="name"/>
+ </xsl:variable>
+ <div class="pure-custom">
+ <xsl:for-each select="choice">
+ <xsl:choose>
+ <xsl:when test="checked='checked'">
+ <input id="id_{$name}_{id}"
type="{input_type}" name="values_attribute[{$attrib_id}][value][]" value="{id}"
checked="checked"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input id="id_{$name}_{id}"
type="{input_type}" name="values_attribute[{$attrib_id}][value][]"
value="{id}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="value"/>
+ <br></br>
+ </xsl:for-each>
+ </div>
+</xsl:template>
Modified: branches/Version-2_0-branch/property/templates/base/entity.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/entity.xsl
2017-04-23 09:59:16 UTC (rev 16614)
+++ branches/Version-2_0-branch/property/templates/base/entity.xsl
2017-04-23 10:01:37 UTC (rev 16615)
@@ -842,8 +842,35 @@
<xsl:with-param name="cat_list"
select="cat_list"/>
</xsl:call-template>
</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="lang_edit">
+ <xsl:value-of
select="php:function('lang', 'edit')" />
+ </xsl:variable>
+ <xsl:variable name="lang_new_entity">
+ <xsl:value-of
select="php:function('lang', 'new')" />
+ </xsl:variable>
+ <input type="button" class="pure-button
pure-button-primary" name="edit_entity" value="{$lang_edit}" title =
"{$lang_edit}" onClick="document.load_edit_form.submit();"/>
+ <!--input type="button"
class="pure-button pure-button-primary" name="new_entity"
value="{$lang_new_entity}" title = "{$lang_new_entity}"
onClick="document.new_form.submit();"/-->
+ <!--input class="pure-button
pure-button-primary" type="button" name="cancelButton" id ='cancelButton'
value="{$lang_cancel}" title = "{$lang_cancel}"
onClick="document.cancel_form.submit();"/-->
+ </xsl:otherwise>
</xsl:choose>
</form>
+
+ <xsl:variable name="edit_params">
+ <xsl:text>menuaction:property.uientity.edit,
id:</xsl:text>
+ <xsl:value-of select="value_id"/>
+ <xsl:text>, location_id:</xsl:text>
+ <xsl:value-of select="value_location_id"/>
+ </xsl:variable>
+ <xsl:variable name="edit_url">
+ <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', $edit_params )" />
+ </xsl:variable>
+
+ <form name="load_edit_form" id="load_edit_form"
action="{$edit_url}" method="post">
+ </form>
+
+
+
<xsl:variable name="cancel_url">
<xsl:value-of select="cancel_url"/>
</xsl:variable>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16615] Stable: Merge 6609:16614 from trunk,
sigurdne <=