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