From 1330f57ae81c4ddb379f7f121de054427f6636bb Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Thu, 11 Apr 2019 06:33:50 +1000 Subject: [PATCH] (NFC) update CRM/Contribute to be the new coder standard --- CRM/Contribute/ActionMapping/ByPage.php | 1 - CRM/Contribute/ActionMapping/ByType.php | 1 - CRM/Contribute/BAO/Contribution.php | 26 +++---- CRM/Contribute/BAO/Contribution/Utils.php | 7 +- CRM/Contribute/BAO/ContributionPage.php | 8 +-- CRM/Contribute/BAO/ContributionRecur.php | 22 +++--- CRM/Contribute/BAO/Product.php | 3 +- CRM/Contribute/BAO/Query.php | 6 +- CRM/Contribute/BAO/Widget.php | 15 ++-- CRM/Contribute/Form/AbstractEditPayment.php | 7 +- CRM/Contribute/Form/AdditionalPayment.php | 43 ++++++----- CRM/Contribute/Form/CancelSubscription.php | 23 +++--- CRM/Contribute/Form/Contribution.php | 71 ++++++++++--------- CRM/Contribute/Form/Contribution/Confirm.php | 60 ++++++++-------- CRM/Contribute/Form/Contribution/Main.php | 13 ++-- CRM/Contribute/Form/Contribution/ThankYou.php | 20 +++--- CRM/Contribute/Form/ContributionBase.php | 4 +- CRM/Contribute/Form/ContributionCharts.php | 7 +- CRM/Contribute/Form/ContributionPage.php | 1 + .../Form/ContributionPage/AddProduct.php | 61 ++++++++-------- .../Form/ContributionPage/Amount.php | 10 +-- .../Form/ContributionPage/Delete.php | 1 + .../Form/ContributionPage/Settings.php | 10 +-- .../Form/ContributionPage/TabHeader.php | 1 + CRM/Contribute/Form/ContributionView.php | 2 +- CRM/Contribute/Form/ManagePremiums.php | 35 +++++---- CRM/Contribute/Form/Search.php | 8 +-- CRM/Contribute/Form/SoftCredit.php | 8 +-- CRM/Contribute/Form/Task.php | 21 +++--- CRM/Contribute/Form/Task/Batch.php | 23 +++--- CRM/Contribute/Form/Task/Delete.php | 3 +- CRM/Contribute/Form/Task/Invoice.php | 33 +++++---- CRM/Contribute/Form/Task/PDF.php | 32 +++++---- CRM/Contribute/Form/Task/PDFLetter.php | 22 +++--- CRM/Contribute/Form/Task/PDFLetterCommon.php | 3 +- CRM/Contribute/Form/Task/PickProfile.php | 8 ++- CRM/Contribute/Form/Task/Print.php | 23 +++--- CRM/Contribute/Form/Task/Result.php | 13 ++-- .../Form/Task/SearchTaskHookSample.php | 13 ++-- CRM/Contribute/Form/Task/Status.php | 23 +++--- CRM/Contribute/Form/UpdateBilling.php | 21 +++--- CRM/Contribute/Form/UpdateSubscription.php | 27 ++++--- CRM/Contribute/Import/Field.php | 5 +- CRM/Contribute/Import/Form/MapField.php | 17 +++-- CRM/Contribute/Import/Parser.php | 54 +++++++------- CRM/Contribute/Import/Parser/Contribution.php | 2 +- CRM/Contribute/Info.php | 7 ++ CRM/Contribute/Page/AJAX.php | 1 + CRM/Contribute/Page/ContributionPage.php | 3 +- CRM/Contribute/Page/ContributionRecur.php | 2 +- CRM/Contribute/Page/DashBoard.php | 8 +-- CRM/Contribute/Page/ManagePremiums.php | 2 +- CRM/Contribute/Page/PaymentInfo.php | 1 + CRM/Contribute/Page/Tab.php | 13 ++-- CRM/Contribute/Selector/Search.php | 6 +- CRM/Contribute/StateMachine/Search.php | 3 +- CRM/Contribute/Task.php | 9 ++- CRM/Contribute/Tokens.php | 3 +- 58 files changed, 446 insertions(+), 429 deletions(-) diff --git a/CRM/Contribute/ActionMapping/ByPage.php b/CRM/Contribute/ActionMapping/ByPage.php index 285e7987a7..5e1d62448b 100644 --- a/CRM/Contribute/ActionMapping/ByPage.php +++ b/CRM/Contribute/ActionMapping/ByPage.php @@ -25,7 +25,6 @@ +--------------------------------------------------------------------+ */ -use Civi\ActionSchedule\RecipientBuilder; /** * Class CRM_Contribute_ActionMapping_ByPage diff --git a/CRM/Contribute/ActionMapping/ByType.php b/CRM/Contribute/ActionMapping/ByType.php index 8708ef3965..3d4a85c8ae 100644 --- a/CRM/Contribute/ActionMapping/ByType.php +++ b/CRM/Contribute/ActionMapping/ByType.php @@ -25,7 +25,6 @@ +--------------------------------------------------------------------+ */ -use Civi\ActionSchedule\RecipientBuilder; /** * Class CRM_Contribute_ActionMapping_ByType diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 50905b2934..48e16a4dbf 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -37,21 +37,21 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { * * @var array */ - static $_importableFields = NULL; + public static $_importableFields = NULL; /** * Static field for all the contribution information that we can potentially export * * @var array */ - static $_exportableFields = NULL; + public static $_exportableFields = NULL; /** * Static field to hold financial trxn id's. * * @var array */ - static $_trxnIDs = NULL; + public static $_trxnIDs = NULL; /** * Field for all the objects related to this contribution @@ -326,7 +326,8 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { return $contribution; } - $null = NULL; // return by reference + // return by reference + $null = NULL; return $null; } @@ -965,7 +966,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { // as they would then me membership.contact_id, membership.is_test etc return civicrm_api3('Membership', 'get', [ 'id' => ['IN' => $membershipIDs], - 'return' => ['id', 'contact_id', 'membership_type_id', 'is_test'] + 'return' => ['id', 'contact_id', 'membership_type_id', 'is_test'], ])['values']; } @@ -990,7 +991,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { } else { $whereClauses['financial_type_id'] = [ - 'IN (' . implode(',', array_keys($types)) . ')' + 'IN (' . implode(',', array_keys($types)) . ')', ]; } return $whereClauses; @@ -1157,7 +1158,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = c.contact_id ) 'subject' => ts('Payment failed at payment processor'), 'source_record_id' => $contributionID, 'source_contact_id' => CRM_Core_Session::getLoggedInContactID() ? CRM_Core_Session::getLoggedInContactID() : - $contactID, + $contactID, )); // CRM-20336 Make sure that the contribution status is Failed, not Pending. @@ -3869,7 +3870,6 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac return FALSE; } - /** * Function to record additional payment for partial and refund contributions. * @@ -5139,6 +5139,7 @@ LEFT JOIN civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co * Line items. * @param bool $isARefund * Is this a refund / negative transaction. + * @param int $previousLineItemTotal * * @return float */ @@ -5345,9 +5346,10 @@ LIMIT 1;"; * @param float $balance * @param string $contributionStatus * - * @return array $actionLinks Links array containing: - * -url - * -title + * @return array + * $actionLinks Links array containing: + * -url + * -title */ protected static function getContributionPaymentLinks($id, $balance, $contributionStatus) { if ($contributionStatus === 'Failed' || !CRM_Core_Permission::check('edit contributions')) { @@ -5450,7 +5452,7 @@ LIMIT 1;"; $clauses = []; foreach ($whereClauses as $key => $clause) { - $clauses[] = 'b.' . $key . " " . implode(' AND b.' . $key, (array) $clause); + $clauses[] = 'b.' . $key . " " . implode(' AND b.' . $key, (array) $clause); } $whereClauseString = implode(' AND ', $clauses); diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index ebd162952e..08c84098c3 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -120,7 +120,8 @@ class CRM_Contribute_BAO_Contribution_Utils { 1 => $form->_id, 2 => $contributionParams['source'], ]), - 220 // eventually activity.description append price information to source text so keep it 220 to ensure string length doesn't exceed 255 characters. + // eventually activity.description append price information to source text so keep it 220 to ensure string length doesn't exceed 255 characters. + 220 ); } @@ -251,7 +252,7 @@ class CRM_Contribute_BAO_Contribution_Utils { * * @return bool */ - static protected function isPaymentTransaction($form) { + protected static function isPaymentTransaction($form) { return ($form->_amount >= 0.0) ? TRUE : FALSE; } @@ -533,7 +534,7 @@ LIMIT 1 * @param int $id * Contribution ID * - * @return array $statuses + * @return array * Array of contribution statuses in array('status id' => 'label') format */ public static function getContributionStatuses($usedFor = 'contribution', $id = NULL) { diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 10e47c8a90..492afdb67c 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -974,10 +974,10 @@ LEFT JOIN civicrm_premiums ON ( civicrm_premiums.entity_id = civicrm */ public static function getIsMembershipPayment($id) { $membershipBlocks = civicrm_api3('membership_block', 'get', [ - 'entity_table' => 'civicrm_contribution_page', - 'entity_id' => $id, - 'sequential' => TRUE, - ]); + 'entity_table' => 'civicrm_contribution_page', + 'entity_id' => $id, + 'sequential' => TRUE, + ]); if (!$membershipBlocks['count']) { return FALSE; } diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index 649b361b49..51ff736c2f 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -175,7 +175,6 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi return CRM_Financial_BAO_PaymentProcessor::getPayment($paymentProcessorID); } - /** * Get the processor object for the recurring contribution record. * @@ -203,7 +202,7 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi public static function getPaymentProcessorID($recurID) { $recur = civicrm_api3('ContributionRecur', 'getsingle', [ 'id' => $recurID, - 'return' => ['payment_processor_id'] + 'return' => ['payment_processor_id'], ]); return (int) CRM_Utils_Array::value('payment_processor_id', $recur, 0); } @@ -306,10 +305,10 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi } else { $details .= '
' . ts('The recurring contribution of %1, every %2 %3 has been cancelled.', [ - 1 => $dao->amount, - 2 => $dao->frequency_interval, - 3 => $dao->frequency_unit, - ]); + 1 => $dao->amount, + 2 => $dao->frequency_interval, + 3 => $dao->frequency_unit, + ]); } $activityParams = [ 'source_contact_id' => $dao->contact_id, @@ -586,7 +585,7 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) * @param int $recurId * @param int $targetContributionId */ - static public function copyCustomValues($recurId, $targetContributionId) { + public static function copyCustomValues($recurId, $targetContributionId) { if ($recurId && $targetContributionId) { // get the initial contribution id of recur id $sourceContributionId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recurId, 'id', 'contribution_recur_id'); @@ -851,6 +850,7 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) * Payment status - this correlates to the machine name of the contribution status ID ie * - Completed * - Failed + * @param string $effectiveDate * * @throws \CiviCRM_API3_Exception */ @@ -931,10 +931,10 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) */ public static function calculateRecurLineItems($recurId, $total_amount, $financial_type_id) { $originalContribution = civicrm_api3('Contribution', 'getsingle', [ - 'contribution_recur_id' => $recurId, - 'contribution_test' => '', - 'options' => ['limit' => 1], - 'return' => ['id', 'financial_type_id'], + 'contribution_recur_id' => $recurId, + 'contribution_test' => '', + 'options' => ['limit' => 1], + 'return' => ['id', 'financial_type_id'], ]); $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($originalContribution['id']); $lineSets = []; diff --git a/CRM/Contribute/BAO/Product.php b/CRM/Contribute/BAO/Product.php index 55915eb270..f3505f972c 100644 --- a/CRM/Contribute/BAO/Product.php +++ b/CRM/Contribute/BAO/Product.php @@ -34,8 +34,9 @@ class CRM_Contribute_BAO_Product extends CRM_Contribute_DAO_Product { /** * Static holder for the default LT. + * @var int */ - static $_defaultContributionType = NULL; + public static $_defaultContributionType = NULL; /** * Class constructor. diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index d0af3c53fa..3c51f78c23 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -32,9 +32,9 @@ */ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { - static $_contribOrSoftCredit = "only_contribs"; + public static $_contribOrSoftCredit = "only_contribs"; - static $_contribRecurPayment = NULL; + public static $_contribRecurPayment = NULL; /** * Function get the searchable fields for contribution. @@ -1030,7 +1030,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { FALSE, [ 'class' => 'crm-select2', 'multiple' => 'multiple', - 'placeholder' => ts('- any -') + 'placeholder' => ts('- any -'), ] ); } diff --git a/CRM/Contribute/BAO/Widget.php b/CRM/Contribute/BAO/Widget.php index 78535f2493..45ecc4116c 100644 --- a/CRM/Contribute/BAO/Widget.php +++ b/CRM/Contribute/BAO/Widget.php @@ -127,14 +127,11 @@ class CRM_Contribute_BAO_Widget extends CRM_Contribute_DAO_Widget { $now = time(); if ($dao->start_date) { $startDate = CRM_Utils_Date::unixTime($dao->start_date); - if ($startDate && - $startDate >= $now - ) { + if ($startDate && $startDate >= $now) { $data['is_active'] = FALSE; $data['campaign_start'] = ts('Campaign starts on %1', [ - 1 => CRM_Utils_Date::customFormat($dao->start_date, $config->dateformatFull), - ] - ); + 1 => CRM_Utils_Date::customFormat($dao->start_date, $config->dateformatFull), + ]); } } @@ -180,9 +177,9 @@ class CRM_Contribute_BAO_Widget extends CRM_Contribute_DAO_Widget { $data['money_raised_percentage'] = (round($percent, 2)) * 100 . "%"; $data['money_target_display'] = CRM_Utils_Money::format($data['money_target']); $data['money_raised'] = ts('Raised %1 of %2', [ - 1 => CRM_Utils_Money::format($data['money_raised']), - 2 => $data['money_target_display'], - ]); + 1 => CRM_Utils_Money::format($data['money_raised']), + 2 => $data['money_target_display'], + ]); } else { $data['money_raised'] = ts('Raised %1', [1 => CRM_Utils_Money::format($data['money_raised'])]); diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 70b4860aed..1eacda32bb 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -178,11 +178,13 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task { /** * The contribution values if an existing contribution + * @var array */ public $_values; /** * The pledge values if this contribution is associated with pledge + * @var array */ public $_pledgeValues; @@ -194,6 +196,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task { /** * Store the line items if price set used. + * @var array */ public $_lineItems; @@ -237,6 +240,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task { * These should get a standardised format in the beginPostProcess function. * * These fields are common to many forms. Some may override this. + * @var array */ protected $submittableMoneyFields = ['total_amount', 'net_amount', 'non_deductible_amount', 'fee_amount']; @@ -730,11 +734,10 @@ WHERE contribution_id = {$id} } } - /** * Assign the values to build the payment info block. * - * @return string $title + * @return string * Block title. */ protected function assignPaymentInfoBlock() { diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 84c7d7ba77..1c37915b58 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -39,6 +39,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract /** * Id of the component entity + * @var int */ public $_id = NULL; @@ -49,9 +50,8 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract protected $_refund = NULL; /** - * @deprecated - use parent $this->contactID - * * @var int + * @deprecated - use parent $this->contactID */ protected $_contactId = NULL; @@ -153,6 +153,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract * @return array * reference to the array of default values */ + /** * @return array */ @@ -188,14 +189,13 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract public function buildQuickForm() { if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) { $this->addButtons([ - [ - 'type' => 'cancel', - 'name' => ts('Done'), - 'spacing' => '         ', - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'cancel', + 'name' => ts('Done'), + 'spacing' => '         ', + 'isDefault' => TRUE, + ], + ]); return; } @@ -262,18 +262,17 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $buttonName = $this->_refund ? 'Record Refund' : 'Record Payment'; $this->addButtons([ - [ - 'type' => 'upload', - 'name' => ts('%1', [1 => $buttonName]), - 'js' => $js, - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'upload', + 'name' => ts('%1', [1 => $buttonName]), + 'js' => $js, + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); $mailingInfo = Civi::settings()->get('mailing_backend'); $this->assign('outBound_option', $mailingInfo['outBound_option']); diff --git a/CRM/Contribute/Form/CancelSubscription.php b/CRM/Contribute/Form/CancelSubscription.php index 2289628909..91bbe38460 100644 --- a/CRM/Contribute/Form/CancelSubscription.php +++ b/CRM/Contribute/Form/CancelSubscription.php @@ -152,18 +152,17 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Contribute_Form_Contrib } $this->addButtons([ - [ - 'type' => $type, - 'name' => $cancelButton, - 'spacing' => '         ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Not Now'), - ], - ] - ); + [ + 'type' => $type, + 'name' => $cancelButton, + 'spacing' => '         ', + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Not Now'), + ], + ]); } /** diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index f088ade2aa..ab46198a0b 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -102,11 +102,13 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP /** * The contribution values if an existing contribution + * @var array */ public $_values; /** * The pledge values if this contribution is associated with pledge + * @var array */ public $_pledgeValues; @@ -116,8 +118,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP /** * Parameter with confusing name. - * @todo what is it? * @var string + * @todo what is it? */ public $_compContext; @@ -137,13 +139,14 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP /** * Store the line items if price set used. + * @var array */ public $_lineItems; /** * Line item - * @todo explain why we use lineItem & lineItems * @var array + * @todo explain why we use lineItem & lineItems */ public $_lineItem; @@ -461,18 +464,17 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP public function buildQuickForm() { if ($this->_action & CRM_Core_Action::DELETE) { $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Delete'), - 'spacing' => '         ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Delete'), + 'spacing' => '         ', + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); return; } @@ -613,9 +615,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP if ($this->_context == 'standalone') { $this->addEntityRef('contact_id', ts('Contact'), [ - 'create' => TRUE, - 'api' => ['extra' => ['email']], - ], TRUE); + 'create' => TRUE, + 'api' => ['extra' => ['email']], + ], TRUE); } $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution'); @@ -798,24 +800,23 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->assign('outBound_option', $mailingInfo['outBound_option']); $this->addButtons([ - [ - 'type' => 'upload', - 'name' => ts('Save'), - 'js' => $js, - 'isDefault' => TRUE, - ], - [ - 'type' => 'upload', - 'name' => ts('Save and New'), - 'js' => $js, - 'subName' => 'new', - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'upload', + 'name' => ts('Save'), + 'js' => $js, + 'isDefault' => TRUE, + ], + [ + 'type' => 'upload', + 'name' => ts('Save and New'), + 'js' => $js, + 'subName' => 'new', + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); // if contribution is related to membership or participant freeze Financial Type, Amount if ($this->_id) { diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index d597b15ece..9add6a4ec1 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -455,10 +455,10 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // no on behalf of an organization, CRM-5519 // so reset loc blocks from main params. foreach ([ - 'phone', - 'email', - 'address', - ] as $blk) { + 'phone', + 'email', + 'address', + ] as $blk) { if (isset($this->_params[$blk])) { unset($this->_params[$blk]); } @@ -606,24 +606,22 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->getPaymentProcessorObject()->getText('contributionPageContinueText', [ 'is_payment_to_existing' => !empty($this->_ccid), 'amount' => $this->_amount, - ] - ) + ]) ); $this->addButtons([ - [ - 'type' => 'next', - 'name' => $contribButton, - 'spacing' => '         ', - 'isDefault' => TRUE, - 'js' => ['onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"], - ], - [ - 'type' => 'back', - 'name' => ts('Go Back'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => $contribButton, + 'spacing' => '         ', + 'isDefault' => TRUE, + 'js' => ['onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"], + ], + [ + 'type' => 'back', + 'name' => ts('Go Back'), + ], + ]); $defaults = []; $fields = array_fill_keys(array_keys($this->_fields), 1); @@ -635,9 +633,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr if (isset($contact[$name]) && is_array($contact[$name]) && ($name == 'onbehalf' || $name == 'honor')) { foreach ($contact[$name] as $fieldName => $fieldValue) { if (is_array($fieldValue) && !in_array($this->_fields[$name][$fieldName]['html_type'], [ - 'Multi-Select', - 'AdvMulti-Select', - ]) + 'Multi-Select', + 'AdvMulti-Select', + ]) ) { foreach ($fieldValue as $key => $value) { $defaults["{$name}[{$fieldName}][{$key}]"] = $value; @@ -660,10 +658,10 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } } elseif (in_array($name, [ - 'addressee', - 'email_greeting', - 'postal_greeting', - ]) && !empty($contact[$name . '_custom']) + 'addressee', + 'email_greeting', + 'postal_greeting', + ]) && !empty($contact[$name . '_custom']) ) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } @@ -1333,11 +1331,11 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $params['pcp_is_anonymous'] = 0; } foreach ([ - 'pcp_display_in_roll', - 'pcp_is_anonymous', - 'pcp_roll_nickname', - 'pcp_personal_note', - ] as $val) { + 'pcp_display_in_roll', + 'pcp_is_anonymous', + 'pcp_roll_nickname', + 'pcp_personal_note', + ] as $val) { if (!empty($params[$val])) { $page->assign($val, $params[$val]); } diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 4fd859f9bf..601c8e08fd 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -38,6 +38,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu /** * Define default MembershipType Id. + * @var int */ public $_defaultMemTypeId; @@ -238,14 +239,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults); $memtypeID = $selectedCurrentMemTypes[] = $values['membership_type_id']; } - elseif (!empty($values['is_default']) && - !$opMemTypeId && - (!isset($this->_defaults[$priceFieldName]) || - ($val['html_type'] == 'CheckBox' && - !isset($this->_defaults[$priceFieldName][$keys])) - )) { - CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults); - $memtypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_defaults[$priceFieldName], 'membership_type_id'); + elseif (!empty($values['is_default']) && !$opMemTypeId && (!isset($this->_defaults[$priceFieldName]) || + ($val['html_type'] == 'CheckBox' && !isset($this->_defaults[$priceFieldName][$keys])))) { + CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults); + $memtypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_defaults[$priceFieldName], 'membership_type_id'); } } } diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index a82579729a..842feec3b5 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -38,11 +38,13 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont /** * Membership price set status. + * @var bool */ public $_useForMember; /** * Tranxaaction Id of the current contribution + * @var string */ public $_trxnId; @@ -158,11 +160,11 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $qParams .= "&pcpId={$this->_pcpId}"; $this->assign('pcpBlock', TRUE); foreach ([ - 'pcp_display_in_roll', - 'pcp_is_anonymous', - 'pcp_roll_nickname', - 'pcp_personal_note', - ] as $val) { + 'pcp_display_in_roll', + 'pcp_is_anonymous', + 'pcp_roll_nickname', + 'pcp_personal_note', + ] as $val) { if (!empty($this->_params[$val])) { $this->assign($val, $this->_params[$val]); } @@ -246,10 +248,10 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont } } elseif (in_array($name, [ - 'addressee', - 'email_greeting', - 'postal_greeting', - ]) && !empty($contact[$name . '_custom']) + 'addressee', + 'email_greeting', + 'postal_greeting', + ]) && !empty($contact[$name . '_custom']) ) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 4b22fae1a4..971479e633 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -181,9 +181,8 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { public $_useForMember; /** + * @var bool * @deprecated - * - * @var */ public $_isBillingAddressRequiredForPayLater; @@ -1393,7 +1392,6 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } } - /** * Get the payment processor object for the submission, returning the manual one for offline payments. * diff --git a/CRM/Contribute/Form/ContributionCharts.php b/CRM/Contribute/Form/ContributionCharts.php index f8c10cd1cc..ac5866da5b 100644 --- a/CRM/Contribute/Form/ContributionCharts.php +++ b/CRM/Contribute/Form/ContributionCharts.php @@ -66,10 +66,9 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form { //p3 = Three dimensional pie chart. //bvg = Vertical bar chart $this->addElement('select', 'chart_type', ts('Chart Style'), [ - 'bvg' => ts('Bar'), - 'p3' => ts('Pie'), - ] - ); + 'bvg' => ts('Bar'), + 'p3' => ts('Pie'), + ]); $defaultValues['chart_type'] = $this->_chartType; $this->setDefaults($defaultValues); diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index b426a3b927..a7e95aedfe 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -452,6 +452,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { * * @return string */ + /** * @return string */ diff --git a/CRM/Contribute/Form/ContributionPage/AddProduct.php b/CRM/Contribute/Form/ContributionPage/AddProduct.php index 70adad65a1..4808e1f73b 100644 --- a/CRM/Contribute/Form/ContributionPage/AddProduct.php +++ b/CRM/Contribute/Form/ContributionPage/AddProduct.php @@ -100,7 +100,7 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For $dao->fetch(); $defaults['weight'] = $dao->max_weight + 1; } - RETURN $defaults; + return $defaults; } /** @@ -124,31 +124,29 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For } $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Delete'), - 'spacing' => '    ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Delete'), + 'spacing' => '    ', + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); return; } if ($this->_action & CRM_Core_Action::PREVIEW) { CRM_Contribute_BAO_Premium::buildPremiumPreviewBlock($this, NULL, $this->_pid); $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Done with Preview'), - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Done with Preview'), + 'isDefault' => TRUE, + ], + ]); return; } @@ -202,18 +200,17 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For if ($this->_single) { $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Save'), - 'spacing' => '    ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Save'), + 'spacing' => '    ', + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } else { parent::buildQuickForm(); diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index 6de2f49ffa..ed7efb2d82 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -224,11 +224,11 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co $options = $pFIDs = []; $priceFieldParams = ['price_set_id' => $priceSetId]; $priceFields = CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = [ - 'html_type', - 'name', - 'is_active', - 'label', - ]); + 'html_type', + 'name', + 'is_active', + 'label', + ]); foreach ($priceFields as $priceField) { if ($priceField['id'] && $priceField['html_type'] == 'Radio' && $priceField['name'] == 'contribution_amount') { $defaults['price_field_id'] = $priceField['id']; diff --git a/CRM/Contribute/Form/ContributionPage/Delete.php b/CRM/Contribute/Form/ContributionPage/Delete.php index b89a1448be..a715b136d8 100644 --- a/CRM/Contribute/Form/ContributionPage/Delete.php +++ b/CRM/Contribute/Form/ContributionPage/Delete.php @@ -45,6 +45,7 @@ class CRM_Contribute_Form_ContributionPage_Delete extends CRM_Contribute_Form_Co /** * Check if there are any related contributions. + * @var bool */ protected $_relatedContributions; diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index c2f7aa06a7..0e7ae3ae58 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -213,11 +213,11 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ ]; $allowCoreTypes = array_merge([ - 'Contact', - 'Individual', - 'Organization', - 'Household', - ], CRM_Contact_BAO_ContactType::subTypes('Individual')); + 'Contact', + 'Individual', + 'Organization', + 'Household', + ], CRM_Contact_BAO_ContactType::subTypes('Individual')); $allowSubTypes = []; $this->addProfileSelector('honoree_profile', ts('Honoree Profile'), $allowCoreTypes, $allowSubTypes, $entities); diff --git a/CRM/Contribute/Form/ContributionPage/TabHeader.php b/CRM/Contribute/Form/ContributionPage/TabHeader.php index 0becb7fb8a..c24edb0726 100644 --- a/CRM/Contribute/Form/ContributionPage/TabHeader.php +++ b/CRM/Contribute/Form/ContributionPage/TabHeader.php @@ -35,6 +35,7 @@ * Helper class to build navigation links. */ class CRM_Contribute_Form_ContributionPage_TabHeader { + /** * @param CRM_Core_Form $form * diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index 99b02342bd..a9eb615488 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -275,7 +275,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { * * @param int $id * - * @return string $title + * @return string * Block title. */ protected function assignPaymentInfoBlock($id) { diff --git a/CRM/Contribute/Form/ManagePremiums.php b/CRM/Contribute/Form/ManagePremiums.php index 6cfbe11798..bbb5543e20 100644 --- a/CRM/Contribute/Form/ManagePremiums.php +++ b/CRM/Contribute/Form/ManagePremiums.php @@ -92,9 +92,9 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'name'), TRUE); $this->addRule('name', ts('A product with this name already exists. Please select another name.'), 'objectExists', [ - 'CRM_Contribute_DAO_Product', - $this->_id, - ]); + 'CRM_Contribute_DAO_Product', + $this->_id, + ]); $this->add('text', 'sku', ts('SKU'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'sku')); $this->add('textarea', 'description', ts('Description'), 'rows=3, cols=60'); @@ -124,10 +124,10 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { $this->add('textarea', 'options', ts('Options'), 'rows=3, cols=60'); $this->add('select', 'period_type', ts('Period Type'), [ - '' => '- select -', - 'rolling' => 'Rolling', - 'fixed' => 'Fixed', - ]); + '' => '- select -', + 'rolling' => 'Rolling', + 'fixed' => 'Fixed', + ]); $this->add('text', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'fixed_period_start_day')); @@ -181,17 +181,16 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { $this->addFormRule(['CRM_Contribute_Form_ManagePremiums', 'formRule']); $this->addButtons([ - [ - 'type' => 'upload', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'upload', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); $this->assign('productId', $this->_id); } diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index 3aa1d912bf..8351b6d9ad 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -59,10 +59,10 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { /** * Prefix for the controller. + * @var string */ protected $_prefix = "contribute_"; - /** * Explicitly declare the entity api name. */ @@ -270,9 +270,9 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { } foreach ([ - 'contribution_amount_low', - 'contribution_amount_high', - ] as $f) { + 'contribution_amount_low', + 'contribution_amount_high', + ] as $f) { if (isset($this->_formValues[$f])) { $this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]); } diff --git a/CRM/Contribute/Form/SoftCredit.php b/CRM/Contribute/Form/SoftCredit.php index b45472fda6..431cb24dce 100644 --- a/CRM/Contribute/Form/SoftCredit.php +++ b/CRM/Contribute/Form/SoftCredit.php @@ -101,10 +101,10 @@ class CRM_Contribute_Form_SoftCredit { $form->addMoney("soft_credit_amount[{$rowNumber}]", ts('Amount'), FALSE, NULL, FALSE); $form->addSelect("soft_credit_type[{$rowNumber}]", [ - 'entity' => 'contribution_soft', - 'field' => 'soft_credit_type_id', - 'label' => ts('Type'), - ]); + 'entity' => 'contribution_soft', + 'field' => 'soft_credit_type_id', + 'label' => ts('Type'), + ]); if (!empty($form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id'])) { $form->add('hidden', "soft_credit_id[{$rowNumber}]", $form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id']); diff --git a/CRM/Contribute/Form/Task.php b/CRM/Contribute/Form/Task.php index 0414b694d7..8e6eb1d3ad 100644 --- a/CRM/Contribute/Form/Task.php +++ b/CRM/Contribute/Form/Task.php @@ -209,17 +209,16 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task { */ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) { $this->addButtons([ - [ - 'type' => $nextType, - 'name' => $title, - 'isDefault' => TRUE, - ], - [ - 'type' => $backType, - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => $nextType, + 'name' => $title, + 'isDefault' => TRUE, + ], + [ + 'type' => $backType, + 'name' => ts('Cancel'), + ], + ]); } } diff --git a/CRM/Contribute/Form/Task/Batch.php b/CRM/Contribute/Form/Task/Batch.php index 2e52dccdef..b2f32ee254 100644 --- a/CRM/Contribute/Form/Task/Batch.php +++ b/CRM/Contribute/Form/Task/Batch.php @@ -45,11 +45,13 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task { /** * Maximum profile fields that will be displayed + * @var int */ protected $_maxFields = 9; /** * Variable to store redirect path + * @var string */ protected $_userContext; @@ -113,17 +115,16 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task { $this->_fields = array_slice($this->_fields, 0, $this->_maxFields); $this->addButtons([ - [ - 'type' => 'submit', - 'name' => ts('Update Contribution(s)'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'submit', + 'name' => ts('Update Contribution(s)'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); $this->assign('profileTitle', $this->_title); $this->assign('componentIds', $this->_contributionIds); diff --git a/CRM/Contribute/Form/Task/Delete.php b/CRM/Contribute/Form/Task/Delete.php index 82c69c935a..8601ee564c 100644 --- a/CRM/Contribute/Form/Task/Delete.php +++ b/CRM/Contribute/Form/Task/Delete.php @@ -88,8 +88,7 @@ class CRM_Contribute_Form_Task_Delete extends CRM_Contribute_Form_Task { 'type' => 'back', 'name' => ts('Cancel'), ], - ] - ); + ]); } elseif ($count && !empty($this->_contributionIds)) { CRM_Core_Session::setStatus(ts('1 contribution will not be deleted.', ['plural' => '%count contributions will not be deleted.', 'count' => $count]), ts('Warning'), 'warning'); diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index dffc33c9f4..f2742ee109 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -49,21 +49,25 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { /** * Gives all the statues for conribution. + * @var int */ public $_contributionStatusId; /** * Gives the HTML template of PDF Invoice. + * @var string */ public $_messageInvoice; /** * This variable is used to assign parameters for HTML template of PDF Invoice. + * @var string */ public $_invoiceTemplate; /** * Selected output. + * @var string */ public $_selectedOutput; @@ -164,17 +168,16 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { ]); $this->addButtons([ - [ - 'type' => 'upload', - 'name' => $this->_selectedOutput == 'email' ? ts('Send Email') : ts('Process Invoice(s)'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'upload', + 'name' => $this->_selectedOutput == 'email' ? ts('Send Email') : ts('Process Invoice(s)'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } /** @@ -307,8 +310,8 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { } $resultPayments = civicrm_api3('Payment', 'get', [ - 'sequential' => 1, - 'contribution_id' => $contribID, + 'sequential' => 1, + 'contribution_id' => $contribID, ]); $amountPaid = 0; foreach ($resultPayments['values'] as $singlePayment) { @@ -557,7 +560,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { * For invoices. * */ - static public function addActivities($subject, $contactIds, $fileName, $params) { + public static function addActivities($subject, $contactIds, $fileName, $params) { $session = CRM_Core_Session::singleton(); $userID = $session->get('userID'); $config = CRM_Core_Config::singleton(); @@ -605,7 +608,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { * @return string * Name of file which is in pdf format */ - static public function putFile($html, $name = 'Invoice.pdf') { + public static function putFile($html, $name = 'Invoice.pdf') { $options = new Options(); $options->set('isRemoteEnabled', TRUE); diff --git a/CRM/Contribute/Form/Task/PDF.php b/CRM/Contribute/Form/Task/PDF.php index aff1abaf0d..c27b4fd176 100644 --- a/CRM/Contribute/Form/Task/PDF.php +++ b/CRM/Contribute/Form/Task/PDF.php @@ -106,12 +106,14 @@ AND {$this->_componentClause}"; $this->addElement('radio', 'output', NULL, ts('Email Receipts'), 'email_receipt', [ 'onClick' => "document.getElementById('selectPdfFormat').style.display = 'none'; - document.getElementById('selectEmailFrom').style.display = 'block';"] + document.getElementById('selectEmailFrom').style.display = 'block';", + ] ); $this->addElement('radio', 'output', NULL, ts('PDF Receipts'), 'pdf_receipt', [ 'onClick' => "document.getElementById('selectPdfFormat').style.display = 'block'; - document.getElementById('selectEmailFrom').style.display = 'none';"] + document.getElementById('selectEmailFrom').style.display = 'none';", + ] ); $this->addRule('output', ts('Selection required'), 'required'); @@ -124,17 +126,16 @@ AND {$this->_componentClause}"; $this->add('select', 'from_email_address', ts('From Email'), $this->_fromEmails, FALSE); $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Process Receipt(s)'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'back', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Process Receipt(s)'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'back', + 'name' => ts('Cancel'), + ], + ]); } /** @@ -193,7 +194,8 @@ AND {$this->_componentClause}"; FROM civicrm_financial_trxn WHERE trxn_id = %1 LIMIT 1", [ - 1 => [$contribution->trxn_id, 'String']]); + 1 => [$contribution->trxn_id, 'String'], + ]); // CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date $objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date); @@ -262,7 +264,7 @@ AND {$this->_componentClause}"; * array of common elements * */ - static public function getElements($contribIds, $params, $contactIds) { + public static function getElements($contribIds, $params, $contactIds) { $pdfElements = []; $pdfElements['contribIDs'] = implode(',', $contribIds); diff --git a/CRM/Contribute/Form/Task/PDFLetter.php b/CRM/Contribute/Form/Task/PDFLetter.php index b481060195..03620ec4dd 100644 --- a/CRM/Contribute/Form/Task/PDFLetter.php +++ b/CRM/Contribute/Form/Task/PDFLetter.php @@ -84,6 +84,7 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task { * @return array * reference to the array of default values */ + /** * @return array */ @@ -142,17 +143,16 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task { $this->addElement('select', 'email_options', ts('Print and email options'), $emailOptions, [], "
", FALSE); $this->addButtons([ - [ - 'type' => 'upload', - 'name' => ts('Make Thank-you Letters'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Done'), - ], - ] - ); + [ + 'type' => 'upload', + 'name' => ts('Make Thank-you Letters'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Done'), + ], + ]); } diff --git a/CRM/Contribute/Form/Task/PDFLetterCommon.php b/CRM/Contribute/Form/Task/PDFLetterCommon.php index c6af7bcd7c..88a870f716 100644 --- a/CRM/Contribute/Form/Task/PDFLetterCommon.php +++ b/CRM/Contribute/Form/Task/PDFLetterCommon.php @@ -70,7 +70,8 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF $realSeparator = "
"; } } - $separator = '****~~~~';// a placeholder in case the separator is common in the string - e.g ', ' + // a placeholder in case the separator is common in the string - e.g ', ' + $separator = '****~~~~'; $groupBy = $formValues['group_by']; // skip some contacts ? diff --git a/CRM/Contribute/Form/Task/PickProfile.php b/CRM/Contribute/Form/Task/PickProfile.php index c4908eb068..9d45ddafcd 100644 --- a/CRM/Contribute/Form/Task/PickProfile.php +++ b/CRM/Contribute/Form/Task/PickProfile.php @@ -45,11 +45,13 @@ class CRM_Contribute_Form_Task_PickProfile extends CRM_Contribute_Form_Task { /** * Maximum contributions that should be allowed to update + * @var int */ protected $_maxContributions = 100; /** * Variable to store redirect path + * @var string */ protected $_userContext; @@ -68,9 +70,9 @@ class CRM_Contribute_Form_Task_PickProfile extends CRM_Contribute_Form_Task { //validations if (count($this->_contributionIds) > $this->_maxContributions) { CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Update multiple contributions is %1. You have selected %2. Please select fewer contributions from your search results and try again.", [ - 1 => $this->_maxContributions, - 2 => count($this->_contributionIds), - ]), ts('Update multiple records error'), 'error'); + 1 => $this->_maxContributions, + 2 => count($this->_contributionIds), + ]), ts('Update multiple records error'), 'error'); $validate = TRUE; } diff --git a/CRM/Contribute/Form/Task/Print.php b/CRM/Contribute/Form/Task/Print.php index 132e2cefe8..58055ce580 100644 --- a/CRM/Contribute/Form/Task/Print.php +++ b/CRM/Contribute/Form/Task/Print.php @@ -73,18 +73,17 @@ class CRM_Contribute_Form_Task_Print extends CRM_Contribute_Form_Task { // just need to add a javascript to popup the window for printing // $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Print Contributions'), - 'js' => ['onclick' => 'window.print()'], - 'isDefault' => TRUE, - ], - [ - 'type' => 'back', - 'name' => ts('Done'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Print Contributions'), + 'js' => ['onclick' => 'window.print()'], + 'isDefault' => TRUE, + ], + [ + 'type' => 'back', + 'name' => ts('Done'), + ], + ]); } /** diff --git a/CRM/Contribute/Form/Task/Result.php b/CRM/Contribute/Form/Task/Result.php index 6e9c0999ef..11ff679294 100644 --- a/CRM/Contribute/Form/Task/Result.php +++ b/CRM/Contribute/Form/Task/Result.php @@ -47,13 +47,12 @@ class CRM_Contribute_Form_Task_Result extends CRM_Contribute_Form_Task { */ public function buildQuickForm() { $this->addButtons([ - [ - 'type' => 'done', - 'name' => ts('Done'), - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'done', + 'name' => ts('Done'), + 'isDefault' => TRUE, + ], + ]); } } diff --git a/CRM/Contribute/Form/Task/SearchTaskHookSample.php b/CRM/Contribute/Form/Task/SearchTaskHookSample.php index ce9e319b84..6c84b5315d 100644 --- a/CRM/Contribute/Form/Task/SearchTaskHookSample.php +++ b/CRM/Contribute/Form/Task/SearchTaskHookSample.php @@ -75,13 +75,12 @@ INNER JOIN civicrm_contact ct ON ( co.contact_id = ct.id ) */ public function buildQuickForm() { $this->addButtons([ - [ - 'type' => 'done', - 'name' => ts('Done'), - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'done', + 'name' => ts('Done'), + 'isDefault' => TRUE, + ], + ]); } } diff --git a/CRM/Contribute/Form/Task/Status.php b/CRM/Contribute/Form/Task/Status.php index 08262c92b3..348ed22387 100644 --- a/CRM/Contribute/Form/Task/Status.php +++ b/CRM/Contribute/Form/Task/Status.php @@ -155,17 +155,16 @@ AND co.id IN ( $contribIDs )"; $this->assign_by_ref('rows', $this->_rows); $this->setDefaults($defaults); $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Update Pending Status'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'back', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Update Pending Status'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'back', + 'name' => ts('Cancel'), + ], + ]); $this->addFormRule(['CRM_Contribute_Form_Task_Status', 'formRule']); } @@ -292,7 +291,7 @@ AND co.id IN ( $contribIDs )"; else { $input['trxn_id'] = $contribution->invoice_id; } - $input['trxn_date'] = $params["trxn_date_{$row['contribution_id']}"] . ' ' . date('H:i:s'); + $input['trxn_date'] = $params["trxn_date_{$row['contribution_id']}"] . ' ' . date('H:i:s'); // @todo calling baseIPN like this is a pattern in it's last gasps. Call contribute.completetransaction api. $baseIPN->completeTransaction($input, $ids, $objects, $transaction, FALSE); diff --git a/CRM/Contribute/Form/UpdateBilling.php b/CRM/Contribute/Form/UpdateBilling.php index 03c3b80c71..8d58d978e0 100644 --- a/CRM/Contribute/Form/UpdateBilling.php +++ b/CRM/Contribute/Form/UpdateBilling.php @@ -173,17 +173,16 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution } $this->addButtons(array( - array( - 'type' => $type, - 'name' => ts('Save'), - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - ), - ) - ); + array( + 'type' => $type, + 'name' => ts('Save'), + 'isDefault' => TRUE, + ), + array( + 'type' => 'cancel', + 'name' => ts('Cancel'), + ), + )); CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, TRUE, TRUE); $this->addFormRule(array('CRM_Contribute_Form_UpdateBilling', 'formRule'), $this); diff --git a/CRM/Contribute/Form/UpdateSubscription.php b/CRM/Contribute/Form/UpdateSubscription.php index cbe2ee8333..7b4be7a22c 100644 --- a/CRM/Contribute/Form/UpdateSubscription.php +++ b/CRM/Contribute/Form/UpdateSubscription.php @@ -215,17 +215,16 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Contribute_Form_Contrib // define the buttons $this->addButtons([ - [ - 'type' => $type, - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => $type, + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } /** @@ -290,9 +289,9 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Contribute_Form_Contrib if ($this->_subscriptionDetails->installments != $params['installments']) { $message .= "
" . ts("Recurring contribution installments have been updated from %1 to %2 for this subscription.", [ - 1 => $this->_subscriptionDetails->installments, - 2 => $params['installments'], - ]) . ' '; + 1 => $this->_subscriptionDetails->installments, + 2 => $params['installments'], + ]) . ' '; } $activityParams = [ diff --git a/CRM/Contribute/Import/Field.php b/CRM/Contribute/Import/Field.php index fdd1ce6177..969441ef83 100644 --- a/CRM/Contribute/Import/Field.php +++ b/CRM/Contribute/Import/Field.php @@ -32,17 +32,20 @@ */ class CRM_Contribute_Import_Field { - /**#@+ + /** + * #@+ * @var string */ /** * Name of the field + * @var string */ public $_name; /** * Title of the field to be used in display + * @var string */ public $_title; diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index 84449eea98..e0f58c436e 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -36,7 +36,6 @@ */ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { - /** * Set variables up before form is built. */ @@ -79,10 +78,10 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { //modify field title only for update mode. CRM-3245 foreach ([ - 'contribution_id', - 'invoice_id', - 'trxn_id', - ] as $key) { + 'contribution_id', + 'invoice_id', + 'trxn_id', + ] as $key) { $this->_mapperFields[$key] .= ' (match to contribution record)'; $highlightedFields[] = $key; } @@ -384,8 +383,8 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $self->_onDuplicate != CRM_Import_Parser::DUPLICATE_UPDATE ) { $errors['_qf_default'] .= ts('Missing required contact matching fields.') . " $fieldMessage " . ts('(Sum of all weights should be greater than or equal to threshold: %1).', [ - 1 => $threshold, - ]) . '
'; + 1 => $threshold, + ]) . '
'; } elseif ($self->_onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE && !(in_array('invoice_id', $importKeys) || in_array('trxn_id', $importKeys) || @@ -397,8 +396,8 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { } else { $errors['_qf_default'] .= ts('Missing required field: %1', [ - 1 => $title, - ]) . '
'; + 1 => $title, + ]) . '
'; } } } diff --git a/CRM/Contribute/Import/Parser.php b/CRM/Contribute/Import/Parser.php index 57a0156537..939eef3d80 100644 --- a/CRM/Contribute/Import/Parser.php +++ b/CRM/Contribute/Import/Parser.php @@ -38,50 +38,62 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { */ const SOFT_CREDIT = 512, SOFT_CREDIT_ERROR = 1024, PLEDGE_PAYMENT = 2048, PLEDGE_PAYMENT_ERROR = 4096; + /** + * @var string + */ protected $_fileName; /** * Imported file size + * @var int */ protected $_fileSize; /** * Seperator being used + * @var string */ protected $_seperator; /** * Total number of lines in file + * @var int */ protected $_lineCount; /** * Running total number of valid soft credit rows + * @var int */ protected $_validSoftCreditRowCount; /** * Running total number of invalid soft credit rows + * @var int */ protected $_invalidSoftCreditRowCount; /** * Running total number of valid pledge payment rows + * @var int */ protected $_validPledgePaymentRowCount; /** * Running total number of invalid pledge payment rows + * @var int */ protected $_invalidPledgePaymentRowCount; /** * Array of pledge payment error lines, bounded by MAX_ERROR + * @var array */ protected $_pledgePaymentErrors; /** * Array of pledge payment error lines, bounded by MAX_ERROR + * @var array */ protected $_softCreditErrors; @@ -114,6 +126,8 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { * @param int $mode * @param int $contactType * @param int $onDuplicate + * @param int $statusID + * @param int $totalRowCount * * @return mixed * @throws Exception @@ -346,11 +360,9 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { if ($this->_invalidRowCount) { // removed view url for invlaid contacts $headers = array_merge([ - ts('Line Number'), - ts('Reason'), - ], - $customHeaders - ); + ts('Line Number'), + ts('Reason'), + ], $customHeaders); $this->_errorFileName = self::errorFileName(self::ERROR); self::exportCSV($this->_errorFileName, $headers, $this->_errors); } @@ -358,11 +370,9 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { if ($this->_invalidPledgePaymentRowCount) { // removed view url for invlaid contacts $headers = array_merge([ - ts('Line Number'), - ts('Reason'), - ], - $customHeaders - ); + ts('Line Number'), + ts('Reason'), + ], $customHeaders); $this->_pledgePaymentErrorsFileName = self::errorFileName(self::PLEDGE_PAYMENT_ERROR); self::exportCSV($this->_pledgePaymentErrorsFileName, $headers, $this->_pledgePaymentErrors); } @@ -370,32 +380,26 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { if ($this->_invalidSoftCreditRowCount) { // removed view url for invlaid contacts $headers = array_merge([ - ts('Line Number'), - ts('Reason'), - ], - $customHeaders - ); + ts('Line Number'), + ts('Reason'), + ], $customHeaders); $this->_softCreditErrorsFileName = self::errorFileName(self::SOFT_CREDIT_ERROR); self::exportCSV($this->_softCreditErrorsFileName, $headers, $this->_softCreditErrors); } if ($this->_conflictCount) { $headers = array_merge([ - ts('Line Number'), - ts('Reason'), - ], - $customHeaders - ); + ts('Line Number'), + ts('Reason'), + ], $customHeaders); $this->_conflictFileName = self::errorFileName(self::CONFLICT); self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts); } if ($this->_duplicateCount) { $headers = array_merge([ - ts('Line Number'), - ts('View Contribution URL'), - ], - $customHeaders - ); + ts('Line Number'), + ts('View Contribution URL'), + ], $customHeaders); $this->_duplicateFileName = self::errorFileName(self::DUPLICATE); self::exportCSV($this->_duplicateFileName, $headers, $this->_duplicates); diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 3d6dbd7691..6ee91c40ef 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -48,7 +48,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa /** * Array of successfully imported contribution id's * - * @array + * @var array */ protected $_newContributions; diff --git a/CRM/Contribute/Info.php b/CRM/Contribute/Info.php index b6934b6167..6fd1c9c51c 100644 --- a/CRM/Contribute/Info.php +++ b/CRM/Contribute/Info.php @@ -37,6 +37,7 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { /** + * @var string * @inheritDoc */ protected $keyword = 'contribute'; @@ -50,6 +51,7 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * @return array * collection of required component settings */ + /** * @return array */ @@ -114,6 +116,7 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * list of permissions * @see CRM_Component_Info::getPermissions */ + /** * @return array */ @@ -132,6 +135,7 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * collection of required dashboard settings, * null if no element offered */ + /** * @return array|null */ @@ -153,6 +157,7 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * collection of required dashboard settings, * null if no element offered */ + /** * @return array|null */ @@ -181,6 +186,7 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * collection of required pane settings, * null if no element offered */ + /** * @return array|null */ @@ -201,6 +207,7 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * @return array|null * collection of activity types */ + /** * @return array|null */ diff --git a/CRM/Contribute/Page/AJAX.php b/CRM/Contribute/Page/AJAX.php index 1f3c70c5fb..9cbfacdd6a 100644 --- a/CRM/Contribute/Page/AJAX.php +++ b/CRM/Contribute/Page/AJAX.php @@ -36,6 +36,7 @@ * This class contains all the function that are called using AJAX (jQuery) */ class CRM_Contribute_Page_AJAX { + /** * Get Soft credit to list in DT */ diff --git a/CRM/Contribute/Page/ContributionPage.php b/CRM/Contribute/Page/ContributionPage.php index 7771184f19..0f9f8df41a 100644 --- a/CRM/Contribute/Page/ContributionPage.php +++ b/CRM/Contribute/Page/ContributionPage.php @@ -215,7 +215,8 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { 'title' => ts('Test-drive'), 'url' => $urlString, 'qs' => $urlParams . '&action=preview', - 'fe' => TRUE, // Addresses https://lab.civicrm.org/dev/core/issues/658 + // Addresses https://lab.civicrm.org/dev/core/issues/658 + 'fe' => TRUE, 'uniqueName' => 'test_drive', ), ); diff --git a/CRM/Contribute/Page/ContributionRecur.php b/CRM/Contribute/Page/ContributionRecur.php index 6a5029d076..7aa68b264e 100644 --- a/CRM/Contribute/Page/ContributionRecur.php +++ b/CRM/Contribute/Page/ContributionRecur.php @@ -36,7 +36,7 @@ */ class CRM_Contribute_Page_ContributionRecur extends CRM_Core_Page { - static $_links = NULL; + public static $_links = NULL; public $_permission = NULL; public $_contactId = NULL; public $_id = NULL; diff --git a/CRM/Contribute/Page/DashBoard.php b/CRM/Contribute/Page/DashBoard.php index 29893f8812..59b07ffda4 100644 --- a/CRM/Contribute/Page/DashBoard.php +++ b/CRM/Contribute/Page/DashBoard.php @@ -52,10 +52,10 @@ class CRM_Contribute_Page_DashBoard extends CRM_Core_Page { //get contribution dates. $dates = CRM_Contribute_BAO_Contribution::getContributionDates(); foreach ([ - 'now', - 'yearDate', - 'monthDate', - ] as $date) { + 'now', + 'yearDate', + 'monthDate', + ] as $date) { $$date = $dates[$date]; } // fiscal years end date diff --git a/CRM/Contribute/Page/ManagePremiums.php b/CRM/Contribute/Page/ManagePremiums.php index c4f0939a61..f4d41cf60a 100644 --- a/CRM/Contribute/Page/ManagePremiums.php +++ b/CRM/Contribute/Page/ManagePremiums.php @@ -43,7 +43,7 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic { * * @var array */ - static $_links = NULL; + public static $_links = NULL; /** * Get BAO Name. diff --git a/CRM/Contribute/Page/PaymentInfo.php b/CRM/Contribute/Page/PaymentInfo.php index 5b17464568..bfb9e84361 100644 --- a/CRM/Contribute/Page/PaymentInfo.php +++ b/CRM/Contribute/Page/PaymentInfo.php @@ -31,6 +31,7 @@ * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Contribute_Page_PaymentInfo extends CRM_Core_Page { + public function preProcess() { $this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); diff --git a/CRM/Contribute/Page/Tab.php b/CRM/Contribute/Page/Tab.php index f87dff5bbc..b93544e307 100644 --- a/CRM/Contribute/Page/Tab.php +++ b/CRM/Contribute/Page/Tab.php @@ -37,8 +37,8 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { * * @var array */ - static $_links = NULL; - static $_recurLinks = NULL; + public static $_links = NULL; + public static $_recurLinks = NULL; public $_permission = NULL; public $_contactId = NULL; public $_crid = NULL; @@ -157,7 +157,8 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { $softCreditTotals['cancel']['count'], $softCreditTotals['amount'], $softCreditTotals['avg'], - $softCreditTotals['cancel']['amount'] // to get cancel amount + // to get cancel amount + $softCreditTotals['cancel']['amount'] ) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest); $this->assign('softCredit', TRUE); @@ -338,9 +339,9 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, empty($this->_id)); if (empty($this->_contactId)) { $this->_contactId = civicrm_api3('contribution', 'getvalue', [ - 'id' => $this->_id, - 'return' => 'contact_id', - ]); + 'id' => $this->_id, + 'return' => 'contact_id', + ]); } $this->assign('contactId', $this->_contactId); diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index c8fa53a775..f2250641c6 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -40,20 +40,20 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C * * @var array */ - static $_links = NULL; + public static $_links = NULL; /** * We use desc to remind us what that column is, name is used in the tpl * * @var array */ - static $_columnHeaders; + public static $_columnHeaders; /** * Properties of contact we're interested in displaying * @var array */ - static $_properties = [ + public static $_properties = [ 'contact_id', 'contribution_id', 'contact_type', diff --git a/CRM/Contribute/StateMachine/Search.php b/CRM/Contribute/StateMachine/Search.php index 43ac47fa19..62c0d6c078 100644 --- a/CRM/Contribute/StateMachine/Search.php +++ b/CRM/Contribute/StateMachine/Search.php @@ -78,7 +78,8 @@ class CRM_Contribute_StateMachine_Search extends CRM_Core_StateMachine { * * @param string $formName * - * @return array [ 'class' => task classname, 'result' => TRUE ] + * @return array + * [ 'class' => task classname, 'result' => TRUE ] * the name of the form that will handle the task */ public function taskName($controller, $formName = 'Search') { diff --git a/CRM/Contribute/Task.php b/CRM/Contribute/Task.php index 2c6065350a..c7679aab1b 100644 --- a/CRM/Contribute/Task.php +++ b/CRM/Contribute/Task.php @@ -38,14 +38,19 @@ */ class CRM_Contribute_Task extends CRM_Core_Task { + /** + * Contribution tasks + */ const - // Contribution tasks UPDATE_STATUS = 401, PDF_RECEIPT = 402, PDF_THANKYOU = 403, PDF_INVOICE = 404; - static $objectType = 'contribution'; + /** + * @var string + */ + public static $objectType = 'contribution'; /** * These tasks are the core set of tasks that the user can perform diff --git a/CRM/Contribute/Tokens.php b/CRM/Contribute/Tokens.php index 5906f5e969..25d247c51f 100644 --- a/CRM/Contribute/Tokens.php +++ b/CRM/Contribute/Tokens.php @@ -97,8 +97,7 @@ class CRM_Contribute_Tokens extends \Civi\Token\AbstractTokenSubscriber { * @return bool */ public function checkActive(\Civi\Token\TokenProcessor $processor) { - return - !empty($processor->context['actionMapping']) + return !empty($processor->context['actionMapping']) && $processor->context['actionMapping']->getEntity() === 'civicrm_contribution'; } -- 2.25.1