From 27010e05d0d94c337d88c412c9284904bc152e10 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 8 Jan 2022 21:51:03 -0500 Subject: [PATCH] Navigation - Make required fields NOT NULL --- CRM/Core/DAO/Navigation.php | 6 +++++- CRM/Upgrade/Incremental/sql/5.47.alpha1.mysql.tpl | 6 ++++++ xml/schema/Core/Navigation.xml | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CRM/Core/DAO/Navigation.php b/CRM/Core/DAO/Navigation.php index f57b5fe098..3b60e5d2ca 100644 --- a/CRM/Core/DAO/Navigation.php +++ b/CRM/Core/DAO/Navigation.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Navigation.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:6400fef9c925231f0d6245030ec46e68) + * (GenCodeChecksum:a26cb263ead3cb0d9bb3f0fda7fbec3c) */ /** @@ -316,7 +316,9 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Active'), 'description' => ts('Is this navigation item active?'), + 'required' => TRUE, 'where' => 'civicrm_navigation.is_active', + 'default' => '1', 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', @@ -344,7 +346,9 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Order'), 'description' => ts('Ordering of the navigation items in various blocks.'), + 'required' => TRUE, 'where' => 'civicrm_navigation.weight', + 'default' => '0', 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', diff --git a/CRM/Upgrade/Incremental/sql/5.47.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.47.alpha1.mysql.tpl index 83d347868b..dd955c3e32 100644 --- a/CRM/Upgrade/Incremental/sql/5.47.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/5.47.alpha1.mysql.tpl @@ -1 +1,7 @@ {* file to handle db changes in 5.47.alpha1 during upgrade *} + +UPDATE `civicrm_navigation` SET `is_active` = 0 WHERE `is_active` IS NULL; +UPDATE `civicrm_navigation` SET `weight` = 0 WHERE `weight` IS NULL; +ALTER TABLE `civicrm_navigation` + MODIFY COLUMN `is_active` tinyint NOT NULL DEFAULT 1 COMMENT 'Is this navigation item active?', + MODIFY COLUMN `weight` int NOT NULL DEFAULT 0 COMMENT 'Ordering of the navigation items in various blocks.'; diff --git a/xml/schema/Core/Navigation.xml b/xml/schema/Core/Navigation.xml index dd489e66e0..bb97737ad3 100644 --- a/xml/schema/Core/Navigation.xml +++ b/xml/schema/Core/Navigation.xml @@ -125,6 +125,8 @@ Is Active boolean Is this navigation item active? + 1 + true 3.0 @@ -143,6 +145,8 @@ Order int Ordering of the navigation items in various blocks. + 0 + true 3.0 -- 2.25.1