import of users does not issue an error if a group column isn't set

This commit is contained in:
Uwe Steinmann 2020-09-14 10:40:00 +02:00
parent 84a849a28f
commit 3945ae54b9
2 changed files with 14 additions and 5 deletions

View File

@ -4,6 +4,7 @@
- fix import of users
- major rework of scripts in utils, unify reading of settings, use PHP_EOL
- allow inline editing of document name
- import of users does not issue an error if a group column isn't set
--------------------------------------------------------------------------------
Changes in version 5.1.19

View File

@ -70,6 +70,10 @@ function renderFolderData($colname, $objdata) { /* {{{ */
function getGroupData($colname, $coldata, $objdata) { /* {{{ */
global $dms;
/* explode column name to extract index of group. Actually, the whole column
* name could be used as well, as it is just a unique index in the array
* of groups.
*/
$kk = explode('_', $colname);
if(count($kk) == 2)
$gn = $kk[1];
@ -77,11 +81,15 @@ function getGroupData($colname, $coldata, $objdata) { /* {{{ */
$gn = '1';
if(!isset($objdata['groups']))
$objdata['groups'] = [];
if($group = $dms->getGroupByName($coldata)) {
$objdata['groups'][$gn] = $group;
} else {
// $objdata['groups'][$gn] = null;
$objdata['__logs__'][] = array('type'=>'error', 'msg'=> "No such group with name '".$coldata."'");
/* $coldata can be empty, if an imported users is assigned to less groups
* than group columns exists.
*/
if($coldata) {
if($group = $dms->getGroupByName($coldata)) {
$objdata['groups'][$gn] = $group;
} else {
$objdata['__logs__'][] = array('type'=>'error', 'msg'=> "No such group with name '".$coldata."'");
}
}
return $objdata;
} /* }}} */