From 32c7a805ace980c8c3dd633c572cec85768d9a9b 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 'Mailing' --- CRM/Mailing/DAO/Mailing.php | 31 +++++++++++++------ CRM/Mailing/DAO/MailingComponent.php | 9 ++++-- CRM/Mailing/DAO/MailingJob.php | 5 +-- .../php/FiveFortyNine/Mailing.bool.php | 19 ++++++++++++ xml/schema/Mailing/Component.xml | 3 ++ xml/schema/Mailing/Mailing.xml | 13 ++++++++ xml/schema/Mailing/MailingJob.xml | 1 + 7 files changed, 67 insertions(+), 14 deletions(-) create mode 100644 CRM/Upgrade/Incremental/php/FiveFortyNine/Mailing.bool.php diff --git a/CRM/Mailing/DAO/Mailing.php b/CRM/Mailing/DAO/Mailing.php index 219a8c9905..5345514b1f 100644 --- a/CRM/Mailing/DAO/Mailing.php +++ b/CRM/Mailing/DAO/Mailing.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Mailing.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:d9992e7d40fdab9d29f2a093e34aa1cb) + * (GenCodeChecksum:4144d565580335c15e750f73a73df644) */ /** @@ -209,7 +209,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Should we track URL click-throughs for this mailing? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -218,7 +218,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Should we forward replies back to the author? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -227,7 +227,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Should we enable the auto-responder? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -236,7 +236,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Should we track when recipients open/read this mailing? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -245,7 +245,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Has at least one job associated with this mailing finished? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -263,7 +263,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Overwrite the VERP address in Reply-To * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -353,7 +353,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Is this mailing archived? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -380,7 +380,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Remove duplicate emails? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -805,7 +805,9 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Url Tracking'), 'description' => ts('Should we track URL click-throughs for this mailing?'), + 'required' => TRUE, 'where' => 'civicrm_mailing.url_tracking', + 'default' => '0', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', @@ -821,7 +823,9 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Forward Replies'), 'description' => ts('Should we forward replies back to the author?'), + 'required' => TRUE, 'where' => 'civicrm_mailing.forward_replies', + 'default' => '0', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', @@ -837,7 +841,9 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Auto Responder'), 'description' => ts('Should we enable the auto-responder?'), + 'required' => TRUE, 'where' => 'civicrm_mailing.auto_responder', + 'default' => '0', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', @@ -853,7 +859,9 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Track Mailing?'), 'description' => ts('Should we track when recipients open/read this mailing?'), + 'required' => TRUE, 'where' => 'civicrm_mailing.open_tracking', + 'default' => '0', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', @@ -865,7 +873,9 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Mailing Completed'), 'description' => ts('Has at least one job associated with this mailing finished?'), + 'required' => TRUE, 'where' => 'civicrm_mailing.is_completed', + 'default' => '0', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', @@ -896,6 +906,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Override Verp'), 'description' => ts('Overwrite the VERP address in Reply-To'), + 'required' => TRUE, 'where' => 'civicrm_mailing.override_verp', 'default' => '0', 'table_name' => 'civicrm_mailing', @@ -1068,6 +1079,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Mailing Archived?'), 'description' => ts('Is this mailing archived?'), + 'required' => TRUE, 'where' => 'civicrm_mailing.is_archived', 'default' => '0', 'table_name' => 'civicrm_mailing', @@ -1129,6 +1141,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('No Duplicate emails?'), 'description' => ts('Remove duplicate emails?'), + 'required' => TRUE, 'where' => 'civicrm_mailing.dedupe_email', 'default' => '0', 'table_name' => 'civicrm_mailing', diff --git a/CRM/Mailing/DAO/MailingComponent.php b/CRM/Mailing/DAO/MailingComponent.php index 0f77ebdfb5..44509bb0e5 100644 --- a/CRM/Mailing/DAO/MailingComponent.php +++ b/CRM/Mailing/DAO/MailingComponent.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/MailingComponent.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:07a2027aee545a570c9fd99294f98d9a) + * (GenCodeChecksum:0714e4996da6d79fc972efe53df08a26) */ /** @@ -84,7 +84,7 @@ class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO { /** * Is this the default component for this component_type? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -93,7 +93,7 @@ class CRM_Mailing_DAO_MailingComponent 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. */ @@ -231,6 +231,7 @@ class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Mailing Component is Default?'), 'description' => ts('Is this the default component for this component_type?'), + 'required' => TRUE, 'where' => 'civicrm_mailing_component.is_default', 'default' => '0', 'table_name' => 'civicrm_mailing_component', @@ -244,7 +245,9 @@ class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Mailing Component Is Active?'), 'description' => ts('Is this property active?'), + 'required' => TRUE, 'where' => 'civicrm_mailing_component.is_active', + 'default' => '1', 'table_name' => 'civicrm_mailing_component', 'entity' => 'MailingComponent', 'bao' => 'CRM_Mailing_BAO_MailingComponent', diff --git a/CRM/Mailing/DAO/MailingJob.php b/CRM/Mailing/DAO/MailingJob.php index 3ba252d040..3f366c0dbc 100644 --- a/CRM/Mailing/DAO/MailingJob.php +++ b/CRM/Mailing/DAO/MailingJob.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/MailingJob.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:fdca7fda2701c59049924abfdb6adf3b) + * (GenCodeChecksum:492e51f255632b9c3d87714bc9ca0f4d) */ /** @@ -86,7 +86,7 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO { /** * Is this job for a test mail? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -283,6 +283,7 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Mailing Job Is Test?'), 'description' => ts('Is this job for a test mail?'), + 'required' => TRUE, 'where' => 'civicrm_mailing_job.is_test', 'default' => '0', 'table_name' => 'civicrm_mailing_job', diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine/Mailing.bool.php b/CRM/Upgrade/Incremental/php/FiveFortyNine/Mailing.bool.php new file mode 100644 index 0000000000..bb37d5c4f1 --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine/Mailing.bool.php @@ -0,0 +1,19 @@ + [ + 'url_tracking' => "DEFAULT 0 COMMENT 'Should we track URL click-throughs for this mailing?'", + 'forward_replies' => "DEFAULT 0 COMMENT 'Should we forward replies back to the author?'", + 'auto_responder' => "DEFAULT 0 COMMENT 'Should we enable the auto-responder?'", + 'open_tracking' => "DEFAULT 0 COMMENT 'Should we track when recipients open/read this mailing?'", + 'is_completed' => "DEFAULT 0 COMMENT 'Has at least one job associated with this mailing finished?'", + 'override_verp' => "DEFAULT 0 COMMENT 'Overwrite the VERP address in Reply-To'", + 'is_archived' => "DEFAULT 0 COMMENT 'Is this mailing archived?'", + 'dedupe_email' => "DEFAULT 0 COMMENT 'Remove duplicate emails?'", + ], + 'civicrm_mailing_job' => [ + 'is_test' => "DEFAULT 0 COMMENT 'Is this job for a test mail?'", + ], + 'civicrm_mailing_component' => [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this property active?'", + ], +]; diff --git a/xml/schema/Mailing/Component.xml b/xml/schema/Mailing/Component.xml index 54788c45ce..a716253366 100644 --- a/xml/schema/Mailing/Component.xml +++ b/xml/schema/Mailing/Component.xml @@ -74,12 +74,15 @@ Mailing Component is Default? boolean 0 + true Is this the default component for this component_type? is_active Mailing Component Is Active? boolean + true + 1 Is this property active? diff --git a/xml/schema/Mailing/Mailing.xml b/xml/schema/Mailing/Mailing.xml index f7a9ebb848..666cf4e29a 100644 --- a/xml/schema/Mailing/Mailing.xml +++ b/xml/schema/Mailing/Mailing.xml @@ -245,6 +245,8 @@ url_tracking boolean + 0 + true Should we track URL click-throughs for this mailing? CheckBox @@ -254,6 +256,8 @@ forward_replies boolean + 0 + true Should we forward replies back to the author? CheckBox @@ -263,6 +267,8 @@ auto_responder boolean + 0 + true Should we enable the auto-responder? CheckBox @@ -273,12 +279,16 @@ open_tracking Track Mailing? boolean + 0 + true Should we track when recipients open/read this mailing? is_completed Mailing Completed boolean + 0 + true Has at least one job associated with this mailing finished? CheckBox @@ -303,6 +313,7 @@ override_verp boolean 0 + true 2.2 Overwrite the VERP address in Reply-To @@ -436,6 +447,7 @@ boolean Is Mailing Archived? 0 + true Is this mailing archived? CheckBox @@ -486,6 +498,7 @@ boolean No Duplicate emails? 0 + true 4.1 Remove duplicate emails? diff --git a/xml/schema/Mailing/MailingJob.xml b/xml/schema/Mailing/MailingJob.xml index d657c80011..eb728a6aa0 100644 --- a/xml/schema/Mailing/MailingJob.xml +++ b/xml/schema/Mailing/MailingJob.xml @@ -93,6 +93,7 @@ Mailing Job Is Test? boolean 0 + true Is this job for a test mail? 1.9 -- 2.25.1