Skip to content

Commit

Permalink
fix(formanswer): requester can edit refused answer
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Oct 10, 2023
1 parent 9146ea5 commit c4f799b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions inc/formanswer.class.php
Expand Up @@ -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
* ---------------------------------------------------------------------
*/

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 '</div>';
Expand Down

0 comments on commit c4f799b

Please sign in to comment.