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