From 4691b077791c37e98f6f0cdbe5cf0ee4581bf67b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 14 May 2014 14:27:09 +1200 Subject: [PATCH] minor code cleanups - add comments, remove unused var, declare function as static --- CRM/Contribute/Form/AbstractEditPayment.php | 8 +++++ CRM/Contribute/Form/Contribution.php | 34 +++++++++++++++++++-- CRM/Core/Payment.php | 4 ++- CRM/Core/Payment/Form.php | 2 +- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 3bbca7fdcd..0bd7a97ae3 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -66,6 +66,10 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Core_Form { * @public */ public $_premiumID = NULL; + + /** + * @var CRM_Contribute_DAO_ContributionProduct + */ public $_productDAO = NULL; /** @@ -213,6 +217,10 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Core_Form { CRM_Custom_Form_CustomData::setDefaultValues($this); } + /** + * @param $id + * @todo - this function is a long way, non standard of saying $dao = new CRM_Contribute_DAO_ContributionProduct(); $dao->id = $id; $dao->find(); + */ public function assignPremiumProduct($id) { //to get Premium id $sql = " SELECT * diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index b71b60c0b2..44ed3d523b 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -53,6 +53,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP * @public */ public $_premiumID = NULL; + + /** + * @var CRM_Contribute_DAO_ContributionProduct + */ public $_productDAO = NULL; /** @@ -104,6 +108,14 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP */ public $_options; + /** + * Storage of parameters from form + * + * @var array + * @public + */ + public $_params; + /** * Store the contribution Type ID * @@ -141,6 +153,25 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP protected $_cdType; public $_honoreeProfileType; + /** + * logged in user's email + * @var string + */ + public $userEmail; + + /** + * Price set ID + * @var integer + */ + public $_priceSetId; + + + /** + * Price set as an array + * @var array + */ + public $_priceSet; + /** * Function to set variables up before form is built * @@ -924,6 +955,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP */ public function postProcess() { $session = CRM_Core_Session::singleton(); + $sendReceipt = FALSE; if ($this->_action & CRM_Core_Action::DELETE) { CRM_Contribute_BAO_Contribution::deleteContribution($this->_id); $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', @@ -991,9 +1023,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $lineItems[$id]['id'] = $id; } $itemId = key($lineItems); - $fieldType = NULL; if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) { - $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type'); $this->_priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id'); } diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 1f1f8bed42..d4a96e4d81 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -231,8 +231,10 @@ abstract class CRM_Core_Payment { * Load requested payment processor and call that processor's handle<$method> method * * @public + * @param $method + * @param array $params */ - static function handlePaymentMethod($method, $params = array( )) { + static function handlePaymentMethod($method, $params = array()) { if (!isset($params['processor_id']) && !isset($params['processor_name'])) { CRM_Core_Error::fatal("Either 'processor_id' or 'processor_name' param is required for payment callback"); } diff --git a/CRM/Core/Payment/Form.php b/CRM/Core/Payment/Form.php index 9e4b334acf..73b4b8b41b 100644 --- a/CRM/Core/Payment/Form.php +++ b/CRM/Core/Payment/Form.php @@ -320,7 +320,7 @@ class CRM_Core_Payment_Form { * @return void * @access public */ - function buildDirectDebit(&$form, $useRequired = FALSE) { + static function buildDirectDebit(&$form, $useRequired = FALSE) { if ($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) { self::setDirectDebitFields($form); foreach ($form->_paymentFields as $name => $field) { -- 2.25.1