From 874c9be71a0eaece92406de8089dc7de42298084 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 13:09:20 -0800 Subject: [PATCH] INFRA-132 - CRM/Contribute - phpcbf --- CRM/Contribute/BAO/Contribution/Utils.php | 16 +++--- CRM/Contribute/BAO/ContributionPage.php | 19 +++---- CRM/Contribute/BAO/ContributionRecur.php | 2 +- CRM/Contribute/BAO/ContributionSoft.php | 39 +++++++------- CRM/Contribute/BAO/ManagePremiums.php | 4 +- CRM/Contribute/BAO/Premium.php | 2 +- CRM/Contribute/Form.php | 2 +- CRM/Contribute/Form/Contribution/Main.php | 16 +++--- CRM/Contribute/Form/Contribution/ThankYou.php | 6 +-- CRM/Contribute/Form/ContributionBase.php | 10 ++-- CRM/Contribute/Form/ContributionCharts.php | 14 ++--- CRM/Contribute/Form/ContributionPage.php | 3 +- .../Form/ContributionPage/AddProduct.php | 15 +++--- .../Form/ContributionPage/Amount.php | 17 +++--- .../Form/ContributionPage/Custom.php | 2 - .../Form/ContributionPage/Premium.php | 2 +- .../Form/ContributionPage/Settings.php | 27 +++++----- .../Form/ContributionPage/TabHeader.php | 30 +++++++---- .../Form/ContributionPage/ThankYou.php | 4 +- .../Form/ContributionPage/Widget.php | 6 ++- CRM/Contribute/Form/ContributionView.php | 2 +- CRM/Contribute/Form/ManagePremiums.php | 23 ++++---- CRM/Contribute/Form/Search.php | 5 +- CRM/Contribute/Form/SoftCredit.php | 2 +- CRM/Contribute/Form/Task.php | 2 +- CRM/Contribute/Form/Task/Batch.php | 1 - CRM/Contribute/Form/Task/Invoice.php | 2 +- CRM/Contribute/Form/Task/PDF.php | 10 ++-- CRM/Contribute/Form/Task/PDFLetterCommon.php | 52 +++++++++---------- CRM/Contribute/Form/Task/Result.php | 3 +- CRM/Contribute/Form/Task/Status.php | 1 - CRM/Contribute/Import/Field.php | 6 +-- CRM/Contribute/Import/Form/MapField.php | 10 ++-- CRM/Contribute/Import/Form/Preview.php | 2 +- CRM/Contribute/Info.php | 6 ++- CRM/Contribute/Page/ContributionPage.php | 16 +++--- CRM/Contribute/Page/ManagePremiums.php | 11 ++-- CRM/Contribute/Page/PaymentInfo.php | 4 +- CRM/Contribute/Page/SubscriptionStatus.php | 6 +-- CRM/Contribute/Page/Tab.php | 3 +- CRM/Contribute/Page/UserDashboard.php | 3 +- CRM/Contribute/PseudoConstant.php | 18 +++---- CRM/Contribute/Selector/Search.php | 15 +++--- CRM/Contribute/Task.php | 2 +- 44 files changed, 224 insertions(+), 217 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 1595e684b7..eae7ce350a 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -87,10 +87,9 @@ class CRM_Contribute_BAO_Contribution_Utils { //CRM-15297 - contributionType is obsolete - pass financial type as well so people can deprecate it $paymentParams['financialType_name'] = $paymentParams['contributionType_name'] = $form->_params['contributionType_name'] = $contributionType->name; //CRM-11456 - $paymentParams['financialType_accounting_code'] = $paymentParams['contributionType_accounting_code'] = $form->_params['contributionType_accounting_code'] = CRM_Financial_BAO_FinancialAccount::getAccountingCode($contributionTypeId); + $paymentParams['financialType_accounting_code'] = $paymentParams['contributionType_accounting_code'] = $form->_params['contributionType_accounting_code'] = CRM_Financial_BAO_FinancialAccount::getAccountingCode($contributionTypeId); $paymentParams['contributionPageID'] = $form->_params['contributionPageID'] = $form->_values['id']; - $payment = NULL; $paymentObjError = ts('The system did not record payment details for this payment and so could not process the transaction. Please report this error to the site administrator.'); @@ -121,7 +120,7 @@ class CRM_Contribute_BAO_Contribution_Utils { ); if ($contribution) { - $form->_params['contributionID'] = $contribution->id; + $form->_params['contributionID'] = $contribution->id; } $form->_params['contributionTypeID'] = $contributionTypeId; @@ -350,12 +349,12 @@ class CRM_Contribute_BAO_Contribution_Utils { // finally send an email receipt if ($contribution) { - $form->_values['contribution_id'] = $contribution->id; + $form->_values['contribution_id'] = $contribution->id; CRM_Contribute_BAO_ContributionPage::sendMail($contactID, $form->_values, $contribution->is_test, FALSE, $fieldTypes - ); - } + ); + } } /** @@ -507,7 +506,8 @@ INNER JOIN civicrm_contact contact ON ( contact.id = contrib.contact_id ) } if (!CRM_Utils_System::isNull($params['email'])) { $params['email'] = array( - 1 => array('email' => $params['email'], + 1 => array( + 'email' => $params['email'], 'location_type_id' => $billingLocTypeId, )); } @@ -899,7 +899,7 @@ LIMIT 1 */ public static function calculateTaxAmount($amount, $taxRate) { $taxAmount = array(); - $taxAmount['tax_amount'] = ($taxRate/100) * CRM_Utils_Rule::cleanMoney($amount); + $taxAmount['tax_amount'] = ($taxRate / 100) * CRM_Utils_Rule::cleanMoney($amount); return $taxAmount; } diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 58212b82ba..468fe9c1d2 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -108,7 +108,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio // if ($values ['financial_type_id']) { // $values ['accountingCode'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $values ['financial_type_id'], 'accounting_code' ); // } - } + } /** * Send the emails @@ -238,7 +238,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio if ($gId) { $email = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify'); if ($email) { - $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array::value($key, $params), true ); + $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array::value($key, $params), TRUE ); CRM_Core_BAO_UFGroup::commonSendMail($contactID, $val); } } @@ -407,7 +407,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue); if (count($taxAmt) > 0 && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) { - $sendTemplateParams['isEmailPdf'] = True; + $sendTemplateParams['isEmailPdf'] = TRUE; $sendTemplateParams['contributionId'] = $values['contribution_id']; } list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); @@ -827,7 +827,8 @@ LEFT JOIN civicrm_premiums ON ( civicrm_premiums.entity_id = civicrm case 'financial_type_id': // Fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get return CRM_Financial_BAO_FinancialType::getIncomeFinancialType(); - break; + + break; } return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context); } @@ -835,7 +836,7 @@ LEFT JOIN civicrm_premiums ON ( civicrm_premiums.entity_id = civicrm /** * Get or Set multilingually affected honor params for processing module_data or setting default values. * - * @param array|String $params: Array when we need to format it according to language state or String as a json encode + * @param string $params: * @param bool $setDefault: If yes then returns array to used for setting default value afterward * * @return array|string @@ -883,10 +884,10 @@ LEFT JOIN civicrm_premiums ON ( civicrm_premiums.entity_id = civicrm else { //if in multilingual state then retrieve the module_data against this contribution and //merge with earlier module_data json data to current so not to lose earlier multilingual module_data information - $sctJson = array( + $sctJson = array( 'soft_credit' => array( 'soft_credit_types' => $params['soft_credit_types'], - $config->lcMessages => array ( + $config->lcMessages => array( 'honor_block_title' => $params['honor_block_title'], 'honor_block_text' => $params['honor_block_text'] ) @@ -899,14 +900,14 @@ LEFT JOIN civicrm_premiums ON ( civicrm_premiums.entity_id = civicrm $ufJoinDAO->find(TRUE); $jsonData = json_decode($ufJoinDAO->module_data); if ($jsonData) { - $sctJson['soft_credit'] = array_merge((array)$jsonData->soft_credit, $sctJson['soft_credit']); + $sctJson['soft_credit'] = array_merge((array) $jsonData->soft_credit, $sctJson['soft_credit']); } $sctJson = json_encode($sctJson); } return $sctJson; } - /** + /** * Generate html for pdf in confirmation receipt email attachment * @param int $contributionId * Contribution Page Id. diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index 4d0e12f272..0e182ad8bd 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -272,7 +272,7 @@ SELECT r.payment_processor_id else { $details .= '
' . ts('The recurring contribution of %1, every %2 %3 has been cancelled.', array( - 1 => $dao->amount, + 1 => $dao->amount, 2 => $dao->frequency_interval, 3 => $dao->frequency_unit )); diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index 3e9fab2164..e045313309 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -113,7 +113,8 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio WHERE cc.is_test = %2 AND ccs.contact_id = %1 GROUP BY currency'; - $params = array(1 => array($contact_id, 'Integer'), + $params = array( + 1 => array($contact_id, 'Integer'), 2 => array($isTest, 'Integer')); $cs = CRM_Core_DAO::executeQuery($query, $params); @@ -205,7 +206,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio * * @return array */ - public static function getSoftCreditIds($contributionID , $isPCP = FALSE) { + public static function getSoftCreditIds($contributionID, $isPCP = FALSE) { $query = " SELECT id FROM civicrm_contribution_soft @@ -348,24 +349,26 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio ); unset($profileFields['prefix_id']); } - $honorName .= ' ' . $params['first_name'] . ' ' . $params['last_name']; - unset($profileFields['first_name']); - unset($profileFields['last_name']); - if (array_key_exists('suffix_id', $params)) { - $honorName .= ' ' . CRM_Utils_Array::value(CRM_Utils_Array::value('suffix_id', $params), + $honorName .= ' ' . $params['first_name'] . ' ' . $params['last_name']; + unset($profileFields['first_name']); + unset($profileFields['last_name']); + if (array_key_exists('suffix_id', $params)) { + $honorName .= ' ' . CRM_Utils_Array::value(CRM_Utils_Array::value('suffix_id', $params), CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id') ); - unset($profileFields['suffix_id']); - } - break; - case 'Organization': - $honorName = $params['organization_name']; - unset($profileFields['organization_name']); - break; - case 'Household': - $honorName = $params['household_name']; - unset($profileFields['household_name']); - break; + unset($profileFields['suffix_id']); + } + break; + + case 'Organization': + $honorName = $params['organization_name']; + unset($profileFields['organization_name']); + break; + + case 'Household': + $honorName = $params['household_name']; + unset($profileFields['household_name']); + break; } if ($honorId) { diff --git a/CRM/Contribute/BAO/ManagePremiums.php b/CRM/Contribute/BAO/ManagePremiums.php index 990ac820a8..1c567fc505 100644 --- a/CRM/Contribute/BAO/ManagePremiums.php +++ b/CRM/Contribute/BAO/ManagePremiums.php @@ -89,7 +89,7 @@ class CRM_Contribute_BAO_ManagePremiums extends CRM_Contribute_DAO_Product { } /** - * add the financial types + * add the financial types * * @param array $params * Reference array contains the values submitted by the form. @@ -148,7 +148,7 @@ class CRM_Contribute_BAO_ManagePremiums extends CRM_Contribute_DAO_Product { return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/contribute/managePremiums', 'reset=1&action=browse')); } - //delete from financial Type table + //delete from financial Type table $premium = new CRM_Contribute_DAO_Product(); $premium->id = $productID; $premium->delete(); diff --git a/CRM/Contribute/BAO/Premium.php b/CRM/Contribute/BAO/Premium.php index e2e5d837ea..5839377d7c 100644 --- a/CRM/Contribute/BAO/Premium.php +++ b/CRM/Contribute/BAO/Premium.php @@ -94,7 +94,7 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium { public static function del($premiumID) { //check dependencies - //delete from financial Type table + //delete from financial Type table $premium = new CRM_Contribute_DAO_Premium(); $premium->id = $premiumID; $premium->delete(); diff --git a/CRM/Contribute/Form.php b/CRM/Contribute/Form.php index 1b97fa906b..b8a4dee7fd 100644 --- a/CRM/Contribute/Form.php +++ b/CRM/Contribute/Form.php @@ -61,7 +61,7 @@ class CRM_Contribute_Form extends CRM_Admin_Form { } elseif ($this->_action == CRM_Core_Action::ADD) { $condition = " AND is_default = 1"; - $values = CRM_Core_OptionGroup::values('financial_account_type', false, false, false, $condition); + $values = CRM_Core_OptionGroup::values('financial_account_type', FALSE, FALSE, FALSE, $condition); $defaults['financial_account_type_id'] = array_keys($values); $defaults['is_active'] = 1; diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 5bdaa227b6..0c8d042bd1 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -40,7 +40,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_ContributionBase { /** - *Define default MembershipType Id + * Define default MembershipType Id * */ public $_defaultMemTypeId; @@ -519,7 +519,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu CRM_Contact_Form_ProfileContact::buildQuickForm($this); } - //don't build pledge block when mid is passed if (!$this->_mid) { $config = CRM_Core_Config::singleton(); @@ -682,7 +681,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu // CRM 10860, display text instead of a dropdown if there's only 1 frequency unit if(sizeof($unitVals) == 1) { - $form->assign('one_frequency_unit', true); + $form->assign('one_frequency_unit', TRUE); $unit = $unitVals[0]; $form->add('hidden', 'frequency_unit', $unit); if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') { @@ -690,7 +689,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } $form->assign('frequency_unit', $unit); } else { - $form->assign('one_frequency_unit', false); + $form->assign('one_frequency_unit', FALSE); $units = array(); $frequencyUnits = CRM_Core_OptionGroup::values('recur_frequency_units'); foreach ($unitVals as $key => $val) { @@ -704,7 +703,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $frequencyUnit = &$form->add('select', 'frequency_unit', NULL, $units); } - // FIXME: Ideally we should freeze select box if there is only // one option but looks there is some problem /w QF freeze. //if ( count( $units ) == 1 ) { @@ -1230,7 +1228,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); if ($is_quick_config) { foreach ($this->_priceSet['fields'] as $fieldKey => $fieldVal) { - if ($fieldVal['name'] == 'membership_amount' && !empty($params['price_' . $fieldKey ])) { + if ($fieldVal['name'] == 'membership_amount' && !empty($params['price_' . $fieldKey])) { $fieldId = $fieldVal['id']; $fieldOption = $params['price_' . $fieldId]; $proceFieldAmount += $fieldVal['options'][$this->_submitValues['price_' . $fieldId]]['amount']; @@ -1252,7 +1250,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } } - + if (!isset($params['amount_other'])) { $this->set('amount_level', CRM_Utils_Array::value('amount_level', $params)); } @@ -1261,7 +1259,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $lineItem = array(); $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config' ); if ( $is_quick_config ) { - foreach ( $this->_values['fee'] as $key => & $val ) { + foreach ( $this->_values['fee'] as $key => & $val ) { if ( $val['name'] == 'other_amount' && $val['html_type'] == 'Text' && array_key_exists( 'price_'.$key, $params ) ) { $params['price_'.$key] = CRM_Utils_Rule::cleanMoney($params['price_'.$key]); //Clean out any currency symbols if ( $params['price_'.$key] != 0 ) { @@ -1378,7 +1376,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu // redirect to thank you page CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_ThankYou_display=1&qfKey=$qfKey", TRUE, NULL, FALSE)); } - + } /** diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 8b3b6564d4..05523c1a6c 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -116,7 +116,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->assign('useForMember', $this->get('useForMember')); $params = $this->_params; - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if ($invoicing) { $getTaxDetails = FALSE; @@ -135,7 +135,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->assign('totalTaxAmount', $params['tax_amount']); } if ($this->_honor_block_is_active && !empty($params['soft_credit_type_id'])) { - $honorName = null; + $honorName = NULL; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); $this->assign('honor_block_is_active', $this->_honor_block_is_active); @@ -160,7 +160,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont } } - $this->assign( 'qParams' , $qParams ); + $this->assign( 'qParams', $qParams ); if ($membershipTypeID) { $transactionID = $this->get('membership_trx_id'); diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 31919c8314..7df238d58a 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -176,11 +176,11 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { public $_action; - /** - * Is honor block is enabled for this contribution? - * - * @var boolean - */ + /** + * Is honor block is enabled for this contribution? + * + * @var boolean + */ public $_honor_block_is_active = FALSE; /** diff --git a/CRM/Contribute/Form/ContributionCharts.php b/CRM/Contribute/Form/ContributionCharts.php index fa54c5f8bb..68af8adf4d 100644 --- a/CRM/Contribute/Form/ContributionCharts.php +++ b/CRM/Contribute/Form/ContributionCharts.php @@ -87,7 +87,7 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form { krsort($this->_years); } foreach ($this->_years as $k => $v) { - $years[substr($k,0,4)] = substr($k,0,4); + $years[substr($k, 0, 4)] = substr($k, 0, 4); } } @@ -172,9 +172,9 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form { if ($chartKey == 'by_year') { $yearlyChart = TRUE; if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] !== 1 || $config->fiscalYearStart['d'] !== 1)) { - $values['xLabelAngle'] = 45 ; + $values['xLabelAngle'] = 45; } else { - $values['xLabelAngle'] = 0 ; + $values['xLabelAngle'] = 0; } } if ($chartKey == 'by_month') { @@ -199,12 +199,12 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form { } elseif ($chartKey == 'by_year') { if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] != 1 || $config->fiscalYearStart['d'] != 1)) { - $startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], substr($index,0,4))); - $endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index,0,4)) + 1)); + $startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], substr($index, 0, 4))); + $endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index, 0, 4)) + 1)); } else { - $startDate = CRM_Utils_Date::format(array('Y' => substr($index,0,4))); - $endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index,0,4))); + $startDate = CRM_Utils_Date::format(array('Y' => substr($index, 0, 4))); + $endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index, 0, 4))); } $urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0"; } diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index 078e96f0ca..ea742c6d63 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -154,7 +154,6 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { $this->addElement('hidden', 'cancelURL', $this->_cancelURL); } - if ($this->_single) { $this->addButtons(array( array( @@ -368,7 +367,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { case 'Contribute': $attributes = $this->getVar('_attributes'); $subPage = strtolower(basename(CRM_Utils_Array::value('action', $attributes))); - $subPageName = ucFirst($subPage); + $subPageName = ucfirst($subPage); if ($subPage == 'friend') { $nextPage = 'custom'; } diff --git a/CRM/Contribute/Form/ContributionPage/AddProduct.php b/CRM/Contribute/Form/ContributionPage/AddProduct.php index 0238893e9b..f63547aa21 100644 --- a/CRM/Contribute/Form/ContributionPage/AddProduct.php +++ b/CRM/Contribute/Form/ContributionPage/AddProduct.php @@ -82,7 +82,7 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For $dao->id = $this->_pid; $dao->find(TRUE); $defaults['product_id'] = $dao->product_id; - $defaults['financial_type_id'] = $dao->financial_type_id; + $defaults['financial_type_id'] = $dao->financial_type_id; $defaults['weight'] = $dao->weight; } else { $dao = new CRM_Contribute_DAO_Product(); @@ -172,9 +172,9 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For CRM_Core_PseudoConstant::populate( $premiumFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', - $all = True, + $all = TRUE, $retrieve = 'entity_id', - $filter = null, + $filter = NULL, 'account_relationship = 8' ); @@ -182,15 +182,16 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For CRM_Core_PseudoConstant::populate( $costFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', - $all = True, + $all = TRUE, $retrieve = 'entity_id', - $filter = null, + $filter = NULL, 'account_relationship = 7' ); $productFinancialType = array_intersect($costFinancialType, $premiumFinancialType); foreach( $financialType as $key => $financialTypeName ){ - if(!in_array( $key, $productFinancialType)) + if(!in_array( $key, $productFinancialType)) { unset( $financialType[$key] ); + } } if( count( $financialType ) ){ $this->assign( 'financialType', $financialType ); @@ -199,7 +200,7 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For 'select', 'financial_type_id', ts( 'Financial Type' ), - array(''=>ts('- select -')) + $financialType + array('' => ts('- select -')) + $financialType ); $this->addRule('weight', ts('Please enter integer value for weight'), 'integer'); $session->pushUserContext(CRM_Utils_System::url($urlParams, 'action=update&reset=1&id=' . $this->_id)); diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index 76d74b36c4..93091297a5 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -117,7 +117,6 @@ SELECT id array('  ', '  ', '  ', '
') ); - //check if selected payment processor supports recurring payment if (!empty($recurringPaymentProcessor)) { $this->addElement('checkbox', 'is_recur', ts('Recurring Contributions'), NULL, @@ -390,7 +389,7 @@ SELECT id $paymentProcessorID, 'payment_processor_type_id' ); - $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(false, $paymentProcessorTypeId, 'name'); + $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, $paymentProcessorTypeId, 'name'); if ($paymentProcessorType == 'Google_Checkout') { $errors['is_recur_interval'] = ts('Google Checkout does not support recurring intervals'); break; @@ -527,7 +526,8 @@ SELECT id if (isset($values[$i]) && (strlen(trim($values[$i])) > 0) ) { - $options[] = array('label' => trim($labels[$i]), + $options[] = array( + 'label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])), 'weight' => $i, 'is_active' => 1, @@ -535,7 +535,7 @@ SELECT id ); } } - /* || !empty($params['price_field_value']) || CRM_Utils_Array::value( 'price_field_other', $params )*/ + /* || !empty($params['price_field_value']) || CRM_Utils_Array::value( 'price_field_other', $params )*/ if (!empty($options) || !empty($params['is_allow_other_amount'])) { $fieldParams['is_quick_config'] = 1; $noContriAmount = NULL; @@ -550,7 +550,7 @@ SELECT id $setParams['name'] = $pageTitle . '_' . $this->_id; } else { - $timeSec = explode(".", microtime(true)); + $timeSec = explode(".", microtime(TRUE)); $setParams['name'] = $pageTitle . '_' . date('is', $timeSec[0]) . $timeSec[1]; } $setParams['is_quick_config'] = 1; @@ -579,7 +579,8 @@ SELECT id CRM_Price_BAO_PriceField::setIsActive($priceFieldId, '0'); } } - else $priceFieldId = CRM_Utils_Array::value('price_field_other', $params); + else { $priceFieldId = CRM_Utils_Array::value('price_field_other', $params); + } $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceFieldId, 'price_set_id'); } CRM_Price_BAO_PriceSet::addTo('civicrm_contribution_page', $this->_id, $priceSetId); @@ -742,10 +743,10 @@ SELECT id } if ($deleteAmountBlk ) { - $priceField = !empty($params['price_field_id']) ?$params['price_field_id']:CRM_Utils_Array::value('price_field_other', $params); + $priceField = !empty($params['price_field_id']) ? $params['price_field_id'] : CRM_Utils_Array::value('price_field_other', $params); if ($priceField) { $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceField, 'price_set_id'); - CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0); + CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0); } } } diff --git a/CRM/Contribute/Form/ContributionPage/Custom.php b/CRM/Contribute/Form/ContributionPage/Custom.php index a89c32cd30..db41f6df36 100644 --- a/CRM/Contribute/Form/ContributionPage/Custom.php +++ b/CRM/Contribute/Form/ContributionPage/Custom.php @@ -90,7 +90,6 @@ class CRM_Contribute_Form_ContributionPage_Custom extends CRM_Contribute_Form_Co CRM_Utils_System::setTitle(ts('Include Profiles') . " ($title)"); } - $ufJoinParams = array( 'module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', @@ -100,7 +99,6 @@ class CRM_Contribute_Form_ContributionPage_Custom extends CRM_Contribute_Form_Co $second) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams); $defaults['custom_post_id'] = $second ? array_shift($second) : ''; - return $defaults; } diff --git a/CRM/Contribute/Form/ContributionPage/Premium.php b/CRM/Contribute/Form/ContributionPage/Premium.php index d057483c7a..7af17b2d36 100644 --- a/CRM/Contribute/Form/ContributionPage/Premium.php +++ b/CRM/Contribute/Form/ContributionPage/Premium.php @@ -85,7 +85,7 @@ class CRM_Contribute_Form_ContributionPage_Premium extends CRM_Contribute_Form_C // CRM-10999 Control label and position for No Thank-you radio button $this->add('text', 'premiums_nothankyou_label', ts('No Thank-you Label'), $attributes['premiums_nothankyou_label']); $positions = array(1 => ts('Before Premiums'), 2 => ts('After Premiums')); - $this->add('select','premiums_nothankyou_position', ts('No Thank-you Option'), $positions); + $this->add('select', 'premiums_nothankyou_position', ts('No Thank-you Option'), $positions); $showForm = TRUE; if ($this->_single) { diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index 630a90bdd5..8b5e7dc436 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -347,23 +347,22 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ ) ); - foreach ($ufJoinParams as $index => $ufJoinParam) { if (!empty($params[$index])) { - $ufJoinParam['weight'] = 1; - if ($index == 'honor_block_is_active') { - $ufJoinParam['is_active'] = 1; - $ufJoinParam['module'] = 'soft_credit'; - $ufJoinParam['uf_group_id'] = $params['honoree_profile']; - $ufJoinParam['module_data'] = $sctJSON; - } - else { - // first delete all past entries - CRM_Core_BAO_UFJoin::deleteAll($ufJoinParam); - $ufJoinParam['uf_group_id'] = $params[$index]; - } - CRM_Core_BAO_UFJoin::create($ufJoinParam); + $ufJoinParam['weight'] = 1; + if ($index == 'honor_block_is_active') { + $ufJoinParam['is_active'] = 1; + $ufJoinParam['module'] = 'soft_credit'; + $ufJoinParam['uf_group_id'] = $params['honoree_profile']; + $ufJoinParam['module_data'] = $sctJSON; + } + else { + // first delete all past entries + CRM_Core_BAO_UFJoin::deleteAll($ufJoinParam); + $ufJoinParam['uf_group_id'] = $params[$index]; } + CRM_Core_BAO_UFJoin::create($ufJoinParam); + } elseif ($index == 'honor_block_is_active') { //On subsequent honor_block_is_active uncheck, disable(don't delete) //that particular honoree profile entry in UFjoin table, CRM-13981 diff --git a/CRM/Contribute/Form/ContributionPage/TabHeader.php b/CRM/Contribute/Form/ContributionPage/TabHeader.php index 637dacbe68..d0398713f3 100644 --- a/CRM/Contribute/Form/ContributionPage/TabHeader.php +++ b/CRM/Contribute/Form/ContributionPage/TabHeader.php @@ -51,7 +51,8 @@ class CRM_Contribute_Form_ContributionPage_TabHeader { $form->assign_by_ref('tabHeader', $tabs); CRM_Core_Resources::singleton() ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header') - ->addSetting(array('tabSettings' => array( + ->addSetting(array( + 'tabSettings' => array( 'active' => self::getCurrentTab($tabs), ))); return $tabs; @@ -68,55 +69,64 @@ class CRM_Contribute_Form_ContributionPage_TabHeader { } $tabs = array( - 'settings' => array('title' => ts('Title'), + 'settings' => array( + 'title' => ts('Title'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE, ), - 'amount' => array('title' => ts('Amounts'), + 'amount' => array( + 'title' => ts('Amounts'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE, ), - 'membership' => array('title' => ts('Memberships'), + 'membership' => array( + 'title' => ts('Memberships'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE, ), - 'thankyou' => array('title' => ts('Receipt'), + 'thankyou' => array( + 'title' => ts('Receipt'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE, ), - 'friend' => array('title' => ts('Tell a Friend'), + 'friend' => array( + 'title' => ts('Tell a Friend'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE, ), - 'custom' => array('title' => ts('Profiles'), + 'custom' => array( + 'title' => ts('Profiles'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE, ), - 'premium' => array('title' => ts('Premiums'), + 'premium' => array( + 'title' => ts('Premiums'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE, ), - 'widget' => array('title' => ts('Widgets'), + 'widget' => array( + 'title' => ts('Widgets'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE, ), - 'pcp' => array('title' => ts('Personal Campaigns'), + 'pcp' => array( + 'title' => ts('Personal Campaigns'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, diff --git a/CRM/Contribute/Form/ContributionPage/ThankYou.php b/CRM/Contribute/Form/ContributionPage/ThankYou.php index 5e0204c1b1..27a35df7ff 100644 --- a/CRM/Contribute/Form/ContributionPage/ThankYou.php +++ b/CRM/Contribute/Form/ContributionPage/ThankYou.php @@ -63,14 +63,14 @@ class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_ $this->add('text', 'thankyou_title', ts('Thank-you Page Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_title'), TRUE); $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_text'); - $attributes['click_wysiwyg'] = true; + $attributes['click_wysiwyg'] = TRUE; $this->addWysiwyg('thankyou_text', ts('Thank-you Message'), $attributes); // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing // explicit height and width. $footerAttribs = array( 'rows' => 2, 'cols' => 40, - 'click_wysiwyg' => true, + 'click_wysiwyg' => TRUE, ); $this->addWysiwyg('thankyou_footer', ts('Thank-you Footer'), $footerAttribs); diff --git a/CRM/Contribute/Form/ContributionPage/Widget.php b/CRM/Contribute/Form/ContributionPage/Widget.php index bff6ddcd4f..0080b68ccc 100644 --- a/CRM/Contribute/Form/ContributionPage/Widget.php +++ b/CRM/Contribute/Form/ContributionPage/Widget.php @@ -63,7 +63,8 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co 'title' ); - $this->_fields = array('title' => array(ts('Title'), + $this->_fields = array( + 'title' => array(ts('Title'), 'text', FALSE, $title, @@ -80,7 +81,8 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co ), ); - $this->_colorFields = array('color_title' => array(ts('Title Text Color'), + $this->_colorFields = array( + 'color_title' => array(ts('Title Text Color'), 'text', FALSE, '#2786C2', diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index 6372e0371c..425414cd91 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -152,7 +152,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { // assign values to the template $this->assign($values); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $this->assign('invoicing', $invoicing); if ($invoicing && isset($values['tax_amount'])) { diff --git a/CRM/Contribute/Form/ManagePremiums.php b/CRM/Contribute/Form/ManagePremiums.php index a764bc62d0..fcd0c60eae 100644 --- a/CRM/Contribute/Form/ManagePremiums.php +++ b/CRM/Contribute/Form/ManagePremiums.php @@ -122,7 +122,6 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { $this->add('file', 'uploadFile', ts('Image File Name'), 'onChange="select_option();"'); - $this->add('text', 'price', ts('Market Value'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'price'), TRUE); $this->addRule('price', ts('Please enter the Market Value for this product.'), 'money'); @@ -152,9 +151,9 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { CRM_Core_PseudoConstant::populate( $premiumFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', - $all = True, + $all = TRUE, $retrieve = 'entity_id', - $filter = null, + $filter = NULL, 'account_relationship = 8' ); @@ -162,15 +161,16 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { CRM_Core_PseudoConstant::populate( $costFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', - $all = True, + $all = TRUE, $retrieve = 'entity_id', - $filter = null, + $filter = NULL, 'account_relationship = 7' ); $productFinancialType = array_intersect($costFinancialType, $premiumFinancialType); foreach( $financialType as $key => $financialTypeName ){ - if(!in_array( $key, $productFinancialType)) + if(!in_array( $key, $productFinancialType)) { unset( $financialType[$key] ); + } } if( count( $financialType ) ){ $this->assign( 'financialType', $financialType ); @@ -179,7 +179,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { 'select', 'financial_type_id', ts( 'Financial Type' ), - array(''=>ts('- select -')) + $financialType + array('' => ts('- select -')) + $financialType ); $this->add('checkbox', 'is_active', ts('Enabled?')); @@ -264,7 +264,6 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { $errors['frequency_interval'] = ts('Please enter the Frequency Interval for this subscription or service.'); } - return empty($errors) ? TRUE : $errors; } @@ -304,12 +303,12 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { $gdSupport = CRM_Utils_System::getModuleSetting('gd', 'GD Support'); if($gdSupport) { if($imageFile) { - $error = false; + $error = FALSE; $params['image'] = $this->_resizeImage($imageFile, "_full", 200, 200); $params['thumbnail'] = $this->_resizeImage($imageFile, "_thumb", 50, 50); } } else { - $error = true; + $error = TRUE; $params['image'] = $config->resourceBase . 'i/contribute/default_premium.jpg'; $params['thumbnail'] = $config->resourceBase . 'i/contribute/default_premium_thumb.jpg'; } @@ -381,10 +380,10 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { // save the resized image $fp = fopen($newFilename, 'w+'); ob_start(); - ImageJPEG($image); + imagejpeg($image); $image_buffer = ob_get_contents(); ob_end_clean(); - ImageDestroy($image); + imagedestroy($image); fwrite($fp, $image_buffer); rewind($fp); fclose($fp); diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index d96afcca7e..69267ac13b 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -163,8 +163,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { } public function setDefaultValues() { - if (empty($this->_defaults -['contribution_status'])) { + if (empty($this->_defaults['contribution_status'])) { $this->_defaults['contribution_status'][1] = 1; } return $this->_defaults; @@ -291,7 +290,6 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { } } - if (!$config->groupTree) { $group = CRM_Utils_Array::value('group', $this->_formValues); if ($group && !is_array($group)) { @@ -326,7 +324,6 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { return; } - $sortID = NULL; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), diff --git a/CRM/Contribute/Form/SoftCredit.php b/CRM/Contribute/Form/SoftCredit.php index e252cb9290..666c37582b 100644 --- a/CRM/Contribute/Form/SoftCredit.php +++ b/CRM/Contribute/Form/SoftCredit.php @@ -94,7 +94,7 @@ class CRM_Contribute_Form_SoftCredit { $form->addGroup($honorTypes, 'soft_credit_type_id', NULL)->setAttribute('allowClear', TRUE); } } - return $form; + return $form; } // by default generate 5 blocks diff --git a/CRM/Contribute/Form/Task.php b/CRM/Contribute/Form/Task.php index 4d2108d75f..90c10e02e8 100644 --- a/CRM/Contribute/Form/Task.php +++ b/CRM/Contribute/Form/Task.php @@ -122,7 +122,7 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form { } else { $queryParams = $form->get('queryParams'); - $sortOrder = null; + $sortOrder = NULL; if ( $form->get( CRM_Utils_Sort::SORT_ORDER ) ) { $sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER ); } diff --git a/CRM/Contribute/Form/Task/Batch.php b/CRM/Contribute/Form/Task/Batch.php index 55228fdc8e..65c470afd2 100644 --- a/CRM/Contribute/Form/Task/Batch.php +++ b/CRM/Contribute/Form/Task/Batch.php @@ -136,7 +136,6 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task { ) ); - $this->assign('profileTitle', $this->_title); $this->assign('componentIds', $this->_contributionIds); diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index 90d2c0ab12..ca80ed7c11 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -641,7 +641,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { * @return string */ static public function putFile($html) { - require_once("packages/dompdf/dompdf_config.inc.php"); + require_once "packages/dompdf/dompdf_config.inc.php"; spl_autoload_register('DOMPDF_autoload'); $doc = new DOMPDF(); $doc->load_html($html); diff --git a/CRM/Contribute/Form/Task/PDF.php b/CRM/Contribute/Form/Task/PDF.php index db37118246..af5d4a2aa3 100644 --- a/CRM/Contribute/Form/Task/PDF.php +++ b/CRM/Contribute/Form/Task/PDF.php @@ -91,7 +91,8 @@ AND {$this->_componentClause}"; $url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams); $breadCrumb = array( - array('url' => $url, + array( + 'url' => $url, 'title' => ts('Search Results'), )); @@ -194,7 +195,6 @@ AND {$this->_componentClause}"; $values = array(); $mail = $elements['baseIPN']->sendMail($input, $ids, $objects, $values, FALSE, $elements['createPdf']); - if ($mail['html']) { $message[] = $mail['html']; } @@ -282,9 +282,9 @@ AND {$this->_componentClause}"; (empty($params['override_privacy']) && !empty($values['do_not_email'])) || CRM_Utils_Array::value('is_deceased', $values) || !empty($values['on_hold'])) { - $suppressedEmails++; - $pdfElements['suppressedEmails'] = $suppressedEmails; - $excludeContactIds[] = $values['contact_id']; + $suppressedEmails++; + $pdfElements['suppressedEmails'] = $suppressedEmails; + $excludeContactIds[] = $values['contact_id']; } } } diff --git a/CRM/Contribute/Form/Task/PDFLetterCommon.php b/CRM/Contribute/Form/Task/PDFLetterCommon.php index 624ff8b29d..d98f7eb8d9 100644 --- a/CRM/Contribute/Form/Task/PDFLetterCommon.php +++ b/CRM/Contribute/Form/Task/PDFLetterCommon.php @@ -170,30 +170,30 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF return ($within == $total); } - /** - * - * @param string $html_message - * @param array $contact - * @param array $contribution - * @param array $messageToken - * @param array $categories - * @param bool $grouped - * Does this letter represent more than one contribution. - * @param string $separator - * What is the preferred letter separator. - * @return string - */ - private static function resolveTokens($html_message, $contact, $contribution, $messageToken, $categories, $grouped, $separator) { - $tokenHtml = CRM_Utils_Token::replaceContactTokens($html_message, $contact, TRUE, $messageToken); - if($grouped) { - $tokenHtml = CRM_Utils_Token::replaceMultipleContributionTokens($separator, $tokenHtml, $contribution, TRUE, $messageToken); - } - else { - // no change to normal behaviour to avoid risk of breakage - $tokenHtml = CRM_Utils_Token::replaceContributionTokens($tokenHtml, $contribution, TRUE, $messageToken); - } - $tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $contact, $categories, TRUE); - if (defined('CIVICRM_MAIL_SMARTY') && CIVICRM_MAIL_SMARTY) { + /** + * + * @param string $html_message + * @param array $contact + * @param array $contribution + * @param array $messageToken + * @param array $categories + * @param bool $grouped + * Does this letter represent more than one contribution. + * @param string $separator + * What is the preferred letter separator. + * @return string + */ + private static function resolveTokens($html_message, $contact, $contribution, $messageToken, $categories, $grouped, $separator) { + $tokenHtml = CRM_Utils_Token::replaceContactTokens($html_message, $contact, TRUE, $messageToken); + if($grouped) { + $tokenHtml = CRM_Utils_Token::replaceMultipleContributionTokens($separator, $tokenHtml, $contribution, TRUE, $messageToken); + } + else { + // no change to normal behaviour to avoid risk of breakage + $tokenHtml = CRM_Utils_Token::replaceContributionTokens($tokenHtml, $contribution, TRUE, $messageToken); + } + $tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $contact, $categories, TRUE); + if (defined('CIVICRM_MAIL_SMARTY') && CIVICRM_MAIL_SMARTY) { $smarty = CRM_Core_Smarty::singleton(); // also add the tokens to the template $smarty->assign_by_ref('contact', $contact); @@ -237,9 +237,9 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF //@todo find out why this happens & add comments list($contactID) = explode('-', $item); $contactID = (int) $contactID; - } + } else { - $contactID = $contribution['contact_id']; + $contactID = $contribution['contact_id']; } if(!isset($contacts[$contactID])) { list($contact) = CRM_Utils_Token::getTokenDetails(array('contact_id' => $contactID), diff --git a/CRM/Contribute/Form/Task/Result.php b/CRM/Contribute/Form/Task/Result.php index e2a8fb249a..13d8df14cc 100644 --- a/CRM/Contribute/Form/Task/Result.php +++ b/CRM/Contribute/Form/Task/Result.php @@ -45,7 +45,8 @@ class CRM_Contribute_Form_Task_Result extends CRM_Contribute_Form_Task { * * @return void */ - public function preProcess() {} + public function preProcess() { + } /** * Build the form object diff --git a/CRM/Contribute/Form/Task/Status.php b/CRM/Contribute/Form/Task/Status.php index d6c68770a1..ee4321dc0e 100644 --- a/CRM/Contribute/Form/Task/Status.php +++ b/CRM/Contribute/Form/Task/Status.php @@ -141,7 +141,6 @@ AND co.id IN ( $contribIDs )"; array('CRM_Contribute_DAO_Contribution', $dao->contribution_id, 'trxn_id') ); - $row['fee_amount'] = &$this->add('text', "fee_amount_{$row['contribution_id']}", ts('Fee Amount'), $attributes['fee_amount'] ); diff --git a/CRM/Contribute/Import/Field.php b/CRM/Contribute/Import/Field.php index d256d59827..535b5fd75c 100644 --- a/CRM/Contribute/Import/Field.php +++ b/CRM/Contribute/Import/Field.php @@ -165,10 +165,10 @@ class CRM_Contribute_Import_Field { case 'currency': return CRM_Utils_Rule::currencyCode($this->_value); - case 'financial_type': + case 'financial_type': static $contributionTypes = NULL; if (!$contributionTypes) { - $contributionTypes = CRM_Contribute_PseudoConstant::financialType(); + $contributionTypes = CRM_Contribute_PseudoConstant::financialType(); } if (in_array($this->_value, $contributionTypes)) { return TRUE; @@ -176,7 +176,7 @@ class CRM_Contribute_Import_Field { else { return FALSE; } - break; + break; case 'payment_instrument': static $paymentInstruments = NULL; diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index c4d92a95fc..516708f6ba 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -289,11 +289,11 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { ); } if(!empty($mapperKeysValues) && $mapperKeysValues[$i][0] == 'soft_credit') { - $js .="cj('#mapper_".$i."_1').val($mapperKeysValues[$i][1]);\n"; - $js .="cj('#mapper_".$i."_2').val($mapperKeysValues[$i][2]);\n"; + $js .= "cj('#mapper_".$i."_1').val($mapperKeysValues[$i][1]);\n"; + $js .= "cj('#mapper_".$i."_2').val($mapperKeysValues[$i][2]);\n"; } } - $sel->setOptions(array($sel1, $sel2, $sel3,$sel4)); + $sel->setOptions(array($sel1, $sel2, $sel3, $sel4)); } $js .= "\n"; $this->assign('initHideBoxes', $js); @@ -500,7 +500,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { if (isset($mapperKeys[$i][0]) && $mapperKeys[$i][0] == 'soft_credit') { $mapperSoftCredit[$i] = $mapperKeys[$i][1]; - if (strpos($mapperSoftCredit[$i], '_') !== false) { + if (strpos($mapperSoftCredit[$i], '_') !== FALSE) { list($first, $second) = explode('_', $mapperSoftCredit[$i]); $softCreditFields[$i] = ucwords($first . " " . $second); } @@ -513,7 +513,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { ); } else { - $mapperSoftCredit[$i] = $softCreditFields[$i] = $mapperSoftCreditType[$i] = NULL; + $mapperSoftCredit[$i] = $softCreditFields[$i] = $mapperSoftCreditType[$i] = NULL; } } diff --git a/CRM/Contribute/Import/Form/Preview.php b/CRM/Contribute/Import/Form/Preview.php index 5c3d8ff761..1877a10c18 100644 --- a/CRM/Contribute/Import/Form/Preview.php +++ b/CRM/Contribute/Import/Form/Preview.php @@ -134,7 +134,7 @@ class CRM_Contribute_Import_Form_Preview extends CRM_Import_Form_Preview { $mapperSoftCreditType[$key] = $mapperSoftCreditType[$key]['value']; } else { - $mapperSoftCredit[$key] = $mapperSoftCreditType[$key] = NULL; + $mapperSoftCredit[$key] = $mapperSoftCreditType[$key] = NULL; } } diff --git a/CRM/Contribute/Info.php b/CRM/Contribute/Info.php index 88e57343aa..caa1eeb256 100644 --- a/CRM/Contribute/Info.php +++ b/CRM/Contribute/Info.php @@ -118,7 +118,8 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * @return array|null */ public function getUserDashboardElement() { - return array('name' => ts('Contributions'), + return array( + 'name' => ts('Contributions'), 'title' => ts('Your Contribution(s)'), 'perm' => array('make online contributions'), 'weight' => 10, @@ -138,7 +139,8 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * @return array|null */ public function registerTab() { - return array('title' => ts('Contributions'), + return array( + 'title' => ts('Contributions'), 'url' => 'contribution', 'weight' => 20, ); diff --git a/CRM/Contribute/Page/ContributionPage.php b/CRM/Contribute/Page/ContributionPage.php index 1d891c9c02..ae80cd90df 100644 --- a/CRM/Contribute/Page/ContributionPage.php +++ b/CRM/Contribute/Page/ContributionPage.php @@ -288,7 +288,8 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { ); // set breadcrumb to append to 2nd layer pages - $breadCrumb = array(array('title' => ts('Manage Contribution Pages'), + $breadCrumb = array(array( + 'title' => ts('Manage Contribution Pages'), 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1' ), @@ -471,15 +472,15 @@ ORDER BY title asc $action += array_sum(array_keys(self::contributionLinks())); if ($dao->is_active) { - $action -= (int)CRM_Core_Action::ENABLE; + $action -= (int) CRM_Core_Action::ENABLE; } else { - $action -= (int)CRM_Core_Action::DISABLE; + $action -= (int) CRM_Core_Action::DISABLE; } //CRM-4418 if (!$allowToDelete) { - $action -= (int)CRM_Core_Action::DELETE; + $action -= (int) CRM_Core_Action::DELETE; } //build the configure links. @@ -537,8 +538,7 @@ ORDER BY title asc } public function search() { - if (isset($this->_action) & - (CRM_Core_Action::ADD | + if (isset($this->_action) & (CRM_Core_Action::ADD | CRM_Core_Action::UPDATE | CRM_Core_Action::DELETE ) @@ -627,8 +627,8 @@ ORDER BY title asc // The unfiltered value from the session cannot be trusted, it needs to be // processed to get a clean array of positive integers. $ids = array(); - foreach ((array)$this->get('campaign_id') as $id) { - if ((string)(int)$id === (string)$id && $id > 0) { + foreach ((array) $this->get('campaign_id') as $id) { + if ((string) (int) $id === (string) $id && $id > 0) { $ids[] = $id; } } diff --git a/CRM/Contribute/Page/ManagePremiums.php b/CRM/Contribute/Page/ManagePremiums.php index 9c599fa929..ac7a93c5a7 100644 --- a/CRM/Contribute/Page/ManagePremiums.php +++ b/CRM/Contribute/Page/ManagePremiums.php @@ -153,7 +153,6 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic { // form all action links $action = array_sum(array_keys($this->links())); - if ($dao->is_active) { $action -= CRM_Core_Action::ENABLE; } @@ -170,12 +169,12 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic { 'Premium', $dao->id ); - //Financial Type - if( !empty( $dao->financial_type_id ) ){ - require_once 'CRM/Core/DAO.php'; - $premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name' ); + //Financial Type + if( !empty( $dao->financial_type_id ) ){ + require_once 'CRM/Core/DAO.php'; + $premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name' ); + } } - } $this->assign('rows', $premiums); } diff --git a/CRM/Contribute/Page/PaymentInfo.php b/CRM/Contribute/Page/PaymentInfo.php index f1aea8c818..95cec3c57e 100644 --- a/CRM/Contribute/Page/PaymentInfo.php +++ b/CRM/Contribute/Page/PaymentInfo.php @@ -37,8 +37,8 @@ class CRM_Contribute_Page_PaymentInfo extends CRM_Core_Page { $this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); - $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, TRUE); - $this->_cid = CRM_Utils_Request::retrieve('cid', 'String', $this, TRUE); + $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, TRUE); + $this->_cid = CRM_Utils_Request::retrieve('cid', 'String', $this, TRUE); $this->assign('cid', $this->_cid); $this->assign('id', $this->_id); diff --git a/CRM/Contribute/Page/SubscriptionStatus.php b/CRM/Contribute/Page/SubscriptionStatus.php index 11855ff884..98bdd06180 100644 --- a/CRM/Contribute/Page/SubscriptionStatus.php +++ b/CRM/Contribute/Page/SubscriptionStatus.php @@ -42,10 +42,10 @@ class CRM_Contribute_Page_SubscriptionStatus extends CRM_Core_Page { * return null */ public function run() { - $task = CRM_Utils_Request::retrieve('task', 'String', CRM_Core_DAO::$_nullObject); - $result = CRM_Utils_Request::retrieve('result', 'Integer', CRM_Core_DAO::$_nullObject); + $task = CRM_Utils_Request::retrieve('task', 'String', CRM_Core_DAO::$_nullObject); + $result = CRM_Utils_Request::retrieve('result', 'Integer', CRM_Core_DAO::$_nullObject); - $this->assign('task', $task); + $this->assign('task', $task); $this->assign('result', $result); if ( $task == 'billing' ) { diff --git a/CRM/Contribute/Page/Tab.php b/CRM/Contribute/Page/Tab.php index 2f6b09402d..657f09441b 100644 --- a/CRM/Contribute/Page/Tab.php +++ b/CRM/Contribute/Page/Tab.php @@ -89,7 +89,8 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { self::$_links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}"; } if (is_object( $paymentProcessorObj) && $paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) { - self::$_links[CRM_Core_Action::RENEW] = array('name' => ts('Change Billing Details'), + self::$_links[CRM_Core_Action::RENEW] = array( + 'name' => ts('Change Billing Details'), 'title' => ts('Change Billing Details'), 'url' => 'civicrm/contribute/updatebilling', 'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}", diff --git a/CRM/Contribute/Page/UserDashboard.php b/CRM/Contribute/Page/UserDashboard.php index ffcd0969a0..e83fd6dc66 100644 --- a/CRM/Contribute/Page/UserDashboard.php +++ b/CRM/Contribute/Page/UserDashboard.php @@ -65,7 +65,6 @@ class CRM_Contribute_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBo $this->assign('honor', TRUE); } - $recur = new CRM_Contribute_DAO_ContributionRecur(); $recur->contact_id = $this->_contactId; $recur->is_test = 0; @@ -150,7 +149,7 @@ class CRM_Contribute_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBo * return null */ public function run() { - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $this->assign('invoicing', $invoicing); parent::preProcess(); diff --git a/CRM/Contribute/PseudoConstant.php b/CRM/Contribute/PseudoConstant.php index d75461b928..3e64203922 100644 --- a/CRM/Contribute/PseudoConstant.php +++ b/CRM/Contribute/PseudoConstant.php @@ -61,11 +61,11 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant { */ private static $financialAccount; - /** - * Contribution pages - * @var array - * @static - */ + /** + * Contribution pages + * @var array + * @static + */ private static $contributionPageActive = NULL; /** @@ -158,7 +158,7 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant { * @static */ public static function &financialAccount($id = NULL, $financialAccountTypeId = NULL, $retrieveColumn = 'name', $key = 'id') { - $condition = NUll; + $condition = NULL; if ($financialAccountTypeId) { $condition = " financial_account_type_id = ". $financialAccountTypeId; } @@ -192,9 +192,9 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant { * @param bool|string $name pseudoconstant to be flushed */ public static function flush($name = 'cache') { - if (isset(self::$$name)) { + if (isset(self::$$name)) { self::$$name = NULL; - } + } } /** @@ -407,7 +407,7 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant { CRM_Core_PseudoConstant::populate( self::$financialTypeAccount[$financialTypeId], 'CRM_Financial_DAO_EntityFinancialAccount', - $all = true, + $all = TRUE, $retrieve = 'financial_account_id', $filter = NULL, $condition, diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index 28728157d1..7ed80e6d57 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -168,12 +168,12 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C @access public */ function __construct(&$queryParams, - $action = CRM_Core_Action::NONE, + $action = CRM_Core_Action::NONE, $contributionClause = NULL, - $single = FALSE, - $limit = NULL, - $context = 'search', - $compContext = NULL + $single = FALSE, + $limit = NULL, + $context = 'search', + $compContext = NULL ) { // submitted form values @@ -359,7 +359,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C //get all campaigns. $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); - While ($result->fetch()) { + while ($result->fetch()) { $row = array(); // the columns we are interested in foreach (self::$_properties as $property) { @@ -410,8 +410,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C $result->contribution_id ); - $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? - $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id + $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id ); if (!empty($row['amount_level'])) { diff --git a/CRM/Contribute/Task.php b/CRM/Contribute/Task.php index d48f91d45c..6f997a815e 100644 --- a/CRM/Contribute/Task.php +++ b/CRM/Contribute/Task.php @@ -126,7 +126,7 @@ class CRM_Contribute_Task { } //CRM-12920 - check for edit permission if( !CRM_Core_Permission::check('edit contributions') ){ - unset(self::$_tasks[4],self::$_tasks[6]); + unset(self::$_tasks[4], self::$_tasks[6]); } // remove action "Print or Email Contribution Invoices" -- 2.25.1