diff --git a/CHANGELOG.md b/CHANGELOG.md index 2295b602e8..e354d70301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - Core: bugfix editing individual field set in entity +- Core: bugfix user export 24-10-2024: 6.8.79 - E-mail: Server side sort was disabled by accident since May 2024 diff --git a/www/go/core/convert/UserSpreadsheet.php b/www/go/core/convert/UserSpreadsheet.php index f49f548165..65fcc302c3 100644 --- a/www/go/core/convert/UserSpreadsheet.php +++ b/www/go/core/convert/UserSpreadsheet.php @@ -4,6 +4,7 @@ use Exception; use go\core\data\convert\Spreadsheet; use go\core\model\Module; +use go\core\model\User; use go\core\orm\Entity; use go\modules\community\serverclient\model\MailDomain; use go\modules\community\serverclient\Module as GoModule; @@ -11,12 +12,13 @@ class UserSpreadsheet extends Spreadsheet { public static $excludeHeaders = ['syncSettings', 'tasksSettings', 'notesSettings', 'addressBookSettings', - 'calendarSettings', 'emailSettings', 'supportSettings', 'projectsSettings', 'otp', 'clients', 'authenticators']; + 'calendarSettings', 'emailSettings', 'supportSettings', 'projectsSettings', 'otp', 'clients', 'authenticators', + 'profile']; protected function init() { parent::init(); - + $this->addColumn("personalGroup", go()->t("Personal group")); $this->addColumn('createEmailAccount', go()->t("Create E-mail account")); } @@ -24,6 +26,14 @@ public function exportCreateEmailAccount(Entity $entity, array $templateValues, return "0"; } + public function exportPersonalGroup(Entity $entity, array $templateValues, $columnName): string + { + if($entity instanceof User && $entity->getPersonalGroup()) { + return $entity->getPersonalGroup()->name; + } + return ""; + } + public function importCreateEmailAccount(Entity $entity, $value, $values) { $this->postFixAdminDomain = false; $this->postFixAdminPassword = false; diff --git a/www/go/core/data/convert/Spreadsheet.php b/www/go/core/data/convert/Spreadsheet.php index 8b07ef74a1..800a785303 100644 --- a/www/go/core/data/convert/Spreadsheet.php +++ b/www/go/core/data/convert/Spreadsheet.php @@ -368,39 +368,36 @@ protected function getValue(Entity $entity, $templateValues, $header) { } $path = explode('.', $header); - - while($seg = array_shift($path)) { + + while ($seg = array_shift($path)) { $index = $this->extractIndex($seg); - if(isset($index)) { - if(!isset($templateValues[$seg][$index])) { + if (isset($index)) { + if (!isset($templateValues[$seg][$index])) { return ""; - }else{ + } else { $templateValues = $templateValues[$seg][$index]; continue; } } - - if(is_array($templateValues)) { - if(!isset($templateValues[0])) { + + if (is_array($templateValues)) { + if (!isset($templateValues[0])) { $templateValues = $templateValues[$seg] ?? ""; - } else - { + } else { $a = []; - - foreach($templateValues as $i) { - if(is_array($i)) { + + foreach ($templateValues as $i) { + if (is_array($i)) { $a[] = $i[$seg] ?? ""; - } else - { + } else { $a[] = $i->$seg ?? ""; } } $templateValues = $a; } - }else - { + } else { $templateValues = $templateValues->$seg ?? ""; } }