Check error after name check, skip exists call if cat_name=''

This commit is contained in:
Miles Lott 2001-04-21 15:51:39 +00:00
parent e1fcfb7fcf
commit 568fa2524c

View File

@ -35,15 +35,20 @@
$c = CreateObject('phpgwapi.categories'); $c = CreateObject('phpgwapi.categories');
$c->app_name = $cats_app; $c->app_name = $cats_app;
if ($submit) { if ($submit)
{
$errorcount = 0; $errorcount = 0;
if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); } if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); }
if (!$error)
{
if (!$cat_parent) { $exists = $c->exists('mains',$cat_name,$cat_id=''); } if (!$cat_parent) { $exists = $c->exists('mains',$cat_name,$cat_id=''); }
else { $exists = $c->exists('subs',$cat_name,$cat_id=''); } else { $exists = $c->exists('subs',$cat_name,$cat_id=''); }
if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); } if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); }
}
if (! $error) { if (!$error)
{
$cat_name = addslashes($cat_name); $cat_name = addslashes($cat_name);
$cat_description = addslashes($cat_description); $cat_description = addslashes($cat_description);
if ($access) { $cat_access = 'private'; } if ($access) { $cat_access = 'private'; }