From 05b27f5114a5415a0a2bb122b332a4ceb47b8dcd Mon Sep 17 00:00:00 2001 From: Merijn Schering Date: Mon, 18 Nov 2024 13:53:07 +0100 Subject: [PATCH 1/4] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb1cfe796..f85c60e28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ - Core: updated german translation - Various: route to main grid when details resets / is deleted for mobile view +- collabora: Added lang variable for collabora 11-11-2024: 6.8.85 - Billing: Fixed undefined index 'sort' From d791e6bb86ad847358aacfeb4e91f3a664f12b43 Mon Sep 17 00:00:00 2001 From: Merijn Schering Date: Mon, 18 Nov 2024 14:15:00 +0100 Subject: [PATCH 2/4] Complete the custom fields --- www/go/core/model/FieldSet.php | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/www/go/core/model/FieldSet.php b/www/go/core/model/FieldSet.php index 6a201ecd4..e3f964f69 100644 --- a/www/go/core/model/FieldSet.php +++ b/www/go/core/model/FieldSet.php @@ -174,13 +174,6 @@ public static function migrateCustomFields(string $fromEntityCls, string $toEnti $fromEntityType = $fromEntityCls::entityType(); $toEntityType = $toEntityCls::entityType(); - $count = \go\core\model\FieldSet::findByEntity($toEntityType->getName())->selectSingleValue("count(*)")->single(); - if($count) { - echo "Custom fields for ". $toEntityType->getName()." already migrated\n"; - - return false; - } - echo "Migrating entity " . $toEntityType->getName() ."\n"; $fieldSets = \go\core\model\FieldSet::findByEntity($fromEntityType->getName()); @@ -188,20 +181,31 @@ public static function migrateCustomFields(string $fromEntityCls, string $toEnti foreach($fieldSets as $fieldSet) { echo "Migrating fieldset " . $fieldSet->name . " (". $fieldSet->id .")\n"; - $newFieldSet = $fieldSet->copy(); - $newFieldSet->setEntity($toEntityType->getName()); - if(!$newFieldSet->save()) { - throw new \go\core\orm\exception\SaveException($newFieldSet); + + $newFieldSet = FieldSet::findByEntity($toEntityType->getName())->where(['name' => $fieldSet->name])->single(); + + if(!$newFieldSet) { + $newFieldSet = $fieldSet->copy(); + $newFieldSet->setEntity($toEntityType->getName()); + if (!$newFieldSet->save()) { + throw new \go\core\orm\exception\SaveException($newFieldSet); + } } echo $newFieldSet->id ."\n"; $fields = \go\core\model\Field::find()->where('fieldSetId', '=', $fieldSet->id); foreach($fields as $field) { - $newField = $field->copy(); - $newField->fieldSetId = $newFieldSet->id; - if(!$newField->save()) { - throw new \go\core\orm\exception\SaveException($newField); + +// echo "Migrating field " . $field->databaseName . "\n"; + $newField = \go\core\model\Field::find()->where('fieldSetId', '=', $newFieldSet->id)->where(['databaseName' => $field->databaseName])->single(); + + if(!$newField) { + $newField = $field->copy(); + $newField->fieldSetId = $newFieldSet->id; + if (!$newField->save()) { + throw new \go\core\orm\exception\SaveException($newField); + } } } } From 0266cf89ebff89fca457daf75d34d3697e2f1f50 Mon Sep 17 00:00:00 2001 From: Merijn Schering Date: Mon, 18 Nov 2024 14:15:55 +0100 Subject: [PATCH 3/4] CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8729946d8..bfecdf868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ - Core: updated german translation - Various: route to main grid when details resets / is deleted for mobile view - collabora: Added lang variable for collabora +- Finance: Migration checks if all custom fields are available + 11-11-2024: 6.8.85 - Billing: Fixed undefined index 'sort' From 77a2aec9fbec15a220b1fe1b66be7bf3f2829140 Mon Sep 17 00:00:00 2001 From: Merijn Schering Date: Mon, 18 Nov 2024 14:28:56 +0100 Subject: [PATCH 4/4] CHANGELOG.md --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfecdf868..53937f2d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,9 @@ - Files: cron job file notification - Core: updated german translation - Various: route to main grid when details resets / is deleted for mobile view -- collabora: Added lang variable for collabora +- Collabora: Added lang variable for collabora - Finance: Migration checks if all custom fields are available - 11-11-2024: 6.8.85 - Billing: Fixed undefined index 'sort'