Add consistency check on caption field values

This commit is contained in:
Romain Neutron
2012-03-21 11:58:24 +01:00
parent 0ecb391e8d
commit a43d764f3d
5 changed files with 127 additions and 34 deletions

View File

@@ -104,6 +104,7 @@ class databox_field implements cache_cacheableInterface
*/
protected $Business;
protected $renamed = false;
protected $metaToMerge = false;
/**
*
@@ -378,6 +379,12 @@ class databox_field implements cache_cacheableInterface
$this->renamed = false;
}
if ($this->metaToMerge)
{
caption_field::merge_all_metadatas($this);
$this->metaToMerge = false;
}
$dom_struct = $this->databox->get_dom_structure();
$xp_struct = $this->databox->get_xpath_structure();
@@ -583,7 +590,14 @@ class databox_field implements cache_cacheableInterface
*/
public function set_multi($multi)
{
$this->multi = !!$multi;
$multi = !!$multi;
if($this->multi !== $multi && !$multi)
{
$this->metaToMerge = true;
}
$this->multi = $multi;
return $this;
}
@@ -651,35 +665,6 @@ class databox_field implements cache_cacheableInterface
return $this;
}
/**
*
* @param string $attr
* @return databox_field
*/
protected function set_reg_attr($attr)
{
try
{
$sql = 'UPDATE metadatas_structure SET reg' . $attr . ' = null';
$stmt = $this->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
$sql = 'UPDATE metadatas_structure SET reg' . $attr . '= 1 WHERE id= :id';
$stmt = $this->get_connection()->prepare($sql);
$stmt->execute(array(':id' => $this->id));
$stmt->closeCursor();
}
catch (Exception $e)
{
}
return $this;
}
/**
*
* @return string