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