Commit 22e263ad authored by totten's avatar totten

INFRA-132 - Put space after flow-control (if/switch/for/foreach/while)

parent 0db6c3e1
......@@ -357,9 +357,9 @@ class CRM_Activity_BAO_Query {
CRM_Campaign_BAO_Query::componentSearchClause($campParams, $query);
break;
case 'activity_result':
if(is_array($value)) {
if (is_array($value)) {
$safe = NULL;
while(list(,$k) = each($value)) {
while (list(,$k) = each($value)) {
$safe[] = "'" . CRM_Utils_Type::escape($k, 'String') . "'";
}
$query->_where[$grouping][] = "civicrm_activity.result IN (" . implode(',', $safe) . ")";
......@@ -551,7 +551,7 @@ class CRM_Activity_BAO_Query {
$value = array();
$value = CRM_Core_OptionGroup::values($name);
if (!empty($value)) {
while(list($k,$v) = each($value)) {
while (list($k,$v) = each($value)) {
$resultOptions[$v] = $v;
}
}
......@@ -559,7 +559,7 @@ class CRM_Activity_BAO_Query {
}
// If no survey result options have been created, don't build
// the field to avoid clutter.
if(count($resultOptions) > 0) {
if (count($resultOptions) > 0) {
$buildSurveyResult = TRUE;
asort($resultOptions);
$form->add('select', 'activity_result', ts("Survey Result"),
......
......@@ -116,7 +116,7 @@ class CRM_Activity_Form_Task extends CRM_Core_Form {
$result = $query->searchQuery(0, 0, NULL);
while ($result->fetch()) {
if(!empty($result->activity_id)) {
if (!empty($result->activity_id)) {
$ids[] = $result->activity_id;
}
}
......
......@@ -83,10 +83,10 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task {
'Activity', $returnProperties
);
$readOnlyFields['assignee_display_name'] = ts('Assigned to');
if(!empty($contactDetails)) {
foreach($contactDetails as $key => $value){
if (!empty($contactDetails)) {
foreach ($contactDetails as $key => $value){
$assignee = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId($key);
foreach($assignee as $keys => $values) {
foreach ($assignee as $keys => $values) {
$assigneeContact[] = CRM_Contact_BAO_Contact::displayname($values);
}
$contactDetails[$key]['assignee_display_name'] = !empty($assigneeContact) ? implode(';', $assigneeContact) : NULL;
......
......@@ -161,7 +161,7 @@ class CRM_Activity_Page_AJAX {
$clientRelationships = array_slice($allClientRelationships, $offset, $rowCount, TRUE);
// after sort we can update username fields to be a url
foreach($clientRelationships as $key => $value) {
foreach ($clientRelationships as $key => $value) {
$clientRelationships[$key]['name'] = '<a href='.CRM_Utils_System::url('civicrm/contact/view',
'action=view&reset=1&cid='.$clientRelationships[$key]['cid']).'>'.$clientRelationships[$key]['name'].'</a>';
}
......@@ -225,7 +225,7 @@ class CRM_Activity_Page_AJAX {
// move/transform caseRoles array data to caseRelationships
// for sorting and display
// CRM-14466 added cid to the non-client array to avoid php notice
foreach($caseRoles as $id => $value) {
foreach ($caseRoles as $id => $value) {
if ($id != "client") {
$rel = array();
$rel['relation'] = $value;
......@@ -237,7 +237,7 @@ class CRM_Activity_Page_AJAX {
$caseRelationships[] = $rel;
}
else {
foreach($value as $clientRole) {
foreach ($value as $clientRole) {
$relClient = array();
$relClient['relation'] = 'Client';
$relClient['name'] = $clientRole['sort_name'];
......@@ -282,7 +282,7 @@ class CRM_Activity_Page_AJAX {
if ($hasAccessToAllCases) {
$contactType = empty($row['relation_type']) ? '' : (string) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $row['relation_type'], 'contact_type_b');
$contactType = $contactType == 'Contact' ? '' : $contactType;
switch($row['source']) {
switch ($row['source']) {
case 'caseRel':
$row['actions'] =
'<a href="#editCaseRoleDialog" title="'. ts('Reassign %1', array(1 => $typeLabel)) .'" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="'. $row['relation_type'] .'" data-rel_id="'. $row['rel_id'] .'"data-key="'. CRM_Core_Key::get('civicrm/ajax/relation') .'">'.
......
......@@ -47,7 +47,7 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form {
protected $_ppDAO;
public function preProcess() {
if(!CRM_Core_Permission::check('administer payment processors')) {
if (!CRM_Core_Permission::check('administer payment processors')) {
CRM_Core_Error::statusBounce('The \'administer payment processors\' permission is required to add or edit a payment processor.');
}
parent::preProcess();
......
......@@ -138,9 +138,9 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
foreach ($this->_settings as $setting => $group){
$settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting));
$props = $settingMetaData['values'][$setting];
if(isset($props['quick_form_type'])){
if (isset($props['quick_form_type'])){
$add = 'add' . $props['quick_form_type'];
if($add == 'addElement'){
if ($add == 'addElement'){
$this->$add(
$props['html_type'],
$setting,
......@@ -153,11 +153,11 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
$this->$add($setting, ts($props['title']));
}
$this->assign("{$setting}_description", ts($props['description']));
if($setting == 'max_attachments'){
if ($setting == 'max_attachments'){
//temp hack @todo fix to get from metadata
$this->addRule('max_attachments', ts('Value should be a positive number'), 'positiveInteger');
}
if($setting == 'maxFileSize'){
if ($setting == 'maxFileSize'){
//temp hack
$this->addRule('maxFileSize', ts('Value should be a positive number'), 'positiveInteger');
}
......
......@@ -99,7 +99,7 @@ class CRM_Admin_Form_Setting_UpdateConfigBackend extends CRM_Admin_Form_Setting
$tmpDir = trim($fields['newBaseDir']);
$errors = array();
if (!is_writeable($tmpDir)) {
if (!is_writable($tmpDir)) {
$errors['newBaseDir'] = ts('%1 directory does not exist or cannot be written by webserver',
array(1 => $tmpDir)
);
......
......@@ -55,7 +55,7 @@ class CRM_Admin_Page_Access extends CRM_Core_Page {
case 'Joomla':
//condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value
if( version_compare(JVERSION, '3.0', 'lt') ) {
if (version_compare(JVERSION, '3.0', 'lt') ) {
JHTML::_('behavior.modal');
$url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component';
$jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"';
......
......@@ -157,7 +157,7 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
$localExtensionRows = array(); // array($pseudo_id => extended_CRM_Extension_Info)
$keys = array_keys($manager->getStatuses());
sort($keys);
foreach($keys as $key) {
foreach ($keys as $key) {
try {
$obj = $mapper->keyToInfo($key);
}
......
......@@ -147,7 +147,7 @@ class CRM_Badge_BAO_Layout extends CRM_Core_DAO_PrintLabel {
$printLabel->find();
$labels = array();
while($printLabel->fetch()) {
while ($printLabel->fetch()) {
$labels[$printLabel->id] = $printLabel->title;
}
return $labels;
......
......@@ -90,7 +90,7 @@ class CRM_Campaign_BAO_Query {
// CRM-14238 Only translate when we are in contact mode
// Other modes need the untranslated data for export and other functions
if (is_array($query->_select) && $query->_mode == CRM_Contact_BAO_Query::MODE_CONTACTS) {
foreach($query->_select as $field => $queryString) {
foreach ($query->_select as $field => $queryString) {
if (substr($field, -11) == 'campaign_id') {
$query->_pseudoConstantsSelect[$field] = array(
'pseudoField' => 'campaign_id',
......
......@@ -409,7 +409,7 @@ SELECT survey.id as id,
return NULL;
}
$reportId = CRM_Campaign_BAO_Survey::getReportID($id);
if($reportId){
if ($reportId){
CRM_Report_BAO_ReportInstance::del($reportId);
}
$dao = new CRM_Campaign_DAO_Survey();
......@@ -552,7 +552,7 @@ INNER JOIN civicrm_activity_contact activityAssignment
ON ( activityAssignment.activity_id = activity.id AND activityAssignment.record_type_id = $assigneeID )
WHERE activity.source_record_id = %1
AND ( activity.is_deleted IS NULL OR activity.is_deleted = 0 ) ";
if(!empty($interviewerId)) {
if (!empty($interviewerId)) {
$query .= "AND activityAssignment.contact_id = %2 ";
$params[2] = array($interviewerId, 'Integer');
}
......
......@@ -90,8 +90,8 @@ class CRM_Case_Page_DashBoard extends CRM_Core_Page {
$upcoming = CRM_Case_BAO_Case::getCases($allCases, $userID, 'upcoming');
$recent = CRM_Case_BAO_Case::getCases($allCases, $userID, 'recent');
foreach($upcoming as $key => $value) {
if(strtotime($value['case_scheduled_activity_date']) < time()) {
foreach ($upcoming as $key => $value) {
if (strtotime($value['case_scheduled_activity_date']) < time()) {
$upcoming[$key]['activity_status'] = 'status-overdue';
}
}
......
......@@ -396,7 +396,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
// use metadata to translate the array to the appropriate DB type or altering the param in the api layer,
// or at least altering the param in same section as 'group_type' rather than repeating here. However, further down
// we need the $params one to be in it's original form & we are not sure what test coverage we have on that
if(isset($group->parents) && is_array($group->parents)) {
if (isset($group->parents) && is_array($group->parents)) {
$group->parents = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
array_keys($group->parents)
) . CRM_Core_DAO::VALUE_SEPARATOR;
......@@ -753,7 +753,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
if (empty($params['parent_id']) && !empty($value['parents'])) {
$groupIds = explode(',', $value['parents']);
$title = array();
foreach($groupIds as $gId) {
foreach ($groupIds as $gId) {
$title[] = $allGroups[$gId];
}
$groupList[$id]['group_name'] .= '<div class="crm-row-parent-name"><em>'.ts('Child of').'</em>: ' . implode(', ', $title) . '</div>';
......@@ -975,7 +975,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
$where .= " AND status = 'Added'";
}
$dao = CRM_Core_DAO::executeQuery("SELECT group_id, COUNT(id) as `count` FROM $table WHERE $where GROUP BY group_id");
while($dao->fetch()) {
while ($dao->fetch()) {
$values[$dao->group_id]['count'] = $dao->count;
}
}
......
......@@ -89,7 +89,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
$relationshipId = CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
//CRM-9015 - the hooks are called here & in add (since add doesn't call create)
// but in future should be tidied per ticket
if(empty($relationshipId)){
if (empty($relationshipId)){
$hook = 'create';
$action = CRM_Core_Action::ADD;
}
......@@ -202,7 +202,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
$hook = 'create';
if($relationshipId) {
if ($relationshipId) {
$hook = 'edit';
}
//@todo hook are called from create and add - remove one
......@@ -233,10 +233,10 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
$dateFields = array('end_date', 'start_date');
foreach (self::getdefaults() as $defaultField => $defaultValue){
if(isset($params[$defaultField])){
if(in_array($defaultField, $dateFields)){
if (isset($params[$defaultField])){
if (in_array($defaultField, $dateFields)){
$relationship->$defaultField = CRM_Utils_Date::format(CRM_Utils_Array::value($defaultField, $params));
if(!$relationship->$defaultField){
if (!$relationship->$defaultField){
$relationship->$defaultField = 'NULL';
}
}
......@@ -767,7 +767,7 @@ WHERE relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer');
$dateFields = array('end_date', 'start_date');
foreach ($dateFields as $dateField){
if(array_key_exists($dateField, $params)) {
if (array_key_exists($dateField, $params)) {
if (empty($params[$dateField]) || $params[$dateField] == 'null'){
//this is most likely coming from an api call & probably loaded
// from the DB to deal with some of the
......@@ -1005,11 +1005,11 @@ LEFT JOIN civicrm_country ON (civicrm_address.country_id = civicrm_country.id)
// CRM-6181
$where .= ' AND civicrm_contact.is_deleted = 0';
if(!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) {
if (!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) {
$where .= self::membershipTypeToRelationshipTypes($params, $direction);
}
if(!empty($params['relationship_type_id'])) {
if(is_array($params['relationship_type_id'])) {
if (!empty($params['relationship_type_id'])) {
if (is_array($params['relationship_type_id'])) {
$where .= " AND " . CRM_Core_DAO::createSQLFilter('relationship_type_id', $params['relationship_type_id'], 'Integer');
}
else {
......@@ -1712,11 +1712,11 @@ AND cc.sort_name LIKE '%$name%'";
public static function membershipTypeToRelationshipTypes(&$params, $direction = NULL) {
$membershipType = civicrm_api3('membership_type', 'getsingle', array('id' => $params['membership_type_id'], 'return' => 'relationship_type_id, relationship_direction'));
$relationshipTypes = $membershipType['relationship_type_id'];
if(empty($relationshipTypes)) {
if (empty($relationshipTypes)) {
return;
}
// if we don't have any contact data we can only filter on type
if(empty($params['contact_id']) && empty($params['contact_id_a']) && empty($params['contact_id_a'])) {
if (empty($params['contact_id']) && empty($params['contact_id_a']) && empty($params['contact_id_a'])) {
$params['relationship_type_id'] = array('IN' => $relationshipTypes);
return;
}
......@@ -1725,14 +1725,14 @@ AND cc.sort_name LIKE '%$name%'";
// if we have contact_id_a OR contact_id_b we can make a call here
// if we have contact??
foreach ($relationshipDirections as $index => $mtdirection) {
if(isset($params['contact_id_a']) && $mtdirection == 'a_b' || $direction == 'a_b') {
if (isset($params['contact_id_a']) && $mtdirection == 'a_b' || $direction == 'a_b') {
$types[] = $relationshipTypes[$index];
}
if(isset($params['contact_id_b']) && $mtdirection == 'b_a' || $direction == 'b_a') {
if (isset($params['contact_id_b']) && $mtdirection == 'b_a' || $direction == 'b_a') {
$types[] = $relationshipTypes[$index];
}
}
if(!empty($types)) {
if (!empty($types)) {
$params['relationship_type_id'] = array('IN' => $types);
}
elseif(!empty($clauses)) {
......
......@@ -125,7 +125,7 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
// this is due to some condition inside it which restricts it from saving in session
// so doing this for multi record edit action
$entityId = CRM_Utils_Request::retrieve('entityID', 'Positive', $this);
if(!empty($entityId)) {
if (!empty($entityId)) {
$subType = CRM_Contact_BAO_Contact::getContactSubType($entityId, ',');
}
CRM_Custom_Form_CustomData::preProcess($this, NULL, $subType, NULL, NULL, $entityId);
......
......@@ -280,7 +280,7 @@ class CRM_Contact_Form_Edit_Address {
// DETACH 'required' form rule error to
// custom data only if address data not exists upon submission
if (!empty($customDataRequiredFields)) {
foreach($customDataRequiredFields as $customElementName) {
foreach ($customDataRequiredFields as $customElementName) {
$elementName = "address[$instance][$customElementName]";
if ($self->getElementError($elementName)) {
// set element error to none
......@@ -294,7 +294,7 @@ class CRM_Contact_Form_Edit_Address {
// DETACH 'required' form rule error to
// custom data only if address data not exists upon submission
if (!empty($customDataRequiredFields) && !CRM_Core_BAO_Address::dataExists($addressValues)) {
foreach($customDataRequiredFields as $customElementName) {
foreach ($customDataRequiredFields as $customElementName) {
$elementName = "address[$instance][$customElementName]";
if ($self->getElementError($elementName)) {
// set element error to none
......
......@@ -75,7 +75,7 @@ class CRM_Contact_Form_Edit_CustomData {
* @static
*/
public static function buildQuickForm(&$form) {
if(!empty($form->_submitValues)) {
if (!empty($form->_submitValues)) {
if ($customValueCount = CRM_Utils_Array::value('hidden_custom_group_count', $form->_submitValues)) {
if (is_array($customValueCount)) {
if (array_key_exists(0, $customValueCount)) {
......
......@@ -120,7 +120,7 @@ class CRM_Contact_Form_ProfileContact {
$dedupeParams = CRM_Dedupe_Finder::formatParams($params['honor'], $profileContactType);
$dedupeParams['check_permission'] = FALSE;
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType);
if(count($ids)) {
if (count($ids)) {
$honorId = CRM_Utils_Array::value(0, $ids);
}
......
......@@ -326,7 +326,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
$jsData = array();
// Get just what we need to keep the dom small
$whatWeWant = array_flip(array('contact_type_a', 'contact_type_b', 'contact_sub_type_a', 'contact_sub_type_b'));
foreach($this->_allRelationshipNames as $id => $vals) {
foreach ($this->_allRelationshipNames as $id => $vals) {
if ($vals['name_a_b'] === 'Employee of') {
$this->assign('employmentRelationship', $id);
}
......
......@@ -361,7 +361,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
$financialType = CRM_Utils_Array::value('financial_type_id', $this->_formValues);
if ($financialType && is_array($financialType)) {
unset($this->_formValues['financial_type_id']);
foreach($financialType as $notImportant => $typeID) {
foreach ($financialType as $notImportant => $typeID) {
$this->_formValues['financial_type_id'][$typeID] = 1;
}
}
......
......@@ -86,7 +86,7 @@ class CRM_Contact_Form_Search_Custom_ContributionAggregate implements CRM_Contac
$form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
$financial_types = CRM_Contribute_PseudoConstant::financialType();
foreach($financial_types as $financial_type_id => $financial_type) {
foreach ($financial_types as $financial_type_id => $financial_type) {
$form->addElement('checkbox', "financial_type_id[{$financial_type_id}]", 'Financial Type', $financial_type);
}
......
......@@ -110,11 +110,11 @@ class CRM_Contact_Form_Task_AlterPreferences extends CRM_Contact_Form_Task {
if (!empty($params['pref'])) {
$privacyValues = $params['pref'];
$count = 0;
foreach($this->_contactIds as $contact_id) {
foreach ($this->_contactIds as $contact_id) {
$contact = new CRM_Contact_BAO_Contact();
$contact->id = $contact_id;
foreach($privacyValues as $privacy_key => $privacy_value) {
foreach ($privacyValues as $privacy_key => $privacy_value) {
$contact->$privacy_key = $privacyValueNew;
}
$contact->save();
......@@ -123,7 +123,7 @@ class CRM_Contact_Form_Task_AlterPreferences extends CRM_Contact_Form_Task {
// Status message
$privacyOptions = CRM_Core_SelectValues::privacy();
$status = array();
foreach($privacyValues as $privacy_key => $privacy_value) {
foreach ($privacyValues as $privacy_key => $privacy_value) {
$label = $privacyOptions[$privacy_key];
$status[] = $privacyValueNew ? ts("Added '%1'", array(1 => $label)) : ts("Removed '%1'", array(1 => $label));
}
......
......@@ -499,7 +499,7 @@ class CRM_Contact_Form_Task_EmailCommon {
if (isset($form->_caseId)) {
// if case-id is found in the url, create case activity record
$cases = explode(',', $form->_caseId);
foreach($cases as $key => $val) {
foreach ($cases as $key => $val) {
if (is_numeric($val)) {
$caseParams = array(
'activity_id' => $activityId,
......
......@@ -153,7 +153,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
// retrieve and highlight required custom fields
$formattedFieldNames = $this->formatCustomFieldName($this->_mapperFields);
self::$customFields = CRM_Core_BAO_CustomField::getFields($this->_contactType);
foreach(self::$customFields as $key => $attr) {
foreach (self::$customFields as $key => $attr) {
if (!empty($attr['is_required'])) {
$highlightedFields[] = "custom_$key";
}
......
......@@ -268,7 +268,7 @@ class CRM_Contact_Page_AJAX {
$ret = array('is_error' => 0);
foreach($clientList as $sourceContactID) {
foreach ($clientList as $sourceContactID) {
$relationParams = array(
'relationship_type_id' => $relType . '_a_b',
'contact_check' => array($relContactID => 1),
......@@ -288,7 +288,7 @@ class CRM_Contact_Page_AJAX {
$caseRelationships->contact_id_a = $sourceContactID;
$caseRelationships->find();
while($caseRelationships->fetch()) {
while ($caseRelationships->fetch()) {
$relationIds['relationship'] = $caseRelationships->id;
$relationIds['contactTarget'] = $relContactID;
}
......
......@@ -1059,7 +1059,7 @@ SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', cont
// build insert query, note that currently we build cache for 500 contact records at a time, hence below approach
$insertValues = array();
while($dao->fetch()) {
while ($dao->fetch()) {
$insertValues[] = "('civicrm_contact', {$dao->contact_id}, {$dao->contact_id}, '{$cacheKey}', '" . CRM_Core_DAO::escapeString($dao->sort_name) . "')";
}
......
......@@ -367,7 +367,7 @@ class CRM_Contribute_BAO_Contribution_Utils {
* @return bool
*/
static protected function isPaymentTransaction($form) {
if(!empty($form->_values['is_monetary']) && $form->_amount >= 0.0) {
if (!empty($form->_values['is_monetary']) && $form->_amount >= 0.0) {
return TRUE;
}
return FALSE;
......
......@@ -935,7 +935,7 @@ LEFT JOIN civicrm_premiums ON ( civicrm_premiums.entity_id = civicrm
*/
public static function getIsMembershipPayment($id) {
$membershipBlocks = civicrm_api3('membership_block', 'get', array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $id, 'sequential' => TRUE));
if(!$membershipBlocks['count']) {
if (!$membershipBlocks['count']) {
return FALSE;
}
return $membershipBlocks['values'][0]['is_separate_payment'];
......
......@@ -93,7 +93,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio
public static function del($params) {
//delete from contribution soft table
$contributionSoft = new CRM_Contribute_DAO_ContributionSoft();
foreach($params as $column => $value) {
foreach ($params as $column => $value) {
$contributionSoft->$column = $value;
}
$contributionSoft->delete();
......
......@@ -253,7 +253,7 @@ class CRM_Contribute_BAO_Query {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
foreach (self::getRecurringFields() as $dateField => $dateFieldTitle) {
if(self::buildDateWhere($values, $query, $name, $dateField, $dateFieldTitle)) {
if (self::buildDateWhere($values, $query, $name, $dateField, $dateFieldTitle)) {
return;
}
}
......@@ -343,7 +343,7 @@ class CRM_Contribute_BAO_Query {
// Ensure we have a sensible string to display to the user.
$names = array();
if (isset($val) && is_array($val)) {
foreach($val as $id) {
foreach ($val as $id) {
$names[] = CRM_Utils_Array::value($id, $types);
}
}
......@@ -1146,7 +1146,7 @@ class CRM_Contribute_BAO_Query {
*/
public static function buildDateWhere(&$values, $query, $name, $field, $title) {
$fieldPart = strpos($name, $field);
if($fieldPart === FALSE) {
if ($fieldPart === FALSE) {
return;
}
// we only have recurring dates using this ATM so lets' short cut to find the table name
......
......@@ -421,7 +421,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
$onlinePaymentProcessorEnabled = FALSE;
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $key => $name) {
if($name['billing_mode'] == 1) {
if ($name['billing_mode'] == 1) {
$onlinePaymentProcessorEnabled = TRUE;
}
$pps[$key] = $name['name'];
......@@ -447,7 +447,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
}
$contactID = $this->getContactID();
if($this->getContactID() === '0') {
if ($this->getContactID() === '0') {
$this->addCidZeroOptions($onlinePaymentProcessorEnabled);
}
//build pledge block.
......@@ -563,7 +563,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
$pcp_supporter_text = ts('This contribution is being made thanks to the effort of <strong>%1</strong>, who supports our campaign.', array(1 => $pcpSupporter));
// Only tell people that can also create a PCP if the contribution page has a non-empty value in the "Create Personal Campaign Page link" field.
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute');
if(!empty($text)) {
if (!empty($text)) {
$pcp_supporter_text .= ts("You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!");
}
$this->assign('pcpSupporterText', $pcp_supporter_text);
......@@ -681,7 +681,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
$unitVals = explode(CRM_Core_DAO::VALUE_SEPARATOR, $frUnits);
// CRM 10860, display text instead of a dropdown if there's only 1 frequency unit
if(sizeof($unitVals) == 1) {
if (sizeof($unitVals) == 1) {
$form->assign('one_frequency_unit', TRUE);
$unit = $unitVals[0];
$form->add('hidden', 'frequency_unit', $unit);
......@@ -870,7 +870,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
$errors['_qf_default'] = ts('Select at least one option from Contribution(s).');
}
}
if($otherAmount && !empty($check)) {
if ($otherAmount && !empty($check)) {
$errors["price_{$otherAmount}"] = ts('Amount is required field.');
}
......