Skip to content

Commit

Permalink
fix(targetticket): SQL exception, refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Nov 18, 2021
1 parent cd7a232 commit 2af9d34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions inc/question.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,9 @@ public function getQuestionsFromFormBySection($formId, $crit = []) {
* @return string|int HTML output or random id
*/
public static function dropdownForForm($formId, $crit, $name, $value = null, $options = []) {
if (isset($crit['used']) && count($crit['used']) == 0) {
unset($crit['used']);
}
$question = new self();
$items = $question->getQuestionsFromFormBySection($formId, $crit);
$options = $options + [
Expand Down
3 changes: 2 additions & 1 deletion inc/targetticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,13 @@ protected function showCompositeTicketSettings($rand) {

// dropdown of questions of type GLPI Object / Ticket
echo '<span id="plugin_formcreator_link_question" style="display: none">';
PluginFormcreatorQuestion::dropdownForForm(
echo PluginFormcreatorQuestion::dropdownForForm(
$this->getForm()->getID(),
[
'fieldtype' => ['glpiselect'],
'itemtype' => [Ticket::class],
'used' => $excludedQuestionIds,
'display' => false,
],
'_link_plugin_formcreator_questions_id',
null
Expand Down

0 comments on commit 2af9d34

Please sign in to comment.