Skip to content

Commit c4f799b

Browse files
committed
fix(formanswer): requester can edit refused answer
1 parent 9146ea5 commit c4f799b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

inc/formanswer.class.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @license http://www.gnu.org/licenses/gpl.txt GPLv3+
2626
* @link https://github.com/pluginsGLPI/formcreator/
2727
* @link https://pluginsglpi.github.io/formcreator/
28-
* @link http://plugins.glpi-project.org/#/plugin/formcreatorp@
28+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
2929
* ---------------------------------------------------------------------
3030
*/
3131

@@ -616,6 +616,11 @@ public function showForm($ID, $options = []) {
616616

617617
// Edit mode for validator
618618
$editMode = !isset($options['edit']) ? false : ($options['edit'] != '0');
619+
// Can the current user edit the answers ?
620+
$canEdit = $this->fields['status'] == self::STATUS_REFUSED
621+
&& Session::getLoginUserID() == $this->fields['requester_id']
622+
|| $this->fields['status'] == self::STATUS_WAITING
623+
&& $this->canValidate() && $editMode;
619624

620625
// form title
621626
if (version_compare(GLPI_VERSION, '10.0.3') < 0) {
@@ -700,7 +705,7 @@ public function showForm($ID, $options = []) {
700705
}
701706
}
702707
}
703-
echo $question->getRenderedHtml($domain, $editMode, $this, $visibility[$question->getType()][$question->getID()]);
708+
echo $question->getRenderedHtml($domain, $canEdit, $this, $visibility[$question->getType()][$question->getID()]);
704709
$lastQuestion = $question;
705710
}
706711
echo '</div>';

0 commit comments

Comments
 (0)