From 77b7441a21f70f08d3e9f0e034d6e937c30a6136 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 9 Jun 2022 16:32:45 -0700 Subject: [PATCH] UserJob - Add property `is_template` Eileen requested, and it's easiest to add now, and it seems safe+consistent. --- CRM/Core/DAO/UserJob.php | 29 +++++++++++++++++++- CRM/Upgrade/Incremental/php/FiveFiftyOne.php | 2 ++ xml/schema/Core/UserJob.xml | 13 +++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/CRM/Core/DAO/UserJob.php b/CRM/Core/DAO/UserJob.php index ebe7e1ee75f1..cfa405500408 100644 --- a/CRM/Core/DAO/UserJob.php +++ b/CRM/Core/DAO/UserJob.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/UserJob.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:58e6fcaa028d157bfa074a073111239d) + * (GenCodeChecksum:fc2efbbf7b26018fe3dff0cda44ffa28) */ /** @@ -125,6 +125,15 @@ class CRM_Core_DAO_UserJob extends CRM_Core_DAO { */ public $metadata; + /** + * Is this a template configuration (for use by other/future jobs)? + * + * @var bool|string + * (SQL type: tinyint) + * Note that values will be retrieved from the database as a string. + */ + public $is_template; + /** * Class constructor. */ @@ -350,6 +359,24 @@ public static function &fields() { 'serialize' => self::SERIALIZE_JSON, 'add' => '5.50', ], + 'is_template' => [ + 'name' => 'is_template', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Template'), + 'description' => ts('Is this a template configuration (for use by other/future jobs)?'), + 'required' => TRUE, + 'where' => 'civicrm_user_job.is_template', + 'default' => '0', + 'table_name' => 'civicrm_user_job', + 'entity' => 'UserJob', + 'bao' => 'CRM_Core_BAO_UserJob', + 'localizable' => 0, + 'html' => [ + 'type' => 'CheckBox', + 'label' => ts("Is Template"), + ], + 'add' => '5.51', + ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } diff --git a/CRM/Upgrade/Incremental/php/FiveFiftyOne.php b/CRM/Upgrade/Incremental/php/FiveFiftyOne.php index a7246c2503a2..f8ae125bde98 100644 --- a/CRM/Upgrade/Incremental/php/FiveFiftyOne.php +++ b/CRM/Upgrade/Incremental/php/FiveFiftyOne.php @@ -38,6 +38,8 @@ public function upgrade_5_51_alpha1($rev): void { 'error', "varchar(16) NULL COMMENT 'Fallback behavior for unhandled errors'"); $this->addTask('Add column "civicrm_queue.is_template"', 'addColumn', 'civicrm_queue', 'is_template', "tinyint NOT NULL DEFAULT 0 COMMENT 'Is this a template configuration (for use by other/future queues)?'"); + $this->addTask('Add column "civicrm_user_job.is_template"', 'addColumn', 'civicrm_user_job', + 'is_template', "tinyint NOT NULL DEFAULT 0 COMMENT 'Is this a template configuration (for use by other/future jobs)?'"); $this->addTask('Backfill "civicrm_queue.status" and "civicrm_queue.error")', 'fillQueueColumns'); } diff --git a/xml/schema/Core/UserJob.xml b/xml/schema/Core/UserJob.xml index 0c8113e0c992..dd01a2e79184 100644 --- a/xml/schema/Core/UserJob.xml +++ b/xml/schema/Core/UserJob.xml @@ -153,4 +153,17 @@ JSON 5.50 + + is_template + Is Template + boolean + true + 0 + Is this a template configuration (for use by other/future jobs)? + + CheckBox + + + 5.51 +