Skip to content

Commit 4cdb8d8

Browse files
committed
fix(form): where criteria outside where clause
1 parent b807974 commit 4cdb8d8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

inc/form.class.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -713,62 +713,62 @@ public static function getFormList(int $rootCategory = 0, string $keywords = '',
713713

714714
$order = "$table_form.name ASC";
715715

716-
$where_form = self::getFormListQuery();
717-
$where_form['SELECT'] = [
716+
$formList = self::getFormListQuery();
717+
$formList['SELECT'] = [
718718
$table_form => ['id', 'name', 'icon', 'icon_color', 'background_color', 'description', 'usage_count', 'is_default'],
719719
];
720-
$where_form['LEFT JOIN'][$table_cat] = [
720+
$formList['LEFT JOIN'][$table_cat] = [
721721
'FKEY' => [
722722
$table_cat => 'id',
723723
$table_form => $categoryFk,
724724
]
725725
];
726-
$where_form['LEFT JOIN'][$table_section] = [
726+
$formList['LEFT JOIN'][$table_section] = [
727727
'FKEY' => [
728728
$table_section => PluginFormcreatorForm::getForeignKeyField(),
729729
$table_form => 'id',
730730
]
731731
];
732-
$where_form['LEFT JOIN'][$table_question] = [
732+
$formList['LEFT JOIN'][$table_question] = [
733733
'FKEY' => [
734734
$table_question => PluginFormcreatorSection::getForeignKeyField(),
735735
$table_section => 'id'
736736
]
737737
];
738738
if ($helpdeskHome) {
739-
$where_form['WHERE']['AND']["$table_form.helpdesk_home"] = '1';
739+
$formList['WHERE']['AND']["$table_form.helpdesk_home"] = '1';
740740
}
741741

742742
$selectedCategories = [];
743743
if ($rootCategory != 0) {
744744
// The user choosed a category
745745
$selectedCategories = getSonsOf($table_cat, $rootCategory);
746-
$where_form['WHERE']['AND']["$table_form.$categoryFk"] = $selectedCategories;
746+
$formList['WHERE']['AND']["$table_form.$categoryFk"] = $selectedCategories;
747747
} else {
748748
// Searching for all forms without category restriction
749749
$onlyDefault = PluginFormcreatorEntityconfig::getUsedConfig('default_form_list_mode', Session::getActiveEntity());
750750
if ($onlyDefault == PluginFormcreatorEntityconfig::CONFIG_DEFAULT_FORM_LIST_DEFAULT) {
751-
$where_form['WHERE']['AND']['is_default'] = 1;
751+
$formList['WHERE']['AND']['is_default'] = 1;
752752
}
753753
}
754754

755-
$where_form['GROUPBY'] = [
755+
$formList['GROUPBY'] = [
756756
"$table_form.id",
757757
"$table_form.name",
758758
"$table_form.description",
759759
"$table_form.usage_count",
760760
"$table_form.is_default"
761761
];
762762

763-
$where_form['ORDER'] = [
763+
$formList['ORDER'] = [
764764
$order
765765
];
766766

767767
// Find forms accessible by the current user
768768
$keywords = trim($keywords);
769769
if (!empty($keywords)) {
770770
$keywordsWithWilcards = $DB->escape(PluginFormcreatorCommon::prepareBooleanKeywords($keywords));
771-
$where_form['WHERE']['AND'][] = [
771+
$formList['WHERE']['AND'][] = [
772772
'OR' => [
773773
new QueryExpression("MATCH($table_form.`name`, $table_form.`description`)
774774
AGAINST('$keywordsWithWilcards' IN BOOLEAN MODE)"),
@@ -778,7 +778,7 @@ public static function getFormList(int $rootCategory = 0, string $keywords = '',
778778
];
779779
}
780780

781-
$result_forms = $DB->request($where_form);
781+
$result_forms = $DB->request($formList);
782782

783783
$formList = [];
784784
foreach ($result_forms as $form) {

0 commit comments

Comments
 (0)