@@ -758,7 +758,6 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
758758 $ table_cat = getTableForItemType ('PluginFormcreatorCategory ' );
759759 $ table_form = getTableForItemType ('PluginFormcreatorForm ' );
760760 $ table_fp = getTableForItemType ('PluginFormcreatorForm_Profile ' );
761- $ table_target = getTableForItemType ('PluginFormcreatorTargets ' );
762761 $ table_section = getTableForItemType ('PluginFormcreatorSections ' );
763762 $ table_question = getTableForItemType ('PluginFormcreatorQuestions ' );
764763
@@ -769,8 +768,8 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
769768 'AND ' => [
770769 "$ table_form.is_active " => '1 ' ,
771770 "$ table_form.is_deleted " => '0 ' ,
772- "$ table_form.language " => [$ _SESSION ['glpilanguage ' ], '0 ' , null ],
773- ] + $ dbUtils ->getEntitiesRestrictCriteria ($ table_form , '' , '' , true , false ),
771+ "$ table_form.language " => [$ _SESSION ['glpilanguage ' ], '0 ' , '' , null ],
772+ ] + $ dbUtils ->getEntitiesRestrictCriteria ($ table_form , '' , '' , true , false )
774773 ];
775774 if ($ helpdeskHome ) {
776775 $ where_form ['AND ' ]["$ table_form.helpdesk_home " ] = '1 ' ;
@@ -779,7 +778,7 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
779778 $ selectedCategories = [];
780779 if ($ rootCategory != 0 ) {
781780 $ selectedCategories = getSonsOf ($ table_cat , $ rootCategory );
782- $ where_form ['AND ' ]["$ table_form.plugin_formcreator_categories_id " ] = [ $ selectedCategories] ;
781+ $ where_form ['AND ' ]["$ table_form.plugin_formcreator_categories_id " ] = $ selectedCategories ;
783782 }
784783
785784 // Find forms accessible by the current user
@@ -807,13 +806,9 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
807806 $ where_form ['AND ' ][] = [
808807 'OR ' => [
809808 'access_rights ' => ['!= ' , PluginFormcreatorForm::ACCESS_RESTRICTED ],
810- "$ table_form.id " => new QuerySubQuery ([
811- 'SELECT ' => 'plugin_formcreator_forms_id ' ,
812- 'FROM ' => $ table_fp ,
813- 'WHERE ' => [
814- 'profiles_id ' => $ _SESSION ['glpiactiveprofile ' ]['id ' ]
815- ]
816- ])
809+ [
810+ "$ table_fp.profiles_id " => $ _SESSION ['glpiactiveprofile ' ]['id ' ]
811+ ]
817812 ]
818813 ];
819814
@@ -829,12 +824,6 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
829824 $ table_form => PluginFormcreatorCategory::getForeignKeyField (),
830825 ]
831826 ],
832- $ table_target => [
833- 'FKEY ' => [
834- $ table_target => PluginFormcreatorForm::getForeignKeyField (),
835- $ table_form => 'id ' ,
836- ]
837- ],
838827 $ table_section => [
839828 'FKEY ' => [
840829 $ table_section => PluginFormcreatorForm::getForeignKeyField (),
@@ -846,11 +835,16 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
846835 $ table_question => PluginFormcreatorSection::getForeignKeyField (),
847836 $ table_section => 'id '
848837 ]
838+ ],
839+ $ table_fp => [
840+ 'FKEY ' => [
841+ $ table_fp => PluginFormcreatorForm::getForeignKeyField (),
842+ $ table_form => 'id ' ,
843+ ]
849844 ]
850845 ],
851846 'WHERE ' => $ where_form ,
852847 'GROUPBY ' => [
853- "$ table_target.plugin_formcreator_forms_id " ,
854848 "$ table_form.id " ,
855849 "$ table_form.name " ,
856850 "$ table_form.description " ,
@@ -864,7 +858,6 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
864858
865859 $ formList = [];
866860 if ($ result_forms ->count () > 0 ) {
867- // while ($form = $DB->fetch_array($result_forms)) {
868861 foreach ($ result_forms as $ form ) {
869862 $ formList [] = [
870863 'id ' => $ form ['id ' ],
@@ -933,7 +926,8 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
933926 'AND ' => [
934927 "$ table_form.is_active " => '1 ' ,
935928 "$ table_form.is_deleted " => '0 ' ,
936- "$ table_form.language " => [$ _SESSION ['glpilanguage ' ], '0 ' , null ],
929+ "$ table_form.language " => [$ _SESSION ['glpilanguage ' ], '0 ' , '' , null ],
930+ "$ table_form.is_default " => ['<> ' , '0 ' ]
937931 ] + $ dbUtils ->getEntitiesRestrictCriteria ($ table_form , '' , '' , true , false ),
938932 ];
939933 $ where_form ['AND ' ][] = [
0 commit comments