update edit cats

This commit is contained in:
ceb 2002-10-12 00:50:37 +00:00
parent 1e7e23d21c
commit 212c43738a

View File

@ -566,11 +566,22 @@
$cat_values['descr'] = $this->db->db_addslashes($cat_values['descr']); $cat_values['descr'] = $this->db->db_addslashes($cat_values['descr']);
$cat_values['name'] = $this->db->db_addslashes($cat_values['name']); $cat_values['name'] = $this->db->db_addslashes($cat_values['name']);
$this->db->query("INSERT INTO phpgw_categories (cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description,cat_data," if (isset($cat_values['id']))
. "cat_main,cat_level) VALUES ('" . $cat_values['parent'] . "','" . $this->account_id . "','" . $cat_values['access'] {
$id_col = 'cat_id,';
$id_val = $cat_values['id'].',';
}
$this->db->query("INSERT INTO phpgw_categories (${id_col}cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description,cat_data,"
. "cat_main,cat_level) VALUES ($id_val'" . $cat_values['parent'] . "','" . $this->account_id . "','" . $cat_values['access']
. "','" . $this->app_name . "','" . $cat_values['name'] . "','" . $cat_values['descr'] . "','" . $cat_values['data'] . "','" . $this->app_name . "','" . $cat_values['name'] . "','" . $cat_values['descr'] . "','" . $cat_values['data']
. "','" . $cat_values['main'] . "','" . $cat_values['level'] . "')",__LINE__,__FILE__); . "','" . $cat_values['main'] . "','" . $cat_values['level'] . "')",__LINE__,__FILE__);
if (isset($cat_values['id']))
{
$max = $cat_values['id'];
}
$max = $this->db->get_last_insert_id('phpgw_categories','cat_id'); $max = $this->db->get_last_insert_id('phpgw_categories','cat_id');
if (!$cat_values['parent'] || $cat_values['parent'] == 0) if (!$cat_values['parent'] || $cat_values['parent'] == 0)
@ -649,7 +660,7 @@
*/ */
function edit($cat_values) function edit($cat_values)
{ {
if (intval($cat_values['old_parent']) != $cat_values['parent']) if (isset($cat_values['old_parent']) && intval($cat_values['old_parent']) != $cat_values['parent'])
{ {
$this->delete(array('cat_id' => $cat_values['id'],'drop_subs' => False,'modify_subs' => True)); $this->delete(array('cat_id' => $cat_values['id'],'drop_subs' => False,'modify_subs' => True));
return $this->add($cat_values); return $this->add($cat_values);