mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Add consistency check on caption field values
This commit is contained in:
@@ -309,13 +309,18 @@ class caption_Field_Value
|
||||
);
|
||||
|
||||
$all_datas = array();
|
||||
foreach ($this->record->get_caption()->get_fields() as $field)
|
||||
|
||||
foreach ($this->record->get_caption()->get_fields(null, true) as $field)
|
||||
{
|
||||
if (!$field->is_indexable())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$all_datas[] = $field->get_serialized_values();
|
||||
}
|
||||
$all_datas = implode(' ', $all_datas);
|
||||
|
||||
$all_datas = implode(' ', $all_datas);
|
||||
|
||||
$sphinx_rt->replace_in_documents(
|
||||
"docs_realtime" . $sbas_crc, //$this->id,
|
||||
@@ -335,6 +340,35 @@ class caption_Field_Value
|
||||
{
|
||||
$connbas = $databox_field->get_connection();
|
||||
|
||||
/**
|
||||
* Check consistency
|
||||
*/
|
||||
if (!$databox_field->is_multi())
|
||||
{
|
||||
try
|
||||
{
|
||||
$field = $record->get_caption()->get_field($databox_field->get_name());
|
||||
$caption_field_value = array_pop($field->get_values());
|
||||
/* @var $value \caption_Field_Value */
|
||||
$caption_field_value->set_value($value);
|
||||
|
||||
if (!$vocabulary || !$vocabularyId)
|
||||
{
|
||||
$caption_field_value->removeVocabulary();
|
||||
}
|
||||
else
|
||||
{
|
||||
$caption_field_value->setVocab($vocabulary, $vocabularyId);
|
||||
}
|
||||
|
||||
return $caption_field_value;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$sql_ins = 'INSERT INTO metadatas
|
||||
(id, record_id, meta_struct_id, value, VocabularyType, VocabularyId)
|
||||
VALUES
|
||||
|
Reference in New Issue
Block a user