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