Skip to content

Commit

Permalink
Ticket 33286: fix user export
Browse files Browse the repository at this point in the history
  • Loading branch information
derjoachim committed Oct 28, 2024
1 parent c47ee39 commit d9f2c00
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 12 additions & 2 deletions www/go/core/convert/UserSpreadsheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,36 @@
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;

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"));
}

public function exportCreateEmailAccount(Entity $entity, array $templateValues, $columnName) {
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;
Expand Down
31 changes: 14 additions & 17 deletions www/go/core/data/convert/Spreadsheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? "";
}
}
Expand Down

0 comments on commit d9f2c00

Please sign in to comment.