Merge pull request #19525 from eileenmcnaughton/member_soft
[civicrm-core.git] / CRM / PCP / DAO / PCP.php
CommitLineData
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/PCP/PCP.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2cbbebe8 9 * (GenCodeChecksum:ad3dcb71cd89052b43154c9e9ee31115)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PCP entity.
f41f0342 14 */
e501603b 15class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.2';
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_pcp';
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
TO
34 /**
35 * Personal Campaign Page ID
36 *
e6ca0a57 37 * @var int
e501603b
TO
38 */
39 public $id;
c3fc2621 40
e501603b
TO
41 /**
42 * FK to Contact ID
43 *
e6ca0a57 44 * @var int
e501603b
TO
45 */
46 public $contact_id;
c3fc2621 47
e501603b 48 /**
e6ca0a57 49 * @var int
e501603b
TO
50 */
51 public $status_id;
c3fc2621 52
e501603b 53 /**
e501603b
TO
54 * @var string
55 */
56 public $title;
c3fc2621 57
e501603b 58 /**
e501603b
TO
59 * @var text
60 */
61 public $intro_text;
c3fc2621 62
e501603b 63 /**
e501603b
TO
64 * @var text
65 */
66 public $page_text;
c3fc2621 67
e501603b 68 /**
e501603b
TO
69 * @var string
70 */
71 public $donate_link_text;
c3fc2621 72
e501603b
TO
73 /**
74 * The Contribution or Event Page which triggered this pcp
75 *
e6ca0a57 76 * @var int
e501603b
TO
77 */
78 public $page_id;
c3fc2621 79
e501603b
TO
80 /**
81 * The type of PCP this is: contribute or event
82 *
83 * @var string
84 */
85 public $page_type;
c3fc2621 86
e501603b
TO
87 /**
88 * The pcp block that this pcp page was created from
89 *
e6ca0a57 90 * @var int
e501603b
TO
91 */
92 public $pcp_block_id;
c3fc2621 93
e501603b 94 /**
e6ca0a57 95 * @var int
e501603b
TO
96 */
97 public $is_thermometer;
c3fc2621 98
e501603b 99 /**
e6ca0a57 100 * @var int
e501603b
TO
101 */
102 public $is_honor_roll;
c3fc2621 103
e501603b
TO
104 /**
105 * Goal amount of this Personal Campaign Page.
106 *
107 * @var float
108 */
109 public $goal_amount;
c3fc2621 110
e501603b
TO
111 /**
112 * 3 character string, value from config setting or input via user.
113 *
114 * @var string
115 */
116 public $currency;
c3fc2621 117
e501603b
TO
118 /**
119 * Is Personal Campaign Page enabled/active?
120 *
e6ca0a57 121 * @var bool
e501603b
TO
122 */
123 public $is_active;
c3fc2621 124
e501603b
TO
125 /**
126 * Notify owner via email when someone donates to page?
127 *
e6ca0a57 128 * @var bool
e501603b
TO
129 */
130 public $is_notify;
c3fc2621 131
e501603b 132 /**
f41f0342 133 * Class constructor.
e501603b 134 */
c3fc2621 135 public function __construct() {
e501603b
TO
136 $this->__table = 'civicrm_pcp';
137 parent::__construct();
138 }
c3fc2621 139
449c4e6b
CW
140 /**
141 * Returns localized title of this entity.
7b66c3b5
AH
142 *
143 * @param bool $plural
144 * Whether to return the plural version of the title.
449c4e6b 145 */
7b66c3b5
AH
146 public static function getEntityTitle($plural = FALSE) {
147 return $plural ? ts('PCPs') : ts('PCP');
449c4e6b
CW
148 }
149
e501603b 150 /**
f41f0342 151 * Returns foreign keys and entity references.
e501603b
TO
152 *
153 * @return array
154 * [CRM_Core_Reference_Interface]
155 */
c3fc2621 156 public static function getReferenceColumns() {
346aaaba 157 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 158 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 159 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 160 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 161 }
346aaaba 162 return Civi::$statics[__CLASS__]['links'];
e501603b 163 }
c3fc2621 164
e501603b
TO
165 /**
166 * Returns all the column names of this table
167 *
168 * @return array
169 */
c3fc2621 170 public static function &fields() {
346aaaba 171 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
172 Civi::$statics[__CLASS__]['fields'] = [
173 'pcp_id' => [
e501603b
TO
174 'name' => 'id',
175 'type' => CRM_Utils_Type::T_INT,
c3fc2621 176 'title' => ts('Personal Campaign Page ID'),
215b423e 177 'description' => ts('Personal Campaign Page ID'),
c3fc2621 178 'required' => TRUE,
a36434b9 179 'where' => 'civicrm_pcp.id',
522a26c9 180 'table_name' => 'civicrm_pcp',
181 'entity' => 'PCP',
182 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 183 'localizable' => 0,
2cbbebe8
A
184 'html' => [
185 'type' => 'Number',
186 ],
a9d0587b 187 'add' => '2.2',
c3fc2621
CW
188 ],
189 'pcp_contact_id' => [
e501603b
TO
190 'name' => 'contact_id',
191 'type' => CRM_Utils_Type::T_INT,
c3fc2621 192 'title' => ts('Contact ID'),
215b423e 193 'description' => ts('FK to Contact ID'),
c3fc2621 194 'required' => TRUE,
a36434b9 195 'where' => 'civicrm_pcp.contact_id',
522a26c9 196 'table_name' => 'civicrm_pcp',
197 'entity' => 'PCP',
198 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 199 'localizable' => 0,
e501603b 200 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 201 'html' => [
e501603b 202 'type' => 'EntityRef',
2cbbebe8 203 'label' => ts("Contact"),
c3fc2621 204 ],
a9d0587b 205 'add' => '2.2',
c3fc2621
CW
206 ],
207 'status_id' => [
e501603b
TO
208 'name' => 'status_id',
209 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
210 'title' => ts('Personal Campaign Page Status'),
211 'required' => TRUE,
a36434b9 212 'where' => 'civicrm_pcp.status_id',
522a26c9 213 'table_name' => 'civicrm_pcp',
214 'entity' => 'PCP',
215 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 216 'localizable' => 0,
c3fc2621 217 'html' => [
e501603b 218 'type' => 'Select',
c3fc2621
CW
219 ],
220 'pseudoconstant' => [
e501603b
TO
221 'optionGroupName' => 'pcp_status',
222 'optionEditPath' => 'civicrm/admin/options/pcp_status',
e6ca0a57 223 ],
a9d0587b 224 'add' => '2.2',
c3fc2621
CW
225 ],
226 'title' => [
e501603b
TO
227 'name' => 'title',
228 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 229 'title' => ts('Personal Campaign Page Title'),
e501603b
TO
230 'maxlength' => 255,
231 'size' => CRM_Utils_Type::HUGE,
a36434b9 232 'where' => 'civicrm_pcp.title',
e501603b 233 'default' => 'NULL',
522a26c9 234 'table_name' => 'civicrm_pcp',
235 'entity' => 'PCP',
236 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 237 'localizable' => 0,
c3fc2621 238 'html' => [
e501603b 239 'type' => 'Text',
c3fc2621 240 ],
a9d0587b 241 'add' => '2.2',
c3fc2621
CW
242 ],
243 'intro_text' => [
e501603b
TO
244 'name' => 'intro_text',
245 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 246 'title' => ts('Intro Text'),
a36434b9 247 'where' => 'civicrm_pcp.intro_text',
e501603b 248 'default' => 'NULL',
522a26c9 249 'table_name' => 'civicrm_pcp',
250 'entity' => 'PCP',
251 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 252 'localizable' => 0,
c3fc2621 253 'html' => [
a510f6fb 254 'type' => 'TextArea',
c3fc2621 255 ],
a9d0587b 256 'add' => '2.2',
c3fc2621
CW
257 ],
258 'page_text' => [
e501603b
TO
259 'name' => 'page_text',
260 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 261 'title' => ts('Page Text'),
a36434b9 262 'where' => 'civicrm_pcp.page_text',
e501603b 263 'default' => 'NULL',
522a26c9 264 'table_name' => 'civicrm_pcp',
265 'entity' => 'PCP',
266 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 267 'localizable' => 0,
c3fc2621 268 'html' => [
a510f6fb 269 'type' => 'TextArea',
c3fc2621 270 ],
a9d0587b 271 'add' => '2.2',
c3fc2621
CW
272 ],
273 'donate_link_text' => [
e501603b
TO
274 'name' => 'donate_link_text',
275 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 276 'title' => ts('Donate Link Text'),
e501603b
TO
277 'maxlength' => 255,
278 'size' => CRM_Utils_Type::HUGE,
a36434b9 279 'where' => 'civicrm_pcp.donate_link_text',
e501603b 280 'default' => 'NULL',
522a26c9 281 'table_name' => 'civicrm_pcp',
282 'entity' => 'PCP',
283 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 284 'localizable' => 0,
c3fc2621 285 'html' => [
e501603b 286 'type' => 'Text',
c3fc2621 287 ],
a9d0587b 288 'add' => '2.2',
c3fc2621
CW
289 ],
290 'page_id' => [
e501603b
TO
291 'name' => 'page_id',
292 'type' => CRM_Utils_Type::T_INT,
c3fc2621 293 'title' => ts('Contribution Page'),
215b423e 294 'description' => ts('The Contribution or Event Page which triggered this pcp'),
c3fc2621 295 'required' => TRUE,
a36434b9 296 'where' => 'civicrm_pcp.page_id',
522a26c9 297 'table_name' => 'civicrm_pcp',
298 'entity' => 'PCP',
299 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 300 'localizable' => 0,
a9d0587b 301 'add' => '4.1',
c3fc2621
CW
302 ],
303 'page_type' => [
e501603b
TO
304 'name' => 'page_type',
305 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 306 'title' => ts('PCP Page Type'),
215b423e 307 'description' => ts('The type of PCP this is: contribute or event'),
e501603b
TO
308 'maxlength' => 64,
309 'size' => CRM_Utils_Type::BIG,
a36434b9 310 'where' => 'civicrm_pcp.page_type',
e501603b 311 'default' => 'contribute',
522a26c9 312 'table_name' => 'civicrm_pcp',
313 'entity' => 'PCP',
314 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 315 'localizable' => 0,
c3fc2621 316 'html' => [
e501603b 317 'type' => 'Select',
c3fc2621 318 ],
a9d0587b 319 'add' => '2.2',
c3fc2621
CW
320 ],
321 'pcp_block_id' => [
e501603b
TO
322 'name' => 'pcp_block_id',
323 'type' => CRM_Utils_Type::T_INT,
c3fc2621 324 'title' => ts('PCP Block'),
215b423e 325 'description' => ts('The pcp block that this pcp page was created from'),
c3fc2621 326 'required' => TRUE,
a36434b9 327 'where' => 'civicrm_pcp.pcp_block_id',
522a26c9 328 'table_name' => 'civicrm_pcp',
329 'entity' => 'PCP',
330 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 331 'localizable' => 0,
a9d0587b 332 'add' => '4.1',
c3fc2621
CW
333 ],
334 'is_thermometer' => [
e501603b
TO
335 'name' => 'is_thermometer',
336 'type' => CRM_Utils_Type::T_INT,
c3fc2621 337 'title' => ts('Use Thermometer?'),
a36434b9 338 'where' => 'civicrm_pcp.is_thermometer',
45a83e42 339 'default' => '0',
522a26c9 340 'table_name' => 'civicrm_pcp',
341 'entity' => 'PCP',
342 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 343 'localizable' => 0,
c3fc2621 344 'html' => [
e501603b 345 'type' => 'CheckBox',
c3fc2621 346 ],
a9d0587b 347 'add' => '2.2',
c3fc2621
CW
348 ],
349 'is_honor_roll' => [
e501603b
TO
350 'name' => 'is_honor_roll',
351 'type' => CRM_Utils_Type::T_INT,
c3fc2621 352 'title' => ts('Show Honor Roll?'),
a36434b9 353 'where' => 'civicrm_pcp.is_honor_roll',
45a83e42 354 'default' => '0',
522a26c9 355 'table_name' => 'civicrm_pcp',
356 'entity' => 'PCP',
357 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 358 'localizable' => 0,
c3fc2621 359 'html' => [
e501603b 360 'type' => 'CheckBox',
c3fc2621 361 ],
a9d0587b 362 'add' => '2.2',
c3fc2621
CW
363 ],
364 'goal_amount' => [
e501603b
TO
365 'name' => 'goal_amount',
366 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 367 'title' => ts('Goal Amount'),
215b423e 368 'description' => ts('Goal amount of this Personal Campaign Page.'),
c3fc2621 369 'precision' => [
e501603b 370 20,
fb607354 371 2,
c3fc2621 372 ],
a36434b9 373 'where' => 'civicrm_pcp.goal_amount',
522a26c9 374 'table_name' => 'civicrm_pcp',
375 'entity' => 'PCP',
376 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 377 'localizable' => 0,
c3fc2621 378 'html' => [
e501603b 379 'type' => 'Text',
c3fc2621 380 ],
a9d0587b 381 'add' => '2.2',
c3fc2621
CW
382 ],
383 'currency' => [
e501603b
TO
384 'name' => 'currency',
385 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 386 'title' => ts('Currency'),
215b423e 387 'description' => ts('3 character string, value from config setting or input via user.'),
e501603b
TO
388 'maxlength' => 3,
389 'size' => CRM_Utils_Type::FOUR,
a36434b9 390 'where' => 'civicrm_pcp.currency',
e501603b 391 'default' => 'NULL',
522a26c9 392 'table_name' => 'civicrm_pcp',
393 'entity' => 'PCP',
394 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 395 'localizable' => 0,
c3fc2621 396 'html' => [
e501603b 397 'type' => 'Select',
c3fc2621
CW
398 ],
399 'pseudoconstant' => [
e501603b
TO
400 'table' => 'civicrm_currency',
401 'keyColumn' => 'name',
402 'labelColumn' => 'full_name',
403 'nameColumn' => 'name',
a8fdb24e 404 'abbrColumn' => 'symbol',
e6ca0a57 405 ],
a9d0587b 406 'add' => '3.2',
c3fc2621
CW
407 ],
408 'is_active' => [
e501603b
TO
409 'name' => 'is_active',
410 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 411 'title' => ts('Enabled?'),
215b423e 412 'description' => ts('Is Personal Campaign Page enabled/active?'),
a36434b9 413 'where' => 'civicrm_pcp.is_active',
45a83e42 414 'default' => '0',
522a26c9 415 'table_name' => 'civicrm_pcp',
416 'entity' => 'PCP',
417 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 418 'localizable' => 0,
c3fc2621 419 'html' => [
e501603b 420 'type' => 'CheckBox',
c3fc2621 421 ],
a9d0587b 422 'add' => '2.2',
c3fc2621
CW
423 ],
424 'is_notify' => [
e501603b
TO
425 'name' => 'is_notify',
426 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 427 'title' => ts('Notify Owner?'),
215b423e 428 'description' => ts('Notify owner via email when someone donates to page?'),
a36434b9 429 'where' => 'civicrm_pcp.is_notify',
45a83e42 430 'default' => '0',
522a26c9 431 'table_name' => 'civicrm_pcp',
432 'entity' => 'PCP',
433 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 434 'localizable' => 0,
c3fc2621 435 'html' => [
e501603b 436 'type' => 'CheckBox',
c3fc2621 437 ],
a9d0587b 438 'add' => '4.6',
c3fc2621
CW
439 ],
440 ];
346aaaba 441 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 442 }
346aaaba 443 return Civi::$statics[__CLASS__]['fields'];
e501603b 444 }
c3fc2621 445
e501603b 446 /**
bd8e0b14 447 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
448 *
449 * @return array
bd8e0b14 450 * Array(string $name => string $uniqueName).
e501603b 451 */
c3fc2621 452 public static function &fieldKeys() {
bd8e0b14
TO
453 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
454 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 455 }
bd8e0b14 456 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 457 }
c3fc2621 458
e501603b
TO
459 /**
460 * Returns the names of this table
461 *
462 * @return string
463 */
c3fc2621 464 public static function getTableName() {
e501603b
TO
465 return self::$_tableName;
466 }
c3fc2621 467
e501603b
TO
468 /**
469 * Returns if this table needs to be logged
470 *
c3fc2621 471 * @return bool
e501603b 472 */
c3fc2621 473 public function getLog() {
e501603b
TO
474 return self::$_log;
475 }
c3fc2621 476
e501603b
TO
477 /**
478 * Returns the list of fields that can be imported
479 *
480 * @param bool $prefix
481 *
482 * @return array
483 */
c3fc2621
CW
484 public static function &import($prefix = FALSE) {
485 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, []);
60808919 486 return $r;
e501603b 487 }
c3fc2621 488
e501603b
TO
489 /**
490 * Returns the list of fields that can be exported
491 *
492 * @param bool $prefix
493 *
494 * @return array
495 */
c3fc2621
CW
496 public static function &export($prefix = FALSE) {
497 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, []);
60808919 498 return $r;
e501603b 499 }
c3fc2621 500
e7a6b91a
AS
501 /**
502 * Returns the list of indices
c3fc2621
CW
503 *
504 * @param bool $localize
505 *
506 * @return array
e7a6b91a
AS
507 */
508 public static function indices($localize = TRUE) {
c3fc2621 509 $indices = [];
e7a6b91a
AS
510 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
511 }
c3fc2621 512
e501603b 513}