Merge pull request #15232 from eileenmcnaughton/credit
[civicrm-core.git] / CRM / Pledge / DAO / PledgeBlock.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/Pledge/PledgeBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
74db51d3 9 * (GenCodeChecksum:dd1489be32b1ac4cf012b93cb68afb10)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PledgeBlock entity.
f41f0342 14 */
e501603b 15class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_pledge_block';
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 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * Pledge ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * physical tablename for entity being joined to pledge, e.g. civicrm_contact
40 *
41 * @var string
42 */
43 public $entity_table;
c3fc2621 44
e501603b
TO
45 /**
46 * FK to entity table specified in entity_table column.
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $entity_id;
c3fc2621 51
e501603b
TO
52 /**
53 * Delimited list of supported frequency units
54 *
55 * @var string
56 */
57 public $pledge_frequency_unit;
c3fc2621 58
e501603b
TO
59 /**
60 * Is frequency interval exposed on the contribution form.
61 *
e6ca0a57 62 * @var bool
e501603b
TO
63 */
64 public $is_pledge_interval;
c3fc2621 65
e501603b
TO
66 /**
67 * The maximum number of payment reminders to send for any given payment.
68 *
e6ca0a57 69 * @var int
e501603b
TO
70 */
71 public $max_reminders;
c3fc2621 72
e501603b
TO
73 /**
74 * Send initial reminder this many days prior to the payment due date.
75 *
e6ca0a57 76 * @var int
e501603b
TO
77 */
78 public $initial_reminder_day;
c3fc2621 79
e501603b
TO
80 /**
81 * Send additional reminder this many days after last one sent, up to maximum number of reminders.
82 *
e6ca0a57 83 * @var int
e501603b
TO
84 */
85 public $additional_reminder_day;
c3fc2621 86
e501603b
TO
87 /**
88 * The date the first scheduled pledge occurs.
89 *
90 * @var string
91 */
92 public $pledge_start_date;
c3fc2621 93
e501603b
TO
94 /**
95 * If true - recurring start date is shown.
96 *
e6ca0a57 97 * @var bool
e501603b
TO
98 */
99 public $is_pledge_start_date_visible;
c3fc2621 100
e501603b
TO
101 /**
102 * If true - recurring start date is editable.
103 *
e6ca0a57 104 * @var bool
e501603b
TO
105 */
106 public $is_pledge_start_date_editable;
c3fc2621 107
e501603b 108 /**
f41f0342 109 * Class constructor.
e501603b 110 */
c3fc2621 111 public function __construct() {
e501603b
TO
112 $this->__table = 'civicrm_pledge_block';
113 parent::__construct();
114 }
c3fc2621 115
e501603b 116 /**
f41f0342 117 * Returns foreign keys and entity references.
e501603b
TO
118 *
119 * @return array
120 * [CRM_Core_Reference_Interface]
121 */
c3fc2621 122 public static function getReferenceColumns() {
346aaaba 123 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 124 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 125 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 126 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 127 }
346aaaba 128 return Civi::$statics[__CLASS__]['links'];
e501603b 129 }
c3fc2621 130
e501603b
TO
131 /**
132 * Returns all the column names of this table
133 *
134 * @return array
135 */
c3fc2621 136 public static function &fields() {
346aaaba 137 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
138 Civi::$statics[__CLASS__]['fields'] = [
139 'id' => [
e501603b
TO
140 'name' => 'id',
141 'type' => CRM_Utils_Type::T_INT,
c3fc2621 142 'title' => ts('Pledge Block ID'),
215b423e 143 'description' => ts('Pledge ID'),
c3fc2621 144 'required' => TRUE,
a36434b9 145 'where' => 'civicrm_pledge_block.id',
522a26c9 146 'table_name' => 'civicrm_pledge_block',
147 'entity' => 'PledgeBlock',
148 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 149 'localizable' => 0,
c3fc2621
CW
150 ],
151 'entity_table' => [
e501603b
TO
152 'name' => 'entity_table',
153 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 154 'title' => ts('Entity Table'),
215b423e 155 'description' => ts('physical tablename for entity being joined to pledge, e.g. civicrm_contact'),
e501603b
TO
156 'maxlength' => 64,
157 'size' => CRM_Utils_Type::BIG,
a36434b9 158 'where' => 'civicrm_pledge_block.entity_table',
522a26c9 159 'table_name' => 'civicrm_pledge_block',
160 'entity' => 'PledgeBlock',
161 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 162 'localizable' => 0,
c3fc2621
CW
163 ],
164 'entity_id' => [
e501603b
TO
165 'name' => 'entity_id',
166 'type' => CRM_Utils_Type::T_INT,
c3fc2621 167 'title' => ts('Entity Id'),
215b423e 168 'description' => ts('FK to entity table specified in entity_table column.'),
c3fc2621 169 'required' => TRUE,
a36434b9 170 'where' => 'civicrm_pledge_block.entity_id',
522a26c9 171 'table_name' => 'civicrm_pledge_block',
172 'entity' => 'PledgeBlock',
173 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 174 'localizable' => 0,
c3fc2621
CW
175 ],
176 'pledge_frequency_unit' => [
e501603b
TO
177 'name' => 'pledge_frequency_unit',
178 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 179 'title' => ts('Pledge Frequency Unit'),
215b423e 180 'description' => ts('Delimited list of supported frequency units'),
e501603b
TO
181 'maxlength' => 128,
182 'size' => CRM_Utils_Type::HUGE,
a36434b9 183 'where' => 'civicrm_pledge_block.pledge_frequency_unit',
522a26c9 184 'table_name' => 'civicrm_pledge_block',
185 'entity' => 'PledgeBlock',
186 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 187 'localizable' => 0,
2a5c9b4d 188 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
c3fc2621
CW
189 ],
190 'is_pledge_interval' => [
e501603b
TO
191 'name' => 'is_pledge_interval',
192 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 193 'title' => ts('Expose Frequency Interval?'),
215b423e 194 'description' => ts('Is frequency interval exposed on the contribution form.'),
a36434b9 195 'where' => 'civicrm_pledge_block.is_pledge_interval',
45a83e42 196 'default' => '0',
522a26c9 197 'table_name' => 'civicrm_pledge_block',
198 'entity' => 'PledgeBlock',
199 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 200 'localizable' => 0,
c3fc2621
CW
201 ],
202 'max_reminders' => [
e501603b
TO
203 'name' => 'max_reminders',
204 'type' => CRM_Utils_Type::T_INT,
c3fc2621 205 'title' => ts('Maximum Number of Reminders'),
215b423e 206 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
a36434b9 207 'where' => 'civicrm_pledge_block.max_reminders',
e501603b 208 'default' => '1',
522a26c9 209 'table_name' => 'civicrm_pledge_block',
210 'entity' => 'PledgeBlock',
211 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 212 'localizable' => 0,
c3fc2621
CW
213 ],
214 'initial_reminder_day' => [
e501603b
TO
215 'name' => 'initial_reminder_day',
216 'type' => CRM_Utils_Type::T_INT,
c3fc2621 217 'title' => ts('Initial Reminder Day'),
215b423e 218 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
a36434b9 219 'where' => 'civicrm_pledge_block.initial_reminder_day',
e501603b 220 'default' => '5',
522a26c9 221 'table_name' => 'civicrm_pledge_block',
222 'entity' => 'PledgeBlock',
223 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 224 'localizable' => 0,
c3fc2621
CW
225 ],
226 'additional_reminder_day' => [
e501603b
TO
227 'name' => 'additional_reminder_day',
228 'type' => CRM_Utils_Type::T_INT,
c3fc2621 229 'title' => ts('Additional Reminder Days'),
215b423e 230 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
a36434b9 231 'where' => 'civicrm_pledge_block.additional_reminder_day',
e501603b 232 'default' => '5',
522a26c9 233 'table_name' => 'civicrm_pledge_block',
234 'entity' => 'PledgeBlock',
235 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 236 'localizable' => 0,
c3fc2621
CW
237 ],
238 'pledge_start_date' => [
e501603b
TO
239 'name' => 'pledge_start_date',
240 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 241 'title' => ts('Pledge Start Date'),
215b423e 242 'description' => ts('The date the first scheduled pledge occurs.'),
e501603b
TO
243 'maxlength' => 64,
244 'size' => CRM_Utils_Type::BIG,
a36434b9 245 'where' => 'civicrm_pledge_block.pledge_start_date',
522a26c9 246 'table_name' => 'civicrm_pledge_block',
247 'entity' => 'PledgeBlock',
248 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 249 'localizable' => 0,
c3fc2621
CW
250 ],
251 'is_pledge_start_date_visible' => [
e501603b
TO
252 'name' => 'is_pledge_start_date_visible',
253 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 254 'title' => ts('Show Recurring Donation Start Date?'),
215b423e 255 'description' => ts('If true - recurring start date is shown.'),
c3fc2621 256 'required' => TRUE,
a36434b9 257 'where' => 'civicrm_pledge_block.is_pledge_start_date_visible',
45a83e42 258 'default' => '0',
522a26c9 259 'table_name' => 'civicrm_pledge_block',
260 'entity' => 'PledgeBlock',
261 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 262 'localizable' => 0,
c3fc2621
CW
263 ],
264 'is_pledge_start_date_editable' => [
e501603b
TO
265 'name' => 'is_pledge_start_date_editable',
266 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 267 'title' => ts('Allow Edits to Recurring Donation Start Date?'),
215b423e 268 'description' => ts('If true - recurring start date is editable.'),
c3fc2621 269 'required' => TRUE,
a36434b9 270 'where' => 'civicrm_pledge_block.is_pledge_start_date_editable',
45a83e42 271 'default' => '0',
522a26c9 272 'table_name' => 'civicrm_pledge_block',
273 'entity' => 'PledgeBlock',
274 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
6a7e5e5d 275 'localizable' => 0,
c3fc2621
CW
276 ],
277 ];
346aaaba 278 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 279 }
346aaaba 280 return Civi::$statics[__CLASS__]['fields'];
e501603b 281 }
c3fc2621 282
e501603b 283 /**
bd8e0b14 284 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
285 *
286 * @return array
bd8e0b14 287 * Array(string $name => string $uniqueName).
e501603b 288 */
c3fc2621 289 public static function &fieldKeys() {
bd8e0b14
TO
290 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
291 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 292 }
bd8e0b14 293 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 294 }
c3fc2621 295
e501603b
TO
296 /**
297 * Returns the names of this table
298 *
299 * @return string
300 */
c3fc2621 301 public static function getTableName() {
e501603b
TO
302 return self::$_tableName;
303 }
c3fc2621 304
e501603b
TO
305 /**
306 * Returns if this table needs to be logged
307 *
c3fc2621 308 * @return bool
e501603b 309 */
c3fc2621 310 public function getLog() {
e501603b
TO
311 return self::$_log;
312 }
c3fc2621 313
e501603b
TO
314 /**
315 * Returns the list of fields that can be imported
316 *
317 * @param bool $prefix
318 *
319 * @return array
320 */
c3fc2621
CW
321 public static function &import($prefix = FALSE) {
322 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_block', $prefix, []);
60808919 323 return $r;
e501603b 324 }
c3fc2621 325
e501603b
TO
326 /**
327 * Returns the list of fields that can be exported
328 *
329 * @param bool $prefix
330 *
331 * @return array
332 */
c3fc2621
CW
333 public static function &export($prefix = FALSE) {
334 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_block', $prefix, []);
60808919 335 return $r;
e501603b 336 }
c3fc2621 337
e7a6b91a
AS
338 /**
339 * Returns the list of indices
c3fc2621
CW
340 *
341 * @param bool $localize
342 *
343 * @return array
e7a6b91a
AS
344 */
345 public static function indices($localize = TRUE) {
c3fc2621
CW
346 $indices = [
347 'index_entity' => [
e7a6b91a 348 'name' => 'index_entity',
c3fc2621 349 'field' => [
e7a6b91a
AS
350 0 => 'entity_table',
351 1 => 'entity_id',
c3fc2621
CW
352 ],
353 'localizable' => FALSE,
e7a6b91a 354 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id',
c3fc2621
CW
355 ],
356 ];
e7a6b91a
AS
357 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
358 }
c3fc2621 359
e501603b 360}