-
Notifications
You must be signed in to change notification settings - Fork 2
/
datamodel.itop-approval-portal.xml
103 lines (103 loc) · 3.1 KB
/
datamodel.itop-approval-portal.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3">
<classes>
<class id="ApprovalScheme" _delta="must_exist">
<methods>
<method id="MakeReplyUrl" _delta="redefine">
<comment>/**
* Helper to make the URL to approve/reject the ticket
*/</comment>
<static>false</static>
<access>public</access>
<type>Custom</type>
<code><![CDATA[ public function MakeReplyUrl($sContactClass, $iContactId, $bFromGUI = true)
{
$sPassCode = $this->GetContactPassCode($sContactClass, $iContactId);
if (is_null($sPassCode))
{
$sReplyUrl = null;
}
else
{
if ($bFromGUI)
{
$sApprovalUI = 'specific';
}
else
{
// Redirect EVERY user to the portal, as soon as they have a valid login
$oSearch = new DBObjectSearch('User');
$oSearch->AddCondition('contactid', $iContactId);
$oSearch->AddCondition('status', 'enabled');
$oSearch->AllowAllData();
$oSet = new DBObjectSet($oSearch);
$iCount = $oSet->Count();
if ($iCount > 0)
{
$sApprovalUI = 'portal';
}
else
{
$sApprovalUI = 'specific';
}
}
switch ($sApprovalUI)
{
case 'specific':
$sToken = $this->GetKey().'-'.$this->Get('current_step').'-'.$sContactClass.'-'.$iContactId.'-'.$sPassCode;
$sReplyUrl = utils::GetAbsoluteUrlModulesRoot().'approval-base/approve.php?token='.$sToken;
if ($bFromGUI)
{
$sReplyUrl .= '&from=object_details';
}
break;
case 'portal':
$sPortalId = 'itop-portal';
$sReplyUrl = utils::GetAbsoluteUrlModulesRoot() . $sPortalId . '/index.php/approval/approvals';
break;
}
}
return $sReplyUrl;
}]]></code>
</method>
</methods>
</class>
</classes>
<module_designs>
<module_design id="itop-portal" xsi:type="portal">
<bricks>
<brick id="approvals" xsi:type="Combodo\iTop\Portal\Brick\ApprovalBrick" _delta="define">
<!-- TODO: restreindre les droits de visibilité à cette brique -->
<active>true</active>
<rank>
<default>60</default>
</rank>
<width>12</width>
<title>
<default>Approval:Portal:Menu</default>
</title>
<description>Approval:Portal:Menu+</description>
<decoration_class>
<default>fa fa-check-circle fa-2x</default>
</decoration_class>
<classes>
<!-- Class to be considered (inc. derived classes) -->
<class id="UserRequest">
<fields>
<field id="title"/>
<field id="start_date"/>
<field id="status"/>
<field id="service_id"/>
<field id="servicesubcategory_id"/>
<field id="priority"/>
<field id="caller_id"/>
</fields>
</class>
</classes>
<!-- TODO: get rid of this? -->
<data_loading>full</data_loading>
</brick>
</bricks>
</module_design>
</module_designs>
</itop_design>