From 098201d8c51bf3e877d46283ce7a82e86bbe0007 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 13:21:22 -0800 Subject: [PATCH] INFRA-132 - CRM/Pledge - phpcbf --- CRM/Pledge/BAO/Pledge.php | 30 ++++++++++++++++++------------ CRM/Pledge/BAO/PledgeBlock.php | 3 ++- CRM/Pledge/BAO/PledgePayment.php | 1 - CRM/Pledge/BAO/Query.php | 7 ++++--- CRM/Pledge/Form/Payment.php | 7 +++---- CRM/Pledge/Form/Pledge.php | 9 +++++---- CRM/Pledge/Form/PledgeView.php | 2 +- CRM/Pledge/Form/Search.php | 1 - CRM/Pledge/Form/Task.php | 2 +- CRM/Pledge/Form/Task/Result.php | 3 ++- CRM/Pledge/Info.php | 12 ++++++++---- CRM/Pledge/Page/AJAX.php | 11 ++++++----- CRM/Pledge/Page/DashBoard.php | 1 - CRM/Pledge/Selector/Search.php | 13 +++++-------- CRM/Pledge/Task.php | 3 ++- 15 files changed, 57 insertions(+), 48 deletions(-) diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index bcea8d81dc..ca226f7f81 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -203,7 +203,6 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { // skip payment stuff inedit mode if (!isset($params['id']) || !empty($params['is_pledge_pending'])) { - //if pledge is pending delete all payments and recreate. if (!empty($params['is_pledge_pending'])) { CRM_Pledge_BAO_PledgePayment::deletePayments($pledge->id); @@ -365,7 +364,8 @@ GROUP BY currency $pamount[] = CRM_Utils_Money::format($dao->pledge_amount, $dao->currency); } - $pledge_amount = array('pledge_amount' => implode(', ', $pamount), + $pledge_amount = array( + 'pledge_amount' => implode(', ', $pamount), 'pledge_count' => $pCount, 'purl' => CRM_Utils_System::url('civicrm/pledge/search', "reset=1&force=1&pstatus={$statusId}&pstart={$start}&pend={$end}&test=0" @@ -430,7 +430,8 @@ GROUP BY currency } if ($count) { - return array_merge($pledge_amount, array('received_amount' => implode(', ', $amount), + return array_merge($pledge_amount, array( + 'received_amount' => implode(', ', $amount), 'received_count' => $count, 'url' => CRM_Utils_System::url('civicrm/pledge/search', "reset=1&force=1&status={$statusId}&start={$start}&end={$end}&test=0" @@ -524,7 +525,8 @@ GROUP BY currency ); } $payments[$payID] = array_merge($contributionValue, - array('amount' => CRM_Utils_Array::value('scheduled_amount', $values), + array( + 'amount' => CRM_Utils_Array::value('scheduled_amount', $values), 'due_date' => CRM_Utils_Array::value('scheduled_date', $values), ) ); @@ -556,7 +558,8 @@ GROUP BY currency //handle domain token values $domain = CRM_Core_BAO_Domain::getDomain(); - $tokens = array('domain' => array('name', 'phone', 'address', 'email'), + $tokens = array( + 'domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens(), ); $domainValues = array(); @@ -702,21 +705,23 @@ GROUP BY currency $fields = array_merge($fields, CRM_Pledge_DAO_PledgePayment::export()); //set title to calculated fields - $calculatedFields = array('pledge_total_paid' => array('title' => ts('Total Paid')), + $calculatedFields = array( + 'pledge_total_paid' => array('title' => ts('Total Paid')), 'pledge_balance_amount' => array('title' => ts('Balance Amount')), 'pledge_next_pay_date' => array('title' => ts('Next Payment Date')), 'pledge_next_pay_amount' => array('title' => ts('Next Payment Amount')), 'pledge_payment_paid_amount' => array('title' => ts('Paid Amount')), 'pledge_payment_paid_date' => array('title' => ts('Paid Date')), - 'pledge_payment_status' => array('title' => ts('Pledge Payment Status'), + 'pledge_payment_status' => array( + 'title' => ts('Pledge Payment Status'), 'name' => 'pledge_payment_status', 'data_type' => CRM_Utils_Type::T_STRING, ), ); - $pledgeFields = array( - 'pledge_status' => array('title' => 'Pledge Status', + 'pledge_status' => array( + 'title' => 'Pledge Status', 'name' => 'pledge_status', 'data_type' => CRM_Utils_Type::T_STRING, ), @@ -916,7 +921,8 @@ SELECT pledge.contact_id as contact_id, if ($sendReminders) { // retrieve domain tokens $domain = CRM_Core_BAO_Domain::getDomain(); - $tokens = array('domain' => array('name', 'phone', 'address', 'email'), + $tokens = array( + 'domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens(), ); @@ -1089,7 +1095,7 @@ SELECT pledge.contact_id as contact_id, * @param int $pledgeStatusID * @return bool do financial transactions exist for this pledge? */ - public static function pledgeHasFinancialTransactions($pledgeID, $pledgeStatusID) { + public static function pledgeHasFinancialTransactions($pledgeID, $pledgeStatusID) { if (empty($pledgeStatusID)) { //why would this happen? If we can see where it does then we can see if we should look it up //but assuming from form code it CAN be empty @@ -1100,7 +1106,7 @@ SELECT pledge.contact_id as contact_id, } return civicrm_api3('pledge_payment', 'getcount', array('pledge_id' => $pledgeID, 'status_id' => array('IN' => self::getTransactionalStatus()))); - } + } /** * Does this pledge / pledge payment status mean that a financial transaction has taken place? diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php index 95c9952d43..4c2b55d95d 100644 --- a/CRM/Pledge/BAO/PledgeBlock.php +++ b/CRM/Pledge/BAO/PledgeBlock.php @@ -283,7 +283,8 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $pledgeBlock = self::getPledgeBlock($form->_id); //build form for pledge creation. - $pledgeOptions = array('0' => ts('I want to make a one-time contribution'), + $pledgeOptions = array( + '0' => ts('I want to make a one-time contribution'), '1' => ts('I pledge to contribute this amount every'), ); $form->addRadio('is_pledge', ts('Pledge Frequency Interval'), $pledgeOptions, diff --git a/CRM/Pledge/BAO/PledgePayment.php b/CRM/Pledge/BAO/PledgePayment.php index db77eea981..4f6d65785b 100644 --- a/CRM/Pledge/BAO/PledgePayment.php +++ b/CRM/Pledge/BAO/PledgePayment.php @@ -196,7 +196,6 @@ WHERE pledge_id = %1 CRM_Utils_Hook::post('create', 'PledgePayment', $payment->id, $payment); } - return $result; } diff --git a/CRM/Pledge/BAO/Query.php b/CRM/Pledge/BAO/Query.php index 6722f39a8a..f7a6bb17f4 100644 --- a/CRM/Pledge/BAO/Query.php +++ b/CRM/Pledge/BAO/Query.php @@ -373,7 +373,7 @@ class CRM_Pledge_BAO_Query { $value, 'Integer' ); - $query->_qill[$grouping][] = ts( 'Financial Type - %1', array( 1 => $type ) ); + $query->_qill[$grouping][] = ts( 'Financial Type - %1', array( 1 => $type ) ); $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; return; @@ -440,7 +440,7 @@ class CRM_Pledge_BAO_Query { break; case 'pledge_financial_type': - $from .= " $side JOIN civicrm_financial_type ON civicrm_pledge.financial_type_id = civicrm_financial_type.id "; + $from .= " $side JOIN civicrm_financial_type ON civicrm_pledge.financial_type_id = civicrm_financial_type.id "; break; case 'civicrm_pledge_payment': @@ -626,7 +626,8 @@ class CRM_Pledge_BAO_Query { * @param $row * @param int $id */ - public static function searchAction(&$row, $id) {} + public static function searchAction(&$row, $id) { + } /** * @param $tables diff --git a/CRM/Pledge/Form/Payment.php b/CRM/Pledge/Form/Payment.php index 2a4af9a24f..7672c6a391 100644 --- a/CRM/Pledge/Form/Payment.php +++ b/CRM/Pledge/Form/Payment.php @@ -105,14 +105,14 @@ class CRM_Pledge_Form_Payment extends CRM_Core_Form { NULL, TRUE ); - $optionTypes = array('1' => ts('Adjust Pledge Payment Schedule?'), + $optionTypes = array( + '1' => ts('Adjust Pledge Payment Schedule?'), '2' => ts('Adjust Total Pledge Amount?'), ); $element = $this->addRadio('option_type', NULL, $optionTypes, - array( - ), '
' + array(), '
' ); $this->addButtons(array( @@ -163,7 +163,6 @@ class CRM_Pledge_Form_Payment extends CRM_Core_Form { $adjustTotalAmount = TRUE; } - $pledgeScheduledAmount = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $params['id'], 'scheduled_amount', diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index a69109c692..39a2830f9e 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -183,7 +183,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $defaults['max_reminders'] = 1; $defaults['additional_reminder_day'] = 5; $defaults['frequency_unit'] = array_search('month', $this->_freqUnits); - $defaults['financial_type_id'] = array_search( 'Donation', CRM_Contribute_PseudoConstant::financialType() ); + $defaults['financial_type_id'] = array_search( 'Donation', CRM_Contribute_PseudoConstant::financialType() ); } $pledgeStatus = CRM_Contribute_PseudoConstant::contributionStatus(); @@ -248,7 +248,8 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { ); foreach ($paneNames as $name => $type) { $urlParams = "snippet=4&formType={$type}"; - $allPanes[$name] = array('url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams), + $allPanes[$name] = array( + 'url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams), 'open' => 'false', 'id' => $type, ); @@ -377,9 +378,9 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $this->addDate('acknowledge_date', ts('Acknowledgment Date')); - $this->add('select', 'financial_type_id', + $this->add('select', 'financial_type_id', ts( 'Financial Type' ), - array(''=>ts( '- select -' )) + CRM_Contribute_PseudoConstant::financialType( ), + array('' => ts( '- select -' )) + CRM_Contribute_PseudoConstant::financialType( ), TRUE ); diff --git a/CRM/Pledge/Form/PledgeView.php b/CRM/Pledge/Form/PledgeView.php index 84475ec12c..12bf4918e9 100644 --- a/CRM/Pledge/Form/PledgeView.php +++ b/CRM/Pledge/Form/PledgeView.php @@ -75,7 +75,7 @@ class CRM_Pledge_Form_PledgeView extends CRM_Core_Form { $values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title'); } - $values['financial_type'] = CRM_Utils_Array::value( $values['financial_type_id'], CRM_Contribute_PseudoConstant::financialType() ); + $values['financial_type'] = CRM_Utils_Array::value( $values['financial_type_id'], CRM_Contribute_PseudoConstant::financialType() ); if ($values['status_id']) { $values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus()); diff --git a/CRM/Pledge/Form/Search.php b/CRM/Pledge/Form/Search.php index 5e2833b174..60a4a37e5a 100644 --- a/CRM/Pledge/Form/Search.php +++ b/CRM/Pledge/Form/Search.php @@ -121,7 +121,6 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { ); } - $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $selector = new CRM_Pledge_Selector_Search($this->_queryParams, $this->_action, diff --git a/CRM/Pledge/Form/Task.php b/CRM/Pledge/Form/Task.php index 1704a2af2e..7960c30a96 100644 --- a/CRM/Pledge/Form/Task.php +++ b/CRM/Pledge/Form/Task.php @@ -101,7 +101,7 @@ class CRM_Pledge_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/Pledge/Form/Task/Result.php b/CRM/Pledge/Form/Task/Result.php index 518d739a3c..11f55f20eb 100644 --- a/CRM/Pledge/Form/Task/Result.php +++ b/CRM/Pledge/Form/Task/Result.php @@ -45,7 +45,8 @@ class CRM_Pledge_Form_Task_Result extends CRM_Pledge_Form_Task { * * @return void */ - public function preProcess() {} + public function preProcess() { + } /** * Build the form object diff --git a/CRM/Pledge/Info.php b/CRM/Pledge/Info.php index 4560ef650c..45a8fdde89 100644 --- a/CRM/Pledge/Info.php +++ b/CRM/Pledge/Info.php @@ -97,7 +97,8 @@ class CRM_Pledge_Info extends CRM_Core_Component_Info { * @return array|null */ public function getUserDashboardElement() { - return array('name' => ts('Pledges'), + return array( + 'name' => ts('Pledges'), 'title' => ts('Your Pledge(s)'), // we need to check this permission since you can click on contribution page link for making payment 'perm' => array('make online contributions'), @@ -118,7 +119,8 @@ class CRM_Pledge_Info extends CRM_Core_Component_Info { * @return array|null */ public function registerTab() { - return array('title' => ts('Pledges'), + return array( + 'title' => ts('Pledges'), 'url' => 'pledge', 'weight' => 25, ); @@ -137,7 +139,8 @@ class CRM_Pledge_Info extends CRM_Core_Component_Info { * @return array|null */ public function registerAdvancedSearchPane() { - return array('title' => ts('Pledges'), + return array( + 'title' => ts('Pledges'), 'weight' => 25, ); } @@ -168,7 +171,8 @@ class CRM_Pledge_Info extends CRM_Core_Component_Info { CRM_Core_Permission::check('edit pledges') ) { $shortCuts = array_merge($shortCuts, array( - array('path' => 'civicrm/pledge/add', + array( + 'path' => 'civicrm/pledge/add', 'query' => 'reset=1&action=add&context=standalone', 'ref' => 'new-pledge', 'title' => ts('Pledge'), diff --git a/CRM/Pledge/Page/AJAX.php b/CRM/Pledge/Page/AJAX.php index ae6cdd69a3..15df1ad3ea 100755 --- a/CRM/Pledge/Page/AJAX.php +++ b/CRM/Pledge/Page/AJAX.php @@ -78,7 +78,8 @@ WHERE {$whereClause} if (!$name && isset($_GET['id'])) { $name = $_GET['id']; } - $elements[] = array('name' => trim($name, '*'), + $elements[] = array( + 'name' => trim($name, '*'), 'value' => trim($name, '*'), ); } @@ -86,10 +87,10 @@ WHERE {$whereClause} echo CRM_Utils_JSON::encode($elements, 'value'); CRM_Utils_System::civiExit(); } - /** - * Function to setDefaults according to Pledge Id - * for batch entry pledges - */ + /** + * Function to setDefaults according to Pledge Id + * for batch entry pledges + */ public function getPledgeDefaults() { $details = array(); if (!empty($_POST['pid'])) { diff --git a/CRM/Pledge/Page/DashBoard.php b/CRM/Pledge/Page/DashBoard.php index 6c6f313abf..1eaf39947a 100644 --- a/CRM/Pledge/Page/DashBoard.php +++ b/CRM/Pledge/Page/DashBoard.php @@ -82,7 +82,6 @@ class CRM_Pledge_Page_DashBoard extends CRM_Core_Page { $previousMonth = date("F Y", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))); $this->assign('previousMonthYear', $previousMonth); - foreach ($prefixes as $prefix) { $aName = $prefix . 'ToDate'; $startName = $prefix . 'Date'; diff --git a/CRM/Pledge/Selector/Search.php b/CRM/Pledge/Selector/Search.php index a976bae0a8..a2b029206b 100644 --- a/CRM/Pledge/Selector/Search.php +++ b/CRM/Pledge/Selector/Search.php @@ -151,11 +151,11 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base { @access public */ function __construct(&$queryParams, - $action = CRM_Core_Action::NONE, + $action = CRM_Core_Action::NONE, $additionalClause = NULL, - $single = FALSE, - $limit = NULL, - $context = 'search' + $single = FALSE, + $limit = NULL, + $context = 'search' ) { // submitted form values $this->_queryParams = &$queryParams; @@ -223,7 +223,6 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base { ), ); - if (in_array('Cancel', $hideOption)) { unset(self::$_links[CRM_Core_Action::DETACH]); } @@ -358,9 +357,7 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base { $result->pledge_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 ); $rows[] = $row; } diff --git a/CRM/Pledge/Task.php b/CRM/Pledge/Task.php index ab6b23e89c..5c92bbf409 100644 --- a/CRM/Pledge/Task.php +++ b/CRM/Pledge/Task.php @@ -66,7 +66,8 @@ class CRM_Pledge_Task { */ public static function &tasks() { if (!self::$_tasks) { - self::$_tasks = array(1 => array( + self::$_tasks = array( + 1 => array( 'title' => ts('Delete Pledges'), 'class' => 'CRM_Pledge_Form_Task_Delete', 'result' => FALSE, -- 2.25.1