From d47b956aa8a38aa1c47f9f45d7946c37690d23f8 Mon Sep 17 00:00:00 2001 From: Sandor Semsey Date: Tue, 10 Oct 2023 11:33:26 +0200 Subject: [PATCH] Make civicrm.is_active required and default=1 --- CRM/ACL/DAO/ACL.php | 6 ++++-- CRM/Upgrade/Incremental/php/FiveSixtyEight.php | 1 + CRM/Upgrade/Incremental/sql/5.68.alpha1.mysql.tpl | 2 ++ xml/schema/ACL/ACL.xml | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CRM/ACL/DAO/ACL.php b/CRM/ACL/DAO/ACL.php index 0a9b48d468..b9b28c82b0 100644 --- a/CRM/ACL/DAO/ACL.php +++ b/CRM/ACL/DAO/ACL.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/ACL/ACL.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:56266204b43a487af7bf9963d23e0556) + * (GenCodeChecksum:d49159426e04e1bab16768e2f7ed9551) */ /** @@ -135,7 +135,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO { /** * Is this property active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -425,6 +425,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('ACL Is Active?'), 'description' => ts('Is this property active?'), + 'required' => TRUE, 'usage' => [ 'import' => FALSE, 'export' => FALSE, @@ -432,6 +433,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO { 'token' => FALSE, ], 'where' => 'civicrm_acl.is_active', + 'default' => '1', 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', diff --git a/CRM/Upgrade/Incremental/php/FiveSixtyEight.php b/CRM/Upgrade/Incremental/php/FiveSixtyEight.php index 93ca90b2cf..94b6752112 100644 --- a/CRM/Upgrade/Incremental/php/FiveSixtyEight.php +++ b/CRM/Upgrade/Incremental/php/FiveSixtyEight.php @@ -37,6 +37,7 @@ class CRM_Upgrade_Incremental_php_FiveSixtyEight extends CRM_Upgrade_Incremental $this->addTask('Update civicrm_managed.module', 'alterColumn', 'civicrm_managed', 'module', "varchar(255) NOT NULL COMMENT 'Name of the module which declared this object (soft FK to civicrm_extension.full_name)'"); $this->addTask('Update civicrm_managed.name', 'alterColumn', 'civicrm_managed', 'name', "varchar(255) NOT NULL COMMENT 'Symbolic name used by the module to identify the object'"); $this->addTask('Update civicrm_managed.cleanup', 'alterColumn', 'civicrm_managed', 'cleanup', "varchar(16) NOT NULL DEFAULT 'always' COMMENT 'Policy on when to cleanup entity (always, never, unused)'"); + $this->addTask('Update civicrm_acl.is_active', 'alterColumn', 'civicrm_acl', 'is_active', "tinyint NOT NULL DEFAULT 1 COMMENT 'Is this property active?'"); } } diff --git a/CRM/Upgrade/Incremental/sql/5.68.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.68.alpha1.mysql.tpl index d7d9ad9e55..4f986d82be 100644 --- a/CRM/Upgrade/Incremental/sql/5.68.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/5.68.alpha1.mysql.tpl @@ -1,5 +1,7 @@ {* file to handle db changes in 5.68.alpha1 during upgrade *} +UPDATE `civicrm_acl` SET `is_active` = 0 WHERE `is_active` IS NULL; + UPDATE `civicrm_tag` SET `label` = `name` WHERE `label` = ''; {* This column is now required. Delete any null values; a managed entity without a name is useless *} diff --git a/xml/schema/ACL/ACL.xml b/xml/schema/ACL/ACL.xml index 1e058ab473..94e143ce7f 100644 --- a/xml/schema/ACL/ACL.xml +++ b/xml/schema/ACL/ACL.xml @@ -144,6 +144,8 @@ is_active ACL Is Active? boolean + true + 1 Is this property active? 1.6 -- 2.25.1