"dont store empty cf's"

This commit is contained in:
Ralf Becker 2008-03-31 14:48:49 +00:00
parent 8c58d4c3f1
commit 8a8f37ecff

View File

@ -578,6 +578,7 @@ class soinfolog // DB-Layer
//echo "<p>soinfolog.write values= "; _debug_array($values);
// write customfields now
$to_delete = array();
foreach($values as $key => $val)
{
if ($key[0] != '#')
@ -586,6 +587,8 @@ class soinfolog // DB-Layer
}
$this->data[$key] = $val; // update internal data
if ($val)
{
$this->db->insert($this->extra_table,array(
'info_extra_value'=>$val
),array(
@ -593,6 +596,18 @@ class soinfolog // DB-Layer
'info_extra_name' => substr($key,1),
),__LINE__,__FILE__);
}
else
{
$to_delete[] = substr($key,1);
}
}
if ($to_delete)
{
$this->db->delete($this->extra_table,array(
'info_id' => $info_id,
'info_extra_name' => $to_delete,
),__LINE__,__FILE__);
}
// echo "<p>soinfolog.write this->data= "; _debug_array($this->data);
//error_log("### soinfolog::write(".print_r($to_write,true).") where=".print_r($where,true)." returning id=".$this->data['info_id']);