From c4f799b2c64b52a8e5bac3f923a2719ce732c97e Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Mon, 2 Oct 2023 14:24:44 +0200 Subject: [PATCH] fix(formanswer): requester can edit refused answer --- inc/formanswer.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/inc/formanswer.class.php b/inc/formanswer.class.php index fbbf1c07c..eae0edaf4 100644 --- a/inc/formanswer.class.php +++ b/inc/formanswer.class.php @@ -25,7 +25,7 @@ * @license http://www.gnu.org/licenses/gpl.txt GPLv3+ * @link https://github.com/pluginsGLPI/formcreator/ * @link https://pluginsglpi.github.io/formcreator/ - * @link http://plugins.glpi-project.org/#/plugin/formcreatorp@ + * @link http://plugins.glpi-project.org/#/plugin/formcreator * --------------------------------------------------------------------- */ @@ -616,6 +616,11 @@ public function showForm($ID, $options = []) { // Edit mode for validator $editMode = !isset($options['edit']) ? false : ($options['edit'] != '0'); + // 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_WAITING + && $this->canValidate() && $editMode; // form title if (version_compare(GLPI_VERSION, '10.0.3') < 0) { @@ -700,7 +705,7 @@ public function showForm($ID, $options = []) { } } } - echo $question->getRenderedHtml($domain, $editMode, $this, $visibility[$question->getType()][$question->getID()]); + echo $question->getRenderedHtml($domain, $canEdit, $this, $visibility[$question->getType()][$question->getID()]); $lastQuestion = $question; } echo '';