test if metadatum is multiple

This commit is contained in:
vnmedeiros 2020-04-21 21:56:34 -03:00
parent 1eef991d0f
commit 74c45fea15
1 changed files with 2 additions and 2 deletions

View File

@ -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);