Skip to content

Commit

Permalink
Make civicrm.is_active required and default=1
Browse files Browse the repository at this point in the history
  • Loading branch information
semseysandor authored and colemanw committed Oct 17, 2023
1 parent f055d6d commit d47b956
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CRM/ACL/DAO/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/ACL/ACL.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:56266204b43a487af7bf9963d23e0556)
* (GenCodeChecksum:d49159426e04e1bab16768e2f7ed9551)
*/

/**
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -425,13 +425,15 @@ public static function &fields() {
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('ACL Is Active?'),
'description' => ts('Is this property active?'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_acl.is_active',
'default' => '1',
'table_name' => 'civicrm_acl',
'entity' => 'ACL',
'bao' => 'CRM_ACL_BAO_ACL',
Expand Down
1 change: 1 addition & 0 deletions CRM/Upgrade/Incremental/php/FiveSixtyEight.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function upgrade_5_68_alpha1($rev): void {
$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?'");
}

}
2 changes: 2 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.68.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
@@ -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 *}
Expand Down
2 changes: 2 additions & 0 deletions xml/schema/ACL/ACL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
<name>is_active</name>
<title>ACL Is Active?</title>
<type>boolean</type>
<required>true</required>
<default>1</default>
<comment>Is this property active?</comment>
<add>1.6</add>
<html>
Expand Down

0 comments on commit d47b956

Please sign in to comment.