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/ContributionProduct.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
513ae7e3 | 9 | * (GenCodeChecksum:b8b2fd54470db337ec6285ac53bc51b1) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the ContributionProduct entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contribute_DAO_ContributionProduct 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_contribution_product'; |
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 | 39 | /** |
e6ca0a57 | 40 | * @var int |
e501603b TO |
41 | */ |
42 | public $product_id; | |
c3fc2621 | 43 | |
e501603b | 44 | /** |
e6ca0a57 | 45 | * @var int |
e501603b TO |
46 | */ |
47 | public $contribution_id; | |
c3fc2621 | 48 | |
e501603b TO |
49 | /** |
50 | * Option value selected if applicable - e.g. color, size etc. | |
51 | * | |
52 | * @var string | |
53 | */ | |
54 | public $product_option; | |
c3fc2621 | 55 | |
e501603b | 56 | /** |
e501603b TO |
57 | * @var int |
58 | */ | |
59 | public $quantity; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * Optional. Can be used to record the date this product was fulfilled or shipped. | |
63 | * | |
64 | * @var date | |
65 | */ | |
66 | public $fulfilled_date; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * Actual start date for a time-delimited premium (subscription, service or membership) | |
70 | * | |
71 | * @var date | |
72 | */ | |
73 | public $start_date; | |
c3fc2621 | 74 | |
e501603b TO |
75 | /** |
76 | * Actual end date for a time-delimited premium (subscription, service or membership) | |
77 | * | |
78 | * @var date | |
79 | */ | |
80 | public $end_date; | |
c3fc2621 | 81 | |
e501603b | 82 | /** |
e501603b TO |
83 | * @var text |
84 | */ | |
85 | public $comment; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * FK to Financial Type(for membership price sets only). | |
89 | * | |
e6ca0a57 | 90 | * @var int |
e501603b TO |
91 | */ |
92 | public $financial_type_id; | |
c3fc2621 | 93 | |
e501603b | 94 | /** |
f41f0342 | 95 | * Class constructor. |
e501603b | 96 | */ |
c3fc2621 | 97 | public function __construct() { |
e501603b TO |
98 | $this->__table = 'civicrm_contribution_product'; |
99 | parent::__construct(); | |
100 | } | |
c3fc2621 | 101 | |
449c4e6b CW |
102 | /** |
103 | * Returns localized title of this entity. | |
7b66c3b5 AH |
104 | * |
105 | * @param bool $plural | |
106 | * Whether to return the plural version of the title. | |
449c4e6b | 107 | */ |
7b66c3b5 AH |
108 | public static function getEntityTitle($plural = FALSE) { |
109 | return $plural ? ts('Contribution Products') : ts('Contribution Product'); | |
449c4e6b CW |
110 | } |
111 | ||
e501603b | 112 | /** |
f41f0342 | 113 | * Returns foreign keys and entity references. |
e501603b TO |
114 | * |
115 | * @return array | |
116 | * [CRM_Core_Reference_Interface] | |
117 | */ | |
c3fc2621 | 118 | public static function getReferenceColumns() { |
346aaaba | 119 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 120 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
8714d4b4 | 121 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'product_id', 'civicrm_product', 'id'); |
c3fc2621 CW |
122 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); |
123 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
346aaaba | 124 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 125 | } |
346aaaba | 126 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 127 | } |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * Returns all the column names of this table | |
131 | * | |
132 | * @return array | |
133 | */ | |
c3fc2621 | 134 | public static function &fields() { |
346aaaba | 135 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
136 | Civi::$statics[__CLASS__]['fields'] = [ |
137 | 'id' => [ | |
e501603b TO |
138 | 'name' => 'id', |
139 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
140 | 'title' => ts('Contribution Product ID'), |
141 | 'required' => TRUE, | |
a36434b9 | 142 | 'where' => 'civicrm_contribution_product.id', |
522a26c9 | 143 | 'table_name' => 'civicrm_contribution_product', |
144 | 'entity' => 'ContributionProduct', | |
145 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 146 | 'localizable' => 0, |
2cbbebe8 A |
147 | 'html' => [ |
148 | 'type' => 'Number', | |
149 | ], | |
1fe423d6 | 150 | 'readonly' => TRUE, |
a9d0587b | 151 | 'add' => '1.4', |
c3fc2621 CW |
152 | ], |
153 | 'product_id' => [ | |
e501603b TO |
154 | 'name' => 'product_id', |
155 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
156 | 'title' => ts('Product ID'), |
157 | 'required' => TRUE, | |
a36434b9 | 158 | 'where' => 'civicrm_contribution_product.product_id', |
522a26c9 | 159 | 'table_name' => 'civicrm_contribution_product', |
160 | 'entity' => 'ContributionProduct', | |
161 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 162 | 'localizable' => 0, |
8714d4b4 | 163 | 'FKClassName' => 'CRM_Contribute_DAO_Product', |
a9d0587b | 164 | 'add' => '1.4', |
c3fc2621 CW |
165 | ], |
166 | 'contribution_id' => [ | |
e501603b TO |
167 | 'name' => 'contribution_id', |
168 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
169 | 'title' => ts('Contribution ID'), |
170 | 'required' => TRUE, | |
a36434b9 | 171 | 'where' => 'civicrm_contribution_product.contribution_id', |
522a26c9 | 172 | 'table_name' => 'civicrm_contribution_product', |
173 | 'entity' => 'ContributionProduct', | |
174 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 175 | 'localizable' => 0, |
e501603b | 176 | 'FKClassName' => 'CRM_Contribute_DAO_Contribution', |
2cbbebe8 A |
177 | 'html' => [ |
178 | 'label' => ts("Contribution"), | |
179 | ], | |
a9d0587b | 180 | 'add' => '1.4', |
c3fc2621 CW |
181 | ], |
182 | 'product_option' => [ | |
e501603b TO |
183 | 'name' => 'product_option', |
184 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 185 | 'title' => ts('Product Option'), |
215b423e | 186 | 'description' => ts('Option value selected if applicable - e.g. color, size etc.'), |
e501603b TO |
187 | 'maxlength' => 255, |
188 | 'size' => CRM_Utils_Type::HUGE, | |
e501603b | 189 | 'where' => 'civicrm_contribution_product.product_option', |
a36434b9 | 190 | 'export' => TRUE, |
522a26c9 | 191 | 'table_name' => 'civicrm_contribution_product', |
192 | 'entity' => 'ContributionProduct', | |
193 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 194 | 'localizable' => 0, |
a9d0587b | 195 | 'add' => '1.4', |
c3fc2621 CW |
196 | ], |
197 | 'quantity' => [ | |
e501603b TO |
198 | 'name' => 'quantity', |
199 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 200 | 'title' => ts('Quantity'), |
e501603b | 201 | 'where' => 'civicrm_contribution_product.quantity', |
a36434b9 | 202 | 'export' => TRUE, |
522a26c9 | 203 | 'table_name' => 'civicrm_contribution_product', |
204 | 'entity' => 'ContributionProduct', | |
205 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 206 | 'localizable' => 0, |
a9d0587b | 207 | 'add' => '1.4', |
c3fc2621 CW |
208 | ], |
209 | 'fulfilled_date' => [ | |
e501603b TO |
210 | 'name' => 'fulfilled_date', |
211 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 212 | 'title' => ts('Fulfilled Date'), |
215b423e | 213 | 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'), |
e501603b | 214 | 'where' => 'civicrm_contribution_product.fulfilled_date', |
a36434b9 | 215 | 'export' => TRUE, |
522a26c9 | 216 | 'table_name' => 'civicrm_contribution_product', |
217 | 'entity' => 'ContributionProduct', | |
218 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 219 | 'localizable' => 0, |
a69cf1d1 SL |
220 | 'html' => [ |
221 | 'type' => 'Select Date', | |
222 | 'formatType' => 'activityDate', | |
223 | ], | |
a9d0587b | 224 | 'add' => '1.4', |
c3fc2621 CW |
225 | ], |
226 | 'contribution_start_date' => [ | |
e501603b TO |
227 | 'name' => 'start_date', |
228 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 229 | 'title' => ts('Start date for premium'), |
215b423e | 230 | 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'), |
e501603b | 231 | 'where' => 'civicrm_contribution_product.start_date', |
a36434b9 | 232 | 'export' => TRUE, |
522a26c9 | 233 | 'table_name' => 'civicrm_contribution_product', |
234 | 'entity' => 'ContributionProduct', | |
235 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 236 | 'localizable' => 0, |
a9d0587b | 237 | 'add' => '1.4', |
c3fc2621 CW |
238 | ], |
239 | 'contribution_end_date' => [ | |
e501603b TO |
240 | 'name' => 'end_date', |
241 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 242 | 'title' => ts('End date for premium'), |
215b423e | 243 | 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'), |
e501603b | 244 | 'where' => 'civicrm_contribution_product.end_date', |
a36434b9 | 245 | 'export' => TRUE, |
522a26c9 | 246 | 'table_name' => 'civicrm_contribution_product', |
247 | 'entity' => 'ContributionProduct', | |
248 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 249 | 'localizable' => 0, |
a9d0587b | 250 | 'add' => '1.4', |
c3fc2621 CW |
251 | ], |
252 | 'comment' => [ | |
e501603b TO |
253 | 'name' => 'comment', |
254 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 255 | 'title' => ts('Premium comment'), |
a36434b9 | 256 | 'where' => 'civicrm_contribution_product.comment', |
522a26c9 | 257 | 'table_name' => 'civicrm_contribution_product', |
258 | 'entity' => 'ContributionProduct', | |
259 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 260 | 'localizable' => 0, |
a9d0587b | 261 | 'add' => '1.4', |
c3fc2621 CW |
262 | ], |
263 | 'financial_type_id' => [ | |
e501603b TO |
264 | 'name' => 'financial_type_id', |
265 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 266 | 'title' => ts('Financial Type ID'), |
215b423e | 267 | 'description' => ts('FK to Financial Type(for membership price sets only).'), |
a36434b9 | 268 | 'where' => 'civicrm_contribution_product.financial_type_id', |
5fb0de1f | 269 | 'default' => NULL, |
522a26c9 | 270 | 'table_name' => 'civicrm_contribution_product', |
271 | 'entity' => 'ContributionProduct', | |
272 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 273 | 'localizable' => 0, |
e501603b | 274 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
2cbbebe8 A |
275 | 'html' => [ |
276 | 'label' => ts("Financial Type"), | |
277 | ], | |
c3fc2621 | 278 | 'pseudoconstant' => [ |
e501603b TO |
279 | 'table' => 'civicrm_financial_type', |
280 | 'keyColumn' => 'id', | |
281 | 'labelColumn' => 'name', | |
e6ca0a57 | 282 | ], |
a9d0587b | 283 | 'add' => '4.3', |
c3fc2621 CW |
284 | ], |
285 | ]; | |
346aaaba | 286 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 287 | } |
346aaaba | 288 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 289 | } |
c3fc2621 | 290 | |
e501603b | 291 | /** |
bd8e0b14 | 292 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
293 | * |
294 | * @return array | |
bd8e0b14 | 295 | * Array(string $name => string $uniqueName). |
e501603b | 296 | */ |
c3fc2621 | 297 | public static function &fieldKeys() { |
bd8e0b14 TO |
298 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
299 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 300 | } |
bd8e0b14 | 301 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 302 | } |
c3fc2621 | 303 | |
e501603b TO |
304 | /** |
305 | * Returns the names of this table | |
306 | * | |
307 | * @return string | |
308 | */ | |
c3fc2621 | 309 | public static function getTableName() { |
e501603b TO |
310 | return self::$_tableName; |
311 | } | |
c3fc2621 | 312 | |
e501603b TO |
313 | /** |
314 | * Returns if this table needs to be logged | |
315 | * | |
c3fc2621 | 316 | * @return bool |
e501603b | 317 | */ |
c3fc2621 | 318 | public function getLog() { |
e501603b TO |
319 | return self::$_log; |
320 | } | |
c3fc2621 | 321 | |
e501603b TO |
322 | /** |
323 | * Returns the list of fields that can be imported | |
324 | * | |
325 | * @param bool $prefix | |
326 | * | |
327 | * @return array | |
328 | */ | |
c3fc2621 CW |
329 | public static function &import($prefix = FALSE) { |
330 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_product', $prefix, []); | |
60808919 | 331 | return $r; |
e501603b | 332 | } |
c3fc2621 | 333 | |
e501603b TO |
334 | /** |
335 | * Returns the list of fields that can be exported | |
336 | * | |
337 | * @param bool $prefix | |
338 | * | |
339 | * @return array | |
340 | */ | |
c3fc2621 CW |
341 | public static function &export($prefix = FALSE) { |
342 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_product', $prefix, []); | |
60808919 | 343 | return $r; |
e501603b | 344 | } |
c3fc2621 | 345 | |
e7a6b91a AS |
346 | /** |
347 | * Returns the list of indices | |
c3fc2621 CW |
348 | * |
349 | * @param bool $localize | |
350 | * | |
351 | * @return array | |
e7a6b91a AS |
352 | */ |
353 | public static function indices($localize = TRUE) { | |
c3fc2621 | 354 | $indices = []; |
e7a6b91a AS |
355 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
356 | } | |
c3fc2621 | 357 | |
e501603b | 358 | } |