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