From: Coleman Watts Date: Thu, 11 Jun 2020 15:55:05 +0000 (-0400) Subject: Update has_separator field in civicrm_navigation X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e0674c373a8b817bae9e809c86a64274aa5ce296;p=civicrm-core.git Update has_separator field in civicrm_navigation This field was incorrectly marked as a boolean; it's actually an int with an option list. --- diff --git a/CRM/Admin/Form/Navigation.php b/CRM/Admin/Form/Navigation.php index 510d039c13..0b21a818d9 100644 --- a/CRM/Admin/Form/Navigation.php +++ b/CRM/Admin/Form/Navigation.php @@ -67,7 +67,7 @@ class CRM_Admin_Form_Navigation extends CRM_Admin_Form { $this->add('select', 'permission_operator', NULL, $operators); //make separator location configurable - $separator = [ts('None'), ts('After menu element'), ts('Before menu element')]; + $separator = CRM_Core_SelectValues::navigationMenuSeparator(); $this->add('select', 'has_separator', ts('Separator'), $separator); $active = $this->add('advcheckbox', 'is_active', ts('Enabled')); diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index ed531ab538..5bca8cb225 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -341,7 +341,7 @@ class CRM_Core_CodeGen_Specification { default: $field['phpType'] = $this->value('phpType', $fieldXML, $type); $field['sqlType'] = $type; - if ($type == 'int unsigned') { + if ($type == 'int unsigned' || $type == 'tinyint') { $field['phpType'] = 'int'; $field['crmType'] = 'CRM_Utils_Type::T_INT'; } diff --git a/CRM/Core/DAO/Navigation.php b/CRM/Core/DAO/Navigation.php index 06c322c4bd..80179999f1 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:3819d9a3e40bfbc36a06809c1f4bd98c) + * (GenCodeChecksum:8d6052b04bcd4a7bdfff07ecfa14e60b) */ /** @@ -97,9 +97,9 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO { public $is_active; /** - * If separator needs to be added after this menu item + * Place a separator either before or after this menu item. * - * @var bool + * @var int */ public $has_separator; @@ -289,14 +289,18 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO { ], 'has_separator' => [ 'name' => 'has_separator', - 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Use separator'), - 'description' => ts('If separator needs to be added after this menu item'), + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Separator'), + 'description' => ts('Place a separator either before or after this menu item.'), 'where' => 'civicrm_navigation.has_separator', + 'default' => '0', 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator', + ], ], 'weight' => [ 'name' => 'weight', diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index b2c515867e..02d6545499 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -1172,6 +1172,9 @@ class CRM_Core_SelectValues { return $ret; } + /** + * @return string[] + */ public static function fieldSerialization() { return [ CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND => 'separator_bookend', @@ -1182,4 +1185,15 @@ class CRM_Core_SelectValues { ]; } + /** + * @return array + */ + public static function navigationMenuSeparator() { + return [ + ts('None'), + ts('After menu element'), + ts('Before menu element'), + ]; + } + } diff --git a/CRM/Upgrade/Incremental/sql/5.28.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.28.alpha1.mysql.tpl index a82693b7f0..13a26cf3e6 100644 --- a/CRM/Upgrade/Incremental/sql/5.28.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/5.28.alpha1.mysql.tpl @@ -1,5 +1,9 @@ {* file to handle db changes in 5.28.alpha1 during upgrade *} +-- https://github.com/civicrm/civicrm-core/pull/17579 +ALTER TABLE `civicrm_navigation` CHANGE `has_separator` +`has_separator` tinyint DEFAULT 0 COMMENT 'Place a separator either before or after this menu item.'; + -- https://github.com/civicrm/civicrm-core/pull/17450 ALTER TABLE `civicrm_activity` CHANGE `activity_date_time` `activity_date_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.'; ALTER TABLE `civicrm_activity` CHANGE `created_date` `created_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When was the activity was created.'; diff --git a/css/crm-menubar.css b/css/crm-menubar.css index 63f421f121..f4428a4fad 100644 --- a/css/crm-menubar.css +++ b/css/crm-menubar.css @@ -31,10 +31,8 @@ #civicrm-menu li li a { padding: 6px 36px 6px 10px; } -#civicrm-menu li.crm-menu-border-bottom:not(:last-child) { - border-bottom: 1px solid #bbb; -} -#civicrm-menu li:not(.crm-menu-border-bottom) + li.crm-menu-border-top { +#civicrm-menu li.crm-menu-border-bottom + li, +#civicrm-menu li + li.crm-menu-border-top { border-top: 1px solid #bbb; } #civicrm-menu li a:focus, diff --git a/xml/schema/Core/Navigation.xml b/xml/schema/Core/Navigation.xml index 8a60e33165..5de7ea9d37 100644 --- a/xml/schema/Core/Navigation.xml +++ b/xml/schema/Core/Navigation.xml @@ -115,10 +115,14 @@ has_separator - Use separator - boolean - If separator needs to be added after this menu item + Separator + tinyint + Place a separator either before or after this menu item. + 0 3.0 + + CRM_Core_SelectValues::navigationMenuSeparator + weight