Skip to content

Commit

Permalink
UserJob - Add property is_template
Browse files Browse the repository at this point in the history
Eileen requested, and it's easiest to add now, and it seems safe+consistent.
  • Loading branch information
totten committed Jun 9, 2022
1 parent b656ba0 commit 77b7441
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
29 changes: 28 additions & 1 deletion CRM/Core/DAO/UserJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/UserJob.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:58e6fcaa028d157bfa074a073111239d)
* (GenCodeChecksum:fc2efbbf7b26018fe3dff0cda44ffa28)
*/

/**
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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']);
}
Expand Down
2 changes: 2 additions & 0 deletions CRM/Upgrade/Incremental/php/FiveFiftyOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
13 changes: 13 additions & 0 deletions xml/schema/Core/UserJob.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,17 @@
<serialize>JSON</serialize>
<add>5.50</add>
</field>
<field>
<name>is_template</name>
<title>Is Template</title>
<type>boolean</type>
<required>true</required>
<default>0</default>
<comment>Is this a template configuration (for use by other/future jobs)?</comment>
<html>
<type>CheckBox</type>
<label>Is Template</label>
</html>
<add>5.51</add>
</field>
</table>

0 comments on commit 77b7441

Please sign in to comment.