mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Add optional parent parameter for new categories
This commit is contained in:
parent
d67a265beb
commit
66f120ff2e
@ -167,9 +167,10 @@ class importexport_helper_functions {
|
||||
* If a cat isn't found, it will be created.
|
||||
*
|
||||
* @param mixed $_cat_names comma seperated list or array.
|
||||
* @param int $parent Optional parent ID to use for new categories
|
||||
* @return mixed comma seperated list or array with cat_ids
|
||||
*/
|
||||
public static function cat_name2id( $_cat_names ) {
|
||||
public static function cat_name2id( $_cat_names, $parent = 0 ) {
|
||||
$cats = new categories(); // uses current user and app (egw_info[flags][currentapp])
|
||||
|
||||
$cat_names = is_array( $_cat_names ) ? $_cat_names : explode( ',', $_cat_names );
|
||||
@ -184,6 +185,7 @@ class importexport_helper_functions {
|
||||
if ( ( $cat_id = $cats->name2id( $cat_name ) ) == 0 ) {
|
||||
$cat_id = $cats->add( array(
|
||||
'name' => $cat_name,
|
||||
'parent' => $parent,
|
||||
'access' => 'public',
|
||||
'descr' => $cat_name. ' ('. lang('Automatically created by importexport'). ')'
|
||||
));
|
||||
|
Loading…
Reference in New Issue
Block a user