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