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