From 74c45fea15b9d03bfc260badd6a90700c0491cc5 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Tue, 21 Apr 2020 21:56:34 -0300 Subject: [PATCH] test if metadatum is multiple --- .../class-tainacan-bulk-edit-process.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php b/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php index f5a34aefa..710e5e3bd 100644 --- a/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php +++ b/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php @@ -313,11 +313,11 @@ class Bulk_Edit_Process extends Generic_Process { $metadatum_id_copy_from = $this->bulk_edit_data['metadatum_id_copy_from']; if ($metadatum_id_copy_from == 'create_by' && $metadatum->get_metadata_type() == 'Tainacan\Metadata_Types\User') { - $item_metadata->set_value( $item->get_author_id() ); + $item_metadata->set_value( $metadatum->is_multiple() ? [$item->get_author_id()] : $item->get_author_id() ); return $this->save_item_metadata($item_metadata, $item); } else { $metadatum_copy_from = $this->metadatum_repository->fetch($metadatum_id_copy_from); - if ( $metadatum_copy_from->get_metadata_type() == $metadatum->get_metadata_type() ) { + if ( $metadatum_copy_from->get_metadata_type() == $metadatum->get_metadata_type() && $metadatum_copy_from->is_multiple() == $metadatum->is_multiple()) { $item_metadata_copy_from = new Entities\Item_Metadata_Entity( $item, $metadatum_copy_from ); $item_metadata->set_value($item_metadata_copy_from->get_value()); return $this->save_item_metadata($item_metadata, $item);