update delete cats

This commit is contained in:
bettina 2001-07-20 01:05:47 +00:00
parent 79561e21f7
commit 8dac4d5616
3 changed files with 10 additions and 9 deletions

View File

@ -32,7 +32,7 @@
{ {
if ($subs) if ($subs)
{ {
$c->delete($cat_id,'True'); $c->delete($cat_id,True);
} }
else else
{ {
@ -60,7 +60,7 @@
$apps_cats = $c->exists('subs',$cat_name='',$cat_id); $apps_cats = $c->exists('subs',$cat_name='',$cat_id);
if ($apps_cats==True) if ($apps_cats)
{ {
$t->set_var('messages',lang('This category is currently being used by applications as a parent category') . '<br>' $t->set_var('messages',lang('This category is currently being used by applications as a parent category') . '<br>'
. lang('You will need to remove the subcategories before you can delete the parent category')); . lang('You will need to remove the subcategories before you can delete the parent category'));
@ -82,7 +82,7 @@
$exists = $c->exists('subs',$cat_name='',$cat_id); $exists = $c->exists('subs',$cat_name='',$cat_id);
if ($exists==True) if ($exists)
{ {
$t->set_var('lang_subs',lang('Do you also want to delete all global subcategories ?')); $t->set_var('lang_subs',lang('Do you also want to delete all global subcategories ?'));
$t->set_var('subs','<input type="checkbox" name="subs" value="True">'); $t->set_var('subs','<input type="checkbox" name="subs" value="True">');

View File

@ -183,7 +183,6 @@
*/ */
function return_single($id = '') function return_single($id = '')
{ {
$this->db->query("select * from phpgw_categories where cat_id='$id'",__LINE__,__FILE__); $this->db->query("select * from phpgw_categories where cat_id='$id'",__LINE__,__FILE__);
if ($this->db->next_record()) if ($this->db->next_record())
@ -361,11 +360,11 @@
@abstract delete category @abstract delete category
@param $cat_id int - category id @param $cat_id int - category id
*/ */
function delete($cat_id,$subs = 'False') function delete($cat_id,$subs = False)
{ {
if ($subs == 'True') if ($subs)
{ {
$subdelete = " OR cat_parent='$cat_id'"; $subdelete = " OR cat_parent='$cat_id' OR cat_main='$cat_id' ";
} }
$this->db->query("delete from phpgw_categories where cat_id='$cat_id' $subdelete and cat_appname='" $this->db->query("delete from phpgw_categories where cat_id='$cat_id' $subdelete and cat_appname='"

View File

@ -36,12 +36,13 @@
{ {
if ($subs) if ($subs)
{ {
$c->delete($cat_id,'True'); $c->delete($cat_id,True);
} }
else else
{ {
$c->delete($cat_id); $c->delete($cat_id);
} }
Header('Location: ' . $phpgw->link('/preferences/categories.php','cats_app=' . $cats_app . '&extra=' . $extra . '&cats_level=' . $cats_level Header('Location: ' . $phpgw->link('/preferences/categories.php','cats_app=' . $cats_app . '&extra=' . $extra . '&cats_level=' . $cats_level
. '&global_cats=' . $global_cats)); . '&global_cats=' . $global_cats));
} }
@ -65,7 +66,8 @@
$t->set_var('hidden_vars',$hidden_vars); $t->set_var('hidden_vars',$hidden_vars);
$exists = $c->exists('subs',$cat_name='',$cat_id); $exists = $c->exists('subs',$cat_name='',$cat_id);
if ($exists==True)
if ($exists)
{ {
$t->set_var('lang_subs',lang('Do you also want to delete all subcategories ?')); $t->set_var('lang_subs',lang('Do you also want to delete all subcategories ?'));
$t->set_var('subs','<input type="checkbox" name="subs" value="True">'); $t->set_var('subs','<input type="checkbox" name="subs" value="True">');