From a442380558130de05fc607c17c4be87c91d4e6a3 Mon Sep 17 00:00:00 2001 From: Monish Deb Date: Thu, 7 Apr 2022 18:12:17 -0700 Subject: [PATCH] Schema - Fix boolean fields in 'Price' --- CRM/Price/DAO/PriceField.php | 14 +++++++++----- CRM/Price/DAO/PriceFieldValue.php | 8 +++++--- CRM/Price/DAO/PriceSet.php | 11 +++++++---- .../php/FiveFortyNine/Price.bool.php | 18 ++++++++++++++++++ xml/schema/Price/PriceField.xml | 4 ++++ xml/schema/Price/PriceFieldValue.xml | 2 ++ xml/schema/Price/PriceSet.xml | 3 +++ 7 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 CRM/Upgrade/Incremental/php/FiveFortyNine/Price.bool.php diff --git a/CRM/Price/DAO/PriceField.php b/CRM/Price/DAO/PriceField.php index 809ccf6d48..13a15de67e 100644 --- a/CRM/Price/DAO/PriceField.php +++ b/CRM/Price/DAO/PriceField.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceField.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e8aa16285c520e7ce5288da53397f9df) + * (GenCodeChecksum:15774f8e0c7f8ef88b21f86cf8ef43bc) */ /** @@ -77,7 +77,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { /** * Enter a quantity for this field? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -113,7 +113,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { /** * Should the price be displayed next to the label for each option? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -131,7 +131,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { /** * Is this price field active * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -140,7 +140,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { /** * Is this price field required (value must be > 1) * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -326,6 +326,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Price Field Quantity Required?'), 'description' => ts('Enter a quantity for this field?'), + 'required' => TRUE, 'where' => 'civicrm_price_field.is_enter_qty', 'default' => '0', 'table_name' => 'civicrm_price_field', @@ -392,6 +393,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Price Field Show Amounts?'), 'description' => ts('Should the price be displayed next to the label for each option?'), + 'required' => TRUE, 'where' => 'civicrm_price_field.is_display_amounts', 'default' => '1', 'table_name' => 'civicrm_price_field', @@ -424,6 +426,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Price Field Is Active?'), 'description' => ts('Is this price field active'), + 'required' => TRUE, 'where' => 'civicrm_price_field.is_active', 'default' => '1', 'table_name' => 'civicrm_price_field', @@ -440,6 +443,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Price Field is Required?'), 'description' => ts('Is this price field required (value must be > 1)'), + 'required' => TRUE, 'where' => 'civicrm_price_field.is_required', 'default' => '1', 'table_name' => 'civicrm_price_field', diff --git a/CRM/Price/DAO/PriceFieldValue.php b/CRM/Price/DAO/PriceFieldValue.php index 0eb232139d..fc0642b78d 100644 --- a/CRM/Price/DAO/PriceFieldValue.php +++ b/CRM/Price/DAO/PriceFieldValue.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceFieldValue.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:3596e8942576c06b6a393c4d16226de9) + * (GenCodeChecksum:d39a35fbdcaed47315fdc0ecce662c7f) */ /** @@ -151,7 +151,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { /** * Is this default price field option * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -160,7 +160,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { /** * Is this price field value active * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -473,6 +473,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Default Price Field Option?'), 'description' => ts('Is this default price field option'), + 'required' => TRUE, 'where' => 'civicrm_price_field_value.is_default', 'default' => '0', 'table_name' => 'civicrm_price_field_value', @@ -489,6 +490,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Price Field Value is Active'), 'description' => ts('Is this price field value active'), + 'required' => TRUE, 'where' => 'civicrm_price_field_value.is_active', 'default' => '1', 'table_name' => 'civicrm_price_field_value', diff --git a/CRM/Price/DAO/PriceSet.php b/CRM/Price/DAO/PriceSet.php index e434d718b5..d9006795a2 100644 --- a/CRM/Price/DAO/PriceSet.php +++ b/CRM/Price/DAO/PriceSet.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceSet.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:128263766d018b5c021df384b3ab6c92) + * (GenCodeChecksum:1aec76208959c72965733e217aaf1fc1) */ /** @@ -70,7 +70,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { /** * Is this price set active * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -124,7 +124,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { /** * Is set if edited on Contribution or Event Page rather than through Manage Price Sets * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -133,7 +133,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { /** * Is this a predefined system price set (i.e. it can not be deleted, edited)? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -272,6 +272,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Price Set Is Active?'), 'description' => ts('Is this price set active'), + 'required' => TRUE, 'where' => 'civicrm_price_set.is_active', 'default' => '1', 'table_name' => 'civicrm_price_set', @@ -385,6 +386,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Price Set Quick Config?'), 'description' => ts('Is set if edited on Contribution or Event Page rather than through Manage Price Sets'), + 'required' => TRUE, 'where' => 'civicrm_price_set.is_quick_config', 'default' => '0', 'table_name' => 'civicrm_price_set', @@ -401,6 +403,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Price Set Is Reserved'), 'description' => ts('Is this a predefined system price set (i.e. it can not be deleted, edited)?'), + 'required' => TRUE, 'where' => 'civicrm_price_set.is_reserved', 'default' => '0', 'table_name' => 'civicrm_price_set', diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine/Price.bool.php b/CRM/Upgrade/Incremental/php/FiveFortyNine/Price.bool.php new file mode 100644 index 0000000000..9f453ab96d --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine/Price.bool.php @@ -0,0 +1,18 @@ + [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this price set active'", + 'is_quick_config' => "DEFAULT 0 COMMENT 'Is set if edited on Contribution or Event Page rather than through Manage Price Sets'", + 'is_reserved' => "DEFAULT 0 COMMENT 'Is this a predefined system price set (i.e. it can not be deleted, edited)?'", + ], + 'civicrm_price_field' => [ + 'is_enter_qty' => "DEFAULT 0 COMMENT 'Enter a quantity for this field?'", + 'is_display_amounts' => "DEFAULT 1 COMMENT 'Should the price be displayed next to the label for each option?'", + 'is_active' => "DEFAULT 1 COMMENT 'Is this price field active'", + 'is_required' => "DEFAULT 1 COMMENT 'Is this price field required (value must be > 1)'", + ], + 'civicrm_price_field_value' => [ + 'is_default' => "DEFAULT 0 COMMENT 'Is this default price field option'", + 'is_active' => "DEFAULT 1 COMMENT 'Is this price field value active'", + ], +]; diff --git a/xml/schema/Price/PriceField.xml b/xml/schema/Price/PriceField.xml index b9c4edaf2b..ef2739f321 100644 --- a/xml/schema/Price/PriceField.xml +++ b/xml/schema/Price/PriceField.xml @@ -95,6 +95,7 @@ Price Field Quantity Required? boolean 0 + true Enter a quantity for this field? 1.8 @@ -143,6 +144,7 @@ Price Field Show Amounts? boolean 1 + true Should the price be displayed next to the label for each option? CheckBox @@ -165,6 +167,7 @@ boolean Is this price field active 1 + true 1.8 CheckBox @@ -176,6 +179,7 @@ boolean Is this price field required (value must be > 1) 1 + true 1.8 CheckBox diff --git a/xml/schema/Price/PriceFieldValue.xml b/xml/schema/Price/PriceFieldValue.xml index 8563ea3c2d..28338f8aa7 100644 --- a/xml/schema/Price/PriceFieldValue.xml +++ b/xml/schema/Price/PriceFieldValue.xml @@ -187,6 +187,7 @@ boolean Is this default price field option 0 + true 3.3 CheckBox @@ -198,6 +199,7 @@ boolean Is this price field value active 1 + true 3.3 diff --git a/xml/schema/Price/PriceSet.xml b/xml/schema/Price/PriceSet.xml index 89d168abf0..408b43d7b2 100644 --- a/xml/schema/Price/PriceSet.xml +++ b/xml/schema/Price/PriceSet.xml @@ -81,6 +81,7 @@ Price Set Is Active? boolean 1 + true Is this price set active 1.8 @@ -170,6 +171,7 @@ Is Price Set Quick Config? boolean 0 + true Is set if edited on Contribution or Event Page rather than through Manage Price Sets CheckBox @@ -181,6 +183,7 @@ Price Set Is Reserved boolean 0 + true Is this a predefined system price set (i.e. it can not be deleted, edited)? 4.2 -- 2.25.1