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