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