mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Merge pull request #1001 from romainneutron/fix-1707
[Ready][3.8] Fix #1707 : Update technical informations and metadata fields on record substitution
This commit is contained in:
@@ -180,7 +180,7 @@ class caption_field implements cache_cacheableInterface
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
* @return \caption_Field_Value[]
|
||||
*/
|
||||
public function get_values()
|
||||
{
|
||||
|
@@ -254,7 +254,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
||||
*/
|
||||
public function get_field($fieldname)
|
||||
{
|
||||
foreach ($this->get_fields(null, true) as $meta_struct_id => $field) {
|
||||
foreach ($this->get_fields(null, true) as $field) {
|
||||
if ($field->get_name() == $fieldname) {
|
||||
return $field;
|
||||
}
|
||||
@@ -263,6 +263,17 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
||||
throw new \Exception('Field not found');
|
||||
}
|
||||
|
||||
public function has_field($fieldname)
|
||||
{
|
||||
foreach ($this->get_fields(null, true) as $field) {
|
||||
if ($field->get_name() == $fieldname) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $label
|
||||
|
@@ -1371,7 +1371,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
$sql = 'REPLACE INTO technical_datas (id, record_id, name, value)
|
||||
$sql = 'DELETE FROM technical_datas WHERE record_id = :record_id';
|
||||
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sql = 'INSERT INTO technical_datas (id, record_id, name, value)
|
||||
VALUES (null, :record_id, :name, :value)';
|
||||
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||
|
||||
|
Reference in New Issue
Block a user