mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge pull request #1905 from jygaulier/PHRAS-1161_Backport-PHRAS_1100
PHRAS-1161_Backport-PHRAS_1100
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\Border;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use databox_field;
|
||||
|
||||
/**
|
||||
* MetaFieldsBad is a collection of MetaField attributes indexed by field names.
|
||||
@@ -28,11 +29,13 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
|
||||
$metas = [];
|
||||
$unicode = new \unicode();
|
||||
|
||||
/** @var databox_field $databox_field */
|
||||
foreach ($metadatasStructure as $databox_field) {
|
||||
if ($this->containsKey($databox_field->get_name())) {
|
||||
$field_name = $databox_field->get_name();
|
||||
if ($this->containsKey($field_name)) {
|
||||
if ($databox_field->is_multi()) {
|
||||
|
||||
$values = $this->get($databox_field->get_name())->getValue();
|
||||
$values = $this->get($field_name)->getValue();
|
||||
|
||||
$tmp = [];
|
||||
|
||||
@@ -60,7 +63,7 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
|
||||
}
|
||||
} else {
|
||||
|
||||
$values = $this->get($databox_field->get_name())->getValue();
|
||||
$values = $this->get($field_name)->getValue();
|
||||
$value = array_shift($values);
|
||||
|
||||
$value = $unicode->substituteCtrlCharacters($value, ' ');
|
||||
|
@@ -12,6 +12,7 @@ namespace Alchemy\Phrasea\Model\Manipulator;
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Border;
|
||||
use Alchemy\Phrasea\Border\Attribute\AttributeInterface;
|
||||
use Alchemy\Phrasea\Border\Attribute\MetaField;
|
||||
use Alchemy\Phrasea\Model\Entities\LazaretFile;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
@@ -146,7 +147,16 @@ class LazaretManipulator
|
||||
$this->app,
|
||||
$lazaretFile->getOriginalName()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// the file is not in tmp anymore ?
|
||||
// delete the quarantine item
|
||||
$this->denyLazaretFile($lazaretFile);
|
||||
$ret['message'] = $this->app->trans('File is not present in quarantine anymore, please refresh');
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
try {
|
||||
//Post record creation
|
||||
/** @var \record_adapter $record */
|
||||
$record = null;
|
||||
@@ -186,7 +196,7 @@ class LazaretManipulator
|
||||
case AttributeInterface::NAME_METADATA:
|
||||
/** @var Metadata $value */
|
||||
$value = $attribute->getValue();
|
||||
$metadataBag->set($value->getTag()->getTagname(), new Metadata($value->getTag(), $value->getValue()));
|
||||
$metadataBag->set($value->getTag()->getTagname(), $value);
|
||||
break;
|
||||
case AttributeInterface::NAME_STORY:
|
||||
/** @var \record_adapter $value */
|
||||
@@ -197,8 +207,8 @@ class LazaretManipulator
|
||||
$record->setStatus($attribute->getValue());
|
||||
break;
|
||||
case AttributeInterface::NAME_METAFIELD:
|
||||
/** @var Border\Attribute\MetaField $attribute */
|
||||
$metaFields->set($attribute->getField()->get_name(), $attribute->getValue());
|
||||
/** @var MetaField $attribute */
|
||||
$metaFields->set($attribute->getField()->get_name(), $attribute);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -1401,8 +1401,8 @@ class ArchiveJob extends AbstractJob
|
||||
|
||||
$metadataBag = new MetaFieldsBag();
|
||||
|
||||
foreach ($sxcaption->description->children() as $tagname => $field) {
|
||||
$field = trim($field);
|
||||
foreach ($sxcaption->description->children() as $tagname => $value) {
|
||||
$value = trim($value);
|
||||
|
||||
$meta = $metadatasStructure->get_element_by_name(trim($tagname));
|
||||
if (!$meta) {
|
||||
@@ -1410,7 +1410,7 @@ class ArchiveJob extends AbstractJob
|
||||
}
|
||||
|
||||
if ($meta->is_multi()) {
|
||||
$fields = \caption_field::get_multi_values($field, $meta->get_separator());
|
||||
$fields = \caption_field::get_multi_values($value, $meta->get_separator());
|
||||
|
||||
if (!$metadataBag->containsKey($meta->get_name())) {
|
||||
$values = $fields;
|
||||
@@ -1420,7 +1420,7 @@ class ArchiveJob extends AbstractJob
|
||||
|
||||
$metadataBag->set($meta->get_name(), new BorderAttribute\MetaField($meta, $values));
|
||||
} else {
|
||||
$metadataBag->set($meta->get_name(), new BorderAttribute\MetaField($meta, [$field]));
|
||||
$metadataBag->set($meta->get_name(), new BorderAttribute\MetaField($meta, [$value]));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user