Merge pull request #19525 from eileenmcnaughton/member_soft
[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:6a15fab577959d8cea4613098356e03d)
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 'add' => '1.6',
154 ],
155 'msg_title' => [
156 'name' => 'msg_title',
157 'type' => CRM_Utils_Type::T_STRING,
158 'title' => ts('Message Template Title'),
159 'description' => ts('Descriptive title of message'),
160 'maxlength' => 255,
161 'size' => CRM_Utils_Type::HUGE,
162 'where' => 'civicrm_msg_template.msg_title',
163 'table_name' => 'civicrm_msg_template',
164 'entity' => 'MessageTemplate',
165 'bao' => 'CRM_Core_BAO_MessageTemplate',
166 'localizable' => 0,
167 'add' => '1.6',
168 ],
169 'msg_subject' => [
170 'name' => 'msg_subject',
171 'type' => CRM_Utils_Type::T_TEXT,
172 'title' => ts('Message Template Subject'),
173 'description' => ts('Subject for email message.'),
174 'where' => 'civicrm_msg_template.msg_subject',
175 'table_name' => 'civicrm_msg_template',
176 'entity' => 'MessageTemplate',
177 'bao' => 'CRM_Core_BAO_MessageTemplate',
178 'localizable' => 0,
179 'add' => '1.6',
180 ],
181 'msg_text' => [
182 'name' => 'msg_text',
183 'type' => CRM_Utils_Type::T_LONGTEXT,
184 'title' => ts('Message Template Text'),
185 'description' => ts('Text formatted message'),
186 'where' => 'civicrm_msg_template.msg_text',
187 'table_name' => 'civicrm_msg_template',
188 'entity' => 'MessageTemplate',
189 'bao' => 'CRM_Core_BAO_MessageTemplate',
190 'localizable' => 0,
191 'html' => [
192 'type' => 'TextArea',
193 ],
194 'add' => '1.6',
195 ],
196 'msg_html' => [
197 'name' => 'msg_html',
198 'type' => CRM_Utils_Type::T_LONGTEXT,
199 'title' => ts('Message Template HTML'),
200 'description' => ts('HTML formatted message'),
201 'where' => 'civicrm_msg_template.msg_html',
202 'table_name' => 'civicrm_msg_template',
203 'entity' => 'MessageTemplate',
204 'bao' => 'CRM_Core_BAO_MessageTemplate',
205 'localizable' => 0,
206 'html' => [
207 'type' => 'RichTextEditor',
208 ],
209 'add' => '1.6',
210 ],
211 'is_active' => [
212 'name' => 'is_active',
213 'type' => CRM_Utils_Type::T_BOOLEAN,
214 'title' => ts('Is Active'),
215 'where' => 'civicrm_msg_template.is_active',
216 'default' => '1',
217 'table_name' => 'civicrm_msg_template',
218 'entity' => 'MessageTemplate',
219 'bao' => 'CRM_Core_BAO_MessageTemplate',
220 'localizable' => 0,
221 'add' => '1.6',
222 ],
223 'workflow_id' => [
224 'name' => 'workflow_id',
225 'type' => CRM_Utils_Type::T_INT,
226 'title' => ts('Deprecated field for Message Template Workflow.'),
227 'description' => ts('a pseudo-FK to civicrm_option_value'),
228 'where' => 'civicrm_msg_template.workflow_id',
229 'table_name' => 'civicrm_msg_template',
230 'entity' => 'MessageTemplate',
231 'bao' => 'CRM_Core_BAO_MessageTemplate',
232 'localizable' => 0,
233 'add' => '3.1',
234 ],
235 'workflow_name' => [
236 'name' => 'workflow_name',
237 'type' => CRM_Utils_Type::T_STRING,
238 'title' => ts('Message Template Workflow Name'),
239 'maxlength' => 255,
240 'size' => CRM_Utils_Type::HUGE,
241 'where' => 'civicrm_msg_template.workflow_name',
242 'table_name' => 'civicrm_msg_template',
243 'entity' => 'MessageTemplate',
244 'bao' => 'CRM_Core_BAO_MessageTemplate',
245 'localizable' => 0,
246 'add' => '5.26',
247 ],
248 'is_default' => [
249 'name' => 'is_default',
250 'type' => CRM_Utils_Type::T_BOOLEAN,
251 'title' => ts('Message Template Is Default?'),
252 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
253 'where' => 'civicrm_msg_template.is_default',
254 'default' => '1',
255 'table_name' => 'civicrm_msg_template',
256 'entity' => 'MessageTemplate',
257 'bao' => 'CRM_Core_BAO_MessageTemplate',
258 'localizable' => 0,
259 'add' => '3.1',
260 ],
261 'is_reserved' => [
262 'name' => 'is_reserved',
263 'type' => CRM_Utils_Type::T_BOOLEAN,
264 'title' => ts('Message Template Is Reserved?'),
265 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
266 'where' => 'civicrm_msg_template.is_reserved',
267 'table_name' => 'civicrm_msg_template',
268 'entity' => 'MessageTemplate',
269 'bao' => 'CRM_Core_BAO_MessageTemplate',
270 'localizable' => 0,
271 'add' => '3.1',
272 ],
273 'is_sms' => [
274 'name' => 'is_sms',
275 'type' => CRM_Utils_Type::T_BOOLEAN,
276 'title' => ts('Message Template is used for SMS?'),
277 'description' => ts('Is this message template used for sms?'),
278 'where' => 'civicrm_msg_template.is_sms',
279 'default' => '0',
280 'table_name' => 'civicrm_msg_template',
281 'entity' => 'MessageTemplate',
282 'bao' => 'CRM_Core_BAO_MessageTemplate',
283 'localizable' => 0,
284 'add' => '4.5',
285 ],
286 'pdf_format_id' => [
287 'name' => 'pdf_format_id',
288 'type' => CRM_Utils_Type::T_INT,
289 'title' => ts('Message Template Format'),
290 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
291 'where' => 'civicrm_msg_template.pdf_format_id',
292 'table_name' => 'civicrm_msg_template',
293 'entity' => 'MessageTemplate',
294 'bao' => 'CRM_Core_BAO_MessageTemplate',
295 'localizable' => 0,
296 'pseudoconstant' => [
297 'optionGroupName' => 'pdf_format',
298 'keyColumn' => 'id',
299 'optionEditPath' => 'civicrm/admin/options/pdf_format',
300 ],
301 'add' => '3.4',
302 ],
303 ];
304 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
305 }
306 return Civi::$statics[__CLASS__]['fields'];
307 }
308
309 /**
310 * Return a mapping from field-name to the corresponding key (as used in fields()).
311 *
312 * @return array
313 * Array(string $name => string $uniqueName).
314 */
315 public static function &fieldKeys() {
316 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
317 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
318 }
319 return Civi::$statics[__CLASS__]['fieldKeys'];
320 }
321
322 /**
323 * Returns the names of this table
324 *
325 * @return string
326 */
327 public static function getTableName() {
328 return self::$_tableName;
329 }
330
331 /**
332 * Returns if this table needs to be logged
333 *
334 * @return bool
335 */
336 public function getLog() {
337 return self::$_log;
338 }
339
340 /**
341 * Returns the list of fields that can be imported
342 *
343 * @param bool $prefix
344 *
345 * @return array
346 */
347 public static function &import($prefix = FALSE) {
348 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []);
349 return $r;
350 }
351
352 /**
353 * Returns the list of fields that can be exported
354 *
355 * @param bool $prefix
356 *
357 * @return array
358 */
359 public static function &export($prefix = FALSE) {
360 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []);
361 return $r;
362 }
363
364 /**
365 * Returns the list of indices
366 *
367 * @param bool $localize
368 *
369 * @return array
370 */
371 public static function indices($localize = TRUE) {
372 $indices = [];
373 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
374 }
375
376 }