Skip to content

Commit 3efc9cd

Browse files
committed
fix(target_actor): duplication requires export of ID, not name
1 parent e468aa3 commit 3efc9cd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

inc/target_actor.class.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,20 +285,23 @@ public function export(bool $remove_uuid = false) : array {
285285
case self::ACTOR_TYPE_PERSON:
286286
case self::ACTOR_TYPE_AUTHORS_SUPERVISOR:
287287
$user = new User;
288+
$field = $idToRemove == 'uuid' ? 'id' : 'completename';
288289
if ($user->getFromDB($target_actor['actor_value'])) {
289-
$target_actor['actor_value'] = $user->fields['name'];
290+
$target_actor['actor_value'] = $user->fields[$field];
290291
}
291292
break;
292293
case self::ACTOR_TYPE_GROUP:
293294
$group = new Group;
295+
$field = $idToRemove == 'uuid' ? 'id' : 'completename';
294296
if ($group->getFromDB($target_actor['actor_value'])) {
295-
$target_actor['actor_value'] = $group->fields['completename'];
297+
$target_actor['actor_value'] = $group->fields[$field];
296298
}
297299
break;
298300
case self::ACTOR_TYPE_SUPPLIER:
299301
$supplier = new Supplier;
302+
$field = $idToRemove == 'uuid' ? 'id' : 'completename';
300303
if ($supplier->getFromDB($target_actor['actor_value'])) {
301-
$target_actor['actor_value'] = $supplier->fields['name'];
304+
$target_actor['actor_value'] = $supplier->fields[$field];
302305
}
303306
break;
304307
}

0 commit comments

Comments
 (0)