Skip to content

Commit

Permalink
Code cleanup - Batch civicrm#9
Browse files Browse the repository at this point in the history
  • Loading branch information
rohankatkar committed Jan 15, 2015
1 parent bb82b35 commit 7c550ca
Show file tree
Hide file tree
Showing 40 changed files with 239 additions and 292 deletions.
4 changes: 2 additions & 2 deletions CRM/Admin/Form/Preferences/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public function preProcess() {

// 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(
Expand Down
2 changes: 0 additions & 2 deletions CRM/Admin/Form/Setting/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ public static function formRule($fields) {
* add the rules (mainly global rules) for form.
* All local rules are added near the element
*
* @param null
*
* @return void
*/
public function addRules() {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static function getStatusMsg() {
$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,
)) . "<br/> $table";
}
else {
Expand Down
16 changes: 8 additions & 8 deletions CRM/Contact/Form/Edit/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharin
//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) {
Expand Down Expand Up @@ -118,12 +118,12 @@ public static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharin
'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),
Expand All @@ -144,7 +144,7 @@ public static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharin
if (in_array($nameWithoutID, array(
'street_number',
'street_name',
'street_unit'
'street_unit',
)) && !empty($addressOptions['street_address_parsing'])
) {
$continue = FALSE;
Expand Down Expand Up @@ -265,7 +265,7 @@ public static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharin
$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));
}
Expand Down Expand Up @@ -359,7 +359,7 @@ public static function setDefaultValues(&$defaults, &$form) {
'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'],
);
Expand Down Expand Up @@ -387,11 +387,11 @@ public static function setDefaultValues(&$defaults, &$form) {
'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 .= ' ';
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Search/Custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function preProcess() {
'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list',
'reset=1'
),
)
),
);
CRM_Utils_System::appendBreadCrumb($breadCrumb);

Expand Down
3 changes: 1 addition & 2 deletions CRM/Contact/Form/Task/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function preProcess() {
$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');
Expand Down Expand Up @@ -94,7 +94,6 @@ public function preProcess() {

$url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $path);
$session->replaceUserContext($url);
return;
}

/**
Expand Down
16 changes: 7 additions & 9 deletions CRM/Contact/Import/Parser/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down Expand Up @@ -148,8 +148,8 @@ public function init() {
}

//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
);
Expand Down Expand Up @@ -250,7 +250,7 @@ public function init() {
* @param array $values
* The array of values belonging to this line.
*
* @return boolean
* @return bool
*/
public function mapField(&$values) {
return CRM_Import_Parser::VALID;
Expand All @@ -262,7 +262,7 @@ public function mapField(&$values) {
* @param array $values
* The array of values belonging to this line.
*
* @return boolean
* @return bool
* the result of this processing
*/
public function preview(&$values) {
Expand All @@ -275,7 +275,7 @@ public function preview(&$values) {
* @param array $values
* The array of values belonging to this line.
*
* @return boolean
* @return boo
* the result of this processing
*/
public function summary(&$values) {
Expand Down Expand Up @@ -449,7 +449,7 @@ public function summary(&$values) {
*
* @param bool $doGeocodeAddress
*
* @return boolean
* @return bool
* the result of this processing
*/
public function import($onDuplicate, &$values, $doGeocodeAddress = FALSE) {
Expand Down Expand Up @@ -1013,8 +1013,6 @@ public function import($onDuplicate, &$values, $doGeocodeAddress = FALSE) {
$newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId);
}
// else skip does nothing and just returns an error code.


if ($cid) {
$contact = array(
'contact_id' => $cid,
Expand Down
12 changes: 6 additions & 6 deletions CRM/Contribute/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static function select(&$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;
Expand Down Expand Up @@ -362,7 +362,7 @@ public static function whereClauseSingle(&$values, &$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;
Expand Down Expand Up @@ -876,7 +876,7 @@ public static function buildSearchForm(&$form) {
$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')
Expand All @@ -890,7 +890,7 @@ public static function buildSearchForm(&$form) {
$form->add('select', 'contribution_page_id',
ts('Contribution Page'),
array(
'' => ts('- any -')
'' => ts('- any -'),
) +
CRM_Contribute_PseudoConstant::contributionPage(),
FALSE, array('class' => 'crm-select2')
Expand All @@ -903,7 +903,7 @@ public static function buildSearchForm(&$form) {
$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')
Expand Down Expand Up @@ -1038,7 +1038,7 @@ public static function tableNames(&$tables) {
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';
Expand Down
34 changes: 16 additions & 18 deletions CRM/Contribute/Form/CancelSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ public function preProcess() {
$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);
}
}

Expand Down Expand Up @@ -186,8 +186,6 @@ public function buildQuickForm() {
* 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
*/
Expand Down Expand Up @@ -227,8 +225,8 @@ public function postProcess() {
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,
);
Expand All @@ -244,10 +242,10 @@ public function postProcess() {
$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';
Expand Down Expand Up @@ -277,9 +275,8 @@ public function postProcess() {
$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'] .
'>';
Expand All @@ -290,8 +287,8 @@ public function postProcess() {
}

// 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,
Expand Down Expand Up @@ -328,11 +325,12 @@ public function postProcess() {
$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"));
}
}
}
}
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static function add(&$params) {
* @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);
Expand Down
13 changes: 1 addition & 12 deletions CRM/Core/BAO/LabelFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -186,8 +184,6 @@ public static function getFontNames($name = 'label_format') {
/**
* Get font sizes supported by the TCPDF package used to create PDF labels.
*
* @param void
*
* @return array
* array of font sizes
*/
Expand All @@ -203,8 +199,6 @@ public static function getFontSizes() {
/**
* Get measurement units recognized by the TCPDF package used to create PDF labels.
*
* @param void
*
* @return array
* array of measurement units
*/
Expand All @@ -220,8 +214,6 @@ public static function getUnits() {
/**
* Get text alignment recognized by the TCPDF package used to create PDF labels.
*
* @param void
*
* @return array
* array of alignments
*/
Expand All @@ -236,8 +228,6 @@ public static function getTextAlignments() {
/**
* Get text alignment recognized by the TCPDF package used to create PDF labels.
*
* @param void
*
* @return array
* array of alignments
*/
Expand Down Expand Up @@ -280,6 +270,7 @@ private static function _getGid($name = 'label_format') {
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;
}

/**
Expand Down Expand Up @@ -462,8 +453,6 @@ public static function retrieve(&$params, &$values, $groupName = 'label_format')
/**
* Return the name of the group for customized labels
*
* @param void
*
* @return void
*/
public static function customGroupName() {
Expand Down
Loading

0 comments on commit 7c550ca

Please sign in to comment.