@@ -245,7 +245,7 @@ function plugin_formcreator_addDefaultWhere($itemtype) {
245245 $ issueSearchOptions = Search::getOptions ($ itemtype );
246246 $ complexJoinId = Search::computeComplexJoinID ($ issueSearchOptions [9 ]['joinparams ' ]);
247247 $ colname = $ issueSearchOptions [9 ]['linkfield ' ];
248- // $condition .= "`glpi_users_${ colname}_$complexJoinId`.`id` = '$currentUser'";
248+ // $condition .= "`glpi_users_{$ colname}_$complexJoinId`.`id` = '$currentUser'";
249249 $ condition .= "`glpi_users_ $ complexJoinId`.`id` = ' $ currentUser' " ;
250250
251251 // condition where current user is a member of a validator group of the issue
@@ -257,7 +257,7 @@ function plugin_formcreator_addDefaultWhere($itemtype) {
257257 $ groupList = implode ("', ' " , $ groupList );
258258 $ complexJoinId = Search::computeComplexJoinID ($ issueSearchOptions [16 ]['joinparams ' ]);
259259 $ colname = $ issueSearchOptions [16 ]['linkfield ' ];
260- // $condition .= " OR `glpi_groups_${ colname}_$complexJoinId`.`id` IN ('$groupList')";
260+ // $condition .= " OR `glpi_groups_{$ colname}_$complexJoinId`.`id` IN ('$groupList')";
261261 $ condition .= " OR `glpi_groups_ $ complexJoinId`.`id` IN (' $ groupList') " ;
262262 }
263263
@@ -328,11 +328,14 @@ function plugin_formcreator_addDefaultWhere($itemtype) {
328328
329329 $ groupIDs = [];
330330 foreach ($ groups as $ group ) {
331+ if ($ group ['id ' ] === null ) {
332+ continue ;
333+ }
331334 $ groupIDs [] = $ group ['id ' ];
332335 }
333336
334337 $ groupIDs = implode ("', ' " , $ groupIDs );
335- $ condition .= " OR ` $ formanswerValidationTable`.`itemtype` = ' $ groupType' AND ` $ formanswerValidationTable`.`items_id` IN (' $ groupList ') " ;
338+ $ condition .= " OR ` $ formanswerValidationTable`.`itemtype` = ' $ groupType' AND ` $ formanswerValidationTable`.`items_id` IN (' $ groupIDs ') " ;
336339 return "( $ condition) " ;
337340 break ;
338341 }
0 commit comments