From 7c550ca086cb4a1069ff1c610eb4e98f9cc98ff9 Mon Sep 17 00:00:00 2001 From: Web Access Date: Thu, 15 Jan 2015 12:32:44 +0530 Subject: [PATCH] Code cleanup - Batch #9 --- CRM/Admin/Form/Preferences/Address.php | 4 +- CRM/Admin/Form/Setting/Mapping.php | 2 - CRM/Admin/Page/AJAX.php | 2 +- CRM/Contact/Form/Edit/Address.php | 16 +- CRM/Contact/Form/Search/Custom.php | 2 +- CRM/Contact/Form/Task/Result.php | 3 +- CRM/Contact/Import/Parser/Contact.php | 16 +- CRM/Contribute/BAO/Query.php | 12 +- CRM/Contribute/Form/CancelSubscription.php | 34 ++-- CRM/Core/BAO/Email.php | 2 +- CRM/Core/BAO/LabelFormat.php | 13 +- CRM/Core/BAO/Mapping.php | 16 +- CRM/Core/BAO/Note.php | 4 +- CRM/Core/Controller.php | 16 +- CRM/Core/LegacyErrorHandler.php | 2 +- CRM/Core/Page/AJAX.php | 2 +- CRM/Core/Payment.php | 14 +- CRM/Core/Payment/AuthorizeNet.php | 4 +- CRM/Core/Permission/Base.php | 10 +- CRM/Custom/Form/Field.php | 14 +- CRM/Custom/Form/Option.php | 20 +- CRM/Event/Cart/Page/CheckoutAJAX.php | 2 +- CRM/Event/Form/Registration.php | 25 ++- CRM/Event/Form/Task/ParticipantStatus.php | 4 +- CRM/Group/Page/Group.php | 1 - CRM/Mailing/Event/BAO/Queue.php | 2 - CRM/Report/Form/Contact/LoggingDetail.php | 2 +- CRM/Report/Form/Contact/Relationship.php | 17 +- CRM/Report/Form/Contact/Summary.php | 186 +++++++++---------- CRM/Upgrade/Incremental/php/FourTwo.php | 18 +- CRM/Utils/Migrate/ExportJSON.php | 4 +- CRM/Utils/Money.php | 2 +- Civi/Core/Container.php | 2 +- api/v3/Mailing.php | 14 +- api/v3/Membership.php | 16 +- settings/Developer.setting.php | 3 +- tests/phpunit/CRM/AllTests.php | 2 +- tests/phpunit/CiviTest/CiviDBAssert.php | 2 +- tests/phpunit/WebTest/Profile/DedupeTest.php | 2 +- tests/phpunit/api/v3/PledgeTest.php | 19 +- 40 files changed, 239 insertions(+), 292 deletions(-) diff --git a/CRM/Admin/Form/Preferences/Address.php b/CRM/Admin/Form/Preferences/Address.php index 1b2eac7a0b..57be327a59 100644 --- a/CRM/Admin/Form/Preferences/Address.php +++ b/CRM/Admin/Form/Preferences/Address.php @@ -43,8 +43,8 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences { // Address Standardization $addrProviders = array( - '' => '- select -' - ) + CRM_Core_SelectValues::addressProvider(); + '' => '- select -', + ) + CRM_Core_SelectValues::addressProvider(); $this->_varNames = array( CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array( diff --git a/CRM/Admin/Form/Setting/Mapping.php b/CRM/Admin/Form/Setting/Mapping.php index a8a052b75a..ee0acdd7f6 100644 --- a/CRM/Admin/Form/Setting/Mapping.php +++ b/CRM/Admin/Form/Setting/Mapping.php @@ -88,8 +88,6 @@ class CRM_Admin_Form_Setting_Mapping extends CRM_Admin_Form_Setting { * add the rules (mainly global rules) for form. * All local rules are added near the element * - * @param null - * * @return void */ public function addRules() { diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index 35d7aa9e2c..a95514675e 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -115,7 +115,7 @@ class CRM_Admin_Page_AJAX { $ret['illegal'] = TRUE; $table = $template->fetch('CRM/Price/Page/table.tpl'); $ret['content'] = ts('Unable to disable the \'%1\' price set - it is currently in use by one or more active events, contribution pages or contributions.', array( - 1 => $priceSet + 1 => $priceSet, )) . "
$table"; } else { diff --git a/CRM/Contact/Form/Edit/Address.php b/CRM/Contact/Form/Edit/Address.php index aff4eb7d35..9e62aaee70 100644 --- a/CRM/Contact/Form/Edit/Address.php +++ b/CRM/Contact/Form/Edit/Address.php @@ -74,7 +74,7 @@ class CRM_Contact_Form_Edit_Address { //make location type required for inline edit $form->addSelect("address[$blockId][location_type_id]", array( 'entity' => 'address', - 'class' => 'eight' + 'class' => 'eight', ) + $js, $inlineEdit); if (!$inlineEdit) { @@ -118,12 +118,12 @@ class CRM_Contact_Form_Edit_Address { 'postal_code' => array( ts('Zip / Postal Code'), array_merge($attributes['postal_code'], array('class' => 'crm_postal_code')), - NULL + NULL, ), 'postal_code_suffix' => array( ts('Postal Code Suffix'), array('size' => 4, 'maxlength' => 12, 'class' => 'crm_postal_code_suffix'), - NULL + NULL, ), 'country_id' => array(ts('Country'), $attributes['country_id'], 'country'), 'state_province_id' => array(ts('State/Province'), $attributes['state_province_id'], NULL), @@ -144,7 +144,7 @@ class CRM_Contact_Form_Edit_Address { if (in_array($nameWithoutID, array( 'street_number', 'street_name', - 'street_unit' + 'street_unit', )) && !empty($addressOptions['street_address_parsing']) ) { $continue = FALSE; @@ -265,7 +265,7 @@ class CRM_Contact_Form_Edit_Address { $profileLinks = CRM_Core_BAO_UFGroup::getCreateLinks(array( 'new_individual', 'new_organization', - 'new_household' + 'new_household', ), 'shared_address'); $form->addEntityRef("address[$blockId][master_contact_id]", ts('Share With'), array('create' => $profileLinks)); } @@ -359,7 +359,7 @@ class CRM_Contact_Form_Edit_Address { 'name' => $shareAddressContactNames[$addressValue['master_id']]['name'], 'options' => CRM_Core_BAO_Address::getValues(array( 'entity_id' => $master_cid, - 'contact_id' => $master_cid + 'contact_id' => $master_cid, )), 'master_id' => $addressValue['master_id'], ); @@ -387,11 +387,11 @@ class CRM_Contact_Form_Edit_Address { 'street_number', 'street_number_suffix', 'street_name', - 'street_unit' + 'street_unit', ) as $fld) { if (in_array($fld, array( 'street_name', - 'street_unit' + 'street_unit', ))) { $streetAddress .= ' '; } diff --git a/CRM/Contact/Form/Search/Custom.php b/CRM/Contact/Form/Search/Custom.php index 7c4edc5172..ad8e178bb4 100644 --- a/CRM/Contact/Form/Search/Custom.php +++ b/CRM/Contact/Form/Search/Custom.php @@ -70,7 +70,7 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search { 'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1' ), - ) + ), ); CRM_Utils_System::appendBreadCrumb($breadCrumb); diff --git a/CRM/Contact/Form/Task/Result.php b/CRM/Contact/Form/Task/Result.php index 3696721a67..f8e04f4981 100644 --- a/CRM/Contact/Form/Task/Result.php +++ b/CRM/Contact/Form/Task/Result.php @@ -54,7 +54,7 @@ class CRM_Contact_Form_Task_Result extends CRM_Contact_Form_Task { $context = $this->get('context'); if (in_array($context, array( 'smog', - 'amtg' + 'amtg', ))) { $urlParams = 'reset=1&force=1&context=smog&gid='; $urlParams .= ($context == 'smog') ? $this->get('gid') : $this->get('amtgID'); @@ -94,7 +94,6 @@ class CRM_Contact_Form_Task_Result extends CRM_Contact_Form_Task { $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $path); $session->replaceUserContext($url); - return; } /** diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 0e00b30a59..72393cfb39 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -102,7 +102,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { /** * Class constructor */ - function __construct( + public function __construct( &$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL, $mapperImProvider = NULL, $mapperRelated = NULL, $mapperRelatedContactType = NULL, $mapperRelatedContactDetails = NULL, $mapperRelatedContactLocType = NULL, $mapperRelatedContactPhoneType = NULL, $mapperRelatedContactImProvider = NULL, $mapperWebsiteType = NULL, $mapperRelatedContactWebsiteType = NULL ) { @@ -148,8 +148,8 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } //Relationship importables - $this->_relationships = $relations = - CRM_Contact_BAO_Relationship::getContactRelationshipType( + $this->_relationships = $relations + = CRM_Contact_BAO_Relationship::getContactRelationshipType( NULL, NULL, NULL, $this->_contactType, FALSE, 'label', TRUE, $this->_contactSubType ); @@ -250,7 +250,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { * @param array $values * The array of values belonging to this line. * - * @return boolean + * @return bool */ public function mapField(&$values) { return CRM_Import_Parser::VALID; @@ -262,7 +262,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { * @param array $values * The array of values belonging to this line. * - * @return boolean + * @return bool * the result of this processing */ public function preview(&$values) { @@ -275,7 +275,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { * @param array $values * The array of values belonging to this line. * - * @return boolean + * @return boo * the result of this processing */ public function summary(&$values) { @@ -449,7 +449,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { * * @param bool $doGeocodeAddress * - * @return boolean + * @return bool * the result of this processing */ public function import($onDuplicate, &$values, $doGeocodeAddress = FALSE) { @@ -1013,8 +1013,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId); } // else skip does nothing and just returns an error code. - - if ($cid) { $contact = array( 'contact_id' => $cid, diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 88e97572a1..c0d5791315 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -138,7 +138,7 @@ class CRM_Contribute_BAO_Query { // get payment instrument id if (!empty($query->_returnProperties['payment_instrument_id'])) { - $query->_select['instrument_id'] = "contribution_payment_instrument.value as instrument_id"; + $query->_select['instrument_id'] = "contribution_payment_instrument.value as instrument_id"; $query->_select['payment_instrument_id'] = "contribution_payment_instrument.value as payment_instrument_id"; $query->_element['instrument_id'] = $query->_element['payment_instrument_id'] = 1; $query->_tables['civicrm_contribution'] = 1; @@ -362,7 +362,7 @@ class CRM_Contribute_BAO_Query { case 'financial_type': $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fields[$name]['where'], $op, $value, 'String'); - CRM_Core_Error::debug( '$query', $query->_where[$grouping] ); + CRM_Core_Error::debug('$query', $query->_where[$grouping]); list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Contribution', $name, $value, $op); $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$name]['title'], 2 => $op, 3 => $value)); $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1; @@ -876,7 +876,7 @@ class CRM_Contribute_BAO_Query { $form->add('select', 'contribution_currency_type', ts('Currency Type'), array( - '' => ts('- any -') + '' => ts('- any -'), ) + CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array('labelColumn' => 'name')), FALSE, array('class' => 'crm-select2') @@ -890,7 +890,7 @@ class CRM_Contribute_BAO_Query { $form->add('select', 'contribution_page_id', ts('Contribution Page'), array( - '' => ts('- any -') + '' => ts('- any -'), ) + CRM_Contribute_PseudoConstant::contributionPage(), FALSE, array('class' => 'crm-select2') @@ -903,7 +903,7 @@ class CRM_Contribute_BAO_Query { $form->add('select', 'contribution_pcp_made_through_id', ts('Personal Campaign Page'), array( - '' => ts('- any -') + '' => ts('- any -'), ) + CRM_Contribute_PseudoConstant::pcPage(), FALSE, array('class' => 'crm-select2') @@ -1038,7 +1038,7 @@ class CRM_Contribute_BAO_Query { public static function buildDateWhere(&$values, $query, $name, $field, $title) { $fieldPart = strpos($name, $field); if ($fieldPart === FALSE) { - return; + return NULL; } // we only have recurring dates using this ATM so lets' short cut to find the table name $table = 'contribution_recur'; diff --git a/CRM/Contribute/Form/CancelSubscription.php b/CRM/Contribute/Form/CancelSubscription.php index 99553db3cb..9f06661bd9 100644 --- a/CRM/Contribute/Form/CancelSubscription.php +++ b/CRM/Contribute/Form/CancelSubscription.php @@ -125,8 +125,8 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { $this->assign('mode', $this->_mode); if ($this->_subscriptionDetails->contact_id) { - list($this->_donorDisplayName, $this->_donorEmail) = - CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id); + list($this->_donorDisplayName, $this->_donorEmail) + = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id); } } @@ -186,8 +186,6 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { * Set default values for the form. Note that in edit/view mode * the default values are retrieved from the database * - * @param null - * * @return array * array of default values */ @@ -227,8 +225,8 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { CRM_Core_Error::displaySessionError($cancelSubscription); } elseif ($cancelSubscription) { - $activityParams = - array( + $activityParams + = array( 'subject' => $this->_mid ? ts('Auto-renewal membership cancelled') : ts('Recurring contribution cancelled'), 'details' => $message, ); @@ -244,10 +242,10 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { $inputParams = array('id' => $this->_mid); CRM_Member_BAO_Membership::getValues($inputParams, $tplParams); $tplParams = $tplParams[$this->_mid]; - $tplParams['membership_status'] = - CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $tplParams['status_id']); - $tplParams['membershipType'] = - CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $tplParams['membership_type_id']); + $tplParams['membership_status'] + = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $tplParams['status_id']); + $tplParams['membershipType'] + = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $tplParams['membership_type_id']); $status = ts('The automatic renewal of your %1 membership has been cancelled as requested. This does not affect the status of your membership - you will receive a separate notification when your membership is up for renewal.', array(1 => $tplParams['membershipType'])); $msgTitle = 'Membership Renewal Cancelled'; $msgType = 'info'; @@ -277,9 +275,8 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { $value, array('title', 'receipt_from_name', 'receipt_from_email') ); - $receiptFrom = - '"' . - CRM_Utils_Array::value('receipt_from_name', $value[$this->_subscriptionDetails->contribution_page_id]) . + $receiptFrom + = '"' . CRM_Utils_Array::value('receipt_from_name', $value[$this->_subscriptionDetails->contribution_page_id]) . '" <' . $value[$this->_subscriptionDetails->contribution_page_id]['receipt_from_email'] . '>'; @@ -290,8 +287,8 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { } // send notification - $sendTemplateParams = - array( + $sendTemplateParams + = array( 'groupName' => $this->_mode == 'auto_renew' ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution', 'valueName' => $this->_mode == 'auto_renew' ? 'membership_autorenew_cancelled' : 'contribution_recurring_cancelled', 'contactId' => $this->_subscriptionDetails->contact_id, @@ -328,11 +325,12 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { $session->setStatus($status, $msgTitle, $msgType); } elseif (!$userID) { - if ($status) + if ($status) { CRM_Utils_System::setUFMessage($status); - // keep result as 1, since we not displaying anything on the redirected page anyway - return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus', + // keep result as 1, since we not displaying anything on the redirected page anyway + return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus', "reset=1&task=cancel&result=1")); + } } } } diff --git a/CRM/Core/BAO/Email.php b/CRM/Core/BAO/Email.php index 33ff4babd7..87649e5d9f 100644 --- a/CRM/Core/BAO/Email.php +++ b/CRM/Core/BAO/Email.php @@ -117,7 +117,7 @@ WHERE contact_id = {$params['contact_id']} * @param array $entityBlock * Input parameters to find object. * - * @return boolean + * @return bool */ public static function &getValues($entityBlock) { return CRM_Core_BAO_Block::getValues('email', $entityBlock); diff --git a/CRM/Core/BAO/LabelFormat.php b/CRM/Core/BAO/LabelFormat.php index 0de74960ee..089a23a2cf 100644 --- a/CRM/Core/BAO/LabelFormat.php +++ b/CRM/Core/BAO/LabelFormat.php @@ -157,8 +157,6 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { /** * Get page orientations recognized by the DOMPDF package used to create PDF letters. * - * @param void - * * @return array * array of page orientations */ @@ -186,8 +184,6 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { /** * Get font sizes supported by the TCPDF package used to create PDF labels. * - * @param void - * * @return array * array of font sizes */ @@ -203,8 +199,6 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { /** * Get measurement units recognized by the TCPDF package used to create PDF labels. * - * @param void - * * @return array * array of measurement units */ @@ -220,8 +214,6 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { /** * Get text alignment recognized by the TCPDF package used to create PDF labels. * - * @param void - * * @return array * array of alignments */ @@ -236,8 +228,6 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { /** * Get text alignment recognized by the TCPDF package used to create PDF labels. * - * @param void - * * @return array * array of alignments */ @@ -280,6 +270,7 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { public static function addOrder(&$list, $returnURL) { $filter = "option_group_id = " . self::_getGid(); CRM_Utils_Weight::addOrder($list, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter); + return $list; } /** @@ -462,8 +453,6 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { /** * Return the name of the group for customized labels * - * @param void - * * @return void */ public static function customGroupName() { diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 243e496746..1c5b94a933 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -68,7 +68,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * @param int $id * Mapping id. * - * @return boolean + * @return boo */ public static function del($id) { // delete from mapping_field table @@ -204,7 +204,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * @param string $mapTypeId * mapping Type. * - * @return boolean + * @return boo */ public static function checkMapping($nameField, $mapTypeId) { $mapping = new CRM_Core_DAO_Mapping(); @@ -363,7 +363,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { foreach (array( 'groups', 'tags', - 'notes' + 'notes', ) as $value) { unset($fields['Individual'][$value]); unset($fields['Household'][$value]); @@ -388,7 +388,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $fields['Contact']['note_body'] = array('title' => $noteTitle . ': ' . ts('Body Only'), 'name' => 'note_body'); $fields['Contact']['note_subject'] = array( 'title' => $noteTitle . ': ' . ts('Subject Only'), - 'name' => 'note_subject' + 'name' => 'note_subject', ); } } @@ -472,8 +472,8 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $csRelationships = array(); if ($mappingType == 'Export') { - $subTypeRelationshipTypes = - CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'], + $subTypeRelationshipTypes + = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'], FALSE, 'label', TRUE, $subType); foreach ($subTypeRelationshipTypes as $key => $var) { @@ -1109,8 +1109,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { 0, ); } - - return $fields; } @@ -1190,7 +1188,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $mappingFields->delete(); if (empty($params['mapper'])) { - return; + return NULL; } //save record in mapping field table diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php index bc8fd6c7a7..59307f1108 100644 --- a/CRM/Core/BAO/Note.php +++ b/CRM/Core/BAO/Note.php @@ -78,7 +78,7 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note { * @param object $note * Either the id of the note to retrieve, or the CRM_Core_DAO_Note object itself. * - * @return boolean + * @return bool * TRUE if the note should be displayed, otherwise FALSE * */ @@ -223,7 +223,7 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note { * @param array $params * (reference ) an assoc array of name/value pairs. * - * @return boolean + * @return bool */ public static function dataExists(&$params) { // return if no data present diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index cd62a31fe7..34c3cf39c1 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -173,7 +173,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * @param bool $ignoreKey * Should we not set a qfKey for this controller (for standalone forms). */ - function __construct( + public function __construct( $title = NULL, $modal = TRUE, $mode = NULL, @@ -193,8 +193,8 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { // lets try to get it from the session and/or the request vars // we do this early on in case there is a fatal error in retrieving the // key and/or session - $this->_entryURL = - CRM_Utils_Request::retrieve('entryURL', 'String', $this); + $this->_entryURL + = CRM_Utils_Request::retrieve('entryURL', 'String', $this); // add a unique validable key to the name $name = CRM_Utils_System::getClassName($this); @@ -379,8 +379,8 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * Helper function to add all the needed default actions. Note that the framework * redefines all of the default QFC actions * - * @param string directory to store all the uploaded files - * @param array names for the various upload buttons (note u can have more than 1 upload) + * @param string $uploadDirectory to store all the uploaded files + * @param array $uploadNames for the various upload buttons (note u can have more than 1 upload) * * * @return void @@ -661,7 +661,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { /** * Getter for embedded * - * @return boolean + * @return bool * return the embedded value */ public function getEmbedded() { @@ -682,7 +682,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { /** * Getter for skipRedirection * - * @return boolean + * @return bool * return the skipRedirection value */ public function getSkipRedirection() { @@ -738,7 +738,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { /** * Getter for print * - * @return boolean + * @return bool * return the print value */ public function getPrint() { diff --git a/CRM/Core/LegacyErrorHandler.php b/CRM/Core/LegacyErrorHandler.php index b10026ac6b..57b8c80e68 100644 --- a/CRM/Core/LegacyErrorHandler.php +++ b/CRM/Core/LegacyErrorHandler.php @@ -5,7 +5,7 @@ class CRM_Core_LegacyErrorHandler { * @param \Civi\Core\Event\UnhandledExceptionEvent $event * @throws Exception */ - static function handleException($event) { + public static function handleException($event) { $e = $event->exception; if ($e instanceof CRM_Core_Exception) { $params = $e->getErrorData(); diff --git a/CRM/Core/Page/AJAX.php b/CRM/Core/Page/AJAX.php index 74fbc48a3b..af7ae6613a 100644 --- a/CRM/Core/Page/AJAX.php +++ b/CRM/Core/Page/AJAX.php @@ -73,7 +73,7 @@ class CRM_Core_Page_AJAX { // FIXME: This is done to maintain current wire protocol, but it might be // simpler to just require different 'types' for pages and forms if (preg_match('/^CRM_[a-zA-Z0-9]+_Page_Inline_/', $className)) { - $page = new $className; + $page = new $className(); $page->run(); } else { diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index ab50f68298..97f9417ae3 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -303,7 +303,7 @@ abstract class CRM_Core_Payment { 'rule_message' => ts('Please enter a valid value for your card security code. This is usually the last 3-4 digits on the card\'s signature panel.'), 'rule_name' => 'integer', 'rule_parameters' => NULL, - ) + ), ), ), 'credit_card_exp_date' => array( @@ -318,7 +318,7 @@ abstract class CRM_Core_Payment { 'rule_message' => ts('Card expiration date cannot be a past date.'), 'rule_name' => 'currentDate', 'rule_parameters' => TRUE, - ) + ), ), ), 'credit_card_type' => array( @@ -357,7 +357,7 @@ abstract class CRM_Core_Payment { 'rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'), 'rule_name' => 'nopunctuation', 'rule_parameters' => NULL, - ) + ), ), 'is_required' => TRUE, ), @@ -378,7 +378,7 @@ abstract class CRM_Core_Payment { 'rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'), 'rule_name' => 'nopunctuation', 'rule_parameters' => NULL, - ) + ), ), ), 'bank_name' => array( @@ -408,7 +408,7 @@ abstract class CRM_Core_Payment { * the result in an nice formatted array (or an error object) * @abstract */ - abstract function doDirectPayment(&$params); + abstract protected function doDirectPayment(&$params); /** * Process payment - this function wraps around both doTransferPayment and doDirectPayment @@ -442,7 +442,7 @@ abstract class CRM_Core_Payment { * @return string * the error message if any */ - abstract function checkConfig(); + abstract protected function checkConfig(); /** * @param $paymentProcessor @@ -589,7 +589,7 @@ abstract class CRM_Core_Payment { * @param string $method * Method to check for. * - * @return boolean + * @return bool */ public function isSupported($method = 'cancelSubscription') { return method_exists(CRM_Utils_System::getClassName($this), $method); diff --git a/CRM/Core/Payment/AuthorizeNet.php b/CRM/Core/Payment/AuthorizeNet.php index a62030a185..da729de70a 100644 --- a/CRM/Core/Payment/AuthorizeNet.php +++ b/CRM/Core/Payment/AuthorizeNet.php @@ -396,7 +396,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { * * @return string * the HMAC_MD5 encoding string - **/ + */ public function hmac($key, $data) { if (function_exists('mhash')) { // Use PHP mhash extension @@ -459,7 +459,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { * * @return string * fingerprint - **/ + */ public function CalculateFP() { $x_tran_key = $this->_getParam('paymentKey'); $loginid = $this->_getParam('apiLogin'); diff --git a/CRM/Core/Permission/Base.php b/CRM/Core/Permission/Base.php index 5e4f239161..be049664f2 100644 --- a/CRM/Core/Permission/Base.php +++ b/CRM/Core/Permission/Base.php @@ -156,10 +156,7 @@ class CRM_Core_Permission_Base { * @param string $str * The permission to check. * - * @return boolean - * true if yes, else false */ - public function check($str) { //no default behaviour } @@ -170,10 +167,9 @@ class CRM_Core_Permission_Base { * @param array $array * The roles to check. * - * @return boolean + * @return bool * true if yes, else false */ - public function checkGroupRole($array) { return FALSE; } @@ -184,8 +180,6 @@ class CRM_Core_Permission_Base { * @param string $permissionName * Name of the permission we are interested in. * - * @return string - * a comma separated list of email addresses */ public function permissionEmails($permissionName) { CRM_Core_Error::fatal("this function only works in Drupal 6 at the moment"); @@ -197,8 +191,6 @@ class CRM_Core_Permission_Base { * @param string $roleName * Name of the role we are interested in. * - * @return string - * a comma separated list of email addresses */ public function roleEmails($roleName) { CRM_Core_Error::fatal("this function only works in Drupal 6 at the moment"); diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index 9bffda7c66..edbcbc8543 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -84,8 +84,6 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { /** * Set variables up before form is built * - * @param null - * * @return void */ public function preProcess() { @@ -171,8 +169,6 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { * Set default values for the form. Note that in edit/view mode * the default values are retrieved from the database * - * @param null - * * @return array * array of default values */ @@ -278,8 +274,6 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { /** * Build the form object * - * @param null - * * @return void */ public function buildQuickForm() { @@ -342,7 +336,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { 'option_group_id', ts('Multiple Choice Option Sets'), array( - '' => ts('- select -') + '' => ts('- select -'), ) + $optionGroups ); } @@ -351,7 +345,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { ts('Option Type'), $optionTypes, array( - 'onclick' => "showOptionSelect();" + 'onclick' => "showOptionSelect();", ), '
' ); @@ -901,8 +895,6 @@ AND option_group_id = %2"; /** * Process the form * - * @param null - * * @return void */ public function postProcess() { @@ -924,7 +916,7 @@ AND option_group_id = %2"; 1, 2, 3, - 5 + 5, ))) { if (empty($params['is_searchable'])) { $params['is_search_range'] = 0; diff --git a/CRM/Custom/Form/Option.php b/CRM/Custom/Form/Option.php index ccb0e94cfd..e91b96e535 100644 --- a/CRM/Custom/Form/Option.php +++ b/CRM/Custom/Form/Option.php @@ -67,8 +67,6 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { /** * Set variables up before form is built * - * @param null - * * @return void */ public function preProcess() { @@ -103,8 +101,6 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { * Set default values for the form. Note that in edit/view mode * the default values are retrieved from the database * - * @param null - * * @return array * array of default values */ @@ -151,8 +147,6 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { /** * Build the form object * - * @param null - * * @return void */ public function buildQuickForm() { @@ -392,8 +386,6 @@ SELECT count(*) /** * Process the form * - * @param null - * * @return void */ public function postProcess() { @@ -425,8 +417,8 @@ SELECT count(*) } $fieldValues = array('option_group_id' => $this->_optionGroupID); - $customOption->weight = - CRM_Utils_Weight::updateOtherWeights( + $customOption->weight + = CRM_Utils_Weight::updateOtherWeights( 'CRM_Core_DAO_OptionValue', $oldWeight, $params['weight'], @@ -456,8 +448,8 @@ SELECT count(*) else { $defVal[] = $customOption->value; } - $customField->default_value = - CRM_Core_DAO::VALUE_SEPARATOR . + $customField->default_value + = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $defVal) . CRM_Core_DAO::VALUE_SEPARATOR; $customField->save(); @@ -471,8 +463,8 @@ SELECT count(*) } } - $customField->default_value = - CRM_Core_DAO::VALUE_SEPARATOR . + $customField->default_value + = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $tempVal) . CRM_Core_DAO::VALUE_SEPARATOR; $customField->save(); diff --git a/CRM/Event/Cart/Page/CheckoutAJAX.php b/CRM/Event/Cart/Page/CheckoutAJAX.php index 194f8b50fb..da1a2395ab 100644 --- a/CRM/Event/Cart/Page/CheckoutAJAX.php +++ b/CRM/Event/Cart/Page/CheckoutAJAX.php @@ -14,7 +14,7 @@ class CRM_Event_Cart_Page_CheckoutAJAX { $params_array = array( 'cart_id' => $cart->id, 'contact_id' => CRM_Event_Cart_Form_Cart::find_or_create_contact(), - 'event_id' => $event_id + 'event_id' => $event_id, ); //XXX security? diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index d5afd4e341..cfe4db0805 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -393,8 +393,8 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->set('values', $this->_values); $this->set('fields', $this->_fields); - $this->_availableRegistrations = - CRM_Event_BAO_Participant::eventFull( + $this->_availableRegistrations + = CRM_Event_BAO_Participant::eventFull( $this->_values['event']['id'], TRUE, CRM_Utils_Array::value('has_waitlist', $this->_values['event']) ); @@ -832,7 +832,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { */ public static function addParticipant(&$form, $contactID) { if (empty($form->_params)) { - return; + return NULL; } $params = $form->_params; $transaction = new CRM_Core_Transaction(); @@ -879,8 +879,7 @@ WHERE v.option_group_id = g.id ), 'register_date' => ($registerDate) ? $registerDate : date('YmdHis'), 'source' => CRM_Utils_String::ellipsify( - isset($params['participant_source']) ? - CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params), + isset($params['participant_source']) ? CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params), $participantFields['participant_source']['maxlength'] ), 'fee_level' => CRM_Utils_Array::value('amount_level', $params), @@ -1290,8 +1289,8 @@ WHERE v.option_group_id = g.id $optionMaxValues[$priceFieldId][$optId] = $currentMaxValue; } else { - $optionMaxValues[$priceFieldId][$optId] = - $currentMaxValue + CRM_Utils_Array::value($optId, CRM_Utils_Array::value($priceFieldId, $optionMaxValues), 0); + $optionMaxValues[$priceFieldId][$optId] + = $currentMaxValue + CRM_Utils_Array::value($optId, CRM_Utils_Array::value($priceFieldId, $optionMaxValues), 0); } } @@ -1308,16 +1307,16 @@ WHERE v.option_group_id = g.id if ($optMax && $total > $optMax) { $errors['soldOutOptions'][] = ts('Option %1 has sold out.', array(1 => $feeBlock[$fieldId]['options'][$optId]['label'])); if ($opDbCount && ($opDbCount >= $optMax)) { - $errors[$currentParticipantNum]["price_{$fieldId}"] = - ts('Sorry, this option is currently sold out.'); + $errors[$currentParticipantNum]["price_{$fieldId}"] + = ts('Sorry, this option is currently sold out.'); } elseif (($optMax - $opDbCount) == 1) { - $errors[$currentParticipantNum]["price_{$fieldId}"] = - ts('Sorry, currently only a single seat is available for this option.', array(1 => ($optMax - $opDbCount))); + $errors[$currentParticipantNum]["price_{$fieldId}"] + = ts('Sorry, currently only a single seat is available for this option.', array(1 => ($optMax - $opDbCount))); } else { - $errors[$currentParticipantNum]["price_{$fieldId}"] = - ts('Sorry, currently only %1 seats are available for this option.', array(1 => ($optMax - $opDbCount))); + $errors[$currentParticipantNum]["price_{$fieldId}"] + = ts('Sorry, currently only %1 seats are available for this option.', array(1 => ($optMax - $opDbCount))); } } } diff --git a/CRM/Event/Form/Task/ParticipantStatus.php b/CRM/Event/Form/Task/ParticipantStatus.php index f27f0d818b..046e5f0238 100644 --- a/CRM/Event/Form/Task/ParticipantStatus.php +++ b/CRM/Event/Form/Task/ParticipantStatus.php @@ -36,7 +36,7 @@ class CRM_Event_Form_Task_ParticipantStatus extends CRM_Event_Form_Task_Batch { public function buildQuickForm() { // CRM_Event_Form_Task_Batch::buildQuickForm() gets ufGroupId // from the form, so set it here to the id of the reserved profile - $dao = new CRM_Core_DAO_UFGroup; + $dao = new CRM_Core_DAO_UFGroup(); $dao->name = 'participant_status'; $dao->find(TRUE); $this->set('ufGroupId', $dao->id); @@ -45,7 +45,7 @@ class CRM_Event_Form_Task_ParticipantStatus extends CRM_Event_Form_Task_Batch { asort($statuses, SORT_STRING); $this->add('select', 'status_change', ts('Change All Statuses'), array( - '' => ts('- select status -') + '' => ts('- select status -'), ) + $statuses ); diff --git a/CRM/Group/Page/Group.php b/CRM/Group/Page/Group.php index df6c826064..e65020f9b0 100644 --- a/CRM/Group/Page/Group.php +++ b/CRM/Group/Page/Group.php @@ -45,7 +45,6 @@ class CRM_Group_Page_Group extends CRM_Core_Page_Basic { /** * Define action links * - * @return array * self::$_links array of action links */ public function &links() { diff --git a/CRM/Mailing/Event/BAO/Queue.php b/CRM/Mailing/Event/BAO/Queue.php index 1ed0e54910..1546ac382f 100644 --- a/CRM/Mailing/Event/BAO/Queue.php +++ b/CRM/Mailing/Event/BAO/Queue.php @@ -63,8 +63,6 @@ class CRM_Mailing_Event_BAO_Queue extends CRM_Mailing_Event_DAO_Queue { /** * Create a security hash from the job, email and contact ids * - * @param array The ids to be hashed - * * @return int * The hash */ diff --git a/CRM/Report/Form/Contact/LoggingDetail.php b/CRM/Report/Form/Contact/LoggingDetail.php index 3422bdc2c9..ddf5cea272 100644 --- a/CRM/Report/Form/Contact/LoggingDetail.php +++ b/CRM/Report/Form/Contact/LoggingDetail.php @@ -36,7 +36,7 @@ class CRM_Report_Form_Contact_LoggingDetail extends CRM_Logging_ReportDetail { /** */ public function __construct() { - $logging = new CRM_Logging_Schema; + $logging = new CRM_Logging_Schema(); $this->tables[] = 'civicrm_contact'; $this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables())); $this->tables[] = 'civicrm_email'; diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php index 0f67ecbff3..d8b46dc055 100644 --- a/CRM/Report/Form/Contact/Relationship.php +++ b/CRM/Report/Form/Contact/Relationship.php @@ -223,9 +223,9 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'title' => ts('Relationship'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array( - '' => '- any relationship type -', - ) + - CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE), + '' => '- any relationship type -', + ) + + CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE), 'type' => CRM_Utils_Type::T_INT, ), ), @@ -587,8 +587,8 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'], $this->_absoluteUrl, $this->_id, $this->_drilldownReport ); - $rows[$rowNum]['civicrm_contact_sort_name_a'] = - $rows[$rowNum]['civicrm_contact_sort_name_a'] . ' (' . + $rows[$rowNum]['civicrm_contact_sort_name_a'] + = $rows[$rowNum]['civicrm_contact_sort_name_a'] . ' (' . $rows[$rowNum]['civicrm_contact_id'] . ')'; $rows[$rowNum]['civicrm_contact_sort_name_a_link'] = $url; $rows[$rowNum]['civicrm_contact_sort_name_a_hover'] = ts("View Contact details for this contact."); @@ -602,8 +602,8 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_b_id'], $this->_absoluteUrl, $this->_id, $this->_drilldownReport ); - $rows[$rowNum]['civicrm_contact_b_sort_name_b'] = - $rows[$rowNum]['civicrm_contact_b_sort_name_b'] . ' (' . + $rows[$rowNum]['civicrm_contact_b_sort_name_b'] + = $rows[$rowNum]['civicrm_contact_b_sort_name_b'] . ' (' . $rows[$rowNum]['civicrm_contact_b_id'] . ')'; $rows[$rowNum]['civicrm_contact_b_sort_name_b_link'] = $url; $rows[$rowNum]['civicrm_contact_b_sort_name_b_hover'] = ts("View Contact details for this contact."); @@ -613,8 +613,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { if (array_key_exists('civicrm_relationship_relationship_id', $row) && array_key_exists('civicrm_contact_id', $row) ) { - $url = - "/civicrm/contact/view/rel?reset=1&action=update&rtype=a_b&cid=" . + $url = "/civicrm/contact/view/rel?reset=1&action=update&rtype=a_b&cid=" . $row['civicrm_contact_id'] . "&id=" . $row['civicrm_relationship_relationship_id']; $rows[$rowNum]['civicrm_relationship_relationship_id_link'] = $url; diff --git a/CRM/Report/Form/Contact/Summary.php b/CRM/Report/Form/Contact/Summary.php index 6a3ae459cc..cb5140fc83 100644 --- a/CRM/Report/Form/Contact/Summary.php +++ b/CRM/Report/Form/Contact/Summary.php @@ -54,108 +54,108 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { public function __construct() { $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $this->_columns = array( - 'civicrm_contact' => array( - 'dao' => 'CRM_Contact_DAO_Contact', - 'fields' => array( - 'sort_name' => array( - 'title' => ts('Contact Name'), - 'required' => TRUE, - 'no_repeat' => TRUE, - ), - 'first_name' => array( - 'title' => ts('First Name'), - ), - 'middle_name' => array( - 'title' => ts('Middle Name'), - ), - 'last_name' => array( - 'title' => ts('Last Name'), - ), - 'id' => array( - 'no_display' => TRUE, - 'required' => TRUE, - ), - 'contact_type' => array( - 'title' => ts('Contact Type'), - ), - 'contact_sub_type' => array( - 'title' => ts('Contact Subtype'), - ), - 'gender_id' => array( - 'title' => ts('Gender'), - ), - 'birth_date' => array( - 'title' => ts('Birth Date'), - ), - 'age' => array( - 'title' => ts('Age'), - 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', - ), + 'civicrm_contact' => array( + 'dao' => 'CRM_Contact_DAO_Contact', + 'fields' => array( + 'sort_name' => array( + 'title' => ts('Contact Name'), + 'required' => TRUE, + 'no_repeat' => TRUE, ), - 'filters' => array( - 'sort_name' => array('title' => ts('Contact Name')), - 'source' => array( - 'title' => ts('Contact Source'), - 'type' => CRM_Utils_Type::T_STRING, - ), - 'id' => array( - 'title' => ts('Contact ID'), - 'no_display' => TRUE, - ), - 'gender_id' => array( - 'title' => ts('Gender'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), - ), - 'birth_date' => array( - 'title' => ts('Birth Date'), - 'operatorType' => CRM_Report_Form::OP_DATE, - ), + 'first_name' => array( + 'title' => ts('First Name'), ), - 'grouping' => 'contact-fields', - 'order_bys' => array( - 'sort_name' => array( - 'title' => ts('Last Name, First Name'), - 'default' => '1', - 'default_weight' => '0', - 'default_order' => 'ASC', - ), - 'gender_id' => array( - 'name' => 'gender_id', - 'title' => ts('Gender'), - ), - 'birth_date' => array( - 'name' => 'birth_date', - 'title' => ts('Birth Date'), - ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), + 'last_name' => array( + 'title' => ts('Last Name'), + ), + 'id' => array( + 'no_display' => TRUE, + 'required' => TRUE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', ), ), - 'civicrm_email' => array( - 'dao' => 'CRM_Core_DAO_Email', - 'fields' => array( - 'email' => array( - 'title' => ts('Email'), - 'no_repeat' => TRUE, - ), + 'filters' => array( + 'sort_name' => array('title' => ts('Contact Name')), + 'source' => array( + 'title' => ts('Contact Source'), + 'type' => CRM_Utils_Type::T_STRING, + ), + 'id' => array( + 'title' => ts('Contact ID'), + 'no_display' => TRUE, + ), + 'gender_id' => array( + 'title' => ts('Gender'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), ), - 'grouping' => 'contact-fields', - 'order_bys' => array( - 'email' => array( - 'title' => ts('Email'), - ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + ), + 'grouping' => 'contact-fields', + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', + ), + 'gender_id' => array( + 'name' => 'gender_id', + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'name' => 'birth_date', + 'title' => ts('Birth Date'), + ), + ), + ), + 'civicrm_email' => array( + 'dao' => 'CRM_Core_DAO_Email', + 'fields' => array( + 'email' => array( + 'title' => ts('Email'), + 'no_repeat' => TRUE, + ), + ), + 'grouping' => 'contact-fields', + 'order_bys' => array( + 'email' => array( + 'title' => ts('Email'), ), ), - 'civicrm_phone' => array( - 'dao' => 'CRM_Core_DAO_Phone', - 'fields' => array( - 'phone' => NULL, - 'phone_ext' => array( - 'title' => ts('Phone Extension'), - ), + ), + 'civicrm_phone' => array( + 'dao' => 'CRM_Core_DAO_Phone', + 'fields' => array( + 'phone' => NULL, + 'phone_ext' => array( + 'title' => ts('Phone Extension'), ), - 'grouping' => 'contact-fields', ), - ) + $this->getAddressColumns(array('group_by' => FALSE)); + 'grouping' => 'contact-fields', + ), + ) + $this->getAddressColumns(array('group_by' => FALSE)); $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; diff --git a/CRM/Upgrade/Incremental/php/FourTwo.php b/CRM/Upgrade/Incremental/php/FourTwo.php index b2cf8f1448..8f91366a4e 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -188,7 +188,7 @@ INNER JOIN civicrm_price_set cps ON cps.id = cpf.price_set_id AND cps.name <>'de } } // Drop index UI_title for civicrm_price_set - $domain = new CRM_Core_DAO_Domain; + $domain = new CRM_Core_DAO_Domain(); $domain->find(TRUE); if ($domain->locales) { $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales); @@ -285,7 +285,7 @@ INNER JOIN civicrm_price_set cps ON cps.id = cpf.price_set_id AND cps.name <>'de $dao = CRM_Core_DAO::executeQuery($query); if (!$dao->N) { - $domain = new CRM_Core_DAO_Domain; + $domain = new CRM_Core_DAO_Domain(); $domain->find(TRUE); if ($domain->locales) { @@ -433,7 +433,7 @@ WHERE cpse.price_set_id IS NULL"; $addTo[2] = $dao->contribution_page_id; $options = array( 'otherAmount' => $dao->is_allow_other_amount, - 'membership' => $dao->membership_block_id + 'membership' => $dao->membership_block_id, ); self::createPriceSet($daoName, $addTo, $options); } @@ -655,7 +655,7 @@ WHERE cpf.price_set_id = %1 '2' => array('membership_amount', 'String'), '3' => array( CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $result->membership_id, 'membership_type_id'), - 'Integer' + 'Integer', ), ); $res = CRM_Core_DAO::executeQuery($sql, $params); @@ -721,12 +721,12 @@ WHERE cpf.price_set_id = %1 if (!empty($defaults)) { $lineParams['price_field_id'] = $defaults['id']; $lineParams['label'] = $defaults['label']; - $lineParams['price_field_value_id'] = - CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue', $defaults['id'], 'id', 'price_field_id'); + $lineParams['price_field_value_id'] + = CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue', $defaults['id'], 'id', 'price_field_id'); } else { - $lineParams['price_field_id'] = - CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field', $priceSetId, 'id', 'price_set_id'); + $lineParams['price_field_id'] + = CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field', $priceSetId, 'id', 'price_set_id'); $lineParams['label'] = 'Contribution Amount'; } $lineParams['qty'] = 1; @@ -967,7 +967,7 @@ VALUES $dao->start_date, $dao->end_date, $memStatus, - $status + $status, ); } } diff --git a/CRM/Utils/Migrate/ExportJSON.php b/CRM/Utils/Migrate/ExportJSON.php index 4cda5c0e1c..6d7e589a2b 100644 --- a/CRM/Utils/Migrate/ExportJSON.php +++ b/CRM/Utils/Migrate/ExportJSON.php @@ -185,7 +185,7 @@ WHERE g.name IN ( $nameString ) * @param $whereField * @param null $additionalWhereCond */ - function table( + public function table( &$ids, $tableName, &$fields, @@ -590,7 +590,7 @@ WHERE ac.contact_id IN ( $ids ) * @param null $lastExportTime * @param bool $discoverContacts */ - function run( + public function run( $fileName, $lastExportTime = NULL, $discoverContacts = FALSE diff --git a/CRM/Utils/Money.php b/CRM/Utils/Money.php index 4bb1672441..916c892938 100644 --- a/CRM/Utils/Money.php +++ b/CRM/Utils/Money.php @@ -90,7 +90,7 @@ class CRM_Utils_Money { if (!self::$_currencySymbols) { self::$_currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array( 'keyColumn' => 'name', - 'labelColumn' => 'symbol' + 'labelColumn' => 'symbol', )); } diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 000143abde..fa56a554c7 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -100,7 +100,7 @@ class Container { $dispatcher->addListener('DAO::post-delete', array('\CRM_Core_BAO_RecurringEntity', 'triggerDelete')); $dispatcher->addListener('hook_civicrm_unhandled_exception', array( 'CRM_Core_LegacyErrorHandler', - 'handleException' + 'handleException', )); return $dispatcher; } diff --git a/api/v3/Mailing.php b/api/v3/Mailing.php index 7bc6be0ae6..f85074236a 100755 --- a/api/v3/Mailing.php +++ b/api/v3/Mailing.php @@ -41,7 +41,7 @@ * * @param array $params * @return array API Success Array - * API Success Array + * API Success Array * @throws \API_Exception * @throws \Civi\API\Exception\UnauthorizedException */ @@ -206,7 +206,7 @@ function civicrm_api3_mailing_event_bounce($params) { return civicrm_api3_create_success($params); } else { - throw new API_Exception(ts('Queue event could not be found'),'no_queue_event + throw new API_Exception(ts('Queue event could not be found'), 'no_queue_event '); } } @@ -573,31 +573,31 @@ function civicrm_api3_mailing_stats($params) { switch ($detail) { case 'Delivered': $stats[$params['mailing_id']] += array( - $detail => CRM_Mailing_Event_BAO_Delivered::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']), + $detail => CRM_Mailing_Event_BAO_Delivered::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']), ); break; case 'Bounces': $stats[$params['mailing_id']] += array( - $detail => CRM_Mailing_Event_BAO_Bounce::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']), + $detail => CRM_Mailing_Event_BAO_Bounce::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']), ); break; case 'Unsubscribers': $stats[$params['mailing_id']] += array( - $detail => CRM_Mailing_Event_BAO_Unsubscribe::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, NULL, $params['date']), + $detail => CRM_Mailing_Event_BAO_Unsubscribe::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, NULL, $params['date']), ); break; case 'Unique Clicks': $stats[$params['mailing_id']] += array( - $detail => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, NULL, $params['date']), + $detail => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, NULL, $params['date']), ); break; case 'Opened': $stats[$params['mailing_id']] += array( - $detail => CRM_Mailing_Event_BAO_Opened::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']), + $detail => CRM_Mailing_Event_BAO_Opened::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']), ); break; } diff --git a/api/v3/Membership.php b/api/v3/Membership.php index d16aff5ec8..dfc3ca78d7 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -46,7 +46,7 @@ * * @return array * api result - * {@getfields membership_delete} + * {@getfields membership_delete} */ function civicrm_api3_membership_delete($params) { return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); @@ -63,7 +63,7 @@ function civicrm_api3_membership_delete($params) { * * @return array * Array of newly created membership property values. - * {@getfields membership_create} + * {@getfields membership_create} */ function civicrm_api3_membership_create($params) { // check params for membership id during update @@ -112,10 +112,10 @@ function civicrm_api3_membership_create($params) { // Fixme: This code belongs in the BAO $action = CRM_Core_Action::ADD; // we need user id during add mode - $ids = array(); - if (!empty($params['contact_id'])) { - $ids['userId'] = $params['contact_id']; - } + $ids = array(); + if (!empty($params['contact_id'])) { + $ids['userId'] = $params['contact_id']; + } //for edit membership id should be present if (!empty($params['id'])) { $ids['membership'] = $params['id']; @@ -202,7 +202,7 @@ function civicrm_api3_membership_get($params) { $params['status_id'] = array('IN' => CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent()); } - $options = _civicrm_api3_get_options_from_params($params, TRUE,'membership', 'get'); + $options = _civicrm_api3_get_options_from_params($params, TRUE, 'membership', 'get'); if ($options['is_count']) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } @@ -218,7 +218,7 @@ function civicrm_api3_membership_get($params) { return civicrm_api3_create_success($membershipValues, $params, 'membership', 'get'); } - $members = _civicrm_api3_membership_relationsship_get_customv2behaviour($params, $membershipValues, $contactID); + $members = _civicrm_api3_membership_relationsship_get_customv2behaviour($params, $membershipValues, $contactID); return civicrm_api3_create_success($members, $params, 'membership', 'get'); } diff --git a/settings/Developer.setting.php b/settings/Developer.setting.php index c9c31e33e1..132090d2dc 100644 --- a/settings/Developer.setting.php +++ b/settings/Developer.setting.php @@ -66,8 +66,7 @@ return array( 'is_contact' => 0, 'description' => "Set this value to Yes if you want CiviCRM error/debugging messages to also appear in Drupal error logs", 'prefetch' => 1, - 'help_text' => "Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS' error log. -In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal's watchdog enabled)", + 'help_text' => "Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS' error log. In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal's watchdog enabled)", ), 'backtrace' => array( 'group_name' => 'Developer Preferences', diff --git a/tests/phpunit/CRM/AllTests.php b/tests/phpunit/CRM/AllTests.php index c63f8c95c0..f910defe84 100644 --- a/tests/phpunit/CRM/AllTests.php +++ b/tests/phpunit/CRM/AllTests.php @@ -47,7 +47,7 @@ class CRM_AllTests extends CiviTestSuite { */ private static function getInstance() { if (is_null(self::$instance)) { - self::$instance = new self; + self::$instance = new self(); } return self::$instance; } diff --git a/tests/phpunit/CiviTest/CiviDBAssert.php b/tests/phpunit/CiviTest/CiviDBAssert.php index ff12960746..dc056dbc1c 100644 --- a/tests/phpunit/CiviTest/CiviDBAssert.php +++ b/tests/phpunit/CiviTest/CiviDBAssert.php @@ -150,7 +150,7 @@ class CiviDBAssert { * @param $expectedValue * @param string $message */ - function assertDBCompareValue( + public function assertDBCompareValue( &$testCase, $daoName, $searchValue, $returnColumn, $searchColumn, $expectedValue, $message ) { diff --git a/tests/phpunit/WebTest/Profile/DedupeTest.php b/tests/phpunit/WebTest/Profile/DedupeTest.php index 00e69530be..accd8a4faa 100644 --- a/tests/phpunit/WebTest/Profile/DedupeTest.php +++ b/tests/phpunit/WebTest/Profile/DedupeTest.php @@ -41,7 +41,7 @@ class WebTest_Profile_DedupeTest extends CiviSeleniumTestCase { 'edit-1-profile-create', 'edit-1-profile-edit', 'edit-1-profile-listings', - 'edit-1-profile-view' + 'edit-1-profile-view', ); $this->changePermissions($permission); diff --git a/tests/phpunit/api/v3/PledgeTest.php b/tests/phpunit/api/v3/PledgeTest.php index 55c452bcad..d1873c6b12 100644 --- a/tests/phpunit/api/v3/PledgeTest.php +++ b/tests/phpunit/api/v3/PledgeTest.php @@ -101,8 +101,6 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $this->customGroupDelete($ids['custom_group_id']); } - /* - */ public function testgetfieldspledge() { $result = $this->callAPISuccess('pledge', 'getfields', array('action' => 'get')); $this->assertEquals(1, $result['values']['next_pay_date']['api.return']); @@ -184,7 +182,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $this->assertEquals($oldPledge['id'], $earlyPledge['id'], ' check correct pledge returned ' . __LINE__); } - /* + /** * create 2 pledges - see if we can get by status id */ public function testGetOverduePledge() { @@ -207,7 +205,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { } - /* + /** * create 2 pledges - see if we can get by status id */ public function testSortParamPledge() { @@ -264,7 +262,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $pledge = $this->callAPISuccess('pledge', 'delete', $pledgeID); } - /* + /** * Test that pledge with weekly schedule calculates dates correctly */ public function testCreatePledgeWeeklySchedule() { @@ -279,7 +277,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { //ensure that correct number of payments created & last payment has the right date $payments = $this->callAPISuccess('PledgePayment', 'Get', array( 'pledge_id' => $pledge['id'], - 'sequential' => 1 + 'sequential' => 1, )); $this->assertEquals($payments['count'], 5, 'In line ' . __LINE__); $this->assertEquals('2011-07-06 00:00:00', $payments['values'][4]['scheduled_date'], 'In line ' . __LINE__); @@ -331,10 +329,10 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $pledge = $this->callAPISuccess('pledge', 'delete', $pledgeID); } - /* - * test that using original_installment_amount rather than pledge_original_installment_amount works - * Pledge field behaviour is a bit random & so pledge has come to try to handle both unique & non -unique fields - */ + /** + * test that using original_installment_amount rather than pledge_original_installment_amount works + * Pledge field behaviour is a bit random & so pledge has come to try to handle both unique & non -unique fields + */ public function testCreatePledgeWithNonUnique() { $params = $this->_params; $params['original_installment_amount'] = $params['pledge_original_installment_amount']; @@ -468,7 +466,6 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $pledge = $this->callAPISuccess('pledge', 'delete', $new_params); } - ///////////////// civicrm_pledge_delete methods public function testDeleteEmptyParamsPledge() { $pledge = $this->callAPIFailure('pledge', 'delete', array(), 'Mandatory key(s) missing from params array: id'); } -- 2.25.1