Schema - Fix boolean fields in 'Price'
authorMonish Deb <monish.deb@jmaconsulting.biz>
Fri, 8 Apr 2022 01:12:17 +0000 (18:12 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 8 Apr 2022 01:12:17 +0000 (18:12 -0700)
CRM/Price/DAO/PriceField.php
CRM/Price/DAO/PriceFieldValue.php
CRM/Price/DAO/PriceSet.php
CRM/Upgrade/Incremental/php/FiveFortyNine/Price.bool.php [new file with mode: 0644]
xml/schema/Price/PriceField.xml
xml/schema/Price/PriceFieldValue.xml
xml/schema/Price/PriceSet.xml

index 809ccf6d487a69dfd4be9259f2f0b2e4f2a3a1fe..13a15de67e710f2b4d93eb833d28778e0f9606bb 100644 (file)
@@ -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',
index 0eb232139db48131bfaaf2a856ca515660f56c97..fc0642b78defc67dafb715129f7e5b0db4cb7e4b 100644 (file)
@@ -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',
index e434d718b568bb9ba769ded8a8a865f83f9e737f..d9006795a2f340ba5e456e5d968561778dd4ab3b 100644 (file)
@@ -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 (file)
index 0000000..9f453ab
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+return [
+  'civicrm_price_set' => [
+    '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'",
+  ],
+];
index b9c4edaf2b8d1f93b5a1b3994b470a6a37e29341..ef2739f321ac3b03b91799782f226a5c3d2abf07 100644 (file)
@@ -95,6 +95,7 @@
     <title>Price Field Quantity Required?</title>
     <type>boolean</type>
     <default>0</default>
+    <required>true</required>
     <comment>Enter a quantity for this field?</comment>
     <add>1.8</add>
     <html>
     <title>Price Field Show Amounts?</title>
     <type>boolean</type>
     <default>1</default>
+    <required>true</required>
     <comment>Should the price be displayed next to the label for each option?</comment>
     <html>
       <type>CheckBox</type>
     <type>boolean</type>
     <comment>Is this price field active</comment>
     <default>1</default>
+    <required>true</required>
     <add>1.8</add>
     <html>
       <type>CheckBox</type>
     <type>boolean</type>
     <comment>Is this price field required (value must be > 1)</comment>
     <default>1</default>
+    <required>true</required>
     <add>1.8</add>
     <html>
       <type>CheckBox</type>
index 8563ea3c2d48454a02c52d257cb375f7291ec0a8..28338f8aa7b0c8cce1682652d8d0d07a27de0296 100644 (file)
     <type>boolean</type>
     <comment>Is this default price field option</comment>
     <default>0</default>
+    <required>true</required>
     <add>3.3</add>
     <html>
       <type>CheckBox</type>
     <type>boolean</type>
     <comment>Is this price field value active</comment>
     <default>1</default>
+    <required>true</required>
     <add>3.3</add>
   </field>
   <field>
index 89d168abf0e7e91ffc7b5147a26c9d532e07aeb4..408b43d7b23411948241972c1208b4d927821821 100644 (file)
@@ -81,6 +81,7 @@
     <title>Price Set Is Active?</title>
     <type>boolean</type>
     <default>1</default>
+    <required>true</required>
     <comment>Is this price set active</comment>
     <add>1.8</add>
     <html>
     <title>Is Price Set Quick Config?</title>
     <type>boolean</type>
     <default>0</default>
+    <required>true</required>
     <comment>Is set if edited on Contribution or Event Page rather than through Manage Price Sets</comment>
     <html>
       <type>CheckBox</type>
     <title>Price Set Is Reserved</title>
     <type>boolean</type>
     <default>0</default>
+    <required>true</required>
     <comment>Is this a predefined system price set  (i.e. it can not be deleted, edited)?</comment>
     <add>4.2</add>
     <html>