Skip to content

Commit 6e9007a

Browse files
authored
implement approval tile search criteria
1 parent 2602a00 commit 6e9007a

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

src/Glpi/Helpdesk/Tile/GlpiPageTile.php

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
namespace Glpi\Helpdesk\Tile;
3636

3737
use CommonDBTM;
38+
use CommonITILValidation;
3839
use Glpi\Helpdesk\HelpdeskTranslation;
3940
use Glpi\ItemTranslation\Context\ProvideTranslationsInterface;
4041
use Glpi\ItemTranslation\Context\TranslationHandler;
@@ -46,6 +47,7 @@
4647
use Session;
4748
use Ticket;
4849
use TicketValidation;
50+
use Toolbox;
4951

5052
final class GlpiPageTile extends CommonDBTM implements TileInterface, ProvideTranslationsInterface
5153
{
@@ -116,12 +118,61 @@ public function getIllustration(): string
116118
#[Override]
117119
public function getTileUrl(): string
118120
{
121+
$approval_criteria = [
122+
'criteria' => [
123+
[
124+
'field' => 55, // Validation status
125+
'searchtype' => 'equals',
126+
'value' => CommonITILValidation::WAITING,
127+
'link' => 'AND',
128+
],
129+
[
130+
'link' => 'AND',
131+
'criteria' => [
132+
[
133+
'field' => 59, // approver user
134+
'searchtype' => 'equals',
135+
'value' => 'myself',
136+
],
137+
[
138+
'field' => 195, // approver user substitute
139+
'searchtype' => 'equals',
140+
'value' => 'myself',
141+
'link' => 'OR',
142+
],
143+
[
144+
'field' => 196, // approver group
145+
'searchtype' => 'equals',
146+
'value' => 'mygroups',
147+
'link' => 'OR',
148+
],
149+
[
150+
'field' => 197, // approver group substitute
151+
'searchtype' => 'equals',
152+
'value' => 'myself',
153+
'link' => 'OR',
154+
],
155+
],
156+
],
157+
[
158+
'field' => 12, // Status
159+
'searchtype' => 'equals',
160+
'value' => 'notold',
161+
'link' => 'AND',
162+
],
163+
[
164+
'field' => 52, // global validation status
165+
'searchtype' => 'notequals',
166+
'value' => CommonITILValidation::WAITING,
167+
'link' => 'AND',
168+
],
169+
],
170+
];
119171
$url = match ($this->fields['page']) {
120172
self::PAGE_SERVICE_CATALOG => '/ServiceCatalog',
121173
self::PAGE_FAQ => '/front/helpdesk.faq.php',
122174
self::PAGE_RESERVATION => '/front/reservationitem.php',
123-
// TODO: apply correct search filter
124-
self::PAGE_APPROVAL => '/front/ticket.php',
175+
self::PAGE_APPROVAL => '/front/ticket.php?' . Toolbox::append_params($approval_criteria),
125176
self::PAGE_ALL_TICKETS => '/front/ticket.php?is_deleted=0&criteria[0][link]=AND&criteria[0][field]=12&criteria[0][searchtype]=equals&criteria[0][value]=all',
126177
default => '/Helpdesk',
127178
};

0 commit comments

Comments
 (0)