diff --git a/inc/form.class.php b/inc/form.class.php index 6ac380221..54f93a90b 100644 --- a/inc/form.class.php +++ b/inc/form.class.php @@ -126,7 +126,7 @@ public static function getMenuContent() { title="' . PluginFormcreatorIssue::getTypeName(Session::getPluralNumber()) . '">'; $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::STATUS_APPROVAL; $menu['links'][$import_image] = PluginFormcreatorForm::getFormURL(false)."?import_form=1"; $menu['links'][$requests_image] = PluginFormcreatorIssue::getSearchURL(false); return $menu; diff --git a/inc/formanswer.class.php b/inc/formanswer.class.php index 9fcde93f4..cf98500dc 100644 --- a/inc/formanswer.class.php +++ b/inc/formanswer.class.php @@ -57,7 +57,8 @@ class PluginFormcreatorFormAnswer extends CommonDBTM // Values choosen to not conflict with status of ticket constants // @see PluginFormcreatorIssue::getNewStatusArray - const STATUS_WAITING = 101; + const STATUS_WAITING = 100; + const STATUS_APPROVAL = 101; const STATUS_REFUSED = 102; const STATUS_ACCEPTED = 103; @@ -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::STATUS_APPROVAL => __('Waiting for approval'), + self::STATUS_WAITING => __('Waiting', 'formcreator'), + self::STATUS_REFUSED => __('Refused', 'formcreator'), + self::STATUS_ACCEPTED => __('Accepted', 'formcreator'), ]; } @@ -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 */ diff --git a/inc/issue.class.php b/inc/issue.class.php index b1d6044f2..fa1e49ff7 100644 --- a/inc/issue.class.php +++ b/inc/issue.class.php @@ -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::STATUS_APPROVAL . "', '" . PluginFormcreatorFormAnswer::STATUS_REFUSED . "' ) ) @@ -1134,7 +1134,7 @@ static function getNewStatusArray() { } static function getPendingStatusArray() { - return [Ticket::WAITING, PluginFormcreatorFormAnswer::STATUS_WAITING]; + return [Ticket::WAITING, PluginFormcreatorFormAnswer::STATUS_APPROVAL]; } static function getProcessStatusArray() { @@ -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_WAITING, PluginFormcreatorFormAnswer::STATUS_ACCEPTED, PluginFormcreatorFormAnswer::STATUS_REFUSED]; $form_status = array_combine($form_status, $form_status); $all_status = $ticket_status + $form_status; return $all_status; @@ -1189,7 +1189,7 @@ static function getValidateCriteria() { return ['criteria' => [['link' => 'AND', 'field' => 4, 'searchtype' => 'equals', - 'value' => PluginFormcreatorFormAnswer::STATUS_WAITING, + 'value' => PluginFormcreatorFormAnswer::STATUS_APPROVAL, ], ], 'reset' => 'reset']; diff --git a/tests/3-unit/PluginFormcreatorCommon.php b/tests/3-unit/PluginFormcreatorCommon.php index 7ac5daeb5..f204b1215 100644 --- a/tests/3-unit/PluginFormcreatorCommon.php +++ b/tests/3-unit/PluginFormcreatorCommon.php @@ -295,7 +295,7 @@ public function providerGetTicketStatusForIssue() { $ticket->fields['global_validation'] = \CommonITILValidation::WAITING; $dataSet = [ 'ticket' => $ticket, - 'expected' => \PluginFormcreatorFormAnswer::STATUS_WAITING + 'expected' => \PluginFormcreatorFormAnswer::STATUS_APPROVAL ]; yield $dataSet; } diff --git a/tests/3-unit/PluginFormcreatorFormAnswer.php b/tests/3-unit/PluginFormcreatorFormAnswer.php index 3c39942c2..03b8f4e53 100644 --- a/tests/3-unit/PluginFormcreatorFormAnswer.php +++ b/tests/3-unit/PluginFormcreatorFormAnswer.php @@ -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::STATUS_APPROVAL, 'request_date' => $_SESSION['glpi_currenttime'], 'comment' => '', ], diff --git a/tests/3-unit/PluginFormcreatorIssue.php b/tests/3-unit/PluginFormcreatorIssue.php index 075657513..0e9cd07ed 100644 --- a/tests/3-unit/PluginFormcreatorIssue.php +++ b/tests/3-unit/PluginFormcreatorIssue.php @@ -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::STATUS_APPROVAL, 'requester_id' => $ticket->fields['users_id_recipient'], 'date_creation' => $ticket->fields['date'], 'date_mod' => $ticket->fields['date_mod'], @@ -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::STATUS_APPROVAL, 'requester_id' => $ticket2->fields['users_id_recipient'], 'date_creation' => $ticket2->fields['date'], 'date_mod' => $ticket2->fields['date_mod'],