Merge pull request #19525 from eileenmcnaughton/member_soft
[civicrm-core.git] / CRM / Core / DAO / PrintLabel.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/PrintLabel.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2cbbebe8 9 * (GenCodeChecksum:2323b196d63227f434ca565ff6b21207)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PrintLabel entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.4';
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_print_label';
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 33 /**
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b 38 /**
01d214aa 39 * User title for this label layout
e501603b
TO
40 *
41 * @var string
42 */
43 public $title;
c3fc2621 44
e501603b
TO
45 /**
46 * variable name/programmatic handle for this field.
47 *
48 * @var string
49 */
50 public $name;
c3fc2621 51
e501603b
TO
52 /**
53 * Description of this label layout
54 *
55 * @var text
56 */
57 public $description;
c3fc2621 58
e501603b
TO
59 /**
60 * This refers to name column of civicrm_option_value row in name_badge option group
61 *
62 * @var string
63 */
64 public $label_format_name;
c3fc2621 65
e501603b
TO
66 /**
67 * Implicit FK to civicrm_option_value row in NEW label_type option group
68 *
e6ca0a57 69 * @var int
e501603b
TO
70 */
71 public $label_type_id;
c3fc2621 72
e501603b
TO
73 /**
74 * contains json encode configurations options
75 *
76 * @var longtext
77 */
78 public $data;
c3fc2621 79
e501603b
TO
80 /**
81 * Is this default?
82 *
e6ca0a57 83 * @var bool
e501603b
TO
84 */
85 public $is_default;
c3fc2621 86
e501603b
TO
87 /**
88 * Is this option active?
89 *
e6ca0a57 90 * @var bool
e501603b
TO
91 */
92 public $is_active;
c3fc2621 93
e501603b
TO
94 /**
95 * Is this reserved label?
96 *
e6ca0a57 97 * @var bool
e501603b
TO
98 */
99 public $is_reserved;
c3fc2621 100
e501603b
TO
101 /**
102 * FK to civicrm_contact, who created this label layout
103 *
e6ca0a57 104 * @var int
e501603b
TO
105 */
106 public $created_id;
c3fc2621 107
e501603b 108 /**
f41f0342 109 * Class constructor.
e501603b 110 */
c3fc2621 111 public function __construct() {
e501603b
TO
112 $this->__table = 'civicrm_print_label';
113 parent::__construct();
114 }
c3fc2621 115
449c4e6b
CW
116 /**
117 * Returns localized title of this entity.
7b66c3b5
AH
118 *
119 * @param bool $plural
120 * Whether to return the plural version of the title.
449c4e6b 121 */
7b66c3b5
AH
122 public static function getEntityTitle($plural = FALSE) {
123 return $plural ? ts('Print Labels') : ts('Print Label');
449c4e6b
CW
124 }
125
e501603b 126 /**
f41f0342 127 * Returns foreign keys and entity references.
e501603b
TO
128 *
129 * @return array
130 * [CRM_Core_Reference_Interface]
131 */
c3fc2621 132 public static function getReferenceColumns() {
346aaaba 133 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 134 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 135 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
346aaaba 136 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 137 }
346aaaba 138 return Civi::$statics[__CLASS__]['links'];
e501603b 139 }
c3fc2621 140
e501603b
TO
141 /**
142 * Returns all the column names of this table
143 *
144 * @return array
145 */
c3fc2621 146 public static function &fields() {
346aaaba 147 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
148 Civi::$statics[__CLASS__]['fields'] = [
149 'id' => [
e501603b
TO
150 'name' => 'id',
151 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
152 'title' => ts('Print Label ID'),
153 'required' => TRUE,
a36434b9 154 'where' => 'civicrm_print_label.id',
522a26c9 155 'table_name' => 'civicrm_print_label',
156 'entity' => 'PrintLabel',
157 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 158 'localizable' => 0,
2cbbebe8
A
159 'html' => [
160 'type' => 'Number',
161 ],
a9d0587b 162 'add' => '4.4',
c3fc2621
CW
163 ],
164 'title' => [
e501603b
TO
165 'name' => 'title',
166 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 167 'title' => ts('Title'),
01d214aa 168 'description' => ts('User title for this label layout'),
e501603b
TO
169 'maxlength' => 255,
170 'size' => CRM_Utils_Type::HUGE,
a36434b9 171 'where' => 'civicrm_print_label.title',
522a26c9 172 'table_name' => 'civicrm_print_label',
173 'entity' => 'PrintLabel',
174 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 175 'localizable' => 0,
a9d0587b 176 'add' => '4.4',
c3fc2621
CW
177 ],
178 'name' => [
e501603b
TO
179 'name' => 'name',
180 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 181 'title' => ts('Name'),
215b423e 182 'description' => ts('variable name/programmatic handle for this field.'),
e501603b
TO
183 'maxlength' => 255,
184 'size' => CRM_Utils_Type::HUGE,
a36434b9 185 'where' => 'civicrm_print_label.name',
522a26c9 186 'table_name' => 'civicrm_print_label',
187 'entity' => 'PrintLabel',
188 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 189 'localizable' => 0,
a9d0587b 190 'add' => '4.4',
c3fc2621
CW
191 ],
192 'description' => [
e501603b
TO
193 'name' => 'description',
194 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 195 'title' => ts('Description'),
215b423e 196 'description' => ts('Description of this label layout'),
a36434b9 197 'where' => 'civicrm_print_label.description',
522a26c9 198 'table_name' => 'civicrm_print_label',
199 'entity' => 'PrintLabel',
200 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 201 'localizable' => 0,
a9d0587b 202 'add' => '4.4',
c3fc2621
CW
203 ],
204 'label_format_name' => [
e501603b
TO
205 'name' => 'label_format_name',
206 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 207 'title' => ts('Label Format'),
215b423e 208 'description' => ts('This refers to name column of civicrm_option_value row in name_badge option group'),
e501603b
TO
209 'maxlength' => 255,
210 'size' => CRM_Utils_Type::HUGE,
a36434b9 211 'where' => 'civicrm_print_label.label_format_name',
522a26c9 212 'table_name' => 'civicrm_print_label',
213 'entity' => 'PrintLabel',
214 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 215 'localizable' => 0,
c3fc2621 216 'html' => [
e501603b 217 'type' => 'Select',
c3fc2621
CW
218 ],
219 'pseudoconstant' => [
e501603b
TO
220 'optionGroupName' => 'name_badge',
221 'optionEditPath' => 'civicrm/admin/options/name_badge',
e6ca0a57 222 ],
a9d0587b 223 'add' => '4.4',
c3fc2621
CW
224 ],
225 'label_type_id' => [
e501603b
TO
226 'name' => 'label_type_id',
227 'type' => CRM_Utils_Type::T_INT,
c3fc2621 228 'title' => ts('Label Type'),
215b423e 229 'description' => ts('Implicit FK to civicrm_option_value row in NEW label_type option group'),
a36434b9 230 'where' => 'civicrm_print_label.label_type_id',
522a26c9 231 'table_name' => 'civicrm_print_label',
232 'entity' => 'PrintLabel',
233 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 234 'localizable' => 0,
c3fc2621 235 'html' => [
e501603b 236 'type' => 'Select',
c3fc2621
CW
237 ],
238 'pseudoconstant' => [
e501603b
TO
239 'optionGroupName' => 'label_type',
240 'optionEditPath' => 'civicrm/admin/options/label_type',
e6ca0a57 241 ],
a9d0587b 242 'add' => '4.4',
c3fc2621
CW
243 ],
244 'data' => [
e501603b
TO
245 'name' => 'data',
246 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 247 'title' => ts('Data'),
215b423e 248 'description' => ts('contains json encode configurations options'),
a36434b9 249 'where' => 'civicrm_print_label.data',
522a26c9 250 'table_name' => 'civicrm_print_label',
251 'entity' => 'PrintLabel',
252 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 253 'localizable' => 0,
2a5c9b4d 254 'serialize' => self::SERIALIZE_JSON,
a9d0587b 255 'add' => '4.4',
c3fc2621
CW
256 ],
257 'is_default' => [
e501603b
TO
258 'name' => 'is_default',
259 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 260 'title' => ts('Label is Default?'),
215b423e 261 'description' => ts('Is this default?'),
a36434b9 262 'where' => 'civicrm_print_label.is_default',
e501603b 263 'default' => '1',
522a26c9 264 'table_name' => 'civicrm_print_label',
265 'entity' => 'PrintLabel',
266 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 267 'localizable' => 0,
a9d0587b 268 'add' => '4.4',
c3fc2621
CW
269 ],
270 'is_active' => [
e501603b
TO
271 'name' => 'is_active',
272 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 273 'title' => ts('Label Is Active?'),
215b423e 274 'description' => ts('Is this option active?'),
a36434b9 275 'where' => 'civicrm_print_label.is_active',
e501603b 276 'default' => '1',
522a26c9 277 'table_name' => 'civicrm_print_label',
278 'entity' => 'PrintLabel',
279 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 280 'localizable' => 0,
a9d0587b 281 'add' => '4.4',
c3fc2621
CW
282 ],
283 'is_reserved' => [
e501603b
TO
284 'name' => 'is_reserved',
285 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 286 'title' => ts('Is Label Reserved?'),
215b423e 287 'description' => ts('Is this reserved label?'),
a36434b9 288 'where' => 'civicrm_print_label.is_reserved',
e501603b 289 'default' => '1',
522a26c9 290 'table_name' => 'civicrm_print_label',
291 'entity' => 'PrintLabel',
292 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 293 'localizable' => 0,
a9d0587b 294 'add' => '4.4',
c3fc2621
CW
295 ],
296 'created_id' => [
e501603b
TO
297 'name' => 'created_id',
298 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 299 'title' => ts('Created By Contact ID'),
215b423e 300 'description' => ts('FK to civicrm_contact, who created this label layout'),
a36434b9 301 'where' => 'civicrm_print_label.created_id',
522a26c9 302 'table_name' => 'civicrm_print_label',
303 'entity' => 'PrintLabel',
304 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 305 'localizable' => 0,
e501603b 306 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
307 'html' => [
308 'label' => ts("Created By Contact"),
309 ],
a9d0587b 310 'add' => '4.4',
c3fc2621
CW
311 ],
312 ];
346aaaba 313 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 314 }
346aaaba 315 return Civi::$statics[__CLASS__]['fields'];
e501603b 316 }
c3fc2621 317
e501603b 318 /**
bd8e0b14 319 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
320 *
321 * @return array
bd8e0b14 322 * Array(string $name => string $uniqueName).
e501603b 323 */
c3fc2621 324 public static function &fieldKeys() {
bd8e0b14
TO
325 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
326 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 327 }
bd8e0b14 328 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 329 }
c3fc2621 330
e501603b
TO
331 /**
332 * Returns the names of this table
333 *
334 * @return string
335 */
c3fc2621 336 public static function getTableName() {
e501603b
TO
337 return self::$_tableName;
338 }
c3fc2621 339
e501603b
TO
340 /**
341 * Returns if this table needs to be logged
342 *
c3fc2621 343 * @return bool
e501603b 344 */
c3fc2621 345 public function getLog() {
e501603b
TO
346 return self::$_log;
347 }
c3fc2621 348
e501603b
TO
349 /**
350 * Returns the list of fields that can be imported
351 *
352 * @param bool $prefix
353 *
354 * @return array
355 */
c3fc2621
CW
356 public static function &import($prefix = FALSE) {
357 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'print_label', $prefix, []);
60808919 358 return $r;
e501603b 359 }
c3fc2621 360
e501603b
TO
361 /**
362 * Returns the list of fields that can be exported
363 *
364 * @param bool $prefix
365 *
366 * @return array
367 */
c3fc2621
CW
368 public static function &export($prefix = FALSE) {
369 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'print_label', $prefix, []);
60808919 370 return $r;
e501603b 371 }
c3fc2621 372
e7a6b91a
AS
373 /**
374 * Returns the list of indices
c3fc2621
CW
375 *
376 * @param bool $localize
377 *
378 * @return array
e7a6b91a
AS
379 */
380 public static function indices($localize = TRUE) {
c3fc2621 381 $indices = [];
e7a6b91a
AS
382 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
383 }
c3fc2621 384
e501603b 385}