Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix identical status label in simplified dashboard #3455

Open
wants to merge 10 commits into
base: support/2.13.0
Choose a base branch
from
2 changes: 1 addition & 1 deletion inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static function getMenuContent() {
title="' . PluginFormcreatorIssue::getTypeName(Session::getPluralNumber()) . '"></i>';

$menu['links']['search'] = PluginFormcreatorFormList::getSearchURL(false);
$menu['links'][$validation_image] = PluginFormcreatorFormAnswer::getSearchURL(false).'?criteria[0][link]=AND&criteria[0][field]=8&criteria[0][searchtype]=equals&criteria[0][value]=' . PluginFormcreatorFormAnswer::STATUS_WAITING;
$menu['links'][$validation_image] = PluginFormcreatorFormAnswer::getSearchURL(false).'?criteria[0][link]=AND&criteria[0][field]=8&criteria[0][searchtype]=equals&criteria[0][value]=' . PluginFormcreatorFormAnswer::WAITING_APPROVAL;
$menu['links'][$import_image] = PluginFormcreatorForm::getFormURL(false)."?import_form=1";
$menu['links'][$requests_image] = PluginFormcreatorIssue::getSearchURL(false);
return $menu;
Expand Down
10 changes: 6 additions & 4 deletions inc/formanswer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class PluginFormcreatorFormAnswer extends CommonDBTM

// Values choosen to not conflict with status of ticket constants
// @see PluginFormcreatorIssue::getNewStatusArray
const WAITING_APPROVAL = 101;
const STATUS_WAITING = 101;
const STATUS_REFUSED = 102;
const STATUS_ACCEPTED = 103;
RomainLvr marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -75,9 +76,10 @@ class PluginFormcreatorFormAnswer extends CommonDBTM

public static function getStatuses() {
return [
self::STATUS_WAITING => __('Waiting', 'formcreator'),
self::STATUS_REFUSED => __('Refused', 'formcreator'),
self::STATUS_ACCEPTED => __('Accepted', 'formcreator'),
self::WAITING_APPROVAL => __('Waiting for approval'),
self::STATUS_WAITING => __('Waiting', 'formcreator'),
self::STATUS_REFUSED => __('Refused', 'formcreator'),
self::STATUS_ACCEPTED => __('Accepted', 'formcreator'),
];
}

Expand Down Expand Up @@ -1914,7 +1916,7 @@ public function getApprovers(array $crit = []): ?array {
}

/**
* Get users or groupe in charge of valdiation
* Get users or groupe in charge of validation
*
* @return array|null
*/
Expand Down
8 changes: 4 additions & 4 deletions inc/issue.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static function getSyncIssuesRequest() : AbstractQuery {
IF(`$ticketTable`.`status` IN ('" . CommonITILObject::SOLVED . "', '" . CommonITILObject::CLOSED . "'),
`$ticketTable`.`status`,
IF(`$ticketTable`.`global_validation` = '" . CommonITILValidation::WAITING . "',
'" . PluginFormcreatorFormAnswer::STATUS_WAITING . "',
'" . PluginFormcreatorFormAnswer::WAITING_APPROVAL . "',
'" . PluginFormcreatorFormAnswer::STATUS_REFUSED . "'
)
)
Expand Down Expand Up @@ -1134,7 +1134,7 @@ static function getNewStatusArray() {
}

static function getPendingStatusArray() {
return [Ticket::WAITING, PluginFormcreatorFormAnswer::STATUS_WAITING];
return [Ticket::WAITING, PluginFormcreatorFormAnswer::STATUS_APPROVAL];
RomainLvr marked this conversation as resolved.
Show resolved Hide resolved
}

static function getProcessStatusArray() {
Expand All @@ -1147,7 +1147,7 @@ static function getReopenableStatusArray() {

static function getAllStatusArray($withmetaforsearch = false) {
$ticket_status = Ticket::getAllStatusArray($withmetaforsearch);
$form_status = [PluginFormcreatorFormAnswer::STATUS_WAITING, PluginFormcreatorFormAnswer::STATUS_ACCEPTED, PluginFormcreatorFormAnswer::STATUS_REFUSED];
$form_status = [PluginFormcreatorFormAnswer::STATUS_APPROVAL, PluginFormcreatorFormAnswer::STATUS_ACCEPTED, PluginFormcreatorFormAnswer::STATUS_REFUSED];
RomainLvr marked this conversation as resolved.
Show resolved Hide resolved
$form_status = array_combine($form_status, $form_status);
$all_status = $ticket_status + $form_status;
return $all_status;
Expand Down Expand Up @@ -1189,7 +1189,7 @@ static function getValidateCriteria() {
return ['criteria' => [['link' => 'AND',
'field' => 4,
'searchtype' => 'equals',
'value' => PluginFormcreatorFormAnswer::STATUS_WAITING,
'value' => PluginFormcreatorFormAnswer::WAITING_APPROVAL,
],
],
'reset' => 'reset'];
Expand Down
2 changes: 1 addition & 1 deletion tests/3-unit/PluginFormcreatorCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public function providerGetTicketStatusForIssue() {
$ticket->fields['global_validation'] = \CommonITILValidation::WAITING;
$dataSet = [
'ticket' => $ticket,
'expected' => \PluginFormcreatorFormAnswer::STATUS_WAITING
'expected' => \PluginFormcreatorFormAnswer::WAITING_APPROVAL
];
yield $dataSet;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/3-unit/PluginFormcreatorFormAnswer.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function providerPrepareInputForAdd() {
'formcreator_validator' => $user::getType() . '_' . $user->getID(),
'users_id_validator' => $user->getID(),
'groups_id_validator' => 0,
'status' => $testedClassName::STATUS_WAITING,
'status' => $testedClassName::WAITING_APPROVAL,
'request_date' => $_SESSION['glpi_currenttime'],
'comment' => '',
],
Expand Down
4 changes: 2 additions & 2 deletions tests/3-unit/PluginFormcreatorIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public function providerGetsyncIssuesRequest_ticketUnderValidation() {
'items_id' => $ticket->getID(),
'display_id' => 't_' . $ticket->getID(),
'name' => $ticket->fields['name'],
'status' => PluginFormcreatorFormAnswer::STATUS_WAITING,
'status' => PluginFormcreatorFormAnswer::WAITING_APPROVAL,
'requester_id' => $ticket->fields['users_id_recipient'],
'date_creation' => $ticket->fields['date'],
'date_mod' => $ticket->fields['date_mod'],
Expand Down Expand Up @@ -422,7 +422,7 @@ public function providerGetsyncIssuesRequest_validatedTicket() {
'items_id' => $ticket2->getID(),
'display_id' => 't_' . $ticket2->getID(),
'name' => $ticket2->fields['name'],
'status' => PluginFormcreatorFormAnswer::STATUS_WAITING,
'status' => PluginFormcreatorFormAnswer::WAITING_APPROVAL,
'requester_id' => $ticket2->fields['users_id_recipient'],
'date_creation' => $ticket2->fields['date'],
'date_mod' => $ticket2->fields['date_mod'],
Expand Down
Loading