Merge pull request #22992 from eileenmcnaughton/billingnot
[civicrm-core.git] / CRM / Core / DAO / MessageTemplate.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/MessageTemplate.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:1fba7635baeb10d95b90c02ca4ea99c6)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MessageTemplate entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.6';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_msg_template';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b
TO
33 /**
34 * Message Template ID
35 *
28979d65
CW
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
e501603b
TO
39 */
40 public $id;
c3fc2621 41
e501603b
TO
42 /**
43 * Descriptive title of message
44 *
28979d65
CW
45 * @var string|null
46 * (SQL type: varchar(255))
47 * Note that values will be retrieved from the database as a string.
e501603b
TO
48 */
49 public $msg_title;
c3fc2621 50
e501603b
TO
51 /**
52 * Subject for email message.
53 *
28979d65
CW
54 * @var string|null
55 * (SQL type: text)
56 * Note that values will be retrieved from the database as a string.
e501603b
TO
57 */
58 public $msg_subject;
c3fc2621 59
e501603b
TO
60 /**
61 * Text formatted message
62 *
28979d65
CW
63 * @var string|null
64 * (SQL type: longtext)
65 * Note that values will be retrieved from the database as a string.
e501603b
TO
66 */
67 public $msg_text;
c3fc2621 68
e501603b
TO
69 /**
70 * HTML formatted message
71 *
28979d65
CW
72 * @var string|null
73 * (SQL type: longtext)
74 * Note that values will be retrieved from the database as a string.
e501603b
TO
75 */
76 public $msg_html;
c3fc2621 77
e501603b 78 /**
28979d65
CW
79 * @var bool|string|null
80 * (SQL type: tinyint)
81 * Note that values will be retrieved from the database as a string.
e501603b
TO
82 */
83 public $is_active;
c3fc2621 84
e501603b
TO
85 /**
86 * a pseudo-FK to civicrm_option_value
87 *
28979d65
CW
88 * @var int|string|null
89 * (SQL type: int unsigned)
90 * Note that values will be retrieved from the database as a string.
e501603b
TO
91 */
92 public $workflow_id;
c3fc2621 93
c4d7103b 94 /**
28979d65
CW
95 * @var string|null
96 * (SQL type: varchar(255))
97 * Note that values will be retrieved from the database as a string.
c4d7103b 98 */
99 public $workflow_name;
100
e501603b
TO
101 /**
102 * is this the default message template for the workflow referenced by workflow_id?
103 *
28979d65
CW
104 * @var bool|string|null
105 * (SQL type: tinyint)
106 * Note that values will be retrieved from the database as a string.
e501603b
TO
107 */
108 public $is_default;
c3fc2621 109
e501603b
TO
110 /**
111 * is this the reserved message template which we ship for the workflow referenced by workflow_id?
112 *
28979d65
CW
113 * @var bool|string|null
114 * (SQL type: tinyint)
115 * Note that values will be retrieved from the database as a string.
e501603b
TO
116 */
117 public $is_reserved;
c3fc2621 118
e501603b
TO
119 /**
120 * Is this message template used for sms?
121 *
28979d65
CW
122 * @var bool|string|null
123 * (SQL type: tinyint)
124 * Note that values will be retrieved from the database as a string.
e501603b
TO
125 */
126 public $is_sms;
c3fc2621 127
e501603b
TO
128 /**
129 * a pseudo-FK to civicrm_option_value containing PDF Page Format.
130 *
28979d65
CW
131 * @var int|string|null
132 * (SQL type: int unsigned)
133 * Note that values will be retrieved from the database as a string.
e501603b
TO
134 */
135 public $pdf_format_id;
c3fc2621 136
e501603b 137 /**
f41f0342 138 * Class constructor.
e501603b 139 */
c3fc2621 140 public function __construct() {
e501603b
TO
141 $this->__table = 'civicrm_msg_template';
142 parent::__construct();
143 }
c3fc2621 144
449c4e6b
CW
145 /**
146 * Returns localized title of this entity.
7b66c3b5
AH
147 *
148 * @param bool $plural
149 * Whether to return the plural version of the title.
449c4e6b 150 */
7b66c3b5
AH
151 public static function getEntityTitle($plural = FALSE) {
152 return $plural ? ts('Message Templates') : ts('Message Template');
449c4e6b
CW
153 }
154
e501603b
TO
155 /**
156 * Returns all the column names of this table
157 *
158 * @return array
159 */
c3fc2621 160 public static function &fields() {
346aaaba 161 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
162 Civi::$statics[__CLASS__]['fields'] = [
163 'id' => [
e501603b
TO
164 'name' => 'id',
165 'type' => CRM_Utils_Type::T_INT,
c3fc2621 166 'title' => ts('Message Template ID'),
215b423e 167 'description' => ts('Message Template ID'),
c3fc2621 168 'required' => TRUE,
a36434b9 169 'where' => 'civicrm_msg_template.id',
522a26c9 170 'table_name' => 'civicrm_msg_template',
171 'entity' => 'MessageTemplate',
172 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 173 'localizable' => 0,
2cbbebe8
A
174 'html' => [
175 'type' => 'Number',
176 ],
1fe423d6 177 'readonly' => TRUE,
a9d0587b 178 'add' => '1.6',
c3fc2621
CW
179 ],
180 'msg_title' => [
e501603b
TO
181 'name' => 'msg_title',
182 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 183 'title' => ts('Message Template Title'),
215b423e 184 'description' => ts('Descriptive title of message'),
e501603b
TO
185 'maxlength' => 255,
186 'size' => CRM_Utils_Type::HUGE,
a36434b9 187 'where' => 'civicrm_msg_template.msg_title',
522a26c9 188 'table_name' => 'civicrm_msg_template',
189 'entity' => 'MessageTemplate',
190 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 191 'localizable' => 0,
a9d0587b 192 'add' => '1.6',
c3fc2621
CW
193 ],
194 'msg_subject' => [
e501603b
TO
195 'name' => 'msg_subject',
196 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 197 'title' => ts('Message Template Subject'),
215b423e 198 'description' => ts('Subject for email message.'),
a36434b9 199 'where' => 'civicrm_msg_template.msg_subject',
522a26c9 200 'table_name' => 'civicrm_msg_template',
201 'entity' => 'MessageTemplate',
202 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 203 'localizable' => 0,
a9d0587b 204 'add' => '1.6',
c3fc2621
CW
205 ],
206 'msg_text' => [
e501603b
TO
207 'name' => 'msg_text',
208 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 209 'title' => ts('Message Template Text'),
215b423e 210 'description' => ts('Text formatted message'),
a36434b9 211 'where' => 'civicrm_msg_template.msg_text',
522a26c9 212 'table_name' => 'civicrm_msg_template',
213 'entity' => 'MessageTemplate',
214 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 215 'localizable' => 0,
c3fc2621 216 'html' => [
e501603b 217 'type' => 'TextArea',
c3fc2621 218 ],
a9d0587b 219 'add' => '1.6',
c3fc2621
CW
220 ],
221 'msg_html' => [
e501603b
TO
222 'name' => 'msg_html',
223 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 224 'title' => ts('Message Template HTML'),
215b423e 225 'description' => ts('HTML formatted message'),
a36434b9 226 'where' => 'civicrm_msg_template.msg_html',
522a26c9 227 'table_name' => 'civicrm_msg_template',
228 'entity' => 'MessageTemplate',
229 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 230 'localizable' => 0,
c3fc2621 231 'html' => [
e501603b 232 'type' => 'RichTextEditor',
c3fc2621 233 ],
a9d0587b 234 'add' => '1.6',
c3fc2621
CW
235 ],
236 'is_active' => [
e501603b
TO
237 'name' => 'is_active',
238 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 239 'title' => ts('Is Active'),
a36434b9 240 'where' => 'civicrm_msg_template.is_active',
e501603b 241 'default' => '1',
522a26c9 242 'table_name' => 'civicrm_msg_template',
243 'entity' => 'MessageTemplate',
244 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 245 'localizable' => 0,
a9d0587b 246 'add' => '1.6',
c3fc2621
CW
247 ],
248 'workflow_id' => [
e501603b
TO
249 'name' => 'workflow_id',
250 'type' => CRM_Utils_Type::T_INT,
c4d7103b 251 'title' => ts('Deprecated field for Message Template Workflow.'),
215b423e 252 'description' => ts('a pseudo-FK to civicrm_option_value'),
a36434b9 253 'where' => 'civicrm_msg_template.workflow_id',
522a26c9 254 'table_name' => 'civicrm_msg_template',
255 'entity' => 'MessageTemplate',
256 'bao' => 'CRM_Core_BAO_MessageTemplate',
c4d7103b 257 'localizable' => 0,
a9d0587b 258 'add' => '3.1',
c4d7103b 259 ],
260 'workflow_name' => [
261 'name' => 'workflow_name',
262 'type' => CRM_Utils_Type::T_STRING,
263 'title' => ts('Message Template Workflow Name'),
264 'maxlength' => 255,
265 'size' => CRM_Utils_Type::HUGE,
266 'where' => 'civicrm_msg_template.workflow_name',
267 'table_name' => 'civicrm_msg_template',
268 'entity' => 'MessageTemplate',
269 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 270 'localizable' => 0,
a9d0587b 271 'add' => '5.26',
c3fc2621
CW
272 ],
273 'is_default' => [
e501603b
TO
274 'name' => 'is_default',
275 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 276 'title' => ts('Message Template Is Default?'),
215b423e 277 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
a36434b9 278 'where' => 'civicrm_msg_template.is_default',
e501603b 279 'default' => '1',
522a26c9 280 'table_name' => 'civicrm_msg_template',
281 'entity' => 'MessageTemplate',
282 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 283 'localizable' => 0,
a9d0587b 284 'add' => '3.1',
c3fc2621
CW
285 ],
286 'is_reserved' => [
e501603b
TO
287 'name' => 'is_reserved',
288 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 289 'title' => ts('Message Template Is Reserved?'),
215b423e 290 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
a36434b9 291 'where' => 'civicrm_msg_template.is_reserved',
4dbadd81 292 'default' => '0',
522a26c9 293 'table_name' => 'civicrm_msg_template',
294 'entity' => 'MessageTemplate',
295 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 296 'localizable' => 0,
a9d0587b 297 'add' => '3.1',
c3fc2621
CW
298 ],
299 'is_sms' => [
e501603b
TO
300 'name' => 'is_sms',
301 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 302 'title' => ts('Message Template is used for SMS?'),
215b423e 303 'description' => ts('Is this message template used for sms?'),
a36434b9 304 'where' => 'civicrm_msg_template.is_sms',
45a83e42 305 'default' => '0',
522a26c9 306 'table_name' => 'civicrm_msg_template',
307 'entity' => 'MessageTemplate',
308 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 309 'localizable' => 0,
a9d0587b 310 'add' => '4.5',
c3fc2621
CW
311 ],
312 'pdf_format_id' => [
e501603b
TO
313 'name' => 'pdf_format_id',
314 'type' => CRM_Utils_Type::T_INT,
c3fc2621 315 'title' => ts('Message Template Format'),
215b423e 316 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
a36434b9 317 'where' => 'civicrm_msg_template.pdf_format_id',
522a26c9 318 'table_name' => 'civicrm_msg_template',
319 'entity' => 'MessageTemplate',
320 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 321 'localizable' => 0,
c3fc2621 322 'pseudoconstant' => [
e501603b
TO
323 'optionGroupName' => 'pdf_format',
324 'keyColumn' => 'id',
325 'optionEditPath' => 'civicrm/admin/options/pdf_format',
e6ca0a57 326 ],
a9d0587b 327 'add' => '3.4',
c3fc2621
CW
328 ],
329 ];
346aaaba 330 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 331 }
346aaaba 332 return Civi::$statics[__CLASS__]['fields'];
e501603b 333 }
c3fc2621 334
e501603b 335 /**
bd8e0b14 336 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
337 *
338 * @return array
bd8e0b14 339 * Array(string $name => string $uniqueName).
e501603b 340 */
c3fc2621 341 public static function &fieldKeys() {
bd8e0b14
TO
342 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
343 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 344 }
bd8e0b14 345 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 346 }
c3fc2621 347
e501603b
TO
348 /**
349 * Returns the names of this table
350 *
351 * @return string
352 */
c3fc2621 353 public static function getTableName() {
e501603b
TO
354 return self::$_tableName;
355 }
c3fc2621 356
e501603b
TO
357 /**
358 * Returns if this table needs to be logged
359 *
c3fc2621 360 * @return bool
e501603b 361 */
c3fc2621 362 public function getLog() {
e501603b
TO
363 return self::$_log;
364 }
c3fc2621 365
e501603b
TO
366 /**
367 * Returns the list of fields that can be imported
368 *
369 * @param bool $prefix
370 *
371 * @return array
372 */
c3fc2621
CW
373 public static function &import($prefix = FALSE) {
374 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []);
60808919 375 return $r;
e501603b 376 }
c3fc2621 377
e501603b
TO
378 /**
379 * Returns the list of fields that can be exported
380 *
381 * @param bool $prefix
382 *
383 * @return array
384 */
c3fc2621
CW
385 public static function &export($prefix = FALSE) {
386 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []);
60808919 387 return $r;
e501603b 388 }
c3fc2621 389
e7a6b91a
AS
390 /**
391 * Returns the list of indices
c3fc2621
CW
392 *
393 * @param bool $localize
394 *
395 * @return array
e7a6b91a
AS
396 */
397 public static function indices($localize = TRUE) {
c3fc2621 398 $indices = [];
e7a6b91a
AS
399 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
400 }
c3fc2621 401
e501603b 402}