From dbddfb08ab195a76eef52c0bc679a0470585aad0 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 8 May 2014 11:55:42 +1200 Subject: [PATCH] minor code tidy ups highlighted by IDE --- CRM/Contact/Form/Task/PDFLetterCommon.php | 4 +++ CRM/Contribute/Form/Contribution/Confirm.php | 27 ++++++++++---------- CRM/Contribute/Form/ContributionBase.php | 11 ++++++++ CRM/Core/Error.php | 7 ++++- CRM/Pledge/BAO/Pledge.php | 2 +- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index f67aa261c1..8037b9e24d 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -257,6 +257,8 @@ class CRM_Contact_Form_Task_PDFLetterCommon { * * @access protected * + * @param $form + * * @return array( $categories, $html_message, $messageToken, $returnProperties ) */ static protected function processMessageTemplate(&$form) { @@ -330,6 +332,8 @@ class CRM_Contact_Form_Task_PDFLetterCommon { * * @access public * + * @param $form + * * @return void */ static function postProcess(&$form) { diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index ced16cd19c..5098e66b7d 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -570,7 +570,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr * @access public */ public function postProcess() { - $config = CRM_Core_Config::singleton(); $contactID = $this->getContactID(); // add a description field at the very beginning @@ -582,7 +581,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr ); // fix currency ID - $this->_params['currencyID'] = $config->defaultCurrency; + $this->_params['currencyID'] = CRM_Core_Config::singleton()->defaultCurrency; $premiumParams = $membershipParams = $tempParams = $params = $this->_params; @@ -889,6 +888,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr foreach ($priceFieldIds as $priceFieldId) { if ($id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldId, 'membership_type_id')) { $membershipTypeIds[] = $id; + //@todo the value for $term is immediately overwritten. It is unclear from the code whether it was intentional to + // do this or a double = was intended (this ambiguity is the reason many IDEs complain about 'assignment in condition' $term = 1; if ($term = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldId, 'membership_num_terms')) { $membershipTypeTerms[$id] = ($term > 1) ? $term : 1; @@ -1120,7 +1121,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } $recurringContributionID = self::processRecurringContribution($form, $params, $contactID, $contributionType, $online); - $config = CRM_Core_Config::singleton(); // CRM-11885 // if non_deductible_amount exists i.e. Additional Details fieldset was opened [and staff typed something] -> keep it. if (isset($params['non_deductible_amount']) && (!empty($params['non_deductible_amount']))) { @@ -1171,7 +1171,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } //get the contrib page id. - $campaignId = $contributionPageId = NULL; + $contributionPageId = NULL; if ($online) { $contributionPageId = $form->_id; $campaignId = CRM_Utils_Array::value('campaign_id', $params); @@ -1468,9 +1468,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr return NULL; } - $recurParams = array(); - $config = CRM_Core_Config::singleton(); - $recurParams['contact_id'] = $contactID; + $recurParams = array('contact_id' => $contactID); $recurParams['amount'] = CRM_Utils_Array::value('amount', $params); $recurParams['auto_renew'] = CRM_Utils_Array::value('auto_renew', $params); $recurParams['frequency_unit'] = CRM_Utils_Array::value('frequency_unit', $params); @@ -1553,6 +1551,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr */ static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) { $isCurrentEmployer = FALSE; + $dupeIDs = array(); $orgID = NULL; if (!empty($behalfOrganization['organization_id']) && !empty($behalfOrganization['org_option'])) { $orgID = $behalfOrganization['organization_id']; @@ -1659,23 +1658,23 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr static function processPcpSoft(&$params, &$contribution) { //add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin. if (!empty($params['soft_credit_to'])) { - $contribSoftParams = array(); + $contributionSoftParams = array(); foreach (array( 'pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note', 'amount') as $val) { if (!empty($params[$val])) { - $contribSoftParams[$val] = $params[$val]; + $contributionSoftParams[$val] = $params[$val]; } } - $contribSoftParams['contact_id'] = $params['soft_credit_to']; + $contributionSoftParams['contact_id'] = $params['soft_credit_to']; // add contribution id - $contribSoftParams['contribution_id'] = $contribution->id; + $contributionSoftParams['contribution_id'] = $contribution->id; // add pcp id - $contribSoftParams['pcp_id'] = $params['pcp_made_through_id']; + $contributionSoftParams['pcp_id'] = $params['pcp_made_through_id']; - $contribSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name'); + $contributionSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name'); - $softContribution = CRM_Contribute_BAO_ContributionSoft::add($contribSoftParams); + CRM_Contribute_BAO_ContributionSoft::add($contributionSoftParams); } } diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 340e8f5098..e9535cae9a 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -195,6 +195,17 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { */ public $_honor_block_is_active = FALSE; + /** + * Contribution mode e.g express for payment express, notify for off-site + notification back to CiviCRM + * @var string + */ + public $_contributeMode; + + /** + * contribution page supports memberships + * @var boolean + */ + public $_useForMember; /** * Function to set variables up before form is built * diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index ee1f103726..1da9a4fbab 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -119,7 +119,12 @@ class CRM_Core_Error extends PEAR_ErrorStack { return NULL; } - function displaySessionError(&$error, $separator = '
') { + /** + * Status display function specific to payment processor errors + * @param $error + * @param string $separator + */ + static function displaySessionError(&$error, $separator = '
') { $message = self::getMessages($error, $separator); if ($message) { $status = ts("Payment Processor Error message") . "{$separator} $message"; diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index e6b8e8d98f..654ca965ac 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -489,7 +489,7 @@ GROUP BY currency * * @return void. */ - function sendAcknowledgment(&$form, $params) { + static function sendAcknowledgment(&$form, $params) { //handle Acknowledgment. $allPayments = $payments = array(); -- 2.25.1