X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FDAO%2FContributionRecur.php;h=18ca115e0845525412bfcc080484fb250651f88c;hb=63d66a39cb391e4db0f16724908f3e837c2f1c7e;hp=3369ccdec41fb25558028870e72529862df7e7fc;hpb=e501603bcc6d86d85326809a48ce758cacaaa793;p=civicrm-core.git diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php index 3369ccdec4..18ca115e08 100644 --- a/CRM/Contribute/DAO/ContributionRecur.php +++ b/CRM/Contribute/DAO/ContributionRecur.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ -| Copyright CiviCRM LLC (c) 2004-2016 | +| Copyright CiviCRM LLC (c) 2004-2017 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -26,11 +26,11 @@ */ /** * @package CRM - * @copyright CiviCRM LLC (c) 2004-2016 + * @copyright CiviCRM LLC (c) 2004-2017 * * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:fe7fe63ae2bf5e2e2c1f9e2449d5bda6) + * (GenCodeChecksum:0d69452bb0935f1146d7f5fdaff295bc) */ require_once 'CRM/Core/DAO.php'; require_once 'CRM/Utils/Type.php'; @@ -41,38 +41,6 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { * @var string */ static $_tableName = 'civicrm_contribution_recur'; - /** - * static instance to hold the field values - * - * @var array - */ - static $_fields = null; - /** - * static instance to hold the keys used in $_fields for each field. - * - * @var array - */ - static $_fieldKeys = null; - /** - * static instance to hold the FK relationships - * - * @var string - */ - static $_links = null; - /** - * static instance to hold the values that can - * be imported - * - * @var array - */ - static $_import = null; - /** - * static instance to hold the values that can - * be exported - * - * @var array - */ - static $_export = null; /** * static value to see if we should log any modifications to * this table in the civicrm_log table @@ -262,15 +230,16 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { * [CRM_Core_Reference_Interface] */ static function getReferenceColumns() { - if (!self::$_links) { - self::$_links = static ::createReferenceColumns(__CLASS__); - self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_token_id', 'civicrm_payment_token', 'id'); - self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); - self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); - self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + if (!isset(Civi::$statics[__CLASS__]['links'])) { + Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_token_id', 'civicrm_payment_token', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } - return self::$_links; + return Civi::$statics[__CLASS__]['links']; } /** * Returns all the column names of this table @@ -278,8 +247,8 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { * @return array */ static function &fields() { - if (!(self::$_fields)) { - self::$_fields = array( + if (!isset(Civi::$statics[__CLASS__]['fields'])) { + Civi::$statics[__CLASS__]['fields'] = array( 'id' => array( 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, @@ -465,6 +434,9 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'headerPattern' => '', 'dataPattern' => '', 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , ) , 'cycle_day' => array( 'name' => 'cycle_day', @@ -473,6 +445,9 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'description' => 'Day in the period when the payment should be charged e.g. 1st of month, 15th etc.', 'required' => true, 'default' => '1', + 'html' => array( + 'type' => 'Text', + ) , ) , 'next_sched_contribution_date' => array( 'name' => 'next_sched_contribution_date', @@ -488,6 +463,9 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Number of Failures') , 'description' => 'Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.', + 'html' => array( + 'type' => 'Text', + ) , ) , 'failure_retry_date' => array( 'name' => 'failure_retry_date', @@ -504,6 +482,9 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'title' => ts('Auto Renew') , 'description' => 'Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.', 'required' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , ) , 'payment_processor_id' => array( 'name' => 'payment_processor_id', @@ -564,51 +545,26 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'title' => ts('Send email Receipt?') , 'description' => 'if true, receipt is automatically emailed to contact on each successful payment', 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , ) , ); + CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } - return self::$_fields; + return Civi::$statics[__CLASS__]['fields']; } /** - * Returns an array containing, for each field, the arary key used for that - * field in self::$_fields. + * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array + * Array(string $name => string $uniqueName). */ static function &fieldKeys() { - if (!(self::$_fieldKeys)) { - self::$_fieldKeys = array( - 'id' => 'id', - 'contact_id' => 'contact_id', - 'amount' => 'amount', - 'currency' => 'currency', - 'frequency_unit' => 'frequency_unit', - 'frequency_interval' => 'frequency_interval', - 'installments' => 'installments', - 'start_date' => 'start_date', - 'create_date' => 'create_date', - 'modified_date' => 'modified_date', - 'cancel_date' => 'cancel_date', - 'end_date' => 'end_date', - 'processor_id' => 'processor_id', - 'payment_token_id' => 'payment_token_id', - 'trxn_id' => 'trxn_id', - 'invoice_id' => 'invoice_id', - 'contribution_status_id' => 'contribution_status_id', - 'is_test' => 'is_test', - 'cycle_day' => 'cycle_day', - 'next_sched_contribution_date' => 'next_sched_contribution_date', - 'failure_count' => 'failure_count', - 'failure_retry_date' => 'failure_retry_date', - 'auto_renew' => 'auto_renew', - 'payment_processor_id' => 'payment_processor_id', - 'financial_type_id' => 'financial_type_id', - 'payment_instrument_id' => 'payment_instrument_id', - 'campaign_id' => 'contribution_campaign_id', - 'is_email_receipt' => 'is_email_receipt', - ); + if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { + Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } - return self::$_fieldKeys; + return Civi::$statics[__CLASS__]['fieldKeys']; } /** * Returns the names of this table @@ -634,20 +590,8 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { * @return array */ static function &import($prefix = false) { - if (!(self::$_import)) { - self::$_import = array(); - $fields = self::fields(); - foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('import', $field)) { - if ($prefix) { - self::$_import['contribution_recur'] = & $fields[$name]; - } else { - self::$_import[$name] = & $fields[$name]; - } - } - } - } - return self::$_import; + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_recur', $prefix, array()); + return $r; } /** * Returns the list of fields that can be exported @@ -657,19 +601,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { * @return array */ static function &export($prefix = false) { - if (!(self::$_export)) { - self::$_export = array(); - $fields = self::fields(); - foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('export', $field)) { - if ($prefix) { - self::$_export['contribution_recur'] = & $fields[$name]; - } else { - self::$_export[$name] = & $fields[$name]; - } - } - } - } - return self::$_export; + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_recur', $prefix, array()); + return $r; } }