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