3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2016
31 * Generated from xml/schema/CRM/Pledge/Pledge.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:6aa082b07bbcb93e0a7c5e9048643c91)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Pledge_DAO_Pledge
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_pledge';
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
58 * Foreign key to civicrm_contact.id .
64 * FK to Financial Type
68 public $financial_type_id;
70 * The Contribution Page which triggered this contribution
74 public $contribution_page_id;
76 * Total pledged amount.
82 * Original amount for each of the installments.
86 public $original_installment_amount;
88 * 3 character string, value from config setting or input via user.
94 * Time units for recurrence of pledge payments.
98 public $frequency_unit;
100 * Number of time units for recurrence of pledge payments.
104 public $frequency_interval;
106 * Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.
110 public $frequency_day;
112 * Total number of payments to be made.
116 public $installments;
118 * The date the first scheduled pledge occurs.
124 * When this pledge record was created.
130 * When a pledge acknowledgement message was sent to the contributor.
134 public $acknowledge_date;
136 * Last updated date for this pledge record.
140 public $modified_date;
142 * Date this pledge was cancelled by contributor.
148 * Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).
154 * The maximum number of payment reminders to send for any given payment.
158 public $max_reminders;
160 * Send initial reminder this many days prior to the payment due date.
164 public $initial_reminder_day;
166 * Send additional reminder this many days after last one sent, up to maximum number of reminders.
170 public $additional_reminder_day;
172 * Implicit foreign key to civicrm_option_values in the contribution_status option group.
183 * The campaign for which this pledge has been initiated.
191 * @return civicrm_pledge
193 function __construct() {
194 $this->__table
= 'civicrm_pledge';
195 parent
::__construct();
198 * Returns foreign keys and entity references
201 * [CRM_Core_Reference_Interface]
203 static function getReferenceColumns() {
204 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
205 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
206 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
207 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
208 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id');
209 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
210 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
212 return Civi
::$statics[__CLASS__
]['links'];
215 * Returns all the column names of this table
219 static function &fields() {
220 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
221 Civi
::$statics[__CLASS__
]['fields'] = array(
222 'pledge_id' => array(
224 'type' => CRM_Utils_Type
::T_INT
,
225 'title' => ts('Pledge ID') ,
226 'description' => 'Pledge ID',
229 'where' => 'civicrm_pledge.id',
230 'headerPattern' => '',
234 'pledge_contact_id' => array(
235 'name' => 'contact_id',
236 'type' => CRM_Utils_Type
::T_INT
,
237 'title' => ts('Contact ID') ,
238 'description' => 'Foreign key to civicrm_contact.id .',
241 'where' => 'civicrm_pledge.contact_id',
242 'headerPattern' => '',
245 'FKClassName' => 'CRM_Contact_DAO_Contact',
247 'type' => 'EntityRef',
250 'pledge_financial_type_id' => array(
251 'name' => 'financial_type_id',
252 'type' => CRM_Utils_Type
::T_INT
,
253 'title' => ts('Type') ,
254 'description' => 'FK to Financial Type',
255 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
259 'pseudoconstant' => array(
260 'table' => 'civicrm_financial_type',
262 'labelColumn' => 'name',
265 'pledge_contribution_page_id' => array(
266 'name' => 'contribution_page_id',
267 'type' => CRM_Utils_Type
::T_INT
,
268 'title' => ts('Pledge Contribution Page') ,
269 'description' => 'The Contribution Page which triggered this contribution',
270 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
272 'pledge_amount' => array(
274 'type' => CRM_Utils_Type
::T_MONEY
,
275 'title' => ts('Total Pledged') ,
276 'description' => 'Total pledged amount.',
278 'precision' => array(
283 'where' => 'civicrm_pledge.amount',
284 'headerPattern' => '',
291 'pledge_original_installment_amount' => array(
292 'name' => 'original_installment_amount',
293 'type' => CRM_Utils_Type
::T_MONEY
,
294 'title' => ts('Original Installment Amount') ,
295 'description' => 'Original amount for each of the installments.',
297 'precision' => array(
306 'name' => 'currency',
307 'type' => CRM_Utils_Type
::T_STRING
,
308 'title' => ts('Pledge Currency') ,
309 'description' => '3 character string, value from config setting or input via user.',
311 'size' => CRM_Utils_Type
::FOUR
,
316 'pseudoconstant' => array(
317 'table' => 'civicrm_currency',
318 'keyColumn' => 'name',
319 'labelColumn' => 'full_name',
320 'nameColumn' => 'name',
323 'pledge_frequency_unit' => array(
324 'name' => 'frequency_unit',
325 'type' => CRM_Utils_Type
::T_STRING
,
326 'title' => ts('Pledge Frequency Unit') ,
327 'description' => 'Time units for recurrence of pledge payments.',
329 'size' => CRM_Utils_Type
::EIGHT
,
330 'default' => 'month',
334 'pseudoconstant' => array(
335 'optionGroupName' => 'recur_frequency_units',
336 'keyColumn' => 'name',
337 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
340 'pledge_frequency_interval' => array(
341 'name' => 'frequency_interval',
342 'type' => CRM_Utils_Type
::T_INT
,
343 'title' => ts('Pledge Frequency Interval') ,
344 'description' => 'Number of time units for recurrence of pledge payments.',
351 'frequency_day' => array(
352 'name' => 'frequency_day',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Pledge day') ,
355 'description' => 'Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.',
362 'installments' => array(
363 'name' => 'installments',
364 'type' => CRM_Utils_Type
::T_INT
,
365 'title' => ts('Pledge Number of Installments') ,
366 'description' => 'Total number of payments to be made.',
372 'start_date' => array(
373 'name' => 'start_date',
374 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
375 'title' => ts('Pledge Start Date') ,
376 'description' => 'The date the first scheduled pledge occurs.',
379 'type' => 'Select Date',
382 'pledge_create_date' => array(
383 'name' => 'create_date',
384 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
385 'title' => ts('Pledge Made') ,
386 'description' => 'When this pledge record was created.',
389 'where' => 'civicrm_pledge.create_date',
390 'headerPattern' => '',
394 'type' => 'Select Date',
397 'acknowledge_date' => array(
398 'name' => 'acknowledge_date',
399 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
400 'title' => ts('Pledge Acknowledged') ,
401 'description' => 'When a pledge acknowledgement message was sent to the contributor.',
403 'type' => 'Select Date',
406 'modified_date' => array(
407 'name' => 'modified_date',
408 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
409 'title' => ts('Pledge Modified Date') ,
410 'description' => 'Last updated date for this pledge record.',
412 'cancel_date' => array(
413 'name' => 'cancel_date',
414 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
415 'title' => ts('Pledge Cancelled Date') ,
416 'description' => 'Date this pledge was cancelled by contributor.',
418 'type' => 'Select Date',
422 'name' => 'end_date',
423 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
424 'title' => ts('Pledge End Date') ,
425 'description' => 'Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).',
427 'type' => 'Select Date',
430 'max_reminders' => array(
431 'name' => 'max_reminders',
432 'type' => CRM_Utils_Type
::T_INT
,
433 'title' => ts('Maximum Number of Reminders') ,
434 'description' => 'The maximum number of payment reminders to send for any given payment.',
440 'initial_reminder_day' => array(
441 'name' => 'initial_reminder_day',
442 'type' => CRM_Utils_Type
::T_INT
,
443 'title' => ts('Initial Reminder Day') ,
444 'description' => 'Send initial reminder this many days prior to the payment due date.',
450 'additional_reminder_day' => array(
451 'name' => 'additional_reminder_day',
452 'type' => CRM_Utils_Type
::T_INT
,
453 'title' => ts('Additional Reminder Days') ,
454 'description' => 'Send additional reminder this many days after last one sent, up to maximum number of reminders.',
460 'pledge_status_id' => array(
461 'name' => 'status_id',
462 'type' => CRM_Utils_Type
::T_INT
,
463 'title' => ts('Pledge Status Id') ,
464 'description' => 'Implicit foreign key to civicrm_option_values in the contribution_status option group.',
466 'where' => 'civicrm_pledge.status_id',
467 'headerPattern' => '',
470 'pseudoconstant' => array(
471 'optionGroupName' => 'contribution_status',
472 'optionEditPath' => 'civicrm/admin/options/contribution_status',
475 'pledge_is_test' => array(
477 'type' => CRM_Utils_Type
::T_BOOLEAN
,
478 'title' => ts('Test') ,
480 'where' => 'civicrm_pledge.is_test',
481 'headerPattern' => '',
485 'type' => 'CheckBox',
488 'pledge_campaign_id' => array(
489 'name' => 'campaign_id',
490 'type' => CRM_Utils_Type
::T_INT
,
491 'title' => ts('Campaign') ,
492 'description' => 'The campaign for which this pledge has been initiated.',
494 'where' => 'civicrm_pledge.campaign_id',
495 'headerPattern' => '',
498 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
502 'pseudoconstant' => array(
503 'table' => 'civicrm_campaign',
505 'labelColumn' => 'title',
509 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
511 return Civi
::$statics[__CLASS__
]['fields'];
514 * Return a mapping from field-name to the corresponding key (as used in fields()).
517 * Array(string $name => string $uniqueName).
519 static function &fieldKeys() {
520 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
521 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
523 return Civi
::$statics[__CLASS__
]['fieldKeys'];
526 * Returns the names of this table
530 static function getTableName() {
531 return self
::$_tableName;
534 * Returns if this table needs to be logged
542 * Returns the list of fields that can be imported
544 * @param bool $prefix
548 static function &import($prefix = false) {
549 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pledge', $prefix, array());
553 * Returns the list of fields that can be exported
555 * @param bool $prefix
559 static function &export($prefix = false) {
560 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pledge', $prefix, array());