@@ -194,7 +194,8 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
194
194
case self ::ACTOR_TYPE_PERSON :
195
195
case self ::ACTOR_TYPE_AUTHORS_SUPERVISOR :
196
196
$ user = new User ;
197
- $ users_id = plugin_formcreator_getFromDBByField ($ user , 'name ' , $ input ['actor_value ' ]);
197
+ $ field = $ idKey == 'id ' ? 'id ' : 'name ' ;
198
+ $ users_id = plugin_formcreator_getFromDBByField ($ user , $ field , $ input ['actor_value ' ]);
198
199
if ($ users_id === false ) {
199
200
throw new ImportFailureException (sprintf (__ ('Failed to find a user: %1$s ' ), $ input ['actor_value ' ]));
200
201
}
@@ -203,7 +204,8 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
203
204
204
205
case self ::ACTOR_TYPE_GROUP :
205
206
$ group = new Group ;
206
- $ groups_id = plugin_formcreator_getFromDBByField ($ group , 'completename ' , $ input ['actor_value ' ]);
207
+ $ field = $ idKey == 'id ' ? 'id ' : 'completename ' ;
208
+ $ groups_id = plugin_formcreator_getFromDBByField ($ group , $ field , $ input ['actor_value ' ]);
207
209
if ($ groups_id === false ) {
208
210
throw new ImportFailureException (sprintf (__ ('Failed to find a group: %1$s ' ), $ input ['actor_value ' ]));
209
211
}
@@ -212,7 +214,8 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
212
214
213
215
case self ::ACTOR_TYPE_SUPPLIER :
214
216
$ supplier = new Supplier ;
215
- $ suppliers_id = plugin_formcreator_getFromDBByField ($ supplier , 'name ' , $ input ['actor_value ' ]);
217
+ $ field = $ idKey == 'id ' ? 'id ' : 'name ' ;
218
+ $ suppliers_id = plugin_formcreator_getFromDBByField ($ supplier , $ field , $ input ['actor_value ' ]);
216
219
if ($ suppliers_id === false ) {
217
220
throw new ImportFailureException (sprintf (__ ('Failed to find a supplier: %1$s ' ), $ input ['actor_value ' ]));
218
221
}
0 commit comments