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