mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
Fix tf-record_id
This commit is contained in:
@@ -60,8 +60,9 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
protected function retrieve_fields()
|
protected function retrieve_fields()
|
||||||
{
|
{
|
||||||
if (is_array($this->fields))
|
if (is_array($this->fields))
|
||||||
|
{
|
||||||
return $this->fields;
|
return $this->fields;
|
||||||
|
}
|
||||||
|
|
||||||
$fields = array();
|
$fields = array();
|
||||||
try
|
try
|
||||||
@@ -125,6 +126,23 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param type $fieldname
|
||||||
|
* @return \caption_field
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function get_field($fieldname)
|
||||||
|
{
|
||||||
|
foreach ($this->retrieve_fields() as $meta_struct_id => $field)
|
||||||
|
{
|
||||||
|
if ($field->get_name() == $fieldname)
|
||||||
|
return $field;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception('Field not found');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param type $label
|
* @param type $label
|
||||||
@@ -134,8 +152,10 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$fields = $this->retrieve_fields();
|
$fields = $this->retrieve_fields();
|
||||||
if (isset($this->dces_elements[$label]))
|
if (isset($this->dces_elements[$label]))
|
||||||
|
{
|
||||||
return $fields[$this->dces_elements[$label]];
|
return $fields[$this->dces_elements[$label]];
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -617,8 +617,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
throw new Exception_Media_SubdefNotFound ();
|
throw new Exception_Media_SubdefNotFound ();
|
||||||
|
|
||||||
if (isset($this->subdefs[$name]))
|
if (isset($this->subdefs[$name]))
|
||||||
|
{
|
||||||
return $this->subdefs[$name];
|
return $this->subdefs[$name];
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->subdefs)
|
if (!$this->subdefs)
|
||||||
$this->subdefs = array();
|
$this->subdefs = array();
|
||||||
@@ -757,12 +758,14 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
if ($data)
|
if ($data)
|
||||||
{
|
{
|
||||||
if (isset($this->technical_datas[$data]))
|
if (isset($this->technical_datas[$data]))
|
||||||
|
{
|
||||||
return $this->technical_datas[$data];
|
return $this->technical_datas[$data];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->technical_datas;
|
return $this->technical_datas;
|
||||||
}
|
}
|
||||||
@@ -846,17 +849,28 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$this->original_name = $original_name;
|
$this->original_name = $original_name;
|
||||||
|
|
||||||
foreach ($this->get_caption()->get_fields() as $field)
|
foreach ($this->get_databox()->get_meta_structure()->get_elements() as $data_field)
|
||||||
{
|
{
|
||||||
if ($field->get_databox_field()->get_source() != metadata_description_PHRASEANET_tffilename::get_source())
|
if ($data_field->get_metadata_source() != metadata_description_PHRASEANET_tffilename::get_source())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$meta_id = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$meta_id = $this->get_caption()->get_field($data_field->get_name())->get_meta_id();
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
$meta_id = null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->set_metadatas(
|
$this->set_metadatas(
|
||||||
array(
|
array(
|
||||||
'meta_struct_id' => $field->get_meta_struct_id()
|
'meta_struct_id' => $data_field->get_id()
|
||||||
, 'meta_id' => get_meta_id
|
, 'meta_id' => $meta_id
|
||||||
, 'value' => array($original_name)
|
, 'value' => array($original_name)
|
||||||
)
|
)
|
||||||
, true
|
, true
|
||||||
@@ -1226,7 +1240,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
foreach ($metadatas as $param)
|
foreach ($metadatas as $param)
|
||||||
{
|
{
|
||||||
if (!is_array($param))
|
if (!is_array($param))
|
||||||
throw new Exception_InvalidArgument();
|
{
|
||||||
|
throw new Exception_InvalidArgument('Invalid metadatas argument');
|
||||||
|
}
|
||||||
|
|
||||||
$db_field = \databox_field::get_instance($this->get_databox(), $param['meta_struct_id']);
|
$db_field = \databox_field::get_instance($this->get_databox(), $param['meta_struct_id']);
|
||||||
|
|
||||||
@@ -1358,7 +1374,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public function get_reg_name()
|
public function get_reg_name()
|
||||||
{
|
{
|
||||||
if (!$this->is_grouping())
|
if (!$this->is_grouping())
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$balisename = '';
|
$balisename = '';
|
||||||
@@ -1502,8 +1517,39 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
, ':value' => $value
|
, ':value' => $value
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
foreach ($record->get_databox()->get_meta_structure()->get_elements() as $data_field)
|
||||||
|
{
|
||||||
|
if ($data_field->get_metadata_source() != metadata_description_PHRASEANET_tfrecordid::get_source())
|
||||||
|
{
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$meta_id = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$meta_id = $record->get_caption()->get_field($data_field->get_name())->get_meta_id();
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
$meta_id = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$metas = array(
|
||||||
|
array(
|
||||||
|
'meta_struct_id' => $data_field->get_id()
|
||||||
|
, 'meta_id' => $meta_id
|
||||||
|
, 'value' => array($record->get_record_id())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$record->set_metadatas($metas, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $record;
|
return $record;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1555,7 +1601,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$hd = $this->get_subdef('document');
|
$hd = $this->get_subdef('document');
|
||||||
if ($hd->is_physically_present())
|
if ($hd->is_physically_present())
|
||||||
|
|
||||||
return new system_file(p4string::addEndSlash($hd->get_path()) . $hd->get_file());
|
return new system_file(p4string::addEndSlash($hd->get_path()) . $hd->get_file());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1894,7 +1939,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public function get_container_baskets()
|
public function get_container_baskets()
|
||||||
{
|
{
|
||||||
if ($this->container_basket)
|
if ($this->container_basket)
|
||||||
|
|
||||||
return $this->container_basket;
|
return $this->container_basket;
|
||||||
|
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
|
Reference in New Issue
Block a user