running cat_id and name2id on owner now automatical if id's are not numerical

This commit is contained in:
Ralf Becker 2003-10-07 23:54:13 +00:00
parent 3360c838f6
commit 7b3f4277a7

View File

@ -156,9 +156,9 @@
$GLOBALS['phpgw']->template->parse('fheaderhandle','fheader'); $GLOBALS['phpgw']->template->parse('fheaderhandle','fheader');
$addr_names = $GLOBALS['phpgw']->contacts->stock_contact_fields + array( $addr_names = $GLOBALS['phpgw']->contacts->stock_contact_fields + array(
'cat_id' => 'Categories: @cat_id(Cat1,Cat2)', 'cat_id' => 'Categories: id\'s or names, comma separated list',
'access' => 'Access: public, private', 'access' => 'Access: public, private',
'owner' => 'Owner: defaults to user', 'owner' => 'Owner: user-id/-name, defaults to user',
'address2' => 'address line 2', 'address2' => 'address line 2',
'address3' => 'address line 3', 'address3' => 'address line 3',
'ophone' => 'Other Phone' 'ophone' => 'Other Phone'
@ -403,6 +403,20 @@
} }
$empty = !count($values); $empty = !count($values);
// convert the category name to an id
if ($values['cat_id'] && !is_numeric($values['cat_id']) && $values['cat_id'][0] != ',')
{
$values['cat_id'] = cat_id($values['cat_id']);
}
// convert user-names to user-id's
foreach(array('owner') as $user)
{
if (isset($values[$user]) && !is_numeric($user))
{
$values[$user] = $GLOBALS['phpgw']->accounts->name2id($values[$user]);
}
}
if (is_array($auto_fn)) // autocreate full name if (is_array($auto_fn)) // autocreate full name
{ {
reset($auto_fn); reset($auto_fn);