allow more log
[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
c1e814c7 9 * (GenCodeChecksum:a2e8de0828f836d42d4dcce19200ab27)
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 /**
c1e814c7 79 * @var bool|string
28979d65
CW
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 *
c1e814c7 104 * @var bool|string
28979d65
CW
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 *
c1e814c7 113 * @var bool|string
28979d65
CW
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 *
c1e814c7 122 * @var bool|string
28979d65
CW
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'),
c1e814c7 240 'required' => TRUE,
a36434b9 241 'where' => 'civicrm_msg_template.is_active',
e501603b 242 'default' => '1',
522a26c9 243 'table_name' => 'civicrm_msg_template',
244 'entity' => 'MessageTemplate',
245 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 246 'localizable' => 0,
a9d0587b 247 'add' => '1.6',
c3fc2621
CW
248 ],
249 'workflow_id' => [
e501603b
TO
250 'name' => 'workflow_id',
251 'type' => CRM_Utils_Type::T_INT,
c4d7103b 252 'title' => ts('Deprecated field for Message Template Workflow.'),
215b423e 253 'description' => ts('a pseudo-FK to civicrm_option_value'),
a36434b9 254 'where' => 'civicrm_msg_template.workflow_id',
522a26c9 255 'table_name' => 'civicrm_msg_template',
256 'entity' => 'MessageTemplate',
257 'bao' => 'CRM_Core_BAO_MessageTemplate',
c4d7103b 258 'localizable' => 0,
a9d0587b 259 'add' => '3.1',
c4d7103b 260 ],
261 'workflow_name' => [
262 'name' => 'workflow_name',
263 'type' => CRM_Utils_Type::T_STRING,
264 'title' => ts('Message Template Workflow Name'),
265 'maxlength' => 255,
266 'size' => CRM_Utils_Type::HUGE,
267 'where' => 'civicrm_msg_template.workflow_name',
268 'table_name' => 'civicrm_msg_template',
269 'entity' => 'MessageTemplate',
270 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 271 'localizable' => 0,
a9d0587b 272 'add' => '5.26',
c3fc2621
CW
273 ],
274 'is_default' => [
e501603b
TO
275 'name' => 'is_default',
276 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 277 'title' => ts('Message Template Is Default?'),
215b423e 278 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
c1e814c7 279 'required' => TRUE,
a36434b9 280 'where' => 'civicrm_msg_template.is_default',
e501603b 281 'default' => '1',
522a26c9 282 'table_name' => 'civicrm_msg_template',
283 'entity' => 'MessageTemplate',
284 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 285 'localizable' => 0,
a9d0587b 286 'add' => '3.1',
c3fc2621
CW
287 ],
288 'is_reserved' => [
e501603b
TO
289 'name' => 'is_reserved',
290 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 291 'title' => ts('Message Template Is Reserved?'),
215b423e 292 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
c1e814c7 293 'required' => TRUE,
a36434b9 294 'where' => 'civicrm_msg_template.is_reserved',
4dbadd81 295 'default' => '0',
522a26c9 296 'table_name' => 'civicrm_msg_template',
297 'entity' => 'MessageTemplate',
298 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 299 'localizable' => 0,
a9d0587b 300 'add' => '3.1',
c3fc2621
CW
301 ],
302 'is_sms' => [
e501603b
TO
303 'name' => 'is_sms',
304 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 305 'title' => ts('Message Template is used for SMS?'),
215b423e 306 'description' => ts('Is this message template used for sms?'),
c1e814c7 307 'required' => TRUE,
a36434b9 308 'where' => 'civicrm_msg_template.is_sms',
45a83e42 309 'default' => '0',
522a26c9 310 'table_name' => 'civicrm_msg_template',
311 'entity' => 'MessageTemplate',
312 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 313 'localizable' => 0,
a9d0587b 314 'add' => '4.5',
c3fc2621
CW
315 ],
316 'pdf_format_id' => [
e501603b
TO
317 'name' => 'pdf_format_id',
318 'type' => CRM_Utils_Type::T_INT,
c3fc2621 319 'title' => ts('Message Template Format'),
215b423e 320 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
a36434b9 321 'where' => 'civicrm_msg_template.pdf_format_id',
522a26c9 322 'table_name' => 'civicrm_msg_template',
323 'entity' => 'MessageTemplate',
324 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 325 'localizable' => 0,
c3fc2621 326 'pseudoconstant' => [
e501603b
TO
327 'optionGroupName' => 'pdf_format',
328 'keyColumn' => 'id',
329 'optionEditPath' => 'civicrm/admin/options/pdf_format',
e6ca0a57 330 ],
a9d0587b 331 'add' => '3.4',
c3fc2621
CW
332 ],
333 ];
346aaaba 334 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 335 }
346aaaba 336 return Civi::$statics[__CLASS__]['fields'];
e501603b 337 }
c3fc2621 338
e501603b 339 /**
bd8e0b14 340 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
341 *
342 * @return array
bd8e0b14 343 * Array(string $name => string $uniqueName).
e501603b 344 */
c3fc2621 345 public static function &fieldKeys() {
bd8e0b14
TO
346 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
347 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 348 }
bd8e0b14 349 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 350 }
c3fc2621 351
e501603b
TO
352 /**
353 * Returns the names of this table
354 *
355 * @return string
356 */
c3fc2621 357 public static function getTableName() {
e501603b
TO
358 return self::$_tableName;
359 }
c3fc2621 360
e501603b
TO
361 /**
362 * Returns if this table needs to be logged
363 *
c3fc2621 364 * @return bool
e501603b 365 */
c3fc2621 366 public function getLog() {
e501603b
TO
367 return self::$_log;
368 }
c3fc2621 369
e501603b
TO
370 /**
371 * Returns the list of fields that can be imported
372 *
373 * @param bool $prefix
374 *
375 * @return array
376 */
c3fc2621
CW
377 public static function &import($prefix = FALSE) {
378 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []);
60808919 379 return $r;
e501603b 380 }
c3fc2621 381
e501603b
TO
382 /**
383 * Returns the list of fields that can be exported
384 *
385 * @param bool $prefix
386 *
387 * @return array
388 */
c3fc2621
CW
389 public static function &export($prefix = FALSE) {
390 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []);
60808919 391 return $r;
e501603b 392 }
c3fc2621 393
e7a6b91a
AS
394 /**
395 * Returns the list of indices
c3fc2621
CW
396 *
397 * @param bool $localize
398 *
399 * @return array
e7a6b91a
AS
400 */
401 public static function indices($localize = TRUE) {
c3fc2621 402 $indices = [];
e7a6b91a
AS
403 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
404 }
c3fc2621 405
e501603b 406}