Commit | Line | Data |
---|---|---|
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/Contribute/Premium.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
7b66c3b5 | 9 | * (GenCodeChecksum:b35b6fb4895df990a55d9015bb82a852) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Premium entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contribute_DAO_Premium extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.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_premiums'; |
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 = TRUE; |
c3fc2621 | 32 | |
e501603b | 33 | /** |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Joins these premium settings to another object. Always civicrm_contribution_page for now. | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $entity_table; | |
c3fc2621 | 44 | |
e501603b | 45 | /** |
e6ca0a57 | 46 | * @var int |
e501603b TO |
47 | */ |
48 | public $entity_id; | |
c3fc2621 | 49 | |
e501603b TO |
50 | /** |
51 | * Is the Premiums feature enabled for this page? | |
52 | * | |
e6ca0a57 | 53 | * @var bool |
e501603b TO |
54 | */ |
55 | public $premiums_active; | |
c3fc2621 | 56 | |
e501603b TO |
57 | /** |
58 | * Title for Premiums section. | |
59 | * | |
60 | * @var string | |
61 | */ | |
62 | public $premiums_intro_title; | |
c3fc2621 | 63 | |
e501603b TO |
64 | /** |
65 | * Displayed in <div> at top of Premiums section of page. Text and HTML allowed. | |
66 | * | |
67 | * @var text | |
68 | */ | |
69 | public $premiums_intro_text; | |
c3fc2621 | 70 | |
e501603b TO |
71 | /** |
72 | * This email address is included in receipts if it is populated and a premium has been selected. | |
73 | * | |
74 | * @var string | |
75 | */ | |
76 | public $premiums_contact_email; | |
c3fc2621 | 77 | |
e501603b TO |
78 | /** |
79 | * This phone number is included in receipts if it is populated and a premium has been selected. | |
80 | * | |
81 | * @var string | |
82 | */ | |
83 | public $premiums_contact_phone; | |
c3fc2621 | 84 | |
e501603b TO |
85 | /** |
86 | * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions. | |
87 | * | |
e6ca0a57 | 88 | * @var bool |
e501603b TO |
89 | */ |
90 | public $premiums_display_min_contribution; | |
c3fc2621 | 91 | |
e501603b TO |
92 | /** |
93 | * Label displayed for No Thank-you option in premiums block (e.g. No thank you) | |
94 | * | |
95 | * @var string | |
96 | */ | |
97 | public $premiums_nothankyou_label; | |
c3fc2621 | 98 | |
e501603b | 99 | /** |
e6ca0a57 | 100 | * @var int |
e501603b TO |
101 | */ |
102 | public $premiums_nothankyou_position; | |
c3fc2621 | 103 | |
e501603b | 104 | /** |
f41f0342 | 105 | * Class constructor. |
e501603b | 106 | */ |
c3fc2621 | 107 | public function __construct() { |
e501603b TO |
108 | $this->__table = 'civicrm_premiums'; |
109 | parent::__construct(); | |
110 | } | |
c3fc2621 | 111 | |
449c4e6b CW |
112 | /** |
113 | * Returns localized title of this entity. | |
7b66c3b5 AH |
114 | * |
115 | * @param bool $plural | |
116 | * Whether to return the plural version of the title. | |
449c4e6b | 117 | */ |
7b66c3b5 AH |
118 | public static function getEntityTitle($plural = FALSE) { |
119 | return $plural ? ts('Premiums') : ts('Premium'); | |
449c4e6b CW |
120 | } |
121 | ||
e501603b | 122 | /** |
f41f0342 | 123 | * Returns foreign keys and entity references. |
e501603b TO |
124 | * |
125 | * @return array | |
126 | * [CRM_Core_Reference_Interface] | |
127 | */ | |
c3fc2621 | 128 | public static function getReferenceColumns() { |
346aaaba | 129 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 130 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 131 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); |
346aaaba | 132 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 133 | } |
346aaaba | 134 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 135 | } |
c3fc2621 | 136 | |
e501603b TO |
137 | /** |
138 | * Returns all the column names of this table | |
139 | * | |
140 | * @return array | |
141 | */ | |
c3fc2621 | 142 | public static function &fields() { |
346aaaba | 143 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
144 | Civi::$statics[__CLASS__]['fields'] = [ |
145 | 'id' => [ | |
e501603b TO |
146 | 'name' => 'id', |
147 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
148 | 'title' => ts('Premium ID'), |
149 | 'required' => TRUE, | |
a36434b9 | 150 | 'where' => 'civicrm_premiums.id', |
522a26c9 | 151 | 'table_name' => 'civicrm_premiums', |
152 | 'entity' => 'Premium', | |
153 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 154 | 'localizable' => 0, |
a9d0587b | 155 | 'add' => '1.4', |
c3fc2621 CW |
156 | ], |
157 | 'entity_table' => [ | |
e501603b TO |
158 | 'name' => 'entity_table', |
159 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 160 | 'title' => ts('Premium Entity'), |
215b423e | 161 | 'description' => ts('Joins these premium settings to another object. Always civicrm_contribution_page for now.'), |
c3fc2621 | 162 | 'required' => TRUE, |
e501603b TO |
163 | 'maxlength' => 64, |
164 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 165 | 'where' => 'civicrm_premiums.entity_table', |
522a26c9 | 166 | 'table_name' => 'civicrm_premiums', |
167 | 'entity' => 'Premium', | |
168 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 169 | 'localizable' => 0, |
a9d0587b | 170 | 'add' => '1.4', |
c3fc2621 CW |
171 | ], |
172 | 'entity_id' => [ | |
e501603b TO |
173 | 'name' => 'entity_id', |
174 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
175 | 'title' => ts('Premium entity ID'), |
176 | 'required' => TRUE, | |
a36434b9 | 177 | 'where' => 'civicrm_premiums.entity_id', |
522a26c9 | 178 | 'table_name' => 'civicrm_premiums', |
179 | 'entity' => 'Premium', | |
180 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 181 | 'localizable' => 0, |
a9d0587b | 182 | 'add' => '1.4', |
c3fc2621 CW |
183 | ], |
184 | 'premiums_active' => [ | |
e501603b TO |
185 | 'name' => 'premiums_active', |
186 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 187 | 'title' => ts('Is Premium Active?'), |
215b423e | 188 | 'description' => ts('Is the Premiums feature enabled for this page?'), |
c3fc2621 | 189 | 'required' => TRUE, |
a36434b9 | 190 | 'where' => 'civicrm_premiums.premiums_active', |
45a83e42 | 191 | 'default' => '0', |
522a26c9 | 192 | 'table_name' => 'civicrm_premiums', |
193 | 'entity' => 'Premium', | |
194 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 195 | 'localizable' => 0, |
a9d0587b | 196 | 'add' => '1.4', |
c3fc2621 CW |
197 | ], |
198 | 'premiums_intro_title' => [ | |
e501603b TO |
199 | 'name' => 'premiums_intro_title', |
200 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 201 | 'title' => ts('Title for Premiums section'), |
215b423e | 202 | 'description' => ts('Title for Premiums section.'), |
e501603b TO |
203 | 'maxlength' => 255, |
204 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 205 | 'where' => 'civicrm_premiums.premiums_intro_title', |
522a26c9 | 206 | 'table_name' => 'civicrm_premiums', |
207 | 'entity' => 'Premium', | |
208 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 209 | 'localizable' => 1, |
a9d0587b | 210 | 'add' => '1.4', |
c3fc2621 CW |
211 | ], |
212 | 'premiums_intro_text' => [ | |
e501603b TO |
213 | 'name' => 'premiums_intro_text', |
214 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 215 | 'title' => ts('Premium Introductory Text'), |
215b423e | 216 | 'description' => ts('Displayed in <div> at top of Premiums section of page. Text and HTML allowed.'), |
a36434b9 | 217 | 'where' => 'civicrm_premiums.premiums_intro_text', |
522a26c9 | 218 | 'table_name' => 'civicrm_premiums', |
219 | 'entity' => 'Premium', | |
220 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 221 | 'localizable' => 1, |
a9d0587b | 222 | 'add' => '1.4', |
c3fc2621 CW |
223 | ], |
224 | 'premiums_contact_email' => [ | |
e501603b TO |
225 | 'name' => 'premiums_contact_email', |
226 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 227 | 'title' => ts('Premium Contact Email'), |
215b423e | 228 | 'description' => ts('This email address is included in receipts if it is populated and a premium has been selected.'), |
e501603b TO |
229 | 'maxlength' => 100, |
230 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 231 | 'where' => 'civicrm_premiums.premiums_contact_email', |
522a26c9 | 232 | 'table_name' => 'civicrm_premiums', |
233 | 'entity' => 'Premium', | |
234 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 235 | 'localizable' => 0, |
a9d0587b | 236 | 'add' => '1.4', |
c3fc2621 CW |
237 | ], |
238 | 'premiums_contact_phone' => [ | |
e501603b TO |
239 | 'name' => 'premiums_contact_phone', |
240 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 241 | 'title' => ts('Premiums Contact Phone'), |
215b423e | 242 | 'description' => ts('This phone number is included in receipts if it is populated and a premium has been selected.'), |
e501603b TO |
243 | 'maxlength' => 50, |
244 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 245 | 'where' => 'civicrm_premiums.premiums_contact_phone', |
522a26c9 | 246 | 'table_name' => 'civicrm_premiums', |
247 | 'entity' => 'Premium', | |
248 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 249 | 'localizable' => 0, |
a9d0587b | 250 | 'add' => '1.4', |
c3fc2621 CW |
251 | ], |
252 | 'premiums_display_min_contribution' => [ | |
e501603b TO |
253 | 'name' => 'premiums_display_min_contribution', |
254 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 255 | 'title' => ts('Display Minimum Contribution?'), |
215b423e | 256 | 'description' => ts('Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.'), |
c3fc2621 | 257 | 'required' => TRUE, |
a36434b9 | 258 | 'where' => 'civicrm_premiums.premiums_display_min_contribution', |
522a26c9 | 259 | 'table_name' => 'civicrm_premiums', |
260 | 'entity' => 'Premium', | |
261 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 262 | 'localizable' => 0, |
a9d0587b | 263 | 'add' => '1.4', |
c3fc2621 CW |
264 | ], |
265 | 'premiums_nothankyou_label' => [ | |
e501603b TO |
266 | 'name' => 'premiums_nothankyou_label', |
267 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 268 | 'title' => ts('No Thank-you Text'), |
215b423e | 269 | 'description' => ts('Label displayed for No Thank-you option in premiums block (e.g. No thank you)'), |
e501603b TO |
270 | 'maxlength' => 255, |
271 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 272 | 'where' => 'civicrm_premiums.premiums_nothankyou_label', |
522a26c9 | 273 | 'table_name' => 'civicrm_premiums', |
274 | 'entity' => 'Premium', | |
275 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 276 | 'localizable' => 1, |
a9d0587b | 277 | 'add' => '4.3', |
c3fc2621 CW |
278 | ], |
279 | 'premiums_nothankyou_position' => [ | |
e501603b TO |
280 | 'name' => 'premiums_nothankyou_position', |
281 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 282 | 'title' => ts('No Thank-you Position'), |
a36434b9 | 283 | 'where' => 'civicrm_premiums.premiums_nothankyou_position', |
e501603b | 284 | 'default' => '1', |
522a26c9 | 285 | 'table_name' => 'civicrm_premiums', |
286 | 'entity' => 'Premium', | |
287 | 'bao' => 'CRM_Contribute_BAO_Premium', | |
6a7e5e5d | 288 | 'localizable' => 0, |
a9d0587b | 289 | 'add' => '4.3', |
c3fc2621 CW |
290 | ], |
291 | ]; | |
346aaaba | 292 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 293 | } |
346aaaba | 294 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 295 | } |
c3fc2621 | 296 | |
e501603b | 297 | /** |
bd8e0b14 | 298 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
299 | * |
300 | * @return array | |
bd8e0b14 | 301 | * Array(string $name => string $uniqueName). |
e501603b | 302 | */ |
c3fc2621 | 303 | public static function &fieldKeys() { |
bd8e0b14 TO |
304 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
305 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 306 | } |
bd8e0b14 | 307 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 308 | } |
c3fc2621 | 309 | |
e501603b TO |
310 | /** |
311 | * Returns the names of this table | |
312 | * | |
313 | * @return string | |
314 | */ | |
c3fc2621 | 315 | public static function getTableName() { |
e501603b TO |
316 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
317 | } | |
c3fc2621 | 318 | |
e501603b TO |
319 | /** |
320 | * Returns if this table needs to be logged | |
321 | * | |
c3fc2621 | 322 | * @return bool |
e501603b | 323 | */ |
c3fc2621 | 324 | public function getLog() { |
e501603b TO |
325 | return self::$_log; |
326 | } | |
c3fc2621 | 327 | |
e501603b TO |
328 | /** |
329 | * Returns the list of fields that can be imported | |
330 | * | |
331 | * @param bool $prefix | |
332 | * | |
333 | * @return array | |
334 | */ | |
c3fc2621 CW |
335 | public static function &import($prefix = FALSE) { |
336 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums', $prefix, []); | |
60808919 | 337 | return $r; |
e501603b | 338 | } |
c3fc2621 | 339 | |
e501603b TO |
340 | /** |
341 | * Returns the list of fields that can be exported | |
342 | * | |
343 | * @param bool $prefix | |
344 | * | |
345 | * @return array | |
346 | */ | |
c3fc2621 CW |
347 | public static function &export($prefix = FALSE) { |
348 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums', $prefix, []); | |
60808919 | 349 | return $r; |
e501603b | 350 | } |
c3fc2621 | 351 | |
e7a6b91a AS |
352 | /** |
353 | * Returns the list of indices | |
c3fc2621 CW |
354 | * |
355 | * @param bool $localize | |
356 | * | |
357 | * @return array | |
e7a6b91a AS |
358 | */ |
359 | public static function indices($localize = TRUE) { | |
c3fc2621 | 360 | $indices = []; |
e7a6b91a AS |
361 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
362 | } | |
c3fc2621 | 363 | |
e501603b | 364 | } |