@@ -194,7 +194,8 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
194194 case self ::ACTOR_TYPE_PERSON :
195195 case self ::ACTOR_TYPE_AUTHORS_SUPERVISOR :
196196 $ 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 ' ]);
198199 if ($ users_id === false ) {
199200 throw new ImportFailureException (sprintf (__ ('Failed to find a user: %1$s ' ), $ input ['actor_value ' ]));
200201 }
@@ -203,7 +204,8 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
203204
204205 case self ::ACTOR_TYPE_GROUP :
205206 $ 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 ' ]);
207209 if ($ groups_id === false ) {
208210 throw new ImportFailureException (sprintf (__ ('Failed to find a group: %1$s ' ), $ input ['actor_value ' ]));
209211 }
@@ -212,7 +214,8 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
212214
213215 case self ::ACTOR_TYPE_SUPPLIER :
214216 $ 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 ' ]);
216219 if ($ suppliers_id === false ) {
217220 throw new ImportFailureException (sprintf (__ ('Failed to find a supplier: %1$s ' ), $ input ['actor_value ' ]));
218221 }
0 commit comments