"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); //echo "<p>soinfolog.write values= "; _debug_array($values);
// write customfields now // write customfields now
$to_delete = array();
foreach($values as $key => $val) foreach($values as $key => $val)
{ {
if ($key[0] != '#') if ($key[0] != '#')
@ -586,11 +587,25 @@ class soinfolog // DB-Layer
} }
$this->data[$key] = $val; // update internal data $this->data[$key] = $val; // update internal data
$this->db->insert($this->extra_table,array( if ($val)
'info_extra_value'=>$val {
),array( $this->db->insert($this->extra_table,array(
'info_extra_value'=>$val
),array(
'info_id' => $info_id,
'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_id' => $info_id,
'info_extra_name' => substr($key,1), 'info_extra_name' => $to_delete,
),__LINE__,__FILE__); ),__LINE__,__FILE__);
} }
// echo "<p>soinfolog.write this->data= "; _debug_array($this->data); // echo "<p>soinfolog.write this->data= "; _debug_array($this->data);