diff --git a/lib/classes/task/period/archive.class.php b/lib/classes/task/period/archive.class.php index 768f15bdf7..2c73ceb7d7 100755 --- a/lib/classes/task/period/archive.class.php +++ b/lib/classes/task/period/archive.class.php @@ -178,7 +178,6 @@ class task_period_archive extends task_abstract .copy_spe.checked = copy_spe) ? "true" : "false" ?>;
- : + :

- +

-  :  +  :   

-  :  +  :   

  @@ -257,7 +255,6 @@ class task_period_archive extends task_abstract  
sbas_id); - $collection = collection::get_from_coll_id($databox, $cid); + $collection = collection::get_from_coll_id($databox, (int) $cid); $story = $this->createStory($collection, $path . '/' . $representationFileName, $path . '/' . $captionFileName); @@ -1557,7 +1554,7 @@ class task_period_archive extends task_abstract * * @param \collection $collection The destination collection * @param string $pathfile The file to archive - * @param string $captionFile The Phrasea XML caption file + * @param string $captionFile The Phrasea XML caption file (NULL if no caption file) * @param integer $grp_rid Add the record to a story * @param integer $force Force lazaret or record ; use \Alchemy\Phrasea\Border\Manager::FORCE_* constants * @return null @@ -1592,7 +1589,7 @@ class task_period_archive extends task_abstract $metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas()); - if (file_exists($captionFile)) { + if ($captionFile !== NULL && file_exists($captionFile)) { $caption = $this->readXMLForDatabox($metadatasStructure, $captionFile); $captionStatus = $this->parseStatusBit(simplexml_load_file($captionFile)); @@ -1602,7 +1599,6 @@ class task_period_archive extends task_abstract $metadatas = $this->mergeForDatabox($metadatasStructure, $metadatas, $caption); } - $file = new \Alchemy\Phrasea\Border\File($media, $collection); $file->addAttribute(new BorderAttribute\Status($status)); @@ -1774,9 +1770,13 @@ class task_period_archive extends task_abstract try { $databox = \databox::get_instance($this->sbas_id); - $collection = collection::get_from_coll_id($databox, $cid); + $collection = collection::get_from_coll_id($databox, (int) $cid); - $record = $this->createRecord($collection, $path . '/' . $file, $path . '/' . $captionFileName, $grp_rid); + if ($captionFileName === NULL) { + $record = $this->createRecord($collection, $path . '/' . $file, NULL, $grp_rid); + } else { + $record = $this->createRecord($collection, $path . '/' . $file, $path . '/' . $captionFileName, $grp_rid); + } $node->setAttribute('archived', '1');