Skip to content

Commit

Permalink
Fix failed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLvr authored Feb 9, 2024
1 parent df46fa6 commit 6c66fd6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions inc/formanswer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ public function showForm($ID, $options = []) {
// Can the current user edit the answers ?
$canEdit = $this->fields['status'] == self::STATUS_REFUSED
&& Session::getLoginUserID() == $this->fields['requester_id']
|| $this->fields['status'] == self::STATUS_APPROVAL
|| $this->fields['status'] == self::STATUS_WAITING
&& $this->canValidate() && $editMode;

// form title
Expand Down Expand Up @@ -729,7 +729,7 @@ public function showForm($ID, $options = []) {
echo '</div>';
echo '</div>';

} else if (($this->fields['status'] == self::STATUS_APPROVAL) && $this->canValidate()) {
} else if (($this->fields['status'] == self::STATUS_WAITING) && $this->canValidate()) {
// Display validation form
echo '<div class="form-group required line1">';
echo '<label for="comment">' . __('Comment', 'formcreator') . ' <span class="red">*</span></label>';
Expand Down Expand Up @@ -875,7 +875,7 @@ public function prepareInputForUpdate($input) {
}

$skipValidation = false;
$input['status'] = self::STATUS_APPROVAL;
$input['status'] = self::STATUS_WAITING;
if (isset($input['refuse_formanswer']) || isset($input['accept_formanswer'])) {
// The formanswer is being acepted or refused

Expand Down Expand Up @@ -1240,7 +1240,7 @@ public function post_addItem() {

// TODO: find a way to validate the answers
// It the form is not being validated, nothing gives the power to anyone to validate the answers
$formAnswer->updateStatus(self::STATUS_APPROVAL);
$formAnswer->updateStatus(self::STATUS_WAITING);
return;
}
}
Expand Down Expand Up @@ -1292,7 +1292,7 @@ public function post_updateItem($history = 1) {

// TODO: find a way to validate the answers
// If the form is not being validated, nothing gives the power to anyone to validate the answers
$this->updateStatus(self::STATUS_APPROVAL);
$this->updateStatus(self::STATUS_WAITING);
return;
}
}
Expand Down Expand Up @@ -1321,7 +1321,7 @@ public function post_purgeItem() {
);

// If the form was waiting for validation
if ($this->fields['status'] == self::STATUS_APPROVAL) {
if ($this->fields['status'] == self::STATUS_WAITING) {
// Notify the requester
NotificationEvent::raiseEvent('plugin_formcreator_deleted', $this);
}
Expand Down Expand Up @@ -1805,7 +1805,7 @@ protected function setValidator(array $input): array {
// The requester is the validator. No need to validate
break;
}
$input['status'] = self::STATUS_APPROVAL;
$input['status'] = self::STATUS_WAITING;
break;

case PluginFormcreatorForm::VALIDATION_GROUP:
Expand All @@ -1818,7 +1818,7 @@ protected function setValidator(array $input): array {
// The requester is a member of the validator group
break;
}
$input['status'] = self::STATUS_APPROVAL;
$input['status'] = self::STATUS_WAITING;
break;
}
}
Expand Down Expand Up @@ -1921,7 +1921,7 @@ public function getApprovers(array $crit = []): ?array {
* @return array|null
*/
public function getCurrentApprovers(): ?array {
if ($this->fields['status'] != self::STATUS_APPROVAL) {
if ($this->fields['status'] != self::STATUS_WAITING) {
return null;
}

Expand Down Expand Up @@ -2005,7 +2005,7 @@ public function getAggregatedStatus(): ?int {
continue;
}
$ticketStatus = PluginFormcreatorCommon::getTicketStatusForIssue($generatedTarget);
if ($ticketStatus >= PluginFormcreatorFormAnswer::STATUS_APPROVAL) {
if ($ticketStatus >= PluginFormcreatorFormAnswer::STATUS_WAITING) {
// Ignore tickets refused or pending for validation
// getTicketStatusForIssue() does not returns STATUS_ACCEPTED
continue;
Expand Down

0 comments on commit 6c66fd6

Please sign in to comment.