fix: [organisations] made meta fields default to '' and not allow null values

- fixes a filtering issue with sharing group blueprints leading to sharing groups that are more restrictive than expected
pull/8216/head
iglocska 2022-03-02 17:32:35 +01:00
parent c66d718a09
commit 7834ec3760
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 9 additions and 1 deletions

View File

@ -85,7 +85,8 @@ class AppModel extends Model
57 => false, 58 => false, 59 => false, 60 => false, 61 => false, 62 => false,
63 => true, 64 => false, 65 => false, 66 => false, 67 => false, 68 => false,
69 => false, 70 => false, 71 => true, 72 => true, 73 => false, 74 => false,
75 => false, 76 => true, 77 => false, 78 => false, 79 => false, 80 => false
75 => false, 76 => true, 77 => false, 78 => false, 79 => false, 80 => false,
81 => false
);
public $advanced_updates_description = array(
@ -1631,6 +1632,13 @@ class AppModel extends Model
INDEX `sharing_group_id` (`sharing_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;";
break;
case 81:
$fields = ['nationality', 'sector', 'type', 'name', 'description'];
foreach ($fields as $field) {
$sqlArray[] = sprintf("UPDATE organisations SET %s = '' WHERE %s IS NULL;", $field, $field);
$sqlArray[] = sprintf("ALTER table organisations MODIFY %s varchar(255) NOT NULL DEFAULT '';", $field);
}
break;
case 'fixNonEmptySharingGroupID':
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';