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