diff --git a/lib/Alchemy/Phrasea/Border/Manager.php b/lib/Alchemy/Phrasea/Border/Manager.php index 96b3d6cf72..3a882c1639 100644 --- a/lib/Alchemy/Phrasea/Border/Manager.php +++ b/lib/Alchemy/Phrasea/Border/Manager.php @@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Border; use Alchemy\Phrasea\Border\Checker\CheckerInterface; use Alchemy\Phrasea\Border\Attribute\AttributeInterface; +use Alchemy\Phrasea\Media\Subdef\OptionType\Boolean; use Alchemy\Phrasea\Metadata\Tag\TfArchivedate; use Alchemy\Phrasea\Metadata\Tag\TfQuarantine; use Alchemy\Phrasea\Metadata\Tag\TfBasename; @@ -79,7 +80,7 @@ class Manager * @param type $forceBehavior Force a behavior, one of the self::FORCE_* constant * @return int One of the self::RECORD_CREATED or self::LAZARET_CREATED constants */ - public function process(LazaretSession $session, File $file, $callable = null, $forceBehavior = null) + public function process(LazaretSession $session, File $file, $callable = null, $forceBehavior = null, $nosubdef = false) { $visa = $this->getVisa($file); @@ -92,7 +93,7 @@ class Manager $this->addMediaAttributes($file); - $element = $this->createRecord($file); + $element = $this->createRecord($file, $nosubdef); $code = self::RECORD_CREATED; } else { @@ -228,10 +229,9 @@ class Manager * @param File $file The package file * @return \record_adater */ - protected function createRecord(File $file) + protected function createRecord(File $file, $nosubdef=false) { $element = \record_adapter::createFromFile($file, $this->app); - $date = new \DateTime(); $file->addAttribute( @@ -302,7 +302,9 @@ class Manager $this->app['phraseanet.metadata-setter']->replaceMetadata($newMetadata, $element); - $element->rebuild_subdefs(); + if(!$nosubdef) { + $element->rebuild_subdefs(); + } $element->reindex(); return $element; diff --git a/lib/classes/API/V1/adapter.php b/lib/classes/API/V1/adapter.php index 8cfe79cebb..71200a6cbf 100644 --- a/lib/classes/API/V1/adapter.php +++ b/lib/classes/API/V1/adapter.php @@ -494,8 +494,7 @@ class API_V1_adapter extends API_V1_Abstract throw new API_V1_exception_badrequest(sprintf('Invalid forceBehavior value `%s`', $request->get('forceBehavior'))); break; } - - $app['border-manager']->process($session, $Package, $callback, $behavior); + $app['border-manager']->process($session, $Package, $callback, $behavior, $request->get('nosubdef')===''); $ret = array( 'entity' => null, diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index f09ea74323..3579b1c96f 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -1412,7 +1412,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface $record->delete_data_from_cache(\record_adapter::CACHE_SUBDEFS); $record->insertTechnicalDatas($app['mediavorus']); - $record->rebuild_subdefs(); return $record; }