From 8cc574cffccb401cfae8fae926007016e03b92b2 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 21 Jan 2014 21:50:44 -0800 Subject: [PATCH] CRM-14106 - Regex targeting other conditionals Pattern used: \s*(&&|\|\|)\s*CRM_Utils_Array::value\s*\([ ]*(['"$0-9][^,]*),\s*(\$[^ )]*)\s*\)\s*(\&\&|\|\||\)) $1 !empty\($3\[$2\]\)$4 --- CRM/Activity/BAO/Activity.php | 9 +-- CRM/Activity/Form/Activity.php | 10 +-- CRM/Admin/Form/Options.php | 6 +- CRM/Admin/Form/ScheduleReminders.php | 2 +- CRM/Admin/Form/Setting/Localization.php | 2 +- CRM/Admin/Form/WordReplacements.php | 14 ++-- CRM/Badge/BAO/Badge.php | 3 +- CRM/Batch/BAO/Batch.php | 2 +- CRM/Batch/Form/Entry.php | 19 +++--- CRM/Campaign/BAO/Campaign.php | 2 +- CRM/Campaign/Form/Search.php | 4 +- CRM/Campaign/Form/Survey/Main.php | 4 +- CRM/Campaign/Form/Survey/Results.php | 19 ++---- CRM/Campaign/Form/Survey/TabHeader.php | 2 +- CRM/Campaign/Form/Task/Interview.php | 3 +- CRM/Campaign/Page/AJAX.php | 3 +- CRM/Case/BAO/Case.php | 2 +- CRM/Case/BAO/Query.php | 4 +- CRM/Case/Form/Activity/ChangeCaseStatus.php | 4 +- CRM/Case/Form/Activity/OpenCase.php | 2 +- CRM/Case/Form/CaseView.php | 4 +- CRM/Contact/BAO/Contact.php | 8 +-- CRM/Contact/BAO/Contact/Utils.php | 4 +- CRM/Contact/BAO/Group.php | 7 +- CRM/Contact/BAO/GroupOrganization.php | 4 +- CRM/Contact/BAO/Individual.php | 6 +- CRM/Contact/BAO/Query.php | 23 ++----- CRM/Contact/BAO/Relationship.php | 6 +- CRM/Contact/BAO/RelationshipType.php | 8 +-- CRM/Contact/BAO/SavedSearch.php | 4 +- CRM/Contact/Form/Contact.php | 31 +++------ CRM/Contact/Form/Edit/Address.php | 18 ++---- .../Form/Edit/CommunicationPreferences.php | 4 +- CRM/Contact/Form/Edit/CustomData.php | 4 +- CRM/Contact/Form/Edit/Individual.php | 4 +- CRM/Contact/Form/Inline/Address.php | 4 +- CRM/Contact/Form/Inline/IM.php | 3 +- CRM/Contact/Form/Inline/OpenID.php | 3 +- CRM/Contact/Form/Inline/Phone.php | 3 +- CRM/Contact/Form/Location.php | 2 +- CRM/Contact/Form/ProfileContact.php | 7 +- CRM/Contact/Form/Relationship.php | 18 ++---- CRM/Contact/Form/Search.php | 12 +--- CRM/Contact/Form/Search/Advanced.php | 5 +- CRM/Contact/Form/Search/Basic.php | 2 +- CRM/Contact/Form/Search/Builder.php | 2 +- CRM/Contact/Form/Search/Custom/Basic.php | 4 +- CRM/Contact/Form/Task/AddToHousehold.php | 2 +- CRM/Contact/Form/Task/Batch.php | 4 +- CRM/Contact/Form/Task/EmailCommon.php | 9 +-- CRM/Contact/Form/Task/Label.php | 2 +- CRM/Contact/Form/Task/LabelCommon.php | 4 +- CRM/Contact/Form/Task/PDFLetterCommon.php | 2 +- CRM/Contact/Form/Task/ProximityCommon.php | 4 +- CRM/Contact/Form/Task/SMSCommon.php | 13 ++-- CRM/Contact/Import/Form/MapField.php | 3 +- CRM/Contact/Import/Parser/Contact.php | 24 +++---- CRM/Contact/Page/Inline/ContactInfo.php | 3 +- CRM/Contact/Page/View/Summary.php | 2 +- CRM/Contact/Selector.php | 6 +- CRM/Contribute/BAO/Contribution.php | 17 ++--- CRM/Contribute/BAO/Contribution/Utils.php | 2 +- CRM/Contribute/BAO/ContributionPage.php | 14 ++-- CRM/Contribute/BAO/Query.php | 3 +- CRM/Contribute/Form.php | 4 +- CRM/Contribute/Form/AdditionalInfo.php | 7 +- CRM/Contribute/Form/AdditionalPayment.php | 11 ++-- CRM/Contribute/Form/Contribution.php | 26 ++++---- CRM/Contribute/Form/Contribution/Confirm.php | 64 ++++++------------- CRM/Contribute/Form/Contribution/Main.php | 37 ++++------- .../Form/Contribution/OnBehalfOf.php | 4 +- CRM/Contribute/Form/Contribution/ThankYou.php | 6 +- CRM/Contribute/Form/ContributionBase.php | 6 +- .../Form/ContributionPage/Amount.php | 18 +++--- .../Form/ContributionPage/Settings.php | 6 +- .../Form/ContributionPage/TabHeader.php | 2 +- .../Form/ContributionPage/Widget.php | 2 +- CRM/Contribute/Form/ManagePremiums.php | 2 +- CRM/Contribute/Form/SoftCredit.php | 5 +- CRM/Contribute/Form/Task/PDF.php | 7 +- CRM/Contribute/Import/Parser/Contribution.php | 11 +--- CRM/Core/BAO/Address.php | 4 +- CRM/Core/BAO/Block.php | 10 ++- CRM/Core/BAO/CustomField.php | 2 +- CRM/Core/BAO/CustomGroup.php | 2 +- CRM/Core/BAO/CustomOption.php | 2 +- CRM/Core/BAO/Dashboard.php | 2 +- CRM/Core/BAO/File.php | 2 +- CRM/Core/BAO/FinancialTrxn.php | 2 +- CRM/Core/BAO/Log.php | 4 +- CRM/Core/BAO/Mapping.php | 4 +- CRM/Core/BAO/SchemaHandler.php | 4 +- CRM/Core/BAO/Setting.php | 2 +- CRM/Core/BAO/UFGroup.php | 4 +- CRM/Core/BAO/Website.php | 3 +- CRM/Core/Error.php | 2 +- CRM/Core/Form.php | 6 +- CRM/Core/Form/Tag.php | 12 +--- CRM/Core/OptionValue.php | 4 +- CRM/Core/Payment/BaseIPN.php | 2 +- CRM/Core/Payment/ProcessorForm.php | 17 ++--- CRM/Custom/Form/Field.php | 14 ++-- CRM/Dedupe/Merger.php | 7 +- CRM/Event/BAO/Event.php | 8 +-- CRM/Event/BAO/Participant.php | 4 +- CRM/Event/BAO/Query.php | 8 +-- CRM/Event/Cart/Form/Checkout/Payment.php | 8 +-- CRM/Event/Form/EventFees.php | 10 ++- CRM/Event/Form/ManageEvent/Fee.php | 6 +- CRM/Event/Form/ManageEvent/Location.php | 3 +- CRM/Event/Form/ManageEvent/Registration.php | 6 +- CRM/Event/Form/ManageEvent/TabHeader.php | 2 +- CRM/Event/Form/Participant.php | 19 ++---- CRM/Event/Form/Registration.php | 22 ++----- .../Registration/AdditionalParticipant.php | 30 +++------ CRM/Event/Form/Registration/Confirm.php | 45 +++++-------- CRM/Event/Form/Registration/Register.php | 53 +++++---------- CRM/Event/Import/Parser/Participant.php | 4 +- CRM/Event/Page/EventInfo.php | 4 +- CRM/Export/BAO/Export.php | 5 +- CRM/Export/Form/Map.php | 2 +- CRM/Export/Form/Select.php | 4 +- CRM/Financial/Form/FinancialTypeAccount.php | 4 +- CRM/Friend/BAO/Friend.php | 4 +- CRM/Group/Form/Edit.php | 8 +-- CRM/Mailing/BAO/Mailing.php | 3 +- CRM/Mailing/Form/Test.php | 5 +- CRM/Mailing/Form/Upload.php | 9 ++- CRM/Member/BAO/Membership.php | 32 +++------- CRM/Member/BAO/MembershipStatus.php | 9 +-- CRM/Member/BAO/Query.php | 2 +- CRM/Member/Form.php | 2 +- CRM/Member/Form/Membership.php | 32 ++++------ CRM/Member/Form/MembershipBlock.php | 4 +- CRM/Member/Form/MembershipRenewal.php | 2 +- CRM/Member/Form/MembershipType.php | 6 +- CRM/Member/Form/MembershipView.php | 3 +- CRM/Member/Import/Parser/Membership.php | 10 +-- CRM/PCP/Form/Campaign.php | 4 +- CRM/Pledge/BAO/Pledge.php | 4 +- CRM/Pledge/BAO/Query.php | 8 +-- CRM/Pledge/Form/Pledge.php | 5 +- CRM/Price/BAO/LineItem.php | 2 +- CRM/Price/BAO/PriceField.php | 5 +- CRM/Price/BAO/PriceSet.php | 2 +- CRM/Price/Form/Field.php | 2 +- CRM/Price/Form/Option.php | 2 +- CRM/Profile/Form.php | 14 ++-- CRM/Profile/Form/Dynamic.php | 2 +- CRM/Profile/Form/Edit.php | 4 +- CRM/Profile/Page/Listings.php | 8 +-- CRM/Report/BAO/ReportInstance.php | 4 +- CRM/Report/Form.php | 30 +++------ CRM/Report/Form/Activity.php | 3 +- CRM/Report/Form/ActivitySummary.php | 12 +--- CRM/Report/Form/Campaign/SurveyDetails.php | 18 ++---- CRM/Report/Form/Case/Demographics.php | 4 +- CRM/Report/Form/Case/Detail.php | 13 ++-- CRM/Report/Form/Case/Summary.php | 16 ++--- CRM/Report/Form/Case/TimeSpent.php | 3 +- CRM/Report/Form/Contact/CurrentEmployer.php | 4 +- CRM/Report/Form/Contact/Detail.php | 4 +- CRM/Report/Form/Contact/Log.php | 4 +- CRM/Report/Form/Contact/Relationship.php | 4 +- CRM/Report/Form/Contact/Summary.php | 4 +- CRM/Report/Form/Contribute/Bookkeeping.php | 10 +-- CRM/Report/Form/Contribute/Detail.php | 15 ++--- CRM/Report/Form/Contribute/History.php | 18 ++---- .../Form/Contribute/HouseholdSummary.php | 4 +- CRM/Report/Form/Contribute/Lybunt.php | 6 +- .../Form/Contribute/OrganizationSummary.php | 10 +-- CRM/Report/Form/Contribute/Repeat.php | 6 +- CRM/Report/Form/Contribute/SoftCredit.php | 4 +- CRM/Report/Form/Contribute/Summary.php | 18 ++---- CRM/Report/Form/Contribute/Sybunt.php | 6 +- CRM/Report/Form/Contribute/TopDonor.php | 8 +-- CRM/Report/Form/Event/IncomeCountSummary.php | 4 +- .../Form/Event/ParticipantListCount.php | 6 +- CRM/Report/Form/Event/ParticipantListing.php | 7 +- CRM/Report/Form/Event/Summary.php | 8 +-- CRM/Report/Form/Extended.php | 2 +- CRM/Report/Form/Grant/Detail.php | 4 +- CRM/Report/Form/Grant/Statistics.php | 4 +- CRM/Report/Form/Mailing/Bounce.php | 4 +- CRM/Report/Form/Mailing/Clicks.php | 4 +- CRM/Report/Form/Mailing/Detail.php | 4 +- CRM/Report/Form/Mailing/Opened.php | 4 +- CRM/Report/Form/Mailing/Summary.php | 4 +- CRM/Report/Form/Member/ContributionDetail.php | 17 ++--- CRM/Report/Form/Member/Detail.php | 4 +- CRM/Report/Form/Member/Lapse.php | 4 +- CRM/Report/Form/Member/Summary.php | 15 ++--- CRM/Report/Form/Membership/Summary.php | 4 +- CRM/Report/Form/Pledge/Pbnp.php | 4 +- CRM/Report/Form/Pledge/Summary.php | 4 +- CRM/Report/Form/Walklist/Walklist.php | 4 +- CRM/SMS/Form/Upload.php | 2 +- CRM/UF/Form/Field.php | 4 +- CRM/Upgrade/Incremental/php/FourTwo.php | 2 +- CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php | 11 ++-- CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php | 2 +- CRM/Utils/Address/BatchUpdate.php | 4 +- CRM/Utils/DeprecatedUtils.php | 2 +- CRM/Utils/Mail.php | 4 +- CRM/Utils/Rule.php | 2 +- CRM/Utils/Token.php | 12 ++-- api/v3/Activity.php | 4 +- api/v3/Contact.php | 4 +- api/v3/Contribution.php | 2 +- api/v3/Participant.php | 2 +- api/v3/PledgePayment.php | 2 +- api/v3/utils.php | 16 ++--- bin/deprecated/UpdateAddress.php | 4 +- tests/phpunit/CiviTest/CiviUnitTestCase.php | 4 +- .../Baykeeper.php | 17 ++--- .../org.civicrm.report.grant/Grant.php | 4 +- 216 files changed, 551 insertions(+), 1091 deletions(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index b5e2878552..164a841b9b 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -64,9 +64,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { * @access public */ public static function dataExists(&$params) { - if (!empty($params['source_contact_id']) || - CRM_Utils_Array::value('id', $params) - ) { + if (!empty($params['source_contact_id']) || !empty($params['id'])) { return TRUE; } return FALSE; @@ -294,10 +292,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { unset($params['id']); } - if (empty($params['status_id']) && - !CRM_Utils_Array::value('activity_status_id', $params) && - !CRM_Utils_Array::value('id', $params) - ) { + if (empty($params['status_id']) && empty($params['activity_status_id']) && empty($params['id'])) { if (isset($params['activity_date_time']) && strcmp($params['activity_date_time'], CRM_Utils_Date::processDate(date('Ymd')) == -1) ) { diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 6f02353848..bc09379a2a 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -937,9 +937,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } //Activity type is mandatory if creating new activity, CRM-4515 - if (array_key_exists('activity_type_id', $fields) && - !CRM_Utils_Array::value('activity_type_id', $fields) - ) { + if (array_key_exists('activity_type_id', $fields) && empty($fields['activity_type_id'])) { $errors['activity_type_id'] = ts('Activity Type is required field.'); } //FIX me temp. comment @@ -960,13 +958,11 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $errors['status_id'] = ts('You cannot record scheduled SMS activity.'); } - if (!empty($fields['followup_activity_type_id']) && !CRM_Utils_Array::value('followup_date', $fields)) { + if (!empty($fields['followup_activity_type_id']) && empty($fields['followup_date'])) { $errors['followup_date_time'] = ts('Followup date is a required field.'); } //Activity type is mandatory if subject or follow-up date is specified for an Follow-up activity, CRM-4515 - if ((CRM_Utils_Array::value('followup_activity_subject', $fields) || CRM_Utils_Array::value('followup_date', $fields)) && - !CRM_Utils_Array::value('followup_activity_type_id', $fields) - ) { + if ((!empty($fields['followup_activity_subject']) || !empty($fields['followup_date'])) && empty($fields['followup_activity_type_id'])) { $errors['followup_activity_subject'] = ts('Follow-up Activity type is a required field.'); } return $errors; diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index a23d9a1329..d6ced2669a 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -325,13 +325,11 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { */ static function formRule($fields, $files, $self) { $errors = array(); - if ($self->_gName == 'case_status' && !CRM_Utils_Array::value('grouping', $fields)) { + if ($self->_gName == 'case_status' && empty($fields['grouping'])) { $errors['grouping'] = ts('Status class is a required field'); } - if (in_array($self->_gName, array('email_greeting', 'postal_greeting', 'addressee')) - && !CRM_Utils_Array::value('is_reserved', $self->_defaultValues) - ) { + if (in_array($self->_gName, array('email_greeting', 'postal_greeting', 'addressee')) && empty($self->_defaultValues['is_reserved'])) { $label = $fields['label']; $condition = " AND v.label = '{$label}' "; $values = CRM_Core_OptionGroup::values($self->_gName, FALSE, FALSE, FALSE, $condition, 'filter'); diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index 4c78e29624..4340407847 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -77,7 +77,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { } } - if (!empty($_POST) && CRM_Utils_Array::value('entity', $_POST)) { + if (!empty($_POST) && !empty($_POST['entity'])) { $mappingID = $_POST['entity'][0]; } elseif ($this->_mappingID) { diff --git a/CRM/Admin/Form/Setting/Localization.php b/CRM/Admin/Form/Setting/Localization.php index 8ef3af4c02..2c1138a2e1 100644 --- a/CRM/Admin/Form/Setting/Localization.php +++ b/CRM/Admin/Form/Setting/Localization.php @@ -223,7 +223,7 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { // CRM-7962, CRM-7713, CRM-9004 if (!empty($fields['defaultContactCountry']) && - (CRM_Utils_Array::value('countryLimit', $fields) && + (!empty($fields['countryLimit']) && (!in_array($fields['defaultContactCountry'], $fields['countryLimit'])) ) ) { diff --git a/CRM/Admin/Form/WordReplacements.php b/CRM/Admin/Form/WordReplacements.php index 88989ec6b5..c7ef9d18ae 100644 --- a/CRM/Admin/Form/WordReplacements.php +++ b/CRM/Admin/Form/WordReplacements.php @@ -187,8 +187,8 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { elseif (!$v && $newValues[$k]) { $errors['old[' . $k . ']'] = ts('Please Enter the value for Original Word'); } - elseif ((!CRM_Utils_Array::value($k, $newValues) && !CRM_Utils_Array::value($k, $oldValues)) - && (CRM_Utils_Array::value($k, $enabled) || CRM_Utils_Array::value($k, $exactMatch)) + elseif ((empty($newValues[$k]) && empty($oldValues[$k])) + && (!empty($enabled[$k]) || !empty($exactMatch[$k])) ) { $errors['old[' . $k . ']'] = ts('Please Enter the value for Original Word'); $errors['new[' . $k . ']'] = ts('Please Enter the value for Replacement Word'); @@ -211,13 +211,9 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { $enabled['exactMatch'] = $enabled['wildcardMatch'] = $disabled['exactMatch'] = $disabled['wildcardMatch'] = array(); for ($i = 1; $i <= $this->_numStrings; $i++) { - if (!empty($params['new'][$i]) && - CRM_Utils_Array::value($i, $params['old']) - ) { - if (isset($params['enabled']) && CRM_Utils_Array::value($i, $params['enabled'])) { - if (!empty($params['cb']) && - CRM_Utils_Array::value($i, $params['cb']) - ) { + if (!empty($params['new'][$i]) && !empty($params['old'][$i])) { + if (isset($params['enabled']) && !empty($params['enabled'][$i])) { + if (!empty($params['cb']) && !empty($params['cb'][$i])) { $enabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]); } else { diff --git a/CRM/Badge/BAO/Badge.php b/CRM/Badge/BAO/Badge.php index 6c0d49fd8b..00910dd389 100644 --- a/CRM/Badge/BAO/Badge.php +++ b/CRM/Badge/BAO/Badge.php @@ -171,8 +171,7 @@ class CRM_Badge_BAO_Badge { } if ((CRM_Utils_Array::value('height_image_1', $formattedRow) > - CRM_Utils_Array::value('height_image_2', $formattedRow)) && - CRM_Utils_Array::value('height_image_1', $formattedRow)) { + CRM_Utils_Array::value('height_image_2', $formattedRow)) && !empty($formattedRow['height_image_1'])) { $startOffset = CRM_Utils_Array::value('height_image_1', $formattedRow); } elseif (!empty($formattedRow['height_image_2'])) { diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 8b6c74c741..e2f7ee75ed 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -66,7 +66,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { $batch = new CRM_Batch_DAO_Batch(); $batch->copyValues($params); - if ($context == 'financialBatch' && CRM_Utils_Array::value('batchID', $ids)) { + if ($context == 'financialBatch' && !empty($ids['batchID'])) { $batch->id = $ids['batchID']; } $batch->save(); diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 367200592b..309b4a2c25 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -256,11 +256,10 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $batchTotal += $value['total_amount']; //validate for soft credit fields - if (!empty($params['soft_credit_contact_select_id'][$key]) && !CRM_Utils_Array::value($key, $params['soft_credit_amount'])) { + if (!empty($params['soft_credit_contact_select_id'][$key]) && empty($params['soft_credit_amount'][$key])) { $errors["soft_credit_amount[$key]"] = ts('Please enter the soft credit amount.'); } - if (!empty($params['soft_credit_amount']) && CRM_Utils_Array::value($key, $params['soft_credit_amount']) - && CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value($key, $params['soft_credit_amount'])) > CRM_Utils_Rule::cleanMoney($value['total_amount'])) { + if (!empty($params['soft_credit_amount']) && !empty($params['soft_credit_amount'][$key]) && CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value($key, $params['soft_credit_amount'])) > CRM_Utils_Rule::cleanMoney($value['total_amount'])) { $errors["soft_credit_amount[$key]"] = ts('Soft credit amount should not be greater than the total amount'); } @@ -417,7 +416,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $this->updateContactInfo($value); //build soft credit params - if (!empty($params['soft_credit_contact_select_id'][$key]) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) { + if (!empty($params['soft_credit_contact_select_id'][$key]) && !empty($params['soft_credit_amount'][$key])) { $value['soft_credit'][$key]['contact_id'] = $params['soft_credit_contact_select_id'][$key]; $value['soft_credit'][$key]['amount'] = CRM_Utils_Rule::cleanMoney($params['soft_credit_amount'][$key]); $value['soft_credit'][$key]['soft_credit_type_id'] = $params['field'][$key]['soft_credit_type']; @@ -477,7 +476,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { //CRM-11529 for backoffice transactions //when financial_type_id is passed in form, update the //lineitems with the financial type selected in form - if (!empty($value['financial_type_id']) && CRM_Utils_Array::value($priceSetId, $lineItem)) { + if (!empty($value['financial_type_id']) && !empty($lineItem[$priceSetId])) { foreach ($lineItem[$priceSetId] as &$values) { $values['financial_type_id'] = $value['financial_type_id']; } @@ -510,8 +509,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { // end of premium //send receipt mail. - if ( $contribution->id && - CRM_Utils_Array::value( 'send_receipt', $value ) ) { + if ( $contribution->id && !empty($value['send_receipt'])) { // add the domain email id $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail(); $domainEmail = "$domainEmail[0] <$domainEmail[1]>"; @@ -632,7 +630,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { } // handle soft credit - if (is_array(CRM_Utils_Array::value('soft_credit_contact_select_id', $params)) && CRM_Utils_Array::value($key, $params['soft_credit_contact_select_id']) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) { + if (is_array(CRM_Utils_Array::value('soft_credit_contact_select_id', $params)) && !empty($params['soft_credit_contact_select_id'][$key]) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) { $value['soft_credit'][$key]['contact_id'] = $params['soft_credit_contact_select_id'][$key]; $value['soft_credit'][$key]['amount'] = CRM_Utils_Rule::cleanMoney($params['soft_credit_amount'][$key]); } @@ -687,7 +685,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { //CRM-11529 for backoffice transactions //when financial_type_id is passed in form, update the //lineitems with the financial type selected in form - if (!empty($value['financial_type_id']) && CRM_Utils_Array::value($priceSetId, $lineItem)) { + if (!empty($value['financial_type_id']) && !empty($lineItem[$priceSetId])) { foreach ($lineItem[$priceSetId] as &$values) { $values['financial_type_id'] = $value['financial_type_id']; } @@ -743,8 +741,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { // end of premium //send receipt mail. - if ( $membership->id && - CRM_Utils_Array::value( 'send_receipt', $value ) ) { + if ( $membership->id && !empty($value['send_receipt'])) { // add the domain email id $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail(); diff --git a/CRM/Campaign/BAO/Campaign.php b/CRM/Campaign/BAO/Campaign.php index 707005b282..8987e529d2 100644 --- a/CRM/Campaign/BAO/Campaign.php +++ b/CRM/Campaign/BAO/Campaign.php @@ -76,7 +76,7 @@ Class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign { $groupTableName = CRM_Contact_BAO_Group::getTableName(); - if (isset($params['groups']) && CRM_Utils_Array::value('include', $params['groups']) && is_array($params['groups']['include'])) { + if (isset($params['groups']) && !empty($params['groups']['include']) && is_array($params['groups']['include'])) { foreach ($params['groups']['include'] as $entityId) { $dao = new CRM_Campaign_DAO_CampaignGroup(); $dao->campaign_id = $campaign->id; diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index c7ba98a9d7..35efeb9d4d 100755 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -293,9 +293,7 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form { $currentTaskValue = CRM_Utils_Array::value($this->_operation, $taskMapping); $taskValue = array($currentTaskValue => $allTasks[$currentTaskValue]); - if ($this->_operation == 'interview' && - CRM_Utils_Array::value('campaign_survey_id', $this->_formValues) - ) { + if ($this->_operation == 'interview' && !empty($this->_formValues['campaign_survey_id'])) { $activityTypes = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE); $surveyTypeId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', diff --git a/CRM/Campaign/Form/Survey/Main.php b/CRM/Campaign/Form/Survey/Main.php index 8fe6110308..552df9686c 100644 --- a/CRM/Campaign/Form/Survey/Main.php +++ b/CRM/Campaign/Form/Survey/Main.php @@ -118,9 +118,7 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey { if ($this->_surveyId) { - if (!empty($defaults['result_id']) && - CRM_Utils_Array::value('recontact_interval', $defaults) - ) { + if (!empty($defaults['result_id']) && !empty($defaults['recontact_interval'])) { $resultId = $defaults['result_id']; $recontactInterval = unserialize($defaults['recontact_interval']); diff --git a/CRM/Campaign/Form/Survey/Results.php b/CRM/Campaign/Form/Survey/Results.php index f4daeef730..2bc4658417 100644 --- a/CRM/Campaign/Form/Survey/Results.php +++ b/CRM/Campaign/Form/Survey/Results.php @@ -131,7 +131,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { 'onclick' => "showOptionSelect();"), '
', TRUE ); - if (empty($optionGroups) || !CRM_Utils_Array::value('result_id', $this->_values)) { + if (empty($optionGroups) || empty($this->_values['result_id'])) { $this->setdefaults(array('option_type' => 1)); } elseif (!empty($this->_values['result_id'])) { @@ -206,24 +206,19 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { */ static function formRule($fields, $files, $form) { $errors = array(); - if (!empty($fields['option_label']) && - CRM_Utils_Array::value('option_value', $fields) && + if (!empty($fields['option_label']) && !empty($fields['option_value']) && (count(array_filter($fields['option_label'])) == 0) && (count(array_filter($fields['option_value'])) == 0) ) { $errors['option_label[1]'] = ts('Enter at least one result option.'); return $errors; } - elseif (empty($fields['option_label']) && - !CRM_Utils_Array::value('option_value', $fields) - ) { + elseif (empty($fields['option_label']) && empty($fields['option_value'])) { return $errors; } if ( - $fields['option_type'] == 2 && - !CRM_Utils_Array::value('option_group_id', $fields) - ) { + $fields['option_type'] == 2 && empty($fields['option_group_id'])) { $errors['option_group_id'] = ts("Please select a Survey Result Set."); return $errors; } @@ -343,9 +338,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { $updateResultSet = FALSE; $resultSetOptGrpId = NULL; - if ((CRM_Utils_Array::value('option_type', $params) == 2) && - CRM_Utils_Array::value('option_group_id', $params) - ) { + if ((CRM_Utils_Array::value('option_type', $params) == 2) && !empty($params['option_group_id'])) { $updateResultSet = TRUE; $resultSetOptGrpId = $params['option_group_id']; } @@ -399,7 +392,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { $survey = CRM_Campaign_BAO_Survey::create($params); // create report if required. - if ( !$this->_reportId && $survey->id && CRM_Utils_Array::value('create_report', $params) ) { + if ( !$this->_reportId && $survey->id && !empty($params['create_report'])) { $activityStatus = CRM_Core_PseudoConstant::activityStatus('name'); $activityStatus = array_flip($activityStatus); $this->_params = diff --git a/CRM/Campaign/Form/Survey/TabHeader.php b/CRM/Campaign/Form/Survey/TabHeader.php index 015778821e..f491c238bf 100644 --- a/CRM/Campaign/Form/Survey/TabHeader.php +++ b/CRM/Campaign/Form/Survey/TabHeader.php @@ -40,7 +40,7 @@ class CRM_Campaign_Form_Survey_TabHeader { static function build(&$form) { $tabs = $form->get('tabHeader'); - if (!$tabs || !CRM_Utils_Array::value('reset', $_GET)) { + if (!$tabs || empty($_GET['reset'])) { $tabs = self::process($form); $form->set('tabHeader', $tabs); } diff --git a/CRM/Campaign/Form/Task/Interview.php b/CRM/Campaign/Form/Task/Interview.php index e6a451c42b..2f6fd08c52 100755 --- a/CRM/Campaign/Form/Task/Interview.php +++ b/CRM/Campaign/Form/Task/Interview.php @@ -103,8 +103,7 @@ class CRM_Campaign_Form_Task_Interview extends CRM_Campaign_Form_Task { $orderClause = false; $buttonName = $this->controller->getButtonName(); - if ( $buttonName == '_qf_Interview_submit_orderBy' && - CRM_Utils_Array::value('order_bys', $_POST) ) { + if ( $buttonName == '_qf_Interview_submit_orderBy' && !empty($_POST['order_bys'])) { $orderByParams = CRM_Utils_Array::value('order_bys', $_POST); } elseif ( CRM_Core_OptionGroup::getValue('activity_type','WalkList') == $this->_surveyDetails['activity_type_id'] ) { diff --git a/CRM/Campaign/Page/AJAX.php b/CRM/Campaign/Page/AJAX.php index 29ec3fa06a..7dcf6006fa 100644 --- a/CRM/Campaign/Page/AJAX.php +++ b/CRM/Campaign/Page/AJAX.php @@ -64,8 +64,7 @@ class CRM_Campaign_Page_AJAX { } } - if (isset($_POST['field']) && - CRM_Utils_Array::value($voterId, $_POST['field']) && + if (isset($_POST['field']) && !empty($_POST['field'][$voterId]) && is_array($_POST['field'][$voterId]) ) { foreach ($_POST['field'][$voterId] as $fieldKey => $value) { diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index f748309dce..ae76dc5b8b 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -927,7 +927,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type $res = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); while ($res->fetch()) { - if (!empty($rows[$res->case_type]) && CRM_Utils_Array::value($res->case_status, $rows[$res->case_type])) { + if (!empty($rows[$res->case_type]) && !empty($rows[$res->case_type][$res->case_status])) { $rows[$res->case_type][$res->case_status]['count'] = $rows[$res->case_type][$res->case_status]['count'] + 1; } else { diff --git a/CRM/Case/BAO/Query.php b/CRM/Case/BAO/Query.php index 2a5ffa0e61..a2a37907e5 100644 --- a/CRM/Case/BAO/Query.php +++ b/CRM/Case/BAO/Query.php @@ -51,9 +51,7 @@ class CRM_Case_BAO_Query { * @access public */ static function select(&$query) { - if (($query->_mode & CRM_Contact_BAO_Query::MODE_CASE) || - CRM_Utils_Array::value('case_id', $query->_returnProperties) - ) { + if (($query->_mode & CRM_Contact_BAO_Query::MODE_CASE) || !empty($query->_returnProperties['case_id'])) { $query->_select['case_id'] = "civicrm_case.id as case_id"; $query->_element['case_id'] = 1; $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1; diff --git a/CRM/Case/Form/Activity/ChangeCaseStatus.php b/CRM/Case/Form/Activity/ChangeCaseStatus.php index e39601b05c..91f10ed184 100644 --- a/CRM/Case/Form/Activity/ChangeCaseStatus.php +++ b/CRM/Case/Form/Activity/ChangeCaseStatus.php @@ -114,9 +114,7 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { $groupingValues = CRM_Core_OptionGroup::values('case_status', FALSE, TRUE, FALSE, NULL, 'value'); // Set case end_date if we're closing the case. Clear end_date if we're (re)opening it. - if (CRM_Utils_Array::value($params['case_status_id'], $groupingValues) == 'Closed' - && CRM_Utils_Array::value('activity_date_time', $params) - ) { + if (CRM_Utils_Array::value($params['case_status_id'], $groupingValues) == 'Closed' && !empty($params['activity_date_time'])) { $params['end_date'] = $params['activity_date_time']; // End case-specific relationships (roles) diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index 6153f2f418..aab99ce3d0 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -207,7 +207,7 @@ class CRM_Case_Form_Activity_OpenCase { } // set the contact, when contact is selected - if (isset($params['contact_select_id']) && CRM_Utils_Array::value(1, $params['contact_select_id'])) { + if (isset($params['contact_select_id']) && !empty($params['contact_select_id'][1])) { $params['contact_id'] = $params['contact_select_id'][1]; $form->_currentlyViewedContactId = $params['contact_id']; } diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index 8acee3dc87..248e19955c 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -488,9 +488,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { $session = CRM_Core_Session::singleton(); $session->pushUserContext($url); - if (!empty($params['timeline_id']) && - CRM_Utils_Array::value('_qf_CaseView_next', $_POST) - ) { + if (!empty($params['timeline_id']) && !empty($_POST['_qf_CaseView_next'])) { $session = CRM_Core_Session::singleton(); $this->_uid = $session->get('userID'); $xmlProcessor = new CRM_Case_XMLProcessor_Process(); diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index da63d1e565..fafe395c9a 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -272,9 +272,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { */ static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) { $contact = NULL; - if (empty($params['contact_type']) && - !CRM_Utils_Array::value('contact_id', $params) - ) { + if (empty($params['contact_type']) && empty($params['contact_id'])) { return $contact; } @@ -1765,9 +1763,7 @@ ORDER BY civicrm_email.is_primary DESC"; $isOptOut = CRM_Utils_Array::value('is_opt_out', $params, FALSE); $data['is_opt_out'] = $isOptOut; // on change, create new civicrm_subscription_history entry - if (($wasOptOut != $isOptOut) && - CRM_Utils_Array::value('contact_id', $contactDetails) - ) { + if (($wasOptOut != $isOptOut) && !empty($contactDetails['contact_id'])) { $shParams = array( 'contact_id' => $contactDetails['contact_id'], 'status' => $isOptOut ? 'Removed' : 'Added', diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index c1d31856ff..6169b97212 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -848,9 +848,7 @@ Group By componentId"; $skipFields = array('is_primary', 'location_type_id', 'is_billing', 'master_id'); foreach ($address as & $values) { // 2. check if master id exists, if not continue - if (empty($values['master_id']) || - !CRM_Utils_Array::value('use_shared_address', $values) - ) { + if (empty($values['master_id']) || empty($values['use_shared_address'])) { // we should unset master id when use uncheck share address for existing address $values['master_id'] = 'null'; continue; diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index dcc59a8b4d..706d991258 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -355,9 +355,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { // form the name only if missing: CRM-627 $nameParam = CRM_Utils_Array::value('name', $params, NULL); - if (!$nameParam && - !CRM_Utils_Array::value('id', $params) - ) { + if (!$nameParam && empty($params['id'])) { $params['name'] = CRM_Utils_String::titleToVar($params['title']); } @@ -709,8 +707,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { $groupList[$id]['class'] = implode(' ', $value['class']); // append parent names if in search mode - if (empty($params['parent_id']) && - CRM_Utils_Array::value( 'parents', $value ) ) { + if (empty($params['parent_id']) && !empty($value['parents'])) { $groupIds = explode(',', $value['parents']); $title = array(); foreach($groupIds as $gId) { diff --git a/CRM/Contact/BAO/GroupOrganization.php b/CRM/Contact/BAO/GroupOrganization.php index db3c0d0b4f..01c0df9cb1 100644 --- a/CRM/Contact/BAO/GroupOrganization.php +++ b/CRM/Contact/BAO/GroupOrganization.php @@ -101,9 +101,7 @@ class CRM_Contact_BAO_GroupOrganization extends CRM_Contact_DAO_GroupOrganizatio */ static function dataExists($params) { // return if no data present - if (!empty($params['organization_id']) && - CRM_Utils_Array::value('group_id', $params) - ) { + if (!empty($params['organization_id']) && !empty($params['group_id'])) { return TRUE; } return FALSE; diff --git a/CRM/Contact/BAO/Individual.php b/CRM/Contact/BAO/Individual.php index 5d13d0c5e5..104b889760 100644 --- a/CRM/Contact/BAO/Individual.php +++ b/CRM/Contact/BAO/Individual.php @@ -101,7 +101,7 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { $value = $individual->$dbName; // the db has name values - if ($value && CRM_Utils_Array::value('preserveDBName', $params)) { + if ($value && !empty($params['preserveDBName'])) { $useDBNames[] = $name; } } @@ -109,12 +109,12 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { foreach (array('prefix', 'suffix') as $name) { $dbName = "{$name}_id"; $value = $individual->$dbName; - if ($value && CRM_Utils_Array::value('preserveDBName', $params)) { + if ($value && !empty($params['preserveDBName'])) { $useDBNames[] = $name; } } - if ($individual->formal_title && CRM_Utils_Array::value('preserveDBName', $params)) { + if ($individual->formal_title && !empty($params['preserveDBName'])) { $useDBNames[] = 'formal_title'; } diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 56c7d8f0ca..69e4a22e4a 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -647,8 +647,7 @@ class CRM_Contact_BAO_Query { } $cfID = CRM_Core_BAO_CustomField::getKeyID($name); - if (!empty($this->_paramLookup[$name]) || - CRM_Utils_Array::value($name, $this->_returnProperties) || + if (!empty($this->_paramLookup[$name]) || !empty($this->_returnProperties[$name]) || $makeException ) { if ($cfID) { @@ -838,9 +837,7 @@ class CRM_Contact_BAO_Query { } } - if ($cfID && - CRM_Utils_Array::value('is_search_range', $field) - ) { + if ($cfID && !empty($field['is_search_range'])) { // this is a custom field with range search enabled, so we better check for two/from values if (!empty($this->_paramLookup[$name . '_from'])) { if (!array_key_exists($cfID, $this->_cfIDs)) { @@ -1833,7 +1830,7 @@ class CRM_Contact_BAO_Query { $grouping = CRM_Utils_Array::value(3, $values); $wildcard = CRM_Utils_Array::value(4, $values); - if (isset($grouping) && !CRM_Utils_Array::value($grouping, $this->_where)) { + if (isset($grouping) && empty($this->_where[$grouping])) { $this->_where[$grouping] = array(); } @@ -2282,27 +2279,21 @@ class CRM_Contact_BAO_Query { $tables = array_merge(array('civicrm_country' => 1), $tables); } - if ((CRM_Utils_Array::value('civicrm_state_province', $tables) || - CRM_Utils_Array::value('civicrm_country', $tables) || + if ((!empty($tables['civicrm_state_province']) || !empty($tables['civicrm_country']) || CRM_Utils_Array::value('civicrm_county', $tables) - ) && - !CRM_Utils_Array::value('civicrm_address', $tables) - ) { + ) && empty($tables['civicrm_address'])) { $tables = array_merge(array('civicrm_address' => 1), $tables ); } // add group_contact table if group table is present - if (!empty($tables['civicrm_group']) && - !CRM_Utils_Array::value('civicrm_group_contact', $tables) - ) { + if (!empty($tables['civicrm_group']) && empty($tables['civicrm_group_contact'])) { $tables['civicrm_group_contact'] = " LEFT JOIN civicrm_group_contact ON civicrm_group_contact.contact_id = contact_a.id AND civicrm_group_contact.status = 'Added'"; } // add group_contact and group table is subscription history is present - if (!empty($tables['civicrm_subscription_history']) && !CRM_Utils_Array::value('civicrm_group', $tables) - ) { + if (!empty($tables['civicrm_subscription_history']) && empty($tables['civicrm_group'])) { $tables = array_merge(array( 'civicrm_group' => 1, 'civicrm_group_contact' => 1, diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 7ec060ba96..68bb10fcd8 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -132,9 +132,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $validContacts = TRUE; //validate contacts in update mode also. - if (!empty($ids['contact']) && - CRM_Utils_Array::value('contactTarget', $ids) - ) { + if (!empty($ids['contact']) && !empty($ids['contactTarget'])) { if (self::checkValidRelationship($params, $ids, $ids['contactTarget'])) { $validContacts = FALSE; $invalid++; @@ -150,7 +148,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { } // do not add to recent items for import, CRM-4399 - if (!(CRM_Utils_Array::value('skipRecentView', $params) || $invalid || $duplicate)) { + if (!(!empty($params['skipRecentView']) || $invalid || $duplicate)) { $url = CRM_Utils_System::url('civicrm/contact/view/rel', "action=view&reset=1&id={$relationship->id}&cid={$relationship->contact_id_a}&context=home" ); diff --git a/CRM/Contact/BAO/RelationshipType.php b/CRM/Contact/BAO/RelationshipType.php index 390a90dd5d..0990657692 100644 --- a/CRM/Contact/BAO/RelationshipType.php +++ b/CRM/Contact/BAO/RelationshipType.php @@ -92,21 +92,21 @@ class CRM_Contact_BAO_RelationshipType extends CRM_Contact_DAO_RelationshipType */ static function add(&$params, &$ids) { //to change name, CRM-3336 - if (empty($params['label_a_b']) && CRM_Utils_Array::value('name_a_b', $params)) { + if (empty($params['label_a_b']) && !empty($params['name_a_b'])) { $params['label_a_b'] = $params['name_a_b']; } - if (empty($params['label_b_a']) && CRM_Utils_Array::value('name_b_a', $params)) { + if (empty($params['label_b_a']) && !empty($params['name_b_a'])) { $params['label_b_a'] = $params['name_b_a']; } // set label to name if it's not set - but *only* for // ADD action. CRM-3336 as part from (CRM-3522) if (empty($ids['relationshipType'])) { - if (empty($params['name_a_b']) && CRM_Utils_Array::value('label_a_b', $params)) { + if (empty($params['name_a_b']) && !empty($params['label_a_b'])) { $params['name_a_b'] = $params['label_a_b']; } - if (empty($params['name_b_a']) && CRM_Utils_Array::value('label_b_a', $params)) { + if (empty($params['name_b_a']) && !empty($params['label_b_a'])) { $params['name_b_a'] = $params['label_b_a']; } } diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php index 3c74e1fd13..1f630b6605 100644 --- a/CRM/Contact/BAO/SavedSearch.php +++ b/CRM/Contact/BAO/SavedSearch.php @@ -169,9 +169,7 @@ class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch { static function contactIDsSQL($id) { $params = self::getSearchParams($id); - if ($params && - CRM_Utils_Array::value('customSearchID', $params) - ) { + if ($params && !empty($params['customSearchID'])) { return CRM_Contact_BAO_SearchCustom::contactIDSQL(NULL, $id); } else { diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index b1b89e79e5..2610fa6376 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -265,9 +265,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { 'address_options' ); $this->_parseStreetAddress = FALSE; - if (!empty($addressOptions['street_address']) && - CRM_Utils_Array::value('street_address_parsing', $addressOptions) - ) { + if (!empty($addressOptions['street_address']) && !empty($addressOptions['street_address_parsing'])) { $this->_parseStreetAddress = TRUE; } $this->set('parseStreetAddress', $this->_parseStreetAddress); @@ -659,9 +657,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $hasPrimary[] = $instance; if (!$primaryID && in_array($name, array( - 'email', 'openid')) && - CRM_Utils_Array::value($name, $blockValues) - ) { + 'email', 'openid')) && !empty($blockValues[$name])) { $primaryID = $blockValues[$name]; } } @@ -671,7 +667,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } } - if ($name == 'openid' && CRM_Utils_Array::value($name, $blockValues)) { + if ($name == 'openid' && !empty($blockValues[$name])) { $oid = new CRM_Core_DAO_OpenID(); $oid->openid = $openIds[$instance] = CRM_Utils_Array::value($name, $blockValues); $cid = isset($contactId) ? $contactId : 0; @@ -895,9 +891,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { CRM_Contact_BAO_Contact::processImageParams($params); } - if (is_numeric(CRM_Utils_Array::value('current_employer_id', $params)) - && CRM_Utils_Array::value('current_employer', $params) - ) { + if (is_numeric(CRM_Utils_Array::value('current_employer_id', $params)) && !empty($params['current_employer'])) { $params['current_employer'] = $params['current_employer_id']; } @@ -918,10 +912,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } //make deceased date null when is_deceased = false - if ($this->_contactType == 'Individual' && - CRM_Utils_Array::value('Demographics', $this->_editOptions) && - !CRM_Utils_Array::value('is_deceased', $params) - ) { + if ($this->_contactType == 'Individual' && !empty($this->_editOptions['Demographics']) && empty($params['is_deceased'])) { $params['is_deceased'] = FALSE; $params['deceased_date'] = NULL; } @@ -980,9 +971,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $contactGroupList = CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], 'Added'); if (is_array($contactGroupList)) { foreach ($contactGroupList as $key) { - if ((!array_key_exists($key['group_id'], $params['group']) || $params['group'][$key['group_id']] != 1) - && !CRM_Utils_Array::value('is_hidden', $key) - ) { + if ((!array_key_exists($key['group_id'], $params['group']) || $params['group'][$key['group_id']] != 1) && empty($key['is_hidden'])) { $params['group'][$key['group_id']] = -1; } } @@ -1273,9 +1262,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $success = TRUE; // consider address is automatically parseable, // when we should found street_number and street_name - if (empty($parsedFields['street_name']) || - !CRM_Utils_Array::value('street_number', $parsedFields) - ) { + if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) { $success = FALSE; } @@ -1379,9 +1366,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { // process to set membership status to deceased for both active/inactive membership if ($contactId && - $this->_contactType == 'Individual' && - CRM_Utils_Array::value('is_deceased', $deceasedParams) - ) { + $this->_contactType == 'Individual' && !empty($deceasedParams['is_deceased'])) { $session = CRM_Core_Session::singleton(); $userId = $session->get('userID'); diff --git a/CRM/Contact/Form/Edit/Address.php b/CRM/Contact/Form/Edit/Address.php index 2f89b7e7a1..d6b47e9503 100644 --- a/CRM/Contact/Form/Edit/Address.php +++ b/CRM/Contact/Form/Edit/Address.php @@ -140,9 +140,7 @@ class CRM_Contact_Form_Edit_Address { if (empty($addressOptions[$nameWithoutID])) { $continue = TRUE; if (in_array($nameWithoutID, array( - 'street_number', 'street_name', 'street_unit')) && - CRM_Utils_Array::value('street_address_parsing', $addressOptions) - ) { + 'street_number', 'street_name', 'street_unit')) && !empty($addressOptions['street_address_parsing'])) { $continue = FALSE; } if ($continue) { @@ -219,7 +217,7 @@ class CRM_Contact_Form_Edit_Address { CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap); $entityId = NULL; - if (!empty($form->_values['address']) && CRM_Utils_Array::value($blockId, $form->_values['address'])) { + if (!empty($form->_values['address']) && !empty($form->_values['address'][$blockId])) { $entityId = $form->_values['address'][$blockId]['id']; } @@ -400,7 +398,7 @@ class CRM_Contact_Form_Edit_Address { } } - if (!empty($addressValues['use_shared_address']) && !CRM_Utils_Array::value('master_id', $addressValues)) { + if (!empty($addressValues['use_shared_address']) && empty($addressValues['master_id'])) { $errors["address[$instance][use_shared_address]"] = ts('Please select valid shared contact or a contact with valid address.'); } } @@ -476,10 +474,8 @@ class CRM_Contact_Form_Edit_Address { // CRM-7296 freeze the select for state if address is shared with household // CRM-9070 freeze the select for state if it is view only - if (isset($form->_fields) && - CRM_Utils_Array::value($stateElementName, $form->_fields) && - (CRM_Utils_Array::value('is_shared', $form->_fields[$stateElementName]) || - CRM_Utils_Array::value('is_view', $form->_fields[$stateElementName])) + if (isset($form->_fields) && !empty($form->_fields[$stateElementName]) && + (!empty($form->_fields[$stateElementName]['is_shared']) || !empty($form->_fields[$stateElementName]['is_view'])) ) { $stateSelect->freeze(); } @@ -563,9 +559,7 @@ class CRM_Contact_Form_Edit_Address { //hack to handle show/hide address fields. $parsedAddress = array(); - if ($form->_contactId && - CRM_Utils_Array::value('address', $_POST) - && is_array($_POST['address']) + if ($form->_contactId && !empty($_POST['address']) && is_array($_POST['address']) ) { foreach ($_POST['address'] as $cnt => $values) { $showField = 'streetAddress'; diff --git a/CRM/Contact/Form/Edit/CommunicationPreferences.php b/CRM/Contact/Form/Edit/CommunicationPreferences.php index aa2bc1952d..8b5880c6e0 100644 --- a/CRM/Contact/Form/Edit/CommunicationPreferences.php +++ b/CRM/Contact/Form/Edit/CommunicationPreferences.php @@ -152,9 +152,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences { $greetings = self::getGreetingFields($self->_contactType); foreach ($greetings as $greeting => $details) { $customizedValue = CRM_Core_OptionGroup::getValue($greeting, 'Customized', 'name'); - if (CRM_Utils_Array::value($details['field'], $fields) == $customizedValue - && !CRM_Utils_Array::value($details['customField'], $fields) - ) { + if (CRM_Utils_Array::value($details['field'], $fields) == $customizedValue && empty($fields[$details['customField']])) { $errors[$details['customField']] = ts('Custom %1 is a required field if %1 is of type Customized.', array(1 => $details['label']) ); diff --git a/CRM/Contact/Form/Edit/CustomData.php b/CRM/Contact/Form/Edit/CustomData.php index 6bbaf902a6..7ccf43f168 100644 --- a/CRM/Contact/Form/Edit/CustomData.php +++ b/CRM/Contact/Form/Edit/CustomData.php @@ -89,9 +89,7 @@ class CRM_Contact_Form_Edit_CustomData { //build custom data. $contactSubType = NULL; - if (!empty($_POST["hidden_custom"]) && - CRM_Utils_Array::value('contact_sub_type', $_POST) - ) { + if (!empty($_POST["hidden_custom"]) && !empty($_POST['contact_sub_type'])) { $contactSubType = $_POST['contact_sub_type']; } else { diff --git a/CRM/Contact/Form/Edit/Individual.php b/CRM/Contact/Form/Edit/Individual.php index 692d8e5d31..2ceac12ca2 100644 --- a/CRM/Contact/Form/Edit/Individual.php +++ b/CRM/Contact/Form/Edit/Individual.php @@ -157,9 +157,7 @@ class CRM_Contact_Form_Edit_Individual { $primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID); // make sure that firstName and lastName or a primary OpenID is set - if (!$primaryID && (!CRM_Utils_Array::value('first_name', $fields) || - !CRM_Utils_Array::value('last_name', $fields) - )) { + if (!$primaryID && (empty($fields['first_name']) || empty($fields['last_name']))) { $errors['_qf_default'] = ts('First Name and Last Name OR an email OR an OpenID in the Primary Location should be set.'); } diff --git a/CRM/Contact/Form/Inline/Address.php b/CRM/Contact/Form/Inline/Address.php index 8f10acdcde..e7f0b3e64d 100644 --- a/CRM/Contact/Form/Inline/Address.php +++ b/CRM/Contact/Form/Inline/Address.php @@ -111,9 +111,7 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline { 'address_options' ); $this->_parseStreetAddress = FALSE; - if (!empty($addressOptions['street_address']) && - CRM_Utils_Array::value('street_address_parsing', $addressOptions) - ) { + if (!empty($addressOptions['street_address']) && !empty($addressOptions['street_address_parsing'])) { $this->_parseStreetAddress = TRUE; } $this->set('parseStreetAddress', $this->_parseStreetAddress); diff --git a/CRM/Contact/Form/Inline/IM.php b/CRM/Contact/Form/Inline/IM.php index 85e5777763..aab720440a 100644 --- a/CRM/Contact/Form/Inline/IM.php +++ b/CRM/Contact/Form/Inline/IM.php @@ -116,8 +116,7 @@ class CRM_Contact_Form_Inline_IM extends CRM_Contact_Form_Inline { $hasData[] = $instance; if (!empty($blockValues['is_primary'])) { $hasPrimary[] = $instance; - if (!$primaryID && - CRM_Utils_Array::value('im', $blockValues)) { + if (!$primaryID && !empty($blockValues['im'])) { $primaryID = $blockValues['im']; } } diff --git a/CRM/Contact/Form/Inline/OpenID.php b/CRM/Contact/Form/Inline/OpenID.php index ca76f95874..327d0ff5d2 100644 --- a/CRM/Contact/Form/Inline/OpenID.php +++ b/CRM/Contact/Form/Inline/OpenID.php @@ -116,8 +116,7 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline { $hasData[] = $instance; if (!empty($blockValues['is_primary'])) { $hasPrimary[] = $instance; - if (!$primaryID && - CRM_Utils_Array::value('openid', $blockValues)) { + if (!$primaryID && !empty($blockValues['openid'])) { $primaryID = $blockValues['openid']; } } diff --git a/CRM/Contact/Form/Inline/Phone.php b/CRM/Contact/Form/Inline/Phone.php index 1122945c8a..91fd56375b 100644 --- a/CRM/Contact/Form/Inline/Phone.php +++ b/CRM/Contact/Form/Inline/Phone.php @@ -117,8 +117,7 @@ class CRM_Contact_Form_Inline_Phone extends CRM_Contact_Form_Inline { $hasData[] = $instance; if (!empty($blockValues['is_primary'])) { $hasPrimary[] = $instance; - if (!$primaryID && - CRM_Utils_Array::value('phone', $blockValues)) { + if (!$primaryID && !empty($blockValues['phone'])) { $primaryID = $blockValues['phone']; } } diff --git a/CRM/Contact/Form/Location.php b/CRM/Contact/Form/Location.php index 3e36941105..c42e370863 100644 --- a/CRM/Contact/Form/Location.php +++ b/CRM/Contact/Form/Location.php @@ -91,7 +91,7 @@ class CRM_Contact_Form_Location { if (!empty($_POST[$name]) && is_array($_POST[$name])) { $instances = array_keys($_POST[$name]); } - elseif (property_exists($form, '_values') && CRM_Utils_Array::value($name, $form->_values) && is_array($form->_values[$name])) { + elseif (property_exists($form, '_values') && !empty($form->_values[$name]) && is_array($form->_values[$name])) { $instances = array_keys($form->_values[$name]); } diff --git a/CRM/Contact/Form/ProfileContact.php b/CRM/Contact/Form/ProfileContact.php index 9249162eba..11e268c542 100644 --- a/CRM/Contact/Form/ProfileContact.php +++ b/CRM/Contact/Form/ProfileContact.php @@ -101,10 +101,7 @@ class CRM_Contact_Form_ProfileContact { // add the form elements foreach ($honoreeProfileFields as $name => $field) { // If soft credit type is not chosen then make omit requiredness from honoree profile fields - if (count($form->_submitValues) && - !CRM_Utils_Array::value('soft_credit_type_id', $form->_submitValues) && - CRM_Utils_Array::value('is_required', $field) - ) { + if (count($form->_submitValues) && empty($form->_submitValues['soft_credit_type_id']) && !empty($field['is_required'])) { $field['is_required'] = FALSE; } CRM_Core_BAO_UFGroup::buildProfile($form, $field, CRM_Profile_Form::MODE_CREATE, NULL, FALSE, FALSE, NULL, $prefix); @@ -114,7 +111,7 @@ class CRM_Contact_Form_ProfileContact { static function postProcess($form) { $params = $form->_params; $values = $form->_values; - if ($form->get('honor_block_is_active') && CRM_Utils_Array::value('soft_credit_type_id', $params)) { + if ($form->get('honor_block_is_active') && !empty($params['soft_credit_type_id'])) { $honorId = null; //check if there is any duplicate contact diff --git a/CRM/Contact/Form/Relationship.php b/CRM/Contact/Form/Relationship.php index 6dddf7a7ca..f4d7bd44ef 100644 --- a/CRM/Contact/Form/Relationship.php +++ b/CRM/Contact/Form/Relationship.php @@ -469,9 +469,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { // store the submitted values in an array $params = $this->controller->exportValues($this->_name); $quickSave = FALSE; - if (!empty($_POST['_qf_Relationship_refresh_save']) || - CRM_Utils_Array::value('_qf_Relationship_refresh_savedetails', $_POST) - ) { + if (!empty($_POST['_qf_Relationship_refresh_save']) || !empty($_POST['_qf_Relationship_refresh_savedetails'])) { $quickSave = TRUE; } @@ -635,9 +633,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { $orgId = $params['employee_of']; } elseif ($this->_action & CRM_Core_Action::UPDATE) { - if (!empty($params['is_current_employer']) && - CRM_Utils_Array::value('is_active', $params) - ) { + if (!empty($params['is_current_employer']) && !empty($params['is_active'])) { if (CRM_Utils_Array::value('contactTarget', $ids) != CRM_Utils_Array::value('current_employer_id', $this->_values) ) { @@ -710,8 +706,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { */ static function formRule($params, $files, $form) { // hack, no error check for refresh - if (!empty($_POST['_qf_Relationship_refresh']) || - CRM_Utils_Array::value('_qf_Relationship_refresh_save', $_POST) || + if (!empty($_POST['_qf_Relationship_refresh']) || !empty($_POST['_qf_Relationship_refresh_save']) || CRM_Utils_Array::value('_qf_Relationship_refresh_savedetails', $_POST) ) { return TRUE; @@ -759,8 +754,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { } } - if (!empty($params['employer_of']) && - CRM_Utils_Array::value('contact_check', $params) && + if (!empty($params['employer_of']) && !empty($params['contact_check']) && array_diff(array_keys($params['employer_of']), array_keys($params['contact_check'])) ) { if ($form->_callAjax) { @@ -787,9 +781,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { $errors = array(); // check start and end date - if (!empty($params['start_date']) && - CRM_Utils_Array::value('end_date', $params) - ) { + if (!empty($params['start_date']) && !empty($params['end_date'])) { $start_date = CRM_Utils_Date::format(CRM_Utils_Array::value('start_date', $params)); $end_date = CRM_Utils_Date::format(CRM_Utils_Array::value('end_date', $params)); if ($start_date && $end_date && (int ) $end_date < (int ) $start_date) { diff --git a/CRM/Contact/Form/Search.php b/CRM/Contact/Form/Search.php index 999aa71772..23981363cc 100644 --- a/CRM/Contact/Form/Search.php +++ b/CRM/Contact/Form/Search.php @@ -851,21 +851,15 @@ class CRM_Contact_Form_Search extends CRM_Core_Form { //get the button name $buttonName = $this->controller->getButtonName(); - if (isset($this->_ufGroupID) && - !CRM_Utils_Array::value('uf_group_id', $this->_formValues) - ) { + if (isset($this->_ufGroupID) && empty($this->_formValues['uf_group_id'])) { $this->_formValues['uf_group_id'] = $this->_ufGroupID; } - if (isset($this->_componentMode) && - !CRM_Utils_Array::value('component_mode', $this->_formValues) - ) { + if (isset($this->_componentMode) && empty($this->_formValues['component_mode'])) { $this->_formValues['component_mode'] = $this->_componentMode; } - if (isset($this->_operator) && - !CRM_Utils_Array::value('operator', $this->_formValues) - ) { + if (isset($this->_operator) && empty($this->_formValues['operator'])) { $this->_formValues['operator'] = $this->_operator; } diff --git a/CRM/Contact/Form/Search/Advanced.php b/CRM/Contact/Form/Search/Advanced.php index a74a9cdfc9..5d77be01b8 100644 --- a/CRM/Contact/Form/Search/Advanced.php +++ b/CRM/Contact/Form/Search/Advanced.php @@ -145,8 +145,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { ); // see if we need to include this paneName in the current form - if ($this->_searchPane == $type || - CRM_Utils_Array::value("hidden_{$type}", $_POST) || + if ($this->_searchPane == $type || !empty($_POST["hidden_{$type}"]) || CRM_Utils_Array::value("hidden_{$type}", $this->_formValues) ) { $allPanes[$name]['open'] = 'true'; @@ -261,7 +260,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); } - if (isset($this->_groupID) && !CRM_Utils_Array::value('group', $this->_formValues)) { + if (isset($this->_groupID) && empty($this->_formValues['group'])) { $this->_formValues['group'] = array($this->_groupID => 1); } diff --git a/CRM/Contact/Form/Search/Basic.php b/CRM/Contact/Form/Search/Basic.php index 46e76dc98f..096ad8e1cc 100644 --- a/CRM/Contact/Form/Search/Basic.php +++ b/CRM/Contact/Form/Search/Basic.php @@ -174,7 +174,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search { $this->normalizeFormValues(); } - if (isset($this->_groupID) && !CRM_Utils_Array::value('group', $this->_formValues)) { + if (isset($this->_groupID) && empty($this->_formValues['group'])) { $this->_formValues['group'][$this->_groupID] = 1; } elseif (isset($this->_ssID) && empty($_POST)) { diff --git a/CRM/Contact/Form/Search/Builder.php b/CRM/Contact/Form/Search/Builder.php index 3159c6d644..b2abeb0586 100644 --- a/CRM/Contact/Form/Search/Builder.php +++ b/CRM/Contact/Form/Search/Builder.php @@ -146,7 +146,7 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { * @access public */ static function formRule($values, $files, $self) { - if (!empty($values['addMore']) || CRM_Utils_Array::value('addBlock', $values)) { + if (!empty($values['addMore']) || !empty($values['addBlock'])) { return TRUE; } $fields = self::fields(); diff --git a/CRM/Contact/Form/Search/Custom/Basic.php b/CRM/Contact/Form/Search/Custom/Basic.php index 80613aa979..0a3a3e5c09 100644 --- a/CRM/Contact/Form/Search/Custom/Basic.php +++ b/CRM/Contact/Form/Search/Custom/Basic.php @@ -62,9 +62,7 @@ class CRM_Contact_Form_Search_Custom_Basic extends CRM_Contact_Form_Search_Custo foreach ($this->_columns as $name => $field) { if (in_array($field, array( - 'street_address', 'city', 'state_province', 'postal_code', 'country')) && - !CRM_Utils_Array::value($field, $addressOptions) - ) { + 'street_address', 'city', 'state_province', 'postal_code', 'country')) && empty($addressOptions[$field])) { unset($this->_columns[$name]); continue; } diff --git a/CRM/Contact/Form/Task/AddToHousehold.php b/CRM/Contact/Form/Task/AddToHousehold.php index 128693830e..84b142605d 100644 --- a/CRM/Contact/Form/Task/AddToHousehold.php +++ b/CRM/Contact/Form/Task/AddToHousehold.php @@ -233,7 +233,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task { } } - if (!$contactTypeAdded && CRM_Utils_Array::value('contact_type', $params)) { + if (!$contactTypeAdded && !empty($params['contact_type'])) { $searchValues[] = array('contact_type', '=', $params['contact_type'], 0, 0); } diff --git a/CRM/Contact/Form/Task/Batch.php b/CRM/Contact/Form/Task/Batch.php index e6d67bcec9..7dae82b1d1 100644 --- a/CRM/Contact/Form/Task/Batch.php +++ b/CRM/Contact/Form/Task/Batch.php @@ -330,9 +330,7 @@ class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task { //street address consider to be parsed properly, //If we get street_name and street_number. - if (empty($parsedFields['street_name']) || - !CRM_Utils_Array::value('street_number', $parsedFields) - ) { + if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) { $parsedFields = array_fill_keys(array_keys($parsedFields), ''); } diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index 484c44a318..232c890535 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -204,7 +204,7 @@ class CRM_Contact_Form_Task_EmailCommon { // perform all validations foreach ($form->_allContactIds as $key => $contactId) { $value = $form->_contactDetails[$contactId]; - if ($value['do_not_email'] || empty($value['email']) || CRM_Utils_Array::value('is_deceased', $value) || $value['on_hold']) { + if ($value['do_not_email'] || empty($value['email']) || !empty($value['is_deceased']) || $value['on_hold']) { $suppressedEmails++; // unset contact details for contacts that we won't be sending email. This is prevent extra computation @@ -381,8 +381,7 @@ class CRM_Contact_Form_Task_EmailCommon { } // process message template - if (!empty($formValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $formValues) - ) { + if (!empty($formValues['saveTemplate']) || !empty($formValues['updateTemplate'])) { $messageTemplate = array( 'msg_text' => $formValues['text_message'], 'msg_html' => $formValues['html_message'], @@ -395,9 +394,7 @@ class CRM_Contact_Form_Task_EmailCommon { CRM_Core_BAO_MessageTemplate::add($messageTemplate); } - if (!empty($formValues['template']) && - CRM_Utils_Array::value('updateTemplate', $formValues) - ) { + if (!empty($formValues['template']) && !empty($formValues['updateTemplate'])) { $messageTemplate['id'] = $formValues['template']; unset($messageTemplate['msg_title']); CRM_Core_BAO_MessageTemplate::add($messageTemplate); diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index 1fd7f30bb4..b9581b2be2 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -258,7 +258,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { // we need to remove all the "_id" unset($contact['contact_id']); - if ($locName && CRM_Utils_Array::value($locName, $contact)) { + if ($locName && !empty($contact[$locName])) { // If location type is not primary, $contact contains // one more array as "$contact[$locName] = array( values... )" diff --git a/CRM/Contact/Form/Task/LabelCommon.php b/CRM/Contact/Form/Task/LabelCommon.php index 33f4d6570a..d85e391cd5 100644 --- a/CRM/Contact/Form/Task/LabelCommon.php +++ b/CRM/Contact/Form/Task/LabelCommon.php @@ -48,7 +48,7 @@ class CRM_Contact_Form_Task_LabelCommon { function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) { foreach (array_merge($mailingFormatProperties, array_fill_keys($tokenFields, 1)) as $key => $dontCare) { //we should not consider addressee for data exists, CRM-6025 - if ($key != 'addressee' && CRM_Utils_Array::value($key, $contact)) { + if ($key != 'addressee' && !empty($contact[$key])) { return TRUE; } } @@ -188,7 +188,7 @@ class CRM_Contact_Form_Task_LabelCommon { // we need to remove all the "_id" unset($contact['contact_id']); - if ($locName && CRM_Utils_Array::value($locName, $contact)) { + if ($locName && !empty($contact[$locName])) { // If location type is not primary, $contact contains // one more array as "$contact[$locName] = array( values... )" diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index 21e049b9eb..df180c918f 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -260,7 +260,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { $formValues = $form->controller->exportValues($form->getName()); // process message template - if (!empty($formValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $formValues)) { + if (!empty($formValues['saveTemplate']) || !empty($formValues['updateTemplate'])) { $messageTemplate = array( 'msg_text' => NULL, 'msg_html' => $formValues['html_message'], diff --git a/CRM/Contact/Form/Task/ProximityCommon.php b/CRM/Contact/Form/Task/ProximityCommon.php index ce4483a9ec..c249fe62fc 100644 --- a/CRM/Contact/Form/Task/ProximityCommon.php +++ b/CRM/Contact/Form/Task/ProximityCommon.php @@ -134,9 +134,7 @@ class CRM_Contact_Form_Task_ProximityCommon extends CRM_Contact_Form_Task { $errors = array(); // If Distance is present, make sure state, country and city or postal code are populated. if (!empty($fields['prox_distance'])) { - if (empty($fields['prox_state_province_id']) || - !CRM_Utils_Array::value('prox_country_id', $fields) - ) { + if (empty($fields['prox_state_province_id']) || empty($fields['prox_country_id'])) { $errors["prox_state_province_id"] = ts("Country AND State/Province are required to search by distance."); } if (!CRM_Utils_Array::value('prox_postal_code', $fields) AND diff --git a/CRM/Contact/Form/Task/SMSCommon.php b/CRM/Contact/Form/Task/SMSCommon.php index 3ea82538e3..d3f762eb30 100644 --- a/CRM/Contact/Form/Task/SMSCommon.php +++ b/CRM/Contact/Form/Task/SMSCommon.php @@ -208,13 +208,11 @@ class CRM_Contact_Form_Task_SMSCommon { } } - if ((isset($value['phone_type_id']) && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes)) || $value['do_not_sms'] || empty($value['phone']) || CRM_Utils_Array::value('is_deceased', $value)) { + if ((isset($value['phone_type_id']) && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes)) || $value['do_not_sms'] || empty($value['phone']) || !empty($value['is_deceased'])) { //if phone is not primary check if non-primary phone is "Mobile" if (!empty($value['phone']) - && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes) - && !CRM_Utils_Array::value('is_deceased', $value) - ) { + && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes) && empty($value['is_deceased'])) { $filter = array('do_not_sms' => 0); $contactPhones = CRM_Core_BAO_Phone::allPhones($contactId, FALSE, 'Mobile', $filter); if (count($contactPhones) > 0) { @@ -350,8 +348,7 @@ class CRM_Contact_Form_Task_SMSCommon { $fromSmsProviderId = $thisValues['sms_provider_id']; // process message template - if (!empty($thisValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $thisValues) - ) { + if (!empty($thisValues['saveTemplate']) || !empty($thisValues['updateTemplate'])) { $messageTemplate = array( 'msg_text' => $thisValues['text_message'], 'is_active' => TRUE, @@ -362,9 +359,7 @@ class CRM_Contact_Form_Task_SMSCommon { CRM_Core_BAO_MessageTemplate::add($messageTemplate); } - if (!empty($thisValues['template']) && - CRM_Utils_Array::value('updateTemplate', $thisValues) - ) { + if (!empty($thisValues['template']) && !empty($thisValues['updateTemplate'])) { $messageTemplate['id'] = $thisValues['template']; unset($messageTemplate['msg_title']); CRM_Core_BAO_MessageTemplate::add($messageTemplate); diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 7f5c8d1e4f..3e1b675fb9 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -343,8 +343,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { //Modified the Relationship fields if the fields are //present in dedupe rule - if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK && - CRM_Utils_Array::value($cType, $this->_dedupeFields) && + if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK && !empty($this->_dedupeFields[$cType]) && is_array($this->_dedupeFields[$cType]) ) { static $cTypeArray = array(); diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 36af9e51b5..0f3bc84976 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -284,11 +284,11 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { switch ($this->_contactType) { case 'Individual': $missingNames = array(); - if ($this->_firstNameIndex < 0 || !CRM_Utils_Array::value($this->_firstNameIndex, $values)) { + if ($this->_firstNameIndex < 0 || empty($values[$this->_firstNameIndex])) { $errorRequired = TRUE; $missingNames[] = ts('First Name'); } - if ($this->_lastNameIndex < 0 || !CRM_Utils_Array::value($this->_lastNameIndex, $values)) { + if ($this->_lastNameIndex < 0 || empty($values[$this->_lastNameIndex])) { $errorRequired = TRUE; $missingNames[] = ts('Last Name'); } @@ -299,14 +299,14 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { break; case 'Household': - if ($this->_householdNameIndex < 0 || !CRM_Utils_Array::value($this->_householdNameIndex, $values)) { + if ($this->_householdNameIndex < 0 || empty($values[$this->_householdNameIndex])) { $errorRequired = TRUE; $errorMessage = ts('Missing required fields:') . ' ' . ts('Household Name'); } break; case 'Organization': - if ($this->_organizationNameIndex < 0 || !CRM_Utils_Array::value($this->_organizationNameIndex, $values)) { + if ($this->_organizationNameIndex < 0 || empty($values[$this->_organizationNameIndex])) { $errorRequired = TRUE; $errorMessage = ts('Missing required fields:') . ' ' . ts('Organization Name'); } @@ -319,7 +319,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { /* If we don't have the required fields, bail */ if ($this->_contactType == 'Individual' && !$this->_updateWithId) { - if ($errorRequired && !CRM_Utils_Array::value($this->_emailIndex, $values)) { + if ($errorRequired && empty($values[$this->_emailIndex])) { if ($errorMessage) { $errorMessage .= ' ' . ts('OR') . ' ' . ts('Email Address'); } @@ -478,7 +478,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } //check if external identifier exists in database - if (!empty($params['external_identifier']) && (CRM_Utils_Array::value('id', $params) || in_array($onDuplicate, array( + if (!empty($params['external_identifier']) && (!empty($params['id']) || in_array($onDuplicate, array( CRM_Import_Parser::DUPLICATE_SKIP, CRM_Import_Parser::DUPLICATE_NOCHECK, )))) { @@ -515,7 +515,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { //get contact id to format common data in update/fill mode, //if external identifier is present, CRM-4423 - if ($this->_updateWithId && !CRM_Utils_Array::value('id', $params) && CRM_Utils_Array::value('external_identifier', $params)) { + if ($this->_updateWithId && empty($params['id']) && !empty($params['external_identifier'])) { if ($cid = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['external_identifier'], 'id', 'external_identifier')) { $formatted['id'] = $cid; } @@ -529,7 +529,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { // Support Match and Update Via Contact ID if ($this->_updateWithId) { $createNewContact = FALSE; - if (empty($params['id']) && CRM_Utils_Array::value('external_identifier', $params)) { + if (empty($params['id']) && !empty($params['external_identifier'])) { if ($cid) { $params['id'] = $cid; } @@ -788,7 +788,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { if (in_array($onDuplicate, array( CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::DUPLICATE_FILL, - )) && CRM_Utils_Array::value('id', $params[$key])) { + )) && !empty($params[$key]['id'])) { $relatedContactType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$key]['id'], 'contact_type'); if (!$relatedContactType) { $errorMessage = ts("No contact found for this related contact ID: %1", array(1 => $params[$key]['id'])); @@ -1683,7 +1683,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { //get the id of the contact whose street address is not parsable, CRM-5886 if ($this->_parseStreetAddress && is_object($newContact) && property_exists($newContact, 'address') && $newContact->address) { foreach ($newContact->address as $address) { - if (!empty($address['street_address']) && (!CRM_Utils_Array::value('street_number', $address) || !CRM_Utils_Array::value('street_name', $address))) { + if (!empty($address['street_address']) && (empty($address['street_number']) || empty($address['street_name']))) { $this->_unparsedStreetAddressContacts[] = array( 'id' => $newContact->id, 'streetAddress' => $address['street_address'], @@ -1957,7 +1957,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { case 'AdvMulti-Select': case 'Multi-Select': - if (!empty($formatted[$key]) && CRM_Utils_Array::value( $key, $params ) ) { + if (!empty($formatted[$key]) && !empty($params[$key])) { $mulValues = explode( ',', $formatted[$key] ); $customOption = CRM_Core_BAO_CustomOption::getCustomOption( $customFieldID, true ); $formatted[$key] = array( ); @@ -2009,7 +2009,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { //street address consider to be parsed properly, //If we get street_name and street_number. - if (empty($parsedFields['street_name']) || !CRM_Utils_Array::value('street_number', $parsedFields)) { + if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) { $parsedFields = array_fill_keys(array_keys($parsedFields), ''); } diff --git a/CRM/Contact/Page/Inline/ContactInfo.php b/CRM/Contact/Page/Inline/ContactInfo.php index bd91099d15..d84079dcac 100644 --- a/CRM/Contact/Page/Inline/ContactInfo.php +++ b/CRM/Contact/Page/Inline/ContactInfo.php @@ -59,8 +59,7 @@ class CRM_Contact_Page_Inline_ContactInfo extends CRM_Core_Page { //get the current employer name if (CRM_Utils_Array::value('contact_type', $defaults) == 'Individual') { - if (!empty($defaults['employer_id']) && - CRM_Utils_Array::value('organization_name', $defaults)) { + if (!empty($defaults['employer_id']) && !empty($defaults['organization_name'])) { $defaults['current_employer'] = $defaults['organization_name']; $defaults['current_employer_id'] = $defaults['employer_id']; } diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index 2832c8f47d..dc47daaf22 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -365,7 +365,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { ); foreach ($rest as $k => $v) { - if ($accessCiviCRM && CRM_Utils_Array::value($k, $this->_viewOptions)) { + if ($accessCiviCRM && !empty($this->_viewOptions[$k])) { $allTabs[] = $v + array( 'id' => $k, 'url' => CRM_Utils_System::url( diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index c9bf383854..a3b8ad63aa 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -759,8 +759,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se ); } elseif ((is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) || - ($config->mapGeoCoding && - CRM_Utils_Array::value('city', $row) && + ($config->mapGeoCoding && !empty($row['city']) && CRM_Utils_Array::value('state_province', $row) ) ) { @@ -902,8 +901,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se ); } elseif ((is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) || - ($config->mapGeoCoding && - CRM_Utils_Array::value('city', $row) && + ($config->mapGeoCoding && !empty($row['city']) && CRM_Utils_Array::value('state_province', $row) ) ) { diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 1201e6d9ea..00d803d042 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -126,7 +126,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { } // CRM-13420, set payment instrument to default if payment_instrument_id is empty - if (!$contributionID && !CRM_Utils_Array::value('payment_instrument_id', $params)) { + if (!$contributionID && empty($params['payment_instrument_id'])) { $params['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')); } @@ -140,7 +140,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { // contribution status is missing, choose Completed as default status // do this for create mode only - if (empty($ids['contribution']) && !CRM_Utils_Array::value('contribution_status_id', $params)) { + if (empty($ids['contribution']) && empty($params['contribution_status_id'])) { $params['contribution_status_id'] = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name'); } @@ -1322,11 +1322,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ } // do check for required ids. - if (empty($componentDetails['membership']) && - !CRM_Utils_Array::value('participant', $componentDetails) && - !CRM_Utils_Array::value('pledge_payment', $componentDetails) || - !CRM_Utils_Array::value('contact_id', $componentDetails) - ) { + if (empty($componentDetails['membership']) && empty($componentDetails['participant']) && empty($componentDetails['pledge_payment']) || empty($componentDetails['contact_id'])) { return $updateResult; } @@ -2537,7 +2533,7 @@ WHERE contribution_id = %1 "; } $totalAmount = CRM_Utils_Array::value('total_amount', $params); - if (!isset($totalAmount) && CRM_Utils_Array::value('prevContribution', $params)) { + if (!isset($totalAmount) && !empty($params['prevContribution'])) { $totalAmount = $params['total_amount'] = $params['prevContribution']->total_amount; } @@ -2690,8 +2686,7 @@ WHERE contribution_id = %1 "; } // when a fee is charged - if (!empty($params['fee_amount']) && (!CRM_Utils_Array::value('prevContribution', $params) - || $params['contribution']->fee_amount != $params['prevContribution']->fee_amount) && $skipRecords) { + if (!empty($params['fee_amount']) && (empty($params['prevContribution']) || $params['contribution']->fee_amount != $params['prevContribution']->fee_amount) && $skipRecords) { CRM_Core_BAO_FinancialTrxn::recordFees($params); } @@ -2866,7 +2861,7 @@ WHERE contribution_id = %1 "; * @static */ static function checkStatusValidation($values, &$fields, &$errors) { - if (CRM_Utils_System::isNull($values) && CRM_Utils_Array::value('id', $fields)) { + if (CRM_Utils_System::isNull($values) && !empty($fields['id'])) { $values['contribution_status_id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $fields['id'], 'contribution_status_id'); if ($values['contribution_status_id'] == $fields['contribution_status_id']) { return FALSE; diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 536105ba50..bfeaa0138d 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -605,7 +605,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = contrib.contact_id ) $params['address'][1][$mapper['location'][$field]] = $info['VALUE']; } elseif (!empty($mapper['contact'][$field])) { - if ($newOrder && CRM_Utils_Array::value('structured-name', $newOrder['buyer-billing-address'])) { + if ($newOrder && !empty($newOrder['buyer-billing-address']['structured-name'])) { foreach ($newOrder['buyer-billing-address']['structured-name'] as $namePart => $nameValue) { $params[$mapper['contact'][$namePart]] = $nameValue['VALUE']; } diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 6f66c4c610..605bd3a30c 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -55,8 +55,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $dao = new CRM_Contribute_DAO_ContributionPage(); $dao->copyValues($params); $dao->save(); - if ($financialTypeId && CRM_Utils_Array::value('financial_type_id', $params) - && $financialTypeId != $params['financial_type_id']) { + if ($financialTypeId && !empty($params['financial_type_id']) && $financialTypeId != $params['financial_type_id']) { CRM_Price_BAO_PriceFieldValue::updateFinancialType($params['id'], 'civicrm_contribution_page', $params['financial_type_id']); } return $dao; @@ -119,7 +118,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $email = NULL; if (isset($values['custom_pre_id'])) { $preProfileType = CRM_Core_BAO_UFField::getProfileType($values['custom_pre_id']); - if ($preProfileType == 'Membership' && CRM_Utils_Array::value('membership_id', $values)) { + if ($preProfileType == 'Membership' && !empty($values['membership_id'])) { $params['custom_pre_id'] = array( array( 'member_id', @@ -130,7 +129,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio ), ); } - elseif ($preProfileType == 'Contribution' && CRM_Utils_Array::value('contribution_id', $values)) { + elseif ($preProfileType == 'Contribution' && !empty($values['contribution_id'])) { $params['custom_pre_id'] = array( array( 'contribution_id', @@ -147,7 +146,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio if (isset($values['custom_post_id'])) { $postProfileType = CRM_Core_BAO_UFField::getProfileType($values['custom_post_id']); - if ($postProfileType == 'Membership' && CRM_Utils_Array::value('membership_id', $values)) { + if ($postProfileType == 'Membership' && !empty($values['membership_id'])) { $params['custom_post_id'] = array( array( 'member_id', @@ -158,7 +157,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio ), ); } - elseif ($postProfileType == 'Contribution' && CRM_Utils_Array::value('contribution_id', $values)) { + elseif ($postProfileType == 'Contribution' && !empty($values['contribution_id'])) { $params['custom_post_id'] = array( array( 'contribution_id', @@ -232,8 +231,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio } } - if (!empty($values['is_email_receipt']) || - CRM_Utils_Array::value('onbehalf_dupe_alert', $values) || + if (!empty($values['is_email_receipt']) || !empty($values['onbehalf_dupe_alert']) || $returnMessageText ) { $template = CRM_Core_Smarty::singleton(); diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index b536430b4d..20e6bc8039 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -864,8 +864,7 @@ class CRM_Contribute_BAO_Query { $tables = array_merge(array('civicrm_contribution' => 1), $tables); } - if (!empty($tables['civicrm_contribution_product']) && - !CRM_Utils_Array::value('civicrm_product', $tables)) { + if (!empty($tables['civicrm_contribution_product']) && empty($tables['civicrm_product'])) { $tables['civicrm_product'] = 1; } } diff --git a/CRM/Contribute/Form.php b/CRM/Contribute/Form.php index 60c7a7d9e2..4cf363715a 100644 --- a/CRM/Contribute/Form.php +++ b/CRM/Contribute/Form.php @@ -77,7 +77,7 @@ class CRM_Contribute_Form extends CRM_Core_Form { $baoName::retrieve($params, $defaults); } } - if ($this->_action == CRM_Core_Action::DELETE && CRM_Utils_Array::value('name', $defaults)) { + if ($this->_action == CRM_Core_Action::DELETE && !empty($defaults['name'])) { $this->assign('delName', $defaults['name']); } elseif ($this->_action == CRM_Core_Action::ADD) { @@ -88,7 +88,7 @@ class CRM_Contribute_Form extends CRM_Core_Form { } elseif ($this->_action & CRM_Core_Action::UPDATE) { - if (!empty($defaults['contact_id']) || CRM_Utils_Array::value('created_id', $defaults)) { + if (!empty($defaults['contact_id']) || !empty($defaults['created_id'])) { $contactID = !empty($defaults['created_id']) ? $defaults['created_id'] : $defaults['contact_id']; $this->assign('created_id', $contactID); $this->assign('organisationId', $contactID); diff --git a/CRM/Contribute/Form/AdditionalInfo.php b/CRM/Contribute/Form/AdditionalInfo.php index 713f870662..f6623f3420 100644 --- a/CRM/Contribute/Form/AdditionalInfo.php +++ b/CRM/Contribute/Form/AdditionalInfo.php @@ -376,11 +376,8 @@ class CRM_Contribute_Form_AdditionalInfo { $params['product_name'] = $productDAO->name; $params['product_sku'] = $productDAO->sku; - if (empty($params['product_option']) && - CRM_Utils_Array::value($params['product_name'][0], - $form->_options - ) - ) { + if (empty($params['product_option']) && !empty($form->_options +[$params['product_name'][0]])) { $params['product_option'] = $form->_options[$params['product_name'][0]][$params['product_name'][1]]; } } diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 20b5545531..b37a5bacaa 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -163,8 +163,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $showAdditionalInfo = FALSE; foreach ($ccPane as $name => $type) { - if ($this->_formType == $type || - CRM_Utils_Array::value("hidden_{$type}", $_POST) || + if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) || CRM_Utils_Array::value("hidden_{$type}", $defaults) ) { $showAdditionalInfo = TRUE; @@ -324,7 +323,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $result = CRM_Contribute_BAO_Contribution::recordAdditionPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId); // email sending - if (!empty($result) && CRM_Utils_Array::value('is_email_receipt', $submittedValues)) { + if (!empty($result) && !empty($submittedValues['is_email_receipt'])) { $submittedValues['contact_id'] = $this->_contactId; $submittedValues['contribution_id'] = $this->_contributionId; @@ -376,7 +375,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $fields = array(); // we need to retrieve email address - if ($this->_context == 'standalone' && CRM_Utils_Array::value('is_email_receipt', $submittedValues)) { + if ($this->_context == 'standalone' && !empty($submittedValues['is_email_receipt'])) { list($this->userDisplayName, $this->userEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId); @@ -521,9 +520,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract // process the additional payment $trxnRecord = CRM_Contribute_BAO_Contribution::recordAdditionPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId); - if ($trxnRecord->id && - CRM_Utils_Array::value('is_email_receipt', $this->_params) - ) { + if ($trxnRecord->id && !empty($this->_params['is_email_receipt'])) { $sendReceipt = self::emailReceipt($this, $this->_params); } diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 91cc25c756..4db4bdea08 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -388,7 +388,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } } - if (!$this->_id && !CRM_Utils_Array::value('receive_date', $defaults)) { + if (!$this->_id && empty($defaults['receive_date'])) { list($defaults['receive_date'], $defaults['receive_date_time'] ) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime'); @@ -405,7 +405,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->assign('totalAmount', CRM_Utils_Array::value('total_amount', $defaults)); //inherit campaign from pledge. - if ($this->_ppID && CRM_Utils_Array::value('campaign_id', $this->_pledgeValues)) { + if ($this->_ppID && !empty($this->_pledgeValues['campaign_id'])) { $defaults['campaign_id'] = $this->_pledgeValues['campaign_id']; } @@ -428,7 +428,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // build price set form. $buildPriceSet = FALSE; if (empty($this->_lineItems) && - ($this->_priceSetId || CRM_Utils_Array::value('price_set_id', $_POST)) + ($this->_priceSetId || !empty($_POST['price_set_id'])) ) { $buildPriceSet = TRUE; $getOnlyPriceSetElements = TRUE; @@ -525,8 +525,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP ); // see if we need to include this paneName in the current form - if ($this->_formType == $type || - CRM_Utils_Array::value("hidden_{$type}", $_POST) || + if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) || CRM_Utils_Array::value("hidden_{$type}", $defaults) ) { $showAdditionalInfo = TRUE; @@ -864,7 +863,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $softErrors = CRM_Contribute_Form_SoftCredit::formRule($fields, $errors, $self); - if (!empty($fields['total_amount']) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) { + if (!empty($fields['total_amount']) && (!empty($fields['net_amount']) || !empty($fields['fee_amount']))) { $sum = CRM_Utils_Rule::cleanMoney($fields['net_amount']) + CRM_Utils_Rule::cleanMoney($fields['fee_amount']); if (CRM_Utils_Rule::cleanMoney($fields['total_amount']) != $sum) { $errors['total_amount'] = ts('The sum of fee amount and net amount must be equal to total amount'); @@ -950,7 +949,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP //CRM-10964 $pId = ($this->_compId && $this->_context == 'participant') ? $this->_compId : CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'participant_id', 'contribution_id'); } - if (!$priceSetId && CRM_Utils_Array::value('total_amount', $submittedValues) && $this->_id) { + if (!$priceSetId && !empty($submittedValues['total_amount']) && $this->_id) { // 10117 update th line items for participants if ($pId) { $entityTable = 'participant'; @@ -975,7 +974,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } $itemId = key($lineItems); $fieldType = NULL; - if ($itemId && CRM_Utils_Array::value('price_field_id', $lineItems[$itemId])) { + if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) { $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type'); } $lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues)); @@ -992,8 +991,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP //CRM-11529 for quick config backoffice transactions //when financial_type_id is passed in form, update the //lineitems with the financial type selected in form - if ($isQuickConfig && CRM_Utils_Array::value('financial_type_id', $submittedValues) - && CRM_Utils_Array::value($this->_priceSetId, $lineItem) + if ($isQuickConfig && !empty($submittedValues['financial_type_id']) && CRM_Utils_Array::value($this->_priceSetId, $lineItem) ) { foreach ($lineItem[$this->_priceSetId] as &$values) { $values['financial_type_id'] = $submittedValues['financial_type_id']; @@ -1198,7 +1196,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } //send receipt mail. - if ($contribution->id && CRM_Utils_Array::value('is_email_receipt', $formValues)) { + if ($contribution->id && !empty($formValues['is_email_receipt'])) { $formValues['contact_id'] = $this->_contactID; $formValues['contribution_id'] = $contribution->id; @@ -1333,7 +1331,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $fields = array(); // we need to retrieve email address - if ($this->_context == 'standalone' && CRM_Utils_Array::value('is_email_receipt', $submittedValues)) { + if ($this->_context == 'standalone' && !empty($submittedValues['is_email_receipt'])) { list($this->userDisplayName, $this->userEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); @@ -1558,9 +1556,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } //send receipt mail. - if ($contribution->id && - CRM_Utils_Array::value('is_email_receipt', $this->_params) - ) { + if ($contribution->id && !empty($this->_params['is_email_receipt'])) { $this->_params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result); $this->_params['contact_id'] = $this->_contactID; $this->_params['contribution_id'] = $contribution->id; diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index b2c78593a5..e58ecbe7be 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -168,11 +168,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->_params["price_{$priceField->id}"], 'membership_type_id'); } } // if seperate payment we set contribution amount to be null, so that it will not show contribution amount same as membership amount. - elseif ((CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock)) - && CRM_Utils_Array::value($priceField->id, $this->_values['fee']) - && ($this->_values['fee'][$priceField->id]['name'] == "other_amount") - && CRM_Utils_Array::value("price_{$contriPriceId}", $this->_params) < 1 - && !CRM_Utils_Array::value("price_{$priceField->id}", $this->_params)) { + elseif ((CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock)) && !empty($this->_values['fee'][$priceField->id]) && ($this->_values['fee'][$priceField->id]['name'] == "other_amount") + && CRM_Utils_Array::value("price_{$contriPriceId}", $this->_params) < 1 && empty($this->_params["price_{$priceField->id}"])) { $this->_params['amount'] = null; } } @@ -188,9 +185,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } // if onbehalf-of-organization if (!empty($this->_params['hidden_onbehalf_profile'])) { - if (!empty($this->_params['org_option']) && - CRM_Utils_Array::value('organization_id', $this->_params) - ) { + if (!empty($this->_params['org_option']) && !empty($this->_params['organization_id'])) { if (!empty($this->_params['onbehalfof_id'])) { $this->_params['organization_id'] = $this->_params['onbehalfof_id']; } @@ -322,14 +317,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } // if auto renew checkbox is set, initiate a open-ended recurring membership - if ((CRM_Utils_Array::value('selectMembership', $this->_params) || - CRM_Utils_Array::value('priceSetId', $this->_params) - ) && - CRM_Utils_Array::value('is_recur', $this->_paymentProcessor) && - CRM_Utils_Array::value('auto_renew', $this->_params) && - !CRM_Utils_Array::value('is_recur', $this->_params) && - !CRM_Utils_Array::value('frequency_interval', $this->_params) - ) { + if ((!empty($this->_params['selectMembership']) || !empty($this->_params['priceSetId'])) && !empty($this->_paymentProcessor['is_recur']) && + CRM_Utils_Array::value('auto_renew', $this->_params) && empty($this->_params['is_recur']) && empty($this->_params['frequency_interval'])) { $this->_params['is_recur'] = $this->_values['is_recur'] = 1; // check if price set is not quick config @@ -376,7 +365,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $params = $this->_params; $honor_block_is_active = $this->get('honor_block_is_active'); // make sure we have values for it - if ($honor_block_is_active && CRM_Utils_Array::value('soft_credit_type_id', $params)) { + if ($honor_block_is_active && !empty($params['soft_credit_type_id'])) { $honorName = null; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); @@ -544,9 +533,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $defaults["{$name}_id"] = $contact["{$name}_id"]; } } - elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) - && CRM_Utils_Array::value($name . '_custom', $contact) - ) { + elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && !empty($contact[$name . '_custom'])) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } } @@ -845,7 +832,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // store the fact that this is a membership and membership type is selected $processMembership = FALSE; - if ((CRM_Utils_Array::value('selectMembership', $membershipParams) && + if ((!empty($membershipParams['selectMembership']) && $membershipParams['selectMembership'] != 'no_thanks' ) || $this->_useForMember @@ -882,8 +869,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } if (!empty($membershipParams['onbehalf']) && - is_array($membershipParams['onbehalf']) && - CRM_Utils_Array::value('member_campaign_id', $membershipParams['onbehalf'])) { + is_array($membershipParams['onbehalf']) && !empty($membershipParams['onbehalf']['member_campaign_id'])) { $this->_params['campaign_id'] = $membershipParams['onbehalf']['member_campaign_id']; } @@ -1083,7 +1069,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } CRM_Contribute_BAO_Contribution::addPremium($params); - if ($productDAO->cost && CRM_Utils_Array::value('financial_type_id', $params)) { + if ($productDAO->cost && !empty($params['financial_type_id'])) { $trxnParams = array( 'cost' => $productDAO->cost, 'currency' => $productDAO->currency, @@ -1222,7 +1208,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], 'source' => - (!$online || CRM_Utils_Array::value('source', $params)) ? + (!$online || !empty($params['source'])) ? CRM_Utils_Array::value('source', $params) : CRM_Utils_Array::value('description', $params), 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), @@ -1290,10 +1276,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr //create an contribution address if ( - $form->_contributeMode != 'notify' && - !CRM_Utils_Array::value('is_pay_later', $params) && - CRM_Utils_Array::value('is_monetary', $form->_values) - ) { + $form->_contributeMode != 'notify' && empty($params['is_pay_later']) && !empty($form->_values['is_monetary'])) { $contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID); } @@ -1302,9 +1285,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $contribParams['total_amount'] = trim(CRM_Utils_Money::format($contribParams['total_amount'], ' ')); // Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin. - if (!empty($params['pcp_made_through_id']) || - CRM_Utils_Array::value('soft_credit_to', $params) - ) { + if (!empty($params['pcp_made_through_id']) || !empty($params['soft_credit_to'])) { // if its due to pcp if (!empty($params['pcp_made_through_id'])) { $contribSoftContactId = CRM_Core_DAO::getFieldValue( @@ -1339,11 +1320,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution); //handle pledge stuff. - if (empty($form->_params['separate_membership_payment']) && - CRM_Utils_Array::value('pledge_block_id', $form->_values) && - (CRM_Utils_Array::value('is_pledge', $form->_params) || - CRM_Utils_Array::value('pledge_id', $form->_values) - ) + if (empty($form->_params['separate_membership_payment']) && !empty($form->_values['pledge_block_id']) && + (!empty($form->_params['is_pledge']) || !empty($form->_values['pledge_id'])) ) { if (!empty($form->_values['pledge_id'])) { @@ -1494,9 +1472,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // or the user has not chosen the recurring option //this is online case validation. - if ((!CRM_Utils_Array::value('is_recur', $form->_values) && $online) || - !CRM_Utils_Array::value('is_recur', $params) - ) { + if ((empty($form->_values['is_recur']) && $online) || empty($params['is_recur'])) { return NULL; } @@ -1577,9 +1553,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) { $isCurrentEmployer = FALSE; $orgID = NULL; - if (!empty($behalfOrganization['organization_id']) && - CRM_Utils_Array::value('org_option', $behalfOrganization) - ) { + if (!empty($behalfOrganization['organization_id']) && !empty($behalfOrganization['org_option'])) { $orgID = $behalfOrganization['organization_id']; unset($behalfOrganization['organization_id']); $isCurrentEmployer = TRUE; @@ -1718,9 +1692,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr static function processPcp(&$page, $params) { $params['pcp_made_through_id'] = $page->_pcpId; $page->assign('pcpBlock', TRUE); - if (!empty($params['pcp_display_in_roll']) && - !CRM_Utils_Array::value('pcp_roll_nickname', $params) - ) { + if (!empty($params['pcp_display_in_roll']) && empty($params['pcp_roll_nickname'])) { $params['pcp_roll_nickname'] = ts('Anonymous'); $params['pcp_is_anonymous'] = 1; } diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index ac9ba33cf1..cd6b62b91b 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -471,8 +471,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->set('priceSetId', $this->_priceSetId); CRM_Price_BAO_PriceSet::buildPriceSet($this); if ($this->_values['is_monetary'] && - $this->_values['is_recur'] && !CRM_Utils_Array::value('pledge_id', $this->_values) - ) { + $this->_values['is_recur'] && empty($this->_values['pledge_id'])) { self::buildRecur($this); } } @@ -509,9 +508,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu //don't build pledge block when mid is passed if (!$this->_mid) { $config = CRM_Core_Config::singleton(); - if (in_array('CiviPledge', $config->enableComponents) - && CRM_Utils_Array::value('pledge_block_id', $this->_values) - ) { + if (in_array('CiviPledge', $config->enableComponents) && !empty($this->_values['pledge_block_id'])) { CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this); } } @@ -720,10 +717,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $errors = array(); $amount = self::computeAmount($fields, $self); - if ((CRM_Utils_Array::value('selectMembership', $fields) && + if ((!empty($fields['selectMembership']) && $fields['selectMembership'] != 'no_thanks' ) || - (CRM_Utils_Array::value('priceSetId', $fields) && + (!empty($fields['priceSetId']) && $self->_useForMember ) ) { @@ -756,7 +753,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } if ($priceField->name == 'other_amount') { - if ($self->_quickConfig && !CRM_Utils_Array::value("price_{$priceField->id}", $fields) && + if ($self->_quickConfig && empty($fields["price_{$priceField->id}"]) && array_key_exists("price_{$previousId}", $fields) && isset($fields["price_{$previousId}"]) && $self->_values['fee'][$previousId]['name'] == 'contribution_amount' && empty($fields["price_{$previousId}"])) { $otherAmount = $priceField->id; } @@ -805,8 +802,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } // $membershipFieldId is set and additional amount is 'No thank you' or NULL then throw error - if ($membershipFieldId && !(CRM_Utils_Array::value('price_' . $contributionFieldId, $fields, -1) > 0) - && !CRM_Utils_Array::value('price_' . $otherFieldId, $fields)) { + if ($membershipFieldId && !(CRM_Utils_Array::value('price_' . $contributionFieldId, $fields, -1) > 0) && empty($fields['price_' . $otherFieldId])) { $errors["price_{$errorKey}"] = ts('Additional Contribution is required.'); } } @@ -827,7 +823,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $priceFieldMemTypes = array(); foreach ($self->_priceSet['fields'] as $priceId => $value) { - if (!empty($fields['price_' . $priceId]) || ($self->_quickConfig && $value['name'] == 'membership_amount' && !CRM_Utils_Array::value('is_required', $self->_membershipBlock))) { + if (!empty($fields['price_' . $priceId]) || ($self->_quickConfig && $value['name'] == 'membership_amount' && empty($self->_membershipBlock['is_required']))) { if (!empty($fields['price_' . $priceId]) && is_array($fields['price_' . $priceId])) { foreach ($fields['price_' . $priceId] as $priceFldVal => $isSet) { if ($isSet) { @@ -835,7 +831,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } } - elseif (!$value['is_enter_qty'] && CRM_Utils_Array::value('price_' . $priceId, $fields)) { + elseif (!$value['is_enter_qty'] && !empty($fields['price_' . $priceId])) { // The check for {!$value['is_enter_qty']} is done since, quantity fields allow entering // quantity. And the quantity can't be conisdered as civicrm_price_field_value.id, CRM-9577 $priceFieldIDS[] = $fields['price_' . $priceId]; @@ -941,7 +937,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } // validate PCP fields - if not anonymous, we need a nick name value - if ($self->_pcpId && CRM_Utils_Array::value('pcp_display_in_roll', $fields) && + if ($self->_pcpId && !empty($fields['pcp_display_in_roll']) && (CRM_Utils_Array::value('pcp_is_anonymous', $fields) == 0) && CRM_Utils_Array::value('pcp_roll_nickname', $fields) == '' ) { @@ -953,8 +949,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if ($self->_paymentProcessor && $self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON ) { - if (!empty($fields[$self->_expressButtonName . '_x']) || - CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) || + if (!empty($fields[$self->_expressButtonName . '_x']) || !empty($fields[$self->_expressButtonName . '_y']) || CRM_Utils_Array::value($self->_expressButtonName, $fields) ) { return $errors; @@ -1039,9 +1034,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $params['amount_other'] = CRM_Utils_Rule::cleanMoney($params['amount_other']); } - if (CRM_Utils_Array::value('amount', $params) == 'amount_other_radio' || - CRM_Utils_Array::value('amount_other', $params) - ) { + if (CRM_Utils_Array::value('amount', $params) == 'amount_other_radio' || !empty($params['amount_other'])) { $amount = $params['amount_other']; } elseif (!empty($params['pledge_amount'])) { @@ -1173,7 +1166,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); if ($is_quick_config) { foreach ($this->_priceSet['fields'] as $fieldKey => $fieldVal) { - if ($fieldVal['name'] == 'membership_amount' && CRM_Utils_Array::value('price_' . $fieldKey , $params)) { + if ($fieldVal['name'] == 'membership_amount' && !empty($params['price_' . $fieldKey ])) { $fieldId = $fieldVal['id']; $fieldOption = $params['price_' . $fieldId]; $proceFieldAmount += $fieldVal['options'][$this->_submitValues['price_' . $fieldId]]['amount']; @@ -1232,7 +1225,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->set('lineItem', $lineItem); } - if ($this->_membershipBlock['is_separate_payment'] && CRM_Utils_Array::value('separate_amount', $params)) { + if ($this->_membershipBlock['is_separate_payment'] && !empty($params['separate_amount'])) { $this->set('amount', $params['separate_amount']); } else { $this->set('amount', $params['amount']); @@ -1258,9 +1251,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $buttonName = $this->controller->getButtonName(); if (in_array($buttonName, array($this->_expressButtonName, $this->_expressButtonName . '_x', $this->_expressButtonName . '_y') - ) && - !CRM_Utils_Array::value('is_pay_later', $params) - ) { + ) && empty($params['is_pay_later'])) { $this->set('contributeMode', 'express'); $donateURL = CRM_Utils_System::url('civicrm/contribute', '_qf_Contribute_display=1'); diff --git a/CRM/Contribute/Form/Contribution/OnBehalfOf.php b/CRM/Contribute/Form/Contribution/OnBehalfOf.php index 3b4f7dd614..25c1f029b9 100644 --- a/CRM/Contribute/Form/Contribution/OnBehalfOf.php +++ b/CRM/Contribute/Form/Contribution/OnBehalfOf.php @@ -172,9 +172,7 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf { } } elseif (in_array($prefixName, array( - 'organization_name', 'email')) && - !CRM_Utils_Array::value('is_required', $field) - ) { + 'organization_name', 'email')) && empty($field['is_required'])) { $field['is_required'] = 1; } diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 1a1ba4d4cc..66d900e1b6 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -120,7 +120,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $params = $this->_params; $honor_block_is_active = $this->get('honor_block_is_active'); - if ($honor_block_is_active && CRM_Utils_Array::value('soft_credit_type_id', $params)) { + if ($honor_block_is_active && !empty($params['soft_credit_type_id'])) { $honorName = null; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); @@ -243,9 +243,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $defaults[$timeField] = $contact[$timeField]; } } - elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) - && CRM_Utils_Array::value($name . '_custom', $contact) - ) { + elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && !empty($contact[$name . '_custom'])) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } } diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 7d5600d89f..c78d4a412d 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -302,7 +302,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { //FIXME: to support multiple payment processors if ($isMonetary && - (!$isPayLater || CRM_Utils_Array::value('payment_processor', $this->_values)) + (!$isPayLater || !empty($this->_values['payment_processor'])) ) { $ppID = CRM_Utils_Array::value('payment_processor', $this->_values); if (!$ppID) { @@ -527,9 +527,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { ); $config = CRM_Core_Config::singleton(); - if (isset($this->_values['is_recur']) && - CRM_Utils_Array::value('is_recur', $this->_paymentProcessor) - ) { + if (isset($this->_values['is_recur']) && !empty($this->_paymentProcessor['is_recur'])) { $this->assign('is_recur_enabled', 1); $vars = array_merge($vars, array( 'is_recur', 'frequency_interval', 'frequency_unit', diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index d3cf75c7b2..9f629fe468 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -305,7 +305,7 @@ SELECT id } } $hasMembershipBlk = TRUE; - if ($membershipBlock->is_separate_payment && !CRM_Utils_Array::value('amount_block_is_active', $fields)) { + if ($membershipBlock->is_separate_payment && empty($fields['amount_block_is_active'])) { $errors['amount_block_is_active'] = ts('To disable Contribution Amounts section you need to first disable Separate Membership Payment option from Membership Settings.'); } } @@ -500,7 +500,7 @@ SELECT id if ($priceSetID) { // add/update price set. $deletePriceSet = FALSE; - if (!empty($params['price_field_id']) || CRM_Utils_Array::value('price_field_other', $params) ) { + if (!empty($params['price_field_id']) || !empty($params['price_field_other'])) { $deleteAmountBlk = TRUE; } @@ -529,12 +529,12 @@ SELECT id ); } } - /* || CRM_Utils_Array::value( 'price_field_value', $params ) || CRM_Utils_Array::value( 'price_field_other', $params )*/ - if (!empty($options) || CRM_Utils_Array::value('is_allow_other_amount', $params)) { + /* || !empty($params['price_field_value']) || CRM_Utils_Array::value( 'price_field_other', $params )*/ + if (!empty($options) || !empty($params['is_allow_other_amount'])) { $fieldParams['is_quick_config'] = 1; $noContriAmount = NULL; $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3); - if (!(CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params)) && !$usedPriceSetId) { + if (!(!empty($params['price_field_id']) || !empty($params['price_field_other'])) && !$usedPriceSetId) { $pageTitle = strtolower(CRM_Utils_String::munge($this->_values['title'], '_', 245)); $setParams['title'] = $this->_values['title']; if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $pageTitle, 'id', 'name')) { @@ -553,7 +553,7 @@ SELECT id $priceSet = CRM_Price_BAO_PriceSet::create($setParams); $priceSetId = $priceSet->id; } - elseif ($usedPriceSetId && !CRM_Utils_Array::value('price_field_id', $params)) { + elseif ($usedPriceSetId && empty($params['price_field_id'])) { $priceSetId = $usedPriceSetId; } else { @@ -613,7 +613,7 @@ SELECT id $fieldParams['default_option'] = $params['default']; $priceField = CRM_Price_BAO_PriceField::create($fieldParams); } - if (!empty($params['is_allow_other_amount']) && !CRM_Utils_Array::value('price_field_other', $params)) { + if (!empty($params['is_allow_other_amount']) && empty($params['price_field_other'])) { $editedFieldParams = array( 'price_set_id' => $priceSetId, 'name' => 'other_amount', @@ -661,7 +661,7 @@ SELECT id } } } - elseif (empty($params['is_allow_other_amount']) && CRM_Utils_Array::value('price_field_other', $params)) { + elseif (empty($params['is_allow_other_amount']) && !empty($params['price_field_other'])) { CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0'); } elseif ($priceFieldID = CRM_Utils_Array::value('price_field_other', $params)) { @@ -707,7 +707,7 @@ SELECT id } } else { - if (!empty($params['price_field_id']) || CRM_Utils_Array::value('price_field_other', $params)) { + if (!empty($params['price_field_id']) || !empty($params['price_field_other'])) { $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3); if ($usedPriceSetId) { if (!empty($params['price_field_id'])) { diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index 8f4c52801c..8dbf599f31 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -250,9 +250,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $errors['title'] = ts("Please do not use '/' in Title"); } - if (!empty($values['is_organization']) && - !CRM_Utils_Array::value('onbehalf_profile_id', $values) - ) { + if (!empty($values['is_organization']) && empty($values['onbehalf_profile_id'])) { $errors['onbehalf_profile_id'] = ts('Please select a profile to collect organization information on this contribution page.'); } @@ -269,7 +267,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ //dont allow on behalf of save when //pre or post profile consists of membership fields - if ($contributionPageId && CRM_Utils_Array::value('is_organization', $values)) { + if ($contributionPageId && !empty($values['is_organization'])) { $ufJoinParams = array( 'module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', diff --git a/CRM/Contribute/Form/ContributionPage/TabHeader.php b/CRM/Contribute/Form/ContributionPage/TabHeader.php index bec94c9fd9..6342ed8c4d 100644 --- a/CRM/Contribute/Form/ContributionPage/TabHeader.php +++ b/CRM/Contribute/Form/ContributionPage/TabHeader.php @@ -39,7 +39,7 @@ class CRM_Contribute_Form_ContributionPage_TabHeader { static function build(&$form) { $tabs = $form->get('tabHeader'); - if (!$tabs || !CRM_Utils_Array::value('reset', $_GET)) { + if (!$tabs || empty($_GET['reset'])) { $tabs = self::process($form); $form->set('tabHeader', $tabs); } diff --git a/CRM/Contribute/Form/ContributionPage/Widget.php b/CRM/Contribute/Form/ContributionPage/Widget.php index a00ba954df..a33c88cfc2 100644 --- a/CRM/Contribute/Form/ContributionPage/Widget.php +++ b/CRM/Contribute/Form/ContributionPage/Widget.php @@ -214,7 +214,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co } foreach ($params as $key => $val) { - if (substr($key, 0, 6) == 'color_' && !CRM_Utils_Array::value($key, $params)) { + if (substr($key, 0, 6) == 'color_' && empty($params[$key])) { $errors[$key] = ts('%1 is a required field.', array(1 => $self->_colorFields[$key][0])); } } diff --git a/CRM/Contribute/Form/ManagePremiums.php b/CRM/Contribute/Form/ManagePremiums.php index 621b1800df..6e7abf2aaf 100644 --- a/CRM/Contribute/Form/ManagePremiums.php +++ b/CRM/Contribute/Form/ManagePremiums.php @@ -250,7 +250,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { } } // CRM-13231 financial type required if product has cost - if (!empty($params['cost']) && !CRM_Utils_Array::value('financial_type_id', $params)) { + if (!empty($params['cost']) && empty($params['financial_type_id'])) { $errors['financial_type_id'] = ts('Financial Type is required for product having cost.'); } $fileLocation = $files['uploadFile']['tmp_name']; diff --git a/CRM/Contribute/Form/SoftCredit.php b/CRM/Contribute/Form/SoftCredit.php index dba1314cec..eab4cb5e26 100644 --- a/CRM/Contribute/Form/SoftCredit.php +++ b/CRM/Contribute/Form/SoftCredit.php @@ -47,7 +47,7 @@ class CRM_Contribute_Form_SoftCredit { * @return void */ static function buildQuickForm(&$form) { - if ($form->_mode == 'live' && CRM_Utils_Array::value('honor_block_is_active', $form->_values)) { + if ($form->_mode == 'live' && !empty($form->_values['honor_block_is_active'])) { $ufJoinDAO = new CRM_Core_DAO_UFJoin(); $ufJoinDAO->module = 'soft_credit'; $ufJoinDAO->entity_id = $form->_id; @@ -185,8 +185,7 @@ class CRM_Contribute_Form_SoftCredit { // if honor roll fields are populated but no PCP is selected if (empty($fields['pcp_made_through_id'])) { - if (!empty($fields['pcp_display_in_roll']) || - CRM_Utils_Array::value('pcp_roll_nickname', $fields) || + if (!empty($fields['pcp_display_in_roll']) || !empty($fields['pcp_roll_nickname']) || CRM_Utils_Array::value('pcp_personal_note', $fields) ) { $errors['pcp_made_through'] = ts('Please select a Personal Campaign Page, OR uncheck Display in Honor Roll and clear both the Honor Roll Name and the Personal Note field.'); diff --git a/CRM/Contribute/Form/Task/PDF.php b/CRM/Contribute/Form/Task/PDF.php index 8eb00ca4b7..cd40ff9c9e 100644 --- a/CRM/Contribute/Form/Task/PDF.php +++ b/CRM/Contribute/Form/Task/PDF.php @@ -179,11 +179,8 @@ AND {$this->_componentClause}"; list($contactDetails) = CRM_Utils_Token::getTokenDetails($this->_contactIds, $returnProperties, FALSE, FALSE); $suppressedEmails = 0; foreach ($contactDetails as $id => $values) { - if (empty($values['email']) || - CRM_Utils_Array::value('do_not_email', $values) || - CRM_Utils_Array::value('is_deceased', $values) || - CRM_Utils_Array::value('on_hold', $values) - ) { + if (empty($values['email']) || !empty($values['do_not_email']) || + CRM_Utils_Array::value('is_deceased', $values) || !empty($values['on_hold'])) { $suppressedEmails++; $excludeContactIds[] = $values['contact_id']; } diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index d9165c71d0..8019b57ed4 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -307,9 +307,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa //import contribution record according to select contact type if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP && - (CRM_Utils_Array::value('contribution_contact_id', $paramValues) || - CRM_Utils_Array::value('external_identifier', $paramValues) - ) + (!empty($paramValues['contribution_contact_id']) || !empty($paramValues['external_identifier'])) ) { $paramValues['contact_type'] = $this->_contactType; } @@ -353,8 +351,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa else { //fix for CRM-2219 - Update Contribution // onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE - if (!empty($paramValues['invoice_id']) || - CRM_Utils_Array::value('trxn_id', $paramValues) || $paramValues['contribution_id']) { + if (!empty($paramValues['invoice_id']) || !empty($paramValues['trxn_id']) || $paramValues['contribution_id']) { $dupeIds = array( 'id' => CRM_Utils_Array::value('contribution_id', $paramValues), 'trxn_id' => CRM_Utils_Array::value('trxn_id', $paramValues), @@ -561,9 +558,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa * Function to process pledge payments */ function processPledgePayments(&$formatted) { - if (!empty($formatted['pledge_payment_id']) && - CRM_Utils_Array::value('pledge_id', $formatted) - ) { + if (!empty($formatted['pledge_payment_id']) && !empty($formatted['pledge_id'])) { //get completed status $completeStatusID = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name'); diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 2c3d4c9836..e7d7abdda9 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -105,14 +105,14 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { continue; } - if ($isPrimary && CRM_Utils_Array::value('is_primary', $value)) { + if ($isPrimary && !empty($value['is_primary'])) { $isPrimary = FALSE; } else { $value['is_primary'] = 0; } - if ($isBilling && CRM_Utils_Array::value('is_billing', $value)) { + if ($isBilling && !empty($value['is_billing'])) { $isBilling = FALSE; } else { diff --git a/CRM/Core/BAO/Block.php b/CRM/Core/BAO/Block.php index 846f63a3c3..03d109d702 100644 --- a/CRM/Core/BAO/Block.php +++ b/CRM/Core/BAO/Block.php @@ -256,9 +256,7 @@ class CRM_Core_BAO_Block { } } //lets allow to update primary w/ more cleanly. - if (!$resetPrimaryId && - CRM_Utils_Array::value('is_primary', $value) - ) { + if (!$resetPrimaryId && !empty($value['is_primary'])) { $primaryId = TRUE; if (is_array($blockIds)) { foreach ($blockIds as $blockId => $blockValue) { @@ -327,7 +325,7 @@ class CRM_Core_BAO_Block { if ($valueId) { //assigned id as first come first serve basis $value['id'] = $blockValue['id']; - if (!$primaryId && CRM_Utils_Array::value('is_primary', $blockValue)) { + if (!$primaryId && !empty($blockValue['is_primary'])) { $value['is_primary'] = $blockValue['is_primary']; } unset($blockIds[$blockId]); @@ -352,7 +350,7 @@ class CRM_Core_BAO_Block { continue; } - if ($isPrimary && CRM_Utils_Array::value('is_primary', $value)) { + if ($isPrimary && !empty($value['is_primary'])) { $contactFields['is_primary'] = $value['is_primary']; $isPrimary = FALSE; } @@ -360,7 +358,7 @@ class CRM_Core_BAO_Block { $contactFields['is_primary'] = 0; } - if ($isBilling && CRM_Utils_Array::value('is_billing', $value)) { + if ($isBilling && !empty($value['is_billing'])) { $contactFields['is_billing'] = $value['is_billing']; $isBilling = FALSE; } diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index a197f04569..63a65d7866 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -618,7 +618,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { foreach ($fields as $id => $values) { // for now we should not allow multiple fields in profile / export etc, hence unsetting if (!$search && - (CRM_Utils_Array::value('is_multiple', $values) && !$withMultiple) + (!empty($values['is_multiple']) && !$withMultiple) ) { continue; } diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 24f2917fe9..90654c569f 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -129,7 +129,7 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup { 'is_multiple' ); - if ((CRM_Utils_Array::value('is_multiple', $params) || $isMultiple) && + if ((!empty($params['is_multiple']) || $isMultiple) && ($params['is_multiple'] != $isMultiple) ) { $oldTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', diff --git a/CRM/Core/BAO/CustomOption.php b/CRM/Core/BAO/CustomOption.php index 236ca8f0b1..999e4d32f2 100644 --- a/CRM/Core/BAO/CustomOption.php +++ b/CRM/Core/BAO/CustomOption.php @@ -92,7 +92,7 @@ class CRM_Core_BAO_CustomOption { $optionValues = CRM_Core_BAO_OptionValue::getOptionValuesArray($optionGroupID); foreach ($optionValues as $id => $value) { - if (!$inactiveNeeded && !CRM_Utils_Array::value('is_active', $value)) { + if (!$inactiveNeeded && empty($value['is_active'])) { continue; } diff --git a/CRM/Core/BAO/Dashboard.php b/CRM/Core/BAO/Dashboard.php index 710ba42dcd..a0257c4a5e 100644 --- a/CRM/Core/BAO/Dashboard.php +++ b/CRM/Core/BAO/Dashboard.php @@ -123,7 +123,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { $allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']); $defaultDashlets = array(); - if (!$hasDashlets && CRM_Utils_Array::value('blog', $allDashlets)) { + if (!$hasDashlets && !empty($allDashlets['blog'])) { $defaultDashlets['blog'] = array( 'dashboard_id' => $allDashlets['blog']['id'], 'is_active' => 1, diff --git a/CRM/Core/BAO/File.php b/CRM/Core/BAO/File.php index a6a228f1b7..540d4ec628 100644 --- a/CRM/Core/BAO/File.php +++ b/CRM/Core/BAO/File.php @@ -431,7 +431,7 @@ ) { // delete current attachments if applicable - if ($entityID && CRM_Utils_Array::value('is_delete_attachment', $formValues)) { + if ($entityID && !empty($formValues['is_delete_attachment'])) { CRM_Core_BAO_File::deleteEntityFile($entityTable, $entityID); } diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index 5da796b618..df9bdf12f8 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -303,7 +303,7 @@ WHERE ceft.entity_id = %1"; * @static */ static function createPremiumTrxn($params) { - if ((!CRM_Utils_Array::value('financial_type_id', $params) || !CRM_Utils_Array::value('contributionId', $params)) && !CRM_Utils_Array::value('oldPremium', $params)) { + if ((empty($params['financial_type_id']) || empty($params['contributionId'])) && empty($params['oldPremium'])) { return; } diff --git a/CRM/Core/BAO/Log.php b/CRM/Core/BAO/Log.php index 4c949445ed..19814b926a 100644 --- a/CRM/Core/BAO/Log.php +++ b/CRM/Core/BAO/Log.php @@ -176,8 +176,8 @@ UPDATE civicrm_log CRM_Report_BAO_ReportInstance::retrieve($params, $instance); if (!empty($instance) && - (!CRM_Utils_Array::value('permission', $instance) || - (CRM_Utils_Array::value('permission', $instance) && CRM_Core_Permission::check($instance['permission'])) + (empty($instance['permission']) || + (!empty($instance['permission']) && CRM_Core_Permission::check($instance['permission'])) ) ) { return $instance['id']; diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index a626dff2f8..12d8e74d85 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -376,9 +376,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { //build the common contact fields array. $fields['Contact'] = array(); foreach ($fields['Individual'] as $key => $value) { - if (!empty($fields['Household'][$key]) && - CRM_Utils_Array::value($key, $fields['Organization']) - ) { + if (!empty($fields['Household'][$key]) && !empty($fields['Organization'][$key])) { $fields['Contact'][$key] = $value; unset($fields['Organization'][$key], $fields['Household'][$key], diff --git a/CRM/Core/BAO/SchemaHandler.php b/CRM/Core/BAO/SchemaHandler.php index 752337a454..99ea2dd481 100644 --- a/CRM/Core/BAO/SchemaHandler.php +++ b/CRM/Core/BAO/SchemaHandler.php @@ -235,9 +235,7 @@ ALTER TABLE {$tableName} static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) { $sql = NULL; - if (!empty($params['fk_table_name']) && - CRM_Utils_Array::value('fk_field_name', $params) - ) { + if (!empty($params['fk_table_name']) && !empty($params['fk_field_name'])) { $sql .= $separator; $sql .= str_repeat(' ', 8); $sql .= $prefix; diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index d9a17313ed..e0a38646d9 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -996,7 +996,7 @@ AND domain_id = %3 } } // CRM-10931, If DB doesn't have any value, carry on with any default value thats already available - if (!isset($value) && CRM_Utils_Array::value($dao->name, $params)) { + if (!isset($value) && !empty($params[$dao->name])) { $value = $params[$dao->name]; } $params[$dao->name] = $value; diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index bac03c95c0..f3a2517039 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -1057,9 +1057,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { if ($htmlType == 'File') { $entityId = $cid; if (!$cid && - $fieldType == 'Activity' && - CRM_Utils_Array::value(2, $componentWhere[0]) - ) { + $fieldType == 'Activity' && !empty($componentWhere[0][2])) { $entityId = $componentWhere[0][2]; } diff --git a/CRM/Core/BAO/Website.php b/CRM/Core/BAO/Website.php index 7479464f54..5319f19f36 100644 --- a/CRM/Core/BAO/Website.php +++ b/CRM/Core/BAO/Website.php @@ -90,8 +90,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website { is_array($ids) && !empty($ids) ) { foreach ($ids as $id => $value) { - if (($value['website_type_id'] == $values['website_type_id']) - && CRM_Utils_Array::value('url', $values)) { + if (($value['website_type_id'] == $values['website_type_id']) && !empty($values['url'])) { $values['id'] = $id; unset($ids[$id]); break; diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index be85234b39..c9ea0c0f08 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -875,7 +875,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { } public static function isAPIError($error, $type = CRM_Core_Error::FATAL_ERROR) { - if (is_array($error) && CRM_Utils_Array::value('is_error', $error)) { + if (is_array($error) && !empty($error['is_error'])) { $code = $error['error_message']['code']; if ($code == $type) { return TRUE; diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 663ff694e1..a645499491 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1099,9 +1099,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $this->add('text', $name, $label, $attributes); - if (!empty($attributes['addTime']) || - CRM_Utils_Array::value('timeFormat', $attributes) - ) { + if (!empty($attributes['addTime']) || !empty($attributes['timeFormat'])) { if (!isset($attributes['timeFormat'])) { $timeFormat = $config->timeInputFormat; @@ -1130,7 +1128,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { if ($required) { $this->addRule($name, ts('Please select %1', array(1 => $label)), 'required'); - if (!empty($attributes['addTime']) && CRM_Utils_Array::value('addTimeRequired', $attributes)) { + if (!empty($attributes['addTime']) && !empty($attributes['addTimeRequired'])) { $this->addRule($elementName, ts('Please enter a time.'), 'required'); } } diff --git a/CRM/Core/Form/Tag.php b/CRM/Core/Form/Tag.php index 4219e3a603..7263d9371b 100644 --- a/CRM/Core/Form/Tag.php +++ b/CRM/Core/Form/Tag.php @@ -120,9 +120,7 @@ class CRM_Core_Form_Tag { switch ($entityTable) { case 'civicrm_activity': - if (!empty($form->_submitValues['activity_taglist']) && - CRM_Utils_Array::value($parentId, $form->_submitValues['activity_taglist']) - ) { + if (!empty($form->_submitValues['activity_taglist']) && !empty($form->_submitValues['activity_taglist'][$parentId])) { $allTags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE)); $tagIds = explode(',', $form->_submitValues['activity_taglist'][$parentId]); foreach ($tagIds as $tagId) { @@ -141,9 +139,7 @@ class CRM_Core_Form_Tag { break; case 'civicrm_case': - if (!empty($form->_submitValues['case_taglist']) && - CRM_Utils_Array::value($parentId, $form->_submitValues['case_taglist']) - ) { + if (!empty($form->_submitValues['case_taglist']) && !empty($form->_submitValues['case_taglist'][$parentId])) { $allTags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE)); $tagIds = explode(',', $form->_submitValues['case_taglist'][$parentId]); foreach ($tagIds as $tagId) { @@ -166,9 +162,7 @@ class CRM_Core_Form_Tag { $tagset[$i] = $tagset[$tagsetItem]; $tagset[$i]['tagsetElementName'] = "attachment_taglist_$i"; $form->add('text', "attachment_taglist_{$i}[{$parentId}]", NULL); - if (!empty($form->_submitValues["attachment_taglist_$i"]) && - CRM_Utils_Array::value($parentId, $form->_submitValues["attachment_taglist_$i"]) - ) { + if (!empty($form->_submitValues["attachment_taglist_$i"]) && !empty($form->_submitValues["attachment_taglist_$i"][$parentId])) { $allTags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE)); $tagIds = explode(',', $form->_submitValues["attachment_taglist_$i"][$parentId]); foreach ($tagIds as $tagId) { diff --git a/CRM/Core/OptionValue.php b/CRM/Core/OptionValue.php index c0264c5df3..5846d64d35 100644 --- a/CRM/Core/OptionValue.php +++ b/CRM/Core/OptionValue.php @@ -210,7 +210,7 @@ class CRM_Core_OptionValue { } $params['option_group_id'] = $optionGroupID; - if (($action & CRM_Core_Action::ADD) && !CRM_Utils_Array::value('value', $params)) { + if (($action & CRM_Core_Action::ADD) && empty($params['value'])) { $fieldValues = array('option_group_id' => $optionGroupID); // use the next available value /* CONVERT(value, DECIMAL) is used to convert varchar @@ -226,7 +226,7 @@ class CRM_Core_OptionValue { } // set name to label if it's not set - but *only* for ADD action (CRM-3522) - if (($action & CRM_Core_Action::ADD) && !CRM_Utils_Array::value('name', $params) && $params['label']) { + if (($action & CRM_Core_Action::ADD) && empty($params['name']) && $params['label']) { $params['name'] = $params['label']; } if ($action & CRM_Core_Action::UPDATE) { diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index 0c80670ad6..049926b760 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -742,7 +742,7 @@ LIMIT 1;"; } $input['is_test'] = $contribution->is_test; $input['net_amount'] = $contribution->net_amount; - if (!empty($input['fee_amount']) && CRM_Utils_Array::value('amount', $input)) { + if (!empty($input['fee_amount']) && !empty($input['amount'])) { $input['net_amount'] = $input['amount'] - $input['fee_amount']; } diff --git a/CRM/Core/Payment/ProcessorForm.php b/CRM/Core/Payment/ProcessorForm.php index 8ce6e23089..0698ea846c 100644 --- a/CRM/Core/Payment/ProcessorForm.php +++ b/CRM/Core/Payment/ProcessorForm.php @@ -53,9 +53,7 @@ class CRM_Core_Payment_ProcessorForm { $form->set('paymentProcessor', $form->_paymentProcessor); // also set cancel subscription url - if (!empty($form->_paymentProcessor['is_recur']) && - CRM_Utils_Array::value('is_recur', $form->_values) - ) { + if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) { $form->_paymentObject = &CRM_Core_Payment::singleton($mode, $form->_paymentProcessor, $form); $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL(); } @@ -64,9 +62,7 @@ class CRM_Core_Payment_ProcessorForm { // we do this outside of the above conditional to avoid // saving the country/state list in the session (which could be huge) - if (($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) && - CRM_Utils_Array::value('is_monetary', $form->_values) - ) { + if (($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) && !empty($form->_values['is_monetary'])) { if ($form->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) { CRM_Core_Payment_Form::setDirectDebitFields($form); } @@ -87,15 +83,12 @@ class CRM_Core_Payment_ProcessorForm { // make sure we have a valid payment class, else abort if (!empty($form->_values['is_monetary']) && - !$form->_paymentProcessor['class_name'] && - !CRM_Utils_Array::value('is_pay_later', $form->_values) - ) { + !$form->_paymentProcessor['class_name'] && empty($form->_values['is_pay_later'])) { CRM_Core_Error::fatal(ts('Payment processor is not set for this page')); } - if (!empty($form->_membershipBlock) && - CRM_Utils_Array::value('is_separate_payment', $form->_membershipBlock) && - (CRM_Utils_Array::value('class_name', $form->_paymentProcessor) && + if (!empty($form->_membershipBlock) && !empty($form->_membershipBlock['is_separate_payment']) && + (!empty($form->_paymentProcessor['class_name']) && !(CRM_Utils_Array::value('billing_mode', $form->_paymentProcessor) & CRM_Core_Payment::BILLING_MODE_FORM) ) ) { diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index 04a1ae661b..9de5daf921 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -190,7 +190,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { $defaults['default_value'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Country', $countryId); } - if ($defaults['data_type'] == 'ContactReference' && CRM_Utils_Array::value('filter', $defaults)) { + if ($defaults['data_type'] == 'ContactReference' && !empty($defaults['filter'])) { $contactRefFilter = 'Advance'; if (strpos($defaults['filter'], 'action=lookup') !== FALSE && strpos($defaults['filter'], 'group=') !== FALSE @@ -660,9 +660,7 @@ SELECT count(*) break; case 'ContactReference': - if ($fields['filter_selected'] == 'Advance' && - CRM_Utils_Array::value('filter', $fields) - ) { + if ($fields['filter_selected'] == 'Advance' && !empty($fields['filter'])) { if (strpos($fields['filter'], 'entity=') !== FALSE) { $errors['filter'] = ts("Please do not include entity parameter (entity is always 'contact')"); } @@ -876,9 +874,7 @@ AND option_group_id = %2"; } // we can not set require and view at the same time. - if (!empty($fields['is_required']) && - CRM_Utils_Array::value('is_view', $fields) - ) { + if (!empty($fields['is_required']) && !empty($fields['is_view'])) { $errors['is_view'] = ts('Can not set this field Required and View Only at the same time.'); } @@ -919,11 +915,11 @@ AND option_group_id = %2"; } $filter = 'null'; - if ($dataTypeKey == 11 && CRM_Utils_Array::value('filter_selected', $params)) { + if ($dataTypeKey == 11 && !empty($params['filter_selected'])) { if ($params['filter_selected'] == 'Advance' && trim(CRM_Utils_Array::value('filter', $params))) { $filter = trim($params['filter']); } - elseif ($params['filter_selected'] == 'Group' && CRM_Utils_Array::value('group_id', $params)) { + elseif ($params['filter_selected'] == 'Group' && !empty($params['group_id'])) { $filter = 'action=lookup&group=' . implode(',', $params['group_id']); } diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index c7ac62103f..132c47987c 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -896,8 +896,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m if ($value === 0 or $value === '0') { $value = $qfZeroBug; } - if (is_array($value) && - !CRM_Utils_Array::value(1, $value)) { + if (is_array($value) && empty($value[1])) { $value[1] = NULL; } $elements[] = array('advcheckbox', "move_$field", NULL, NULL, NULL, $value); @@ -1469,9 +1468,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $viewOnlyCustomFields = array(); foreach ($submitted as $key => $value) { $fid = (int) substr($key, 7); - if (array_key_exists($fid, $cFields) && - CRM_Utils_Array::value('is_view', $cFields[$fid]['attributes']) - ) { + if (array_key_exists($fid, $cFields) && !empty($cFields[$fid]['attributes']['is_view'])) { $viewOnlyCustomFields[$key] = $value; } } diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 607205377c..3ac4dc31f5 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -112,8 +112,7 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { else { CRM_Utils_Hook::post('create', 'Event', $event->id, $event); } - if ($financialTypeId && CRM_Utils_Array::value('financial_type_id', $params) - && $financialTypeId != $params['financial_type_id']) { + if ($financialTypeId && !empty($params['financial_type_id']) && $financialTypeId != $params['financial_type_id']) { CRM_Price_BAO_PriceFieldValue::updateFinancialType($params['id'], 'civicrm_event', $params['financial_type_id']); } return $result; @@ -1106,7 +1105,7 @@ WHERE civicrm_event.is_active = 1 // CRM-13890 : NOTE wait list condition need to be given so that // wait list message is shown properly in email i.e. WRT online event registration template - if (empty($tplParams['participant_status']) && !CRM_Utils_Array::value('isOnWaitlist', $values['params'])) { + if (empty($tplParams['participant_status']) && empty($values['params']['isOnWaitlist'])) { $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantId, 'status_id', 'id'); $tplParams['participant_status'] = CRM_Event_PseudoConstant::participantStatus($statusId, NULL, 'label'); } @@ -1942,8 +1941,7 @@ WHERE ce.loc_block_id = $locBlockId"; $eventEmail = array(); CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $params, $eventEmail, $returnProperties); - if (!empty($eventEmail['confirm_from_name']) && CRM_Utils_Array::value('confirm_from_email', $eventEmail) - ) { + if (!empty($eventEmail['confirm_from_name']) && !empty($eventEmail['confirm_from_email'])) { $eventEmailId = "{$eventEmail['confirm_from_name']} <{$eventEmail['confirm_from_email']}>"; $fromEmailValues['from_email_id'][$eventEmailId] = htmlspecialchars($eventEmailId); diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index ec55eecc20..8ee25cded2 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1447,9 +1447,7 @@ UPDATE civicrm_participant //take a receipt from as event else domain. $receiptFrom = $domainValues['name'] . ' <' . $domainValues['email'] . '>'; - if (!empty($eventDetails['confirm_from_name']) && - CRM_Utils_Array::value('confirm_from_email', $eventDetails) - ) { + if (!empty($eventDetails['confirm_from_name']) && !empty($eventDetails['confirm_from_email'])) { $receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>'; } diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index c2429467c9..ec486c1592 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -82,9 +82,7 @@ class CRM_Event_BAO_Query { } //add event title also if event id is select - if (!empty($query->_returnProperties['event_id']) || - CRM_Utils_Array::value('event_title', $query->_returnProperties) - ) { + if (!empty($query->_returnProperties['event_id']) || !empty($query->_returnProperties['event_title'])) { $query->_select['event_id'] = "civicrm_event.id as event_id"; $query->_select['event_title'] = "civicrm_event.title as event_title"; $query->_element['event_id'] = 1; @@ -120,9 +118,7 @@ class CRM_Event_BAO_Query { } //add status and status_id - if (!empty($query->_returnProperties['participant_status']) || - CRM_Utils_Array::value('participant_status_id', $query->_returnProperties) - ) { + if (!empty($query->_returnProperties['participant_status']) || !empty($query->_returnProperties['participant_status_id'])) { $query->_select['participant_status'] = "participant_status.label as participant_status"; $query->_select['participant_status_id'] = "participant_status.id as participant_status_id"; $query->_element['participant_status_id'] = 1; diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index 3d69472aae..a33205d36d 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -357,7 +357,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { static function formRule($fields, $files, $self) { $errors = array(); - if ($self->payment_required && !CRM_Utils_Array::value('is_pay_later', $self->_submitValues)) { + if ($self->payment_required && empty($self->_submitValues['is_pay_later'])) { $payment = &CRM_Core_Payment::singleton($self->_mode, $self->_paymentProcessor, $this); $error = $payment->checkConfig($self->_mode); if ($error) { @@ -448,7 +448,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $params['invoiceID'] = md5(uniqid(rand(), TRUE)); $params['amount'] = $this->total; $params['financial_type_id'] = $this->financial_type_id; - if ($this->payment_required && !CRM_Utils_Array::value('is_pay_later', $params)) { + if ($this->payment_required && empty($params['is_pay_later'])) { $trxn = $this->make_payment($params); $params['trxn_id'] = $trxn->trxn_id; $params['trxn_date'] = $trxn->trxn_date; @@ -468,7 +468,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { else { $params['payment_instrument_id'] = CRM_Core_OptionGroup::getValue('payment_instrument', 'Credit Card', 'name'); } - if ($this->is_pay_later && !CRM_Utils_Array::value('payment_completed', $params)) { + if ($this->is_pay_later && empty($params['payment_completed'])) { $params['contribution_status_id'] = array_search('Pending', $contribution_statuses); } else { @@ -571,7 +571,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { } function record_contribution(&$mer_participant, &$params, $event) { - if (self::is_administrator() && CRM_Utils_Array::value('payment_type', $params)) { + if (self::is_administrator() && !empty($params['payment_type'])) { $params['payment_instrument_id'] = $params['payment_type']; } diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index 1f35cb46a4..ac26d648a3 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -100,7 +100,7 @@ class CRM_Event_Form_EventFees { } } - if ($form->_discountId && CRM_Utils_Array::value($defaults[$form->_pId]['discount_id'], $discounts)) { + if ($form->_discountId && !empty($discounts[$defaults[$form->_pId]['discount_id']])) { $form->assign('discount', $discounts[$defaults[$form->_pId]['discount_id']]); } @@ -111,7 +111,7 @@ class CRM_Event_Form_EventFees { } else { $defaults[$form->_pId]['send_receipt'] = (strtotime(CRM_Utils_Array::value('start_date', $details[$form->_eventId])) >= time()) ? 1 : 0; - if ($form->_eventId && CRM_Utils_Array::value('confirm_email_text', $details[$form->_eventId])) { + if ($form->_eventId && !empty($details[$form->_eventId]['confirm_email_text'])) { //set receipt text $defaults[$form->_pId]['receipt_text'] = $details[$form->_eventId]['confirm_email_text']; } @@ -199,13 +199,11 @@ class CRM_Event_Form_EventFees { } } - if ($form->_action == CRM_Core_Action::ADD && CRM_Utils_Array::value('fields', $form->_priceSet)) { + if ($form->_action == CRM_Core_Action::ADD && !empty($form->_priceSet['fields'])) { foreach ($form->_priceSet['fields'] as $key => $val) { foreach ($val['options'] as $keys => $values) { if ($values['is_default']) { - if (get_class($form) != 'CRM_Event_Form_Participant' && - CRM_Utils_Array::value('is_full', $values) - ) { + if (get_class($form) != 'CRM_Event_Form_Participant' && !empty($values['is_full'])) { continue; } diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index 60cc6a20dd..0c4351e242 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -201,9 +201,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $defaults['id'] = $eventId; if (!empty($totalLables)) { $maxKey = count($totalLables) - 1; - if (isset($maxKey) && - CRM_Utils_Array::value('value', $totalLables[$maxKey]) - ) { + if (isset($maxKey) && !empty($totalLables[$maxKey]['value'])) { foreach ($totalLables[$maxKey]['value'] as $i => $v) { if ($totalLables[$maxKey]['amount_id'][$i] == CRM_Utils_Array::value('default_discount_fee_id', $defaults)) { $defaults['discounted_default'] = $i; @@ -749,7 +747,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { if (!empty($value['is_default'])) { $fieldParams['default_option'] = $value['weight']; } - if (!empty($discountFieldIDs[$j]) && CRM_Utils_Array::value($value['weight'], $discountFieldIDs[$j])) { + if (!empty($discountFieldIDs[$j]) && !empty($discountFieldIDs[$j][$value['weight']])) { $fieldParams['option_id'][$value['weight']] = $discountFieldIDs[$j][$value['weight']]; unset($discountFieldIDs[$j][$value['weight']]); } diff --git a/CRM/Event/Form/ManageEvent/Location.php b/CRM/Event/Form/ManageEvent/Location.php index 844f67aa5a..600a7b07f5 100644 --- a/CRM/Event/Form/ManageEvent/Location.php +++ b/CRM/Event/Form/ManageEvent/Location.php @@ -248,8 +248,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent { $deleteOldBlock = FALSE; // if 'use existing location' option is selected - - if (CRM_Utils_Array::value('location_option', $params) == 2 && - CRM_Utils_Array::value('loc_event_id', $params) && + if (CRM_Utils_Array::value('location_option', $params) == 2 && !empty($params['loc_event_id']) && ($params['loc_event_id'] != $this->_oldLocBlockId) ) { // if new selected loc is different from old loc, update the loc_block_id diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index f43f9c26f6..6762b89a1c 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -501,9 +501,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent } $additionalCustomPreId = $additionalCustomPostId = NULL; $isPreError = $isPostError = TRUE; - if (!empty($values['allow_same_participant_emails']) && - CRM_Utils_Array::value('is_multiple_registrations', $values) - ) { + if (!empty($values['allow_same_participant_emails']) && !empty($values['is_multiple_registrations'])) { $types = array_merge(array('Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual')); $profiles = CRM_Core_BAO_UFGroup::getProfiles($types); @@ -798,7 +796,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent if (!empty($params['additional_custom_post_id_multiple'])) { $additionalPostMultiple = array(); foreach ($params['additional_custom_post_id_multiple'] as $key => $value) { - if (!$value && CRM_Utils_Array::value('custom_post_id', $params)) { + if (!$value && !empty($params['custom_post_id'])) { $additionalPostMultiple[$key] = $params['custom_post_id']; } elseif ($value == 'none') { diff --git a/CRM/Event/Form/ManageEvent/TabHeader.php b/CRM/Event/Form/ManageEvent/TabHeader.php index 03151fc964..c8d7cb6789 100644 --- a/CRM/Event/Form/ManageEvent/TabHeader.php +++ b/CRM/Event/Form/ManageEvent/TabHeader.php @@ -40,7 +40,7 @@ class CRM_Event_Form_ManageEvent_TabHeader { static function build(&$form) { $tabs = $form->get('tabHeader'); - if (!$tabs || !CRM_Utils_Array::value('reset', $_GET)) { + if (!$tabs || empty($_GET['reset'])) { $tabs = self::process($form); $form->set('tabHeader', $tabs); } diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 5406562b70..97410f02fa 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -407,8 +407,7 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task { } // when fee amount is included in form - if (!empty($_POST['hidden_feeblock']) || CRM_Utils_Array::value('send_receipt', $_POST) - ) { + if (!empty($_POST['hidden_feeblock']) || !empty($_POST['send_receipt'])) { CRM_Event_Form_EventFees::preProcess($this); CRM_Event_Form_EventFees::buildQuickForm($this); CRM_Event_Form_EventFees::setDefaultValues($this); @@ -1008,8 +1007,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); } // validate contribution status for 'Failed'. - if ($self->_onlinePendingContributionId && - CRM_Utils_Array::value('record_contribution', $values) && + if ($self->_onlinePendingContributionId && !empty($values['record_contribution']) && (CRM_Utils_Array::value('contribution_status_id', $values) == array_search('Failed', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')) ) @@ -1019,8 +1017,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); // do the amount validations. //skip for update mode since amount is freeze, CRM-6052 - if ((!$self->_id && - !CRM_Utils_Array::value('total_amount', $values) && + if ((!$self->_id && empty($values['total_amount']) && empty($self->_values['line_items']) ) || ($self->_id && !$self->_paymentId && isset($self->_values['line_items']) && is_array($self->_values['line_items'])) @@ -1130,8 +1127,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $params['fee_level'] = $params['amount_level']; $contributionParams['total_amount'] = $params['amount']; - if ($this->_quickConfig && CRM_Utils_Array::value('total_amount', $params) - && $params['status_id'] != array_search('Partially paid', $participantStatus)) { + if ($this->_quickConfig && !empty($params['total_amount']) && $params['status_id'] != array_search('Partially paid', $participantStatus)) { $params['fee_amount'] = $params['total_amount']; } else { //fix for CRM-3086 @@ -1533,8 +1529,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); if (is_array($value) && $value != 'skip') { foreach ($value as $lineKey => $line) { //10117 update the line items for participants if contribution amount is recorded - if ($this->_quickConfig && CRM_Utils_Array::value('total_amount', $params ) - && $params['status_id'] != array_search('Partially paid', $participantStatus) + if ($this->_quickConfig && !empty($params['total_amount']) && $params['status_id'] != array_search('Partially paid', $participantStatus) ) { $line['unit_price'] = $line['line_total'] = $params['total_amount']; } @@ -1549,9 +1544,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $updateStatusMsg = NULL; //send mail when participant status changed, CRM-4326 if ($this->_id && $this->_statusId && - $this->_statusId != CRM_Utils_Array::value('status_id', $params) && - CRM_Utils_Array::value('is_notify', $params) - ) { + $this->_statusId != CRM_Utils_Array::value('status_id', $params) && !empty($params['is_notify'])) { $updateStatusMsg = CRM_Event_BAO_Participant::updateStatusMessage($this->_id, $params['status_id'], diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 82bfebc447..4a51eebd63 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -304,7 +304,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later'); //check for variour combination for paylater, payment //process with paid event. - if ($isMonetary && (!$isPayLater || CRM_Utils_Array::value('payment_processor', $this->_values['event']))) { + if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) { $ppID = CRM_Utils_Array::value('payment_processor', $this->_values['event'] ); @@ -532,9 +532,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->assign('address', CRM_Utils_Address::format($addressFields)); - if ($this->_contributeMode == 'direct' && - !CRM_Utils_Array::value('is_pay_later', $params) - ) { + if ($this->_contributeMode == 'direct' && empty($params['is_pay_later'])) { $date = CRM_Utils_Date::format(CRM_Utils_Array::value('credit_card_exp_date', $params)); $date = CRM_Utils_Date::mysqlToIso($date); $this->assign('credit_card_exp_date', $date); @@ -779,9 +777,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $createPayment = TRUE; } - if ($createPayment && $this->_values['event']['is_monetary'] && - CRM_Utils_Array::value('contributionID', $this->_params) - ) { + if ($createPayment && $this->_values['event']['is_monetary'] && !empty($this->_params['contributionID'])) { $paymentParams = array( 'participant_id' => $participant->id, 'contribution_id' => $contribution->id, @@ -791,9 +787,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { } //set only primary participant's params for transfer checkout. - if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify') - && CRM_Utils_Array::value('is_primary', $this->_params) - ) { + if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify') && !empty($this->_params['is_primary'])) { $this->_params['participantID'] = $participant->id; $this->set('primaryParticipant', $this->_params); } @@ -821,9 +815,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { // 3. waiting list participant. // 4. require approval participant. if (!empty($this->_params['is_pay_later']) || - $this->_allowWaitlist || $this->_requireApproval || - !CRM_Utils_Array::value('is_monetary', $this->_values['event']) - ) { + $this->_allowWaitlist || $this->_requireApproval || empty($this->_values['event']['is_monetary'])) { $mail = 'email-Primary'; } @@ -909,9 +901,7 @@ WHERE v.option_group_id = g.id // reuse id if one already exists for this one (can happen // with back button being hit etc) - if (!$participantParams['id'] && - CRM_Utils_Array::value('contributionID', $params) - ) { + if (!$participantParams['id'] && !empty($params['contributionID'])) { $pID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $params['contributionID'], 'participant_id', diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index ac72739690..9688ba80c0 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -102,7 +102,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R //fix for CRM-3088, default value for discount set. if (!empty($this->_values['discount'])) { $discountId = CRM_Core_BAO_Discount::findSet($this->_eventId, 'civicrm_event'); - if ($discountId && CRM_Utils_Array::value('default_discount_fee_id', $this->_values['event'])) { + if ($discountId && !empty($this->_values['event']['default_discount_fee_id'])) { $discountKey = CRM_Core_DAO::getFieldValue("CRM_Core_DAO_OptionValue", $this->_values['event']['default_discount_fee_id'] , 'weight', 'id' ); @@ -206,7 +206,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R //add buttons $js = NULL; - if ($this->isLastParticipant(TRUE) && !CRM_Utils_Array::value('is_monetary', $this->_values['event'])) { + if ($this->isLastParticipant(TRUE) && empty($this->_values['event']['is_monetary'])) { $js = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"); } @@ -226,8 +226,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $processedCnt = self::getParticipantCount($this, $this->_params, TRUE); } - if (!$this->_allowConfirmation && - CRM_Utils_Array::value('bypass_payment', $this->_params[0]) && + if (!$this->_allowConfirmation && !empty($this->_params[0]['bypass_payment']) && $this->_lastParticipant ) { @@ -250,9 +249,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R //lets allow to become a part of runtime waiting list, if primary selected pay later. $realPayLater = FALSE; - if (!empty($this->_values['event']['is_monetary']) && - CRM_Utils_Array::value('is_pay_later', $this->_values['event']) - ) { + if (!empty($this->_values['event']['is_monetary']) && !empty($this->_values['event']['is_pay_later'])) { $realPayLater = CRM_Utils_Array::value('is_pay_later', $this->_params[0]); } @@ -295,8 +292,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } // for priceset with count - if ($pricesetFieldsCount && - CRM_Utils_Array::value('has_waitlist', $this->_values['event']) && + if ($pricesetFieldsCount && !empty($this->_values['event']['has_waitlist']) && !$this->_allowConfirmation ) { @@ -385,9 +381,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $button = substr($self->controller->getButtonName(), -4); $realPayLater = FALSE; - if (!empty($self->_values['event']['is_monetary']) && - CRM_Utils_Array::value('is_pay_later', $self->_values['event']) - ) { + if (!empty($self->_values['event']['is_monetary']) && !empty($self->_values['event']['is_pay_later'])) { $realPayLater = CRM_Utils_Array::value('is_pay_later', $self->_params[0]); } @@ -476,8 +470,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $errors['_qf_default'] = ts("Your event registration will be confirmed. Please go back to the main registration page, to complete payment information."); } //check for availability of registrations. - if (!$self->_allowConfirmation && - !CRM_Utils_Array::value('has_waitlist', $self->_values['event']) && + if (!$self->_allowConfirmation && empty($self->_values['event']['has_waitlist']) && $totalParticipants > $self->_availableRegistrations ) { $errors['_qf_default'] = ts('It looks like event has only %2 seats available and you are trying to register %1 participants, so could you please select price options accordingly.', array(1 => $totalParticipants, 2 => $self->_availableRegistrations)); @@ -486,14 +479,13 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } } - if ($button == 'skip' && $self->_lastParticipant && CRM_Utils_Array::value('priceSetId', $fields)) { + if ($button == 'skip' && $self->_lastParticipant && !empty($fields['priceSetId'])) { $pricesetFieldsCount = CRM_Price_BAO_PriceSet::getPricesetCount($fields['priceSetId']); if (($pricesetFieldsCount < 1) || $self->_allowConfirmation) { return $errors; } - if (!empty($self->_values['event']['has_waitlist']) && - CRM_Utils_Array::value('bypass_payment', $self->_params[0]) && + if (!empty($self->_values['event']['has_waitlist']) && !empty($self->_params[0]['bypass_payment']) && !$self->_allowWaitlist && !$realPayLater && !$self->_requireApproval && @@ -721,9 +713,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } //to check whether call processRegistration() - if (!$this->_values['event']['is_monetary'] - && CRM_Utils_Array::value('additional_participants', $this->_params[0]) - && $this->isLastParticipant() + if (!$this->_values['event']['is_monetary'] && !empty($this->_params[0]['additional_participants']) && $this->isLastParticipant() ) { CRM_Event_Form_Registration_Register::processRegistration($this->_params, NULL); } diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 2c4d5aef92..bec64c18ea 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -78,9 +78,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { CRM_Utils_Hook::eventDiscount($this, $this->_params); - if (!empty($this->_params[0]['discount']) && - CRM_Utils_Array::value('applied', $this->_params[0]['discount']) - ) { + if (!empty($this->_params[0]['discount']) && !empty($this->_params[0]['discount']['applied'])) { $this->set('hookDiscount', $this->_params[0]['discount']); $this->assign('hookDiscount', $this->_params[0]['discount']); } @@ -241,7 +239,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } } - if (!empty($v['first_name']) && CRM_Utils_Array::value('last_name', $v)) { + if (!empty($v['first_name']) && !empty($v['last_name'])) { $append = $v['first_name'] . ' ' . $v['last_name']; } else { @@ -361,8 +359,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { //consider total amount. $this->assign('isAmountzero', ($this->_totalAmount <= 0) ? TRUE : FALSE); - if ($this->_paymentProcessor['payment_processor_type'] == 'Google_Checkout' && - !CRM_Utils_Array::value('is_pay_later', $this->_params[0]) && !($this->_params[0]['amount'] == 0) && + if ($this->_paymentProcessor['payment_processor_type'] == 'Google_Checkout' && empty($this->_params[0]['is_pay_later']) && !($this->_params[0]['amount'] == 0) && !$this->_allowWaitlist && !$this->_requireApproval ) { $this->_checkoutButtonName = $this->getButtonName('next', 'checkout'); @@ -463,13 +460,9 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { // if a discount has been applied, lets now deduct it from the amount // and fix the fee level - if (!empty($this->_params[0]['discount']) && - CRM_Utils_Array::value('applied', $this->_params[0]['discount']) - ) { + if (!empty($this->_params[0]['discount']) && !empty($this->_params[0]['discount']['applied'])) { foreach ($this->_params as $k => $v) { - if (CRM_Utils_Array::value('amount', $this->_params[$k]) > 0 && - CRM_Utils_Array::value('discountAmount', $this->_params[$k]) - ) { + if (CRM_Utils_Array::value('amount', $this->_params[$k]) > 0 && !empty($this->_params[$k]['discountAmount'])) { $this->_params[$k]['amount'] -= $this->_params[$k]['discountAmount']; $this->_params[$k]['amount_level'] .= CRM_Utils_Array::value('discountMessage', $this->_params[$k]); } @@ -516,9 +509,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $this->fixLocationFields($value, $fields); //unset the billing parameters if it is pay later mode //to avoid creation of billing location - if ($this->_allowWaitlist || $this->_requireApproval || - CRM_Utils_Array::value('is_pay_later', $value) || !CRM_Utils_Array::value('is_primary', $value) - ) { + if ($this->_allowWaitlist || $this->_requireApproval || !empty($value['is_pay_later']) || empty($value['is_primary'])) { $billingFields = array( "email-{$this->_bltID}", 'billing_first_name', @@ -559,7 +550,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { // we dont store in userID in case the user is doing multiple // transactions etc // for things like tell a friend - if (!$this->getContactID() && CRM_Utils_Array::value('is_primary', $value)) { + if (!$this->getContactID() && !empty($value['is_primary'])) { $session = CRM_Core_Session::singleton(); $session->set('transaction.userID', $contactID); } @@ -604,7 +595,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $value['participant_status_id'] = $value['participant_status'] = array_search($status, $pendingStatuses); } } - elseif ($this->_contributeMode == 'express' && CRM_Utils_Array::value('is_primary', $value)) { + elseif ($this->_contributeMode == 'express' && !empty($value['is_primary'])) { if (is_object($payment)) $result = $payment->doExpressCheckout($value); else @@ -648,7 +639,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $createContrib = TRUE; } - if ($createContrib && CRM_Utils_Array::value('is_primary', $value) && + if ($createContrib && !empty($value['is_primary']) && !$this->_allowWaitlist && !$this->_requireApproval ) { // if paid event add a contribution record @@ -682,7 +673,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $value['currencyID'] = $primaryCurrencyID; } - if (!$pending && CRM_Utils_Array::value('is_primary', $value) && + if (!$pending && !empty($value['is_primary']) && !$this->_allowWaitlist && !$this->_requireApproval ) { // transactionID & receive date required while building email template @@ -766,8 +757,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { // for Transfer checkout. if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify' - ) && - !CRM_Utils_Array::value('is_pay_later', $params[0]) && + ) && empty($params[0]['is_pay_later']) && !$this->_allowWaitlist && !$this->_requireApproval && $this->_totalAmount > 0 ) { @@ -962,14 +952,12 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } //create an contribution address - if ($form->_contributeMode != 'notify' && !CRM_Utils_Array::value('is_pay_later', $params)) { + if ($form->_contributeMode != 'notify' && empty($params['is_pay_later'])) { $contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID); } // Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin. - if (!empty($params['pcp_made_through_id']) || - CRM_Utils_Array::value('soft_credit_to', $params) - ) { + if (!empty($params['pcp_made_through_id']) || !empty($params['soft_credit_to'])) { // if its due to pcp if (!empty($params['pcp_made_through_id'])) { @@ -1036,14 +1024,11 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $fields['email-Primary'] = 1; //if its pay later or additional participant set email address as primary. - if ((CRM_Utils_Array::value('is_pay_later', $params) || - !CRM_Utils_Array::value('is_primary', $params) || + if ((!empty($params['is_pay_later']) || empty($params['is_primary']) || !$this->_values['event']['is_monetary'] || $this->_allowWaitlist || $this->_requireApproval - ) && - CRM_Utils_Array::value("email-{$this->_bltID}", $params) - ) { + ) && !empty($params["email-{$this->_bltID}"])) { $params['email-Primary'] = $params["email-{$this->_bltID}"]; } } diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 645c56c49b..05d34e4f97 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -96,9 +96,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } $this->_allowWaitlist = FALSE; - if ($eventFull && !$this->_allowConfirmation && - CRM_Utils_Array::value('has_waitlist', $this->_values['event']) - ) { + if ($eventFull && !$this->_allowConfirmation && !empty($this->_values['event']['has_waitlist'])) { $this->_allowWaitlist = TRUE; $this->_waitlistMsg = CRM_Utils_Array::value('waitlist_text', $this->_values['event']); if (!$this->_waitlistMsg) { @@ -263,9 +261,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { if ($this->_priceSetId && !empty($this->_feeBlock)) { foreach ($this->_feeBlock as $key => $val) { foreach ($val['options'] as $keys => $values) { - if ($values['is_default'] && - !CRM_Utils_Array::value('is_full', $values) - ) { + if ($values['is_default'] && empty($values['is_full'])) { if ($val['html_type'] == 'CheckBox') { $this->_defaults["price_{$key}"][$keys] = 1; @@ -365,13 +361,11 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } //hack to allow group to register w/ waiting - if ((CRM_Utils_Array::value('is_multiple_registrations', $this->_values['event']) || + if ((!empty($this->_values['event']['is_multiple_registrations']) || $this->_priceSetId ) && !$this->_allowConfirmation && - is_numeric($this->_availableRegistrations) - && CRM_Utils_Array::value('has_waitlist', $this->_values['event']) - ) { + is_numeric($this->_availableRegistrations) && !empty($this->_values['event']['has_waitlist'])) { $bypassPayment = TRUE; //case might be group become as a part of waitlist. //If not waitlist then they require admin approve. @@ -500,8 +494,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $allAreBillingModeProcessors = FALSE; } - if (!$allAreBillingModeProcessors || - CRM_Utils_Array::value('is_pay_later', $this->_values['event']) || $bypassPayment + if (!$allAreBillingModeProcessors || !empty($this->_values['event']['is_pay_later']) || $bypassPayment ) { //freeze button to avoid multiple calls. @@ -668,9 +661,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $priceSetId = $form->get('priceSetId'); if (!$priceSetId || !is_array($priceSet) || - empty($priceSet) || - !CRM_Utils_Array::value('optionsMaxValueTotal', $priceSet) - ) { + empty($priceSet) || empty($priceSet['optionsMaxValueTotal'])) { return; } @@ -734,9 +725,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $form->_allowConfirmation && !empty($formattedPriceSetDefaults) ) { - if (empty($formattedPriceSetDefaults["price_{$field}"]) || - !CRM_Utils_Array::value($opId, $formattedPriceSetDefaults["price_{$fieldId}"]) - ) { + if (empty($formattedPriceSetDefaults["price_{$field}"]) || empty($formattedPriceSetDefaults["price_{$fieldId}"][$opId])) { $optionFullIds[$optId] = $optId; $isFull = TRUE; } @@ -776,8 +765,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { self::checkRegistration($fields, $self); } //check for availability of registrations. - if (!$self->_allowConfirmation && - !CRM_Utils_Array::value('bypass_payment', $fields) && + if (!$self->_allowConfirmation && empty($fields['bypass_payment']) && is_numeric($self->_availableRegistrations) && CRM_Utils_Array::value('additional_participants', $fields) >= $self->_availableRegistrations ) { @@ -785,8 +773,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } // during confirmation don't allow to increase additional participants, CRM-4320 - if ($self->_allowConfirmation && - CRM_Utils_Array::value('additional_participants', $fields) && + if ($self->_allowConfirmation && !empty($fields['additional_participants']) && is_array($self->_additionalParticipantIds) && $fields['additional_participants'] > count($self->_additionalParticipantIds) ) { @@ -796,7 +783,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { //don't allow to register w/ waiting if enough spaces available. if (!empty($fields['bypass_payment'])) { if (!is_numeric($self->_availableRegistrations) || - (!CRM_Utils_Array::value('priceSetId', $fields) && CRM_Utils_Array::value('additional_participants', $fields) < $self->_availableRegistrations) + (empty($fields['priceSetId']) && CRM_Utils_Array::value('additional_participants', $fields) < $self->_availableRegistrations) ) { $errors['bypass_payment'] = ts("Oops. There are enough available spaces in this event. You can not add yourself to the waiting list."); } @@ -854,8 +841,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { if ($self->_paymentProcessor && $self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON ) { - if (!empty($fields[$self->_expressButtonName . '_x']) || - CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) || + if (!empty($fields[$self->_expressButtonName . '_x']) || !empty($fields[$self->_expressButtonName . '_y']) || CRM_Utils_Array::value($self->_expressButtonName, $fields) ) { return empty($errors) ? TRUE : $errors; @@ -883,13 +869,12 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $isZeroAmount = TRUE; } - if ($isZeroAmount && !($self->_forcePayement && CRM_Utils_Array::value('additional_participants', $fields))) { + if ($isZeroAmount && !($self->_forcePayement && !empty($fields['additional_participants']))) { $skipPaymentValidation = TRUE; } // also return if paylater mode or zero fees for valid members - if (!empty($fields['is_pay_later']) || - CRM_Utils_Array::value('bypass_payment', $fields) || + if (!empty($fields['is_pay_later']) || !empty($fields['bypass_payment']) || $skipPaymentValidation || (!$self->_allowConfirmation && ($self->_requireApproval || $self->_allowWaitlist)) ) { @@ -926,9 +911,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } } - if (!$email && !(CRM_Utils_Array::value('first_name', $fields) && - CRM_Utils_Array::value('last_name', $fields) - )) { + if (!$email && !(!empty($fields['first_name']) && !empty($fields['last_name']))) { $defaults = $params = array('id' => $eventId); CRM_Event_BAO_Event::retrieve($params, $defaults); $message = ts("Mandatory fields (first name and last name, OR email address) are missing from this form."); @@ -993,8 +976,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { if (!empty($params['additional_participants'])) { $totalParticipants += $params['additional_participants']; } - if (!$this->_allowConfirmation && - CRM_Utils_Array::value('bypass_payment', $params) && + if (!$this->_allowConfirmation && !empty($params['bypass_payment']) && is_numeric($this->_availableRegistrations) && $totalParticipants > $this->_availableRegistrations ) { @@ -1098,8 +1080,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $this->_expressButtonName . '_x', $this->_expressButtonName . '_y', ) - ) && - !CRM_Utils_Array::value('is_pay_later', $params) && + ) && empty($params['is_pay_later']) && !$this->_allowWaitlist && !$this->_requireApproval ) { @@ -1242,7 +1223,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { // we dont store in userID in case the user is doing multiple // transactions etc // for things like tell a friend - if (!$this->getContactID() && CRM_Utils_Array::value('is_primary', $value)) { + if (!$this->getContactID() && !empty($value['is_primary'])) { $session->set('transaction.userID', $contactID); } diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php index 59c8647235..d94d88001f 100644 --- a/CRM/Event/Import/Parser/Participant.php +++ b/CRM/Event/Import/Parser/Participant.php @@ -176,7 +176,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { if (!(($index < 0) || ($this->_participantStatusIndex < 0))) { $errorRequired = !CRM_Utils_Array::value($this->_participantStatusIndex, $values); - if (empty($params['event_id']) && !CRM_Utils_Array::value('event_title', $params)) { + if (empty($params['event_id']) && empty($params['event_title'])) { CRM_Contact_Import_Parser_Contact::addToErrorMsg('Event', $missingField); } if (empty($params['participant_status_id'])) { @@ -302,7 +302,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { } } - if (!(CRM_Utils_Array::value('participant_role_id', $params) || CRM_Utils_Array::value('participant_role', $params))) { + if (!(!empty($params['participant_role_id']) || !empty($params['participant_role']))) { if (!empty($params['event_id'])) { $params['participant_role_id'] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'default_role_id'); } diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index d0416b3cb3..7c80266962 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -94,7 +94,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { $this->assign('isShowLocation', CRM_Utils_Array::value('is_show_location', $values['event'])); // show event fees. - if ($this->_id && CRM_Utils_Array::value('is_monetary', $values['event'])) { + if ($this->_id && !empty($values['event']['is_monetary'])) { //CRM-6907 $config = CRM_Core_Config::singleton(); $config->defaultCurrency = CRM_Utils_Array::value('currency', @@ -163,7 +163,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { $this->assign('action', CRM_Core_Action::VIEW); //To show the event location on maps directly on event info page $locations = CRM_Event_BAO_Event::getMapInfo($this->_id); - if (!empty($locations) && CRM_Utils_Array::value('is_map', $values['event'])) { + if (!empty($locations) && !empty($values['event']['is_map'])) { $this->assign('locations', $locations); $this->assign('mapProvider', $config->mapProvider); $this->assign('mapKey', $config->mapAPIKey); diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 7796a8cbc6..51e62e4833 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -349,7 +349,7 @@ class CRM_Export_BAO_Export { } } - if (!$selectAll && $componentTable && CRM_Utils_Array::value('additional_group', $exportParams)) { + if (!$selectAll && $componentTable && !empty($exportParams['additional_group'])) { // If an Additional Group is selected, then all contacts in that group are // added to the export set (filtering out duplicates). $query = " @@ -545,8 +545,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $queryString = "$select $from $where $having"; $groupBy = ""; - if (!empty($returnProperties['tags']) || - CRM_Utils_Array::value('groups', $returnProperties) || + if (!empty($returnProperties['tags']) || !empty($returnProperties['groups']) || CRM_Utils_Array::value('notes', $returnProperties) || // CRM-9552 ($queryMode & CRM_Contact_BAO_Query::MODE_CONTACTS && $query->_useGroupBy) diff --git a/CRM/Export/Form/Map.php b/CRM/Export/Form/Map.php index e8b2da1707..1c57f0bb6b 100644 --- a/CRM/Export/Form/Map.php +++ b/CRM/Export/Form/Map.php @@ -119,7 +119,7 @@ class CRM_Export_Form_Map extends CRM_Core_Form { static function formRule($fields, $values, $mappingTypeId) { $errors = array(); - if (!empty($fields['saveMapping']) && CRM_Utils_Array::value('_qf_Map_next', $fields)) { + if (!empty($fields['saveMapping']) && !empty($fields['_qf_Map_next'])) { $nameField = CRM_Utils_Array::value('saveMappingName', $fields); if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Export Mapping'); diff --git a/CRM/Export/Form/Select.php b/CRM/Export/Form/Select.php index 6d6109cf6f..86492b36e0 100644 --- a/CRM/Export/Form/Select.php +++ b/CRM/Export/Form/Select.php @@ -353,9 +353,7 @@ FROM {$this->_componentTable} foreach ($greetings as $key => $value) { $otherOption = CRM_Utils_Array::value($key, $params); - if ((CRM_Utils_Array::value($otherOption, $self->_greetingOptions[$key]) == ts('Other')) && - !CRM_Utils_Array::value($value, $params) - ) { + if ((CRM_Utils_Array::value($otherOption, $self->_greetingOptions[$key]) == ts('Other')) && empty($params[$value])) { $label = ucwords(str_replace('_', ' ', $key)); $errors[$value] = ts('Please enter a value for %1 (merging > 2 contacts), or select a pre-configured option from the list.', array(1 => $label)); diff --git a/CRM/Financial/Form/FinancialTypeAccount.php b/CRM/Financial/Form/FinancialTypeAccount.php index 35503e9809..a050cd33b8 100644 --- a/CRM/Financial/Form/FinancialTypeAccount.php +++ b/CRM/Financial/Form/FinancialTypeAccount.php @@ -177,7 +177,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form { } if ($this->_action == CRM_Core_Action::ADD) { - if (!empty($this->_submitValues['account_relationship']) || CRM_Utils_Array::value('financial_account_id', $this->_submitValues)) { + if (!empty($this->_submitValues['account_relationship']) || !empty($this->_submitValues['financial_account_id'])) { $financialAccountType = array( '5' => 5, //expense '3' => 1, //AR relation @@ -272,7 +272,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form { if (CRM_Utils_Array::value('financial_account_id', $values) == 'select') { $errorMsg['financial_account_id'] = 'Financial Account is a required field.'; } - if (!empty($values['account_relationship']) && CRM_Utils_Array::value('financial_account_id', $values)) { + if (!empty($values['account_relationship']) && !empty($values['financial_account_id'])) { $params = array( 'account_relationship' => $values['account_relationship'], 'entity_id' => $self->_aid diff --git a/CRM/Friend/BAO/Friend.php b/CRM/Friend/BAO/Friend.php index e14822eac6..d42c34f43f 100644 --- a/CRM/Friend/BAO/Friend.php +++ b/CRM/Friend/BAO/Friend.php @@ -191,7 +191,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { ); //if is_email_receipt is set then take receipt_from_email //as from_email - if (!empty($default['is_email_receipt']) && CRM_Utils_Array::value('receipt_from_email', $default)) { + if (!empty($default['is_email_receipt']) && !empty($default['receipt_from_email'])) { $mailParams['email_from'] = $default['receipt_from_email']; } @@ -211,7 +211,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { //if is_email_confirm is set then take confirm_from_email //as from_email - if (!empty($default['is_email_confirm']) && CRM_Utils_Array::value('confirm_from_email', $default)) { + if (!empty($default['is_email_confirm']) && !empty($default['confirm_from_email'])) { $mailParams['email_from'] = $default['confirm_from_email']; } diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index f36a7be006..5085648c98 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -245,9 +245,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { $groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE); $config = CRM_Core_Config::singleton(); - if (isset($this->_id) && - CRM_Utils_Array::value('saved_search_id', $this->_groupValues) - ) { + if (isset($this->_id) && !empty($this->_groupValues['saved_search_id'])) { unset($groupTypes['Access Control']); } @@ -266,9 +264,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { $groupNames = CRM_Core_PseudoConstant::group(); $parentGroups = $parentGroupElements = array(); - if (isset($this->_id) && - CRM_Utils_Array::value('parents', $this->_groupValues) - ) { + if (isset($this->_id) && !empty($this->_groupValues['parents'])) { $parentGroupIds = explode(',', $this->_groupValues['parents']); foreach ($parentGroupIds as $parentGroupId) { $parentGroups[$parentGroupId] = $groupNames[$parentGroupId]; diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 0f1124b49e..7dcdaa5809 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -1565,8 +1565,7 @@ ORDER BY civicrm_email.is_bulkmail DESC $mg = new CRM_Mailing_DAO_MailingGroup(); foreach (array('groups', 'mailings') as $entity) { foreach (array('include', 'exclude', 'base') as $type) { - if (isset($params[$entity]) && - CRM_Utils_Array::value($type, $params[$entity]) && + if (isset($params[$entity]) && !empty($params[$entity][$type]) && is_array($params[$entity][$type])) { foreach ($params[$entity][$type] as $entityId) { $mg->reset(); diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php index 88c13c0d88..ae2c9cc2ab 100644 --- a/CRM/Mailing/Form/Test.php +++ b/CRM/Mailing/Form/Test.php @@ -268,10 +268,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form { ); } - if (!empty($_POST['_qf_Import_refresh']) || - CRM_Utils_Array::value('_qf_Test_next', $testParams) || - !CRM_Utils_Array::value('sendtest', $testParams) - ) { + if (!empty($_POST['_qf_Import_refresh']) || !empty($testParams['_qf_Test_next']) || empty($testParams['sendtest'])) { $error = TRUE; return $error; } diff --git a/CRM/Mailing/Form/Upload.php b/CRM/Mailing/Form/Upload.php index 0698ccdf72..6d2e3a0281 100644 --- a/CRM/Mailing/Form/Upload.php +++ b/CRM/Mailing/Form/Upload.php @@ -119,7 +119,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { } //set default from email address. - if (!empty($defaults['from_name']) && CRM_Utils_Array::value('from_email', $defaults)) { + if (!empty($defaults['from_name']) && !empty($defaults['from_email'])) { $defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>', CRM_Core_OptionGroup::values('from_email_address') ); @@ -235,8 +235,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { ); //Added code to add custom field as Reply-To on form when it is enabled from Mailer settings - if (isset($config->replyTo) && !empty($config->replyTo) && - ! CRM_Utils_Array::value( 'override_verp', $options ) ) { + if (isset($config->replyTo) && !empty($config->replyTo) && empty($options['override_verp'])) { $this->add('select', 'reply_to_address', ts('Reply-To'), array('' => '- select -') + $fromEmailAddress ); @@ -582,10 +581,10 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { } } else { - if (empty($params['text_message']) && !CRM_Utils_Array::value('html_message', $params)) { + if (empty($params['text_message']) && empty($params['html_message'])) { $errors['html_message'] = ts('Please provide either a Text or HTML formatted message - or both.'); } - if (!empty($params['saveTemplate']) && !CRM_Utils_Array::value('saveTemplateName', $params)) { + if (!empty($params['saveTemplate']) && empty($params['saveTemplateName'])) { $errors['saveTemplateName'] = ts('Please provide a Template Name.'); } } diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 2609b3906a..7ed98d56a7 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -231,9 +231,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { // To skip status calculation we should use 'skipStatusCal'. // eg pay later membership, membership update cron CRM-3984 - if (empty($params['is_override']) && - !CRM_Utils_Array::value('skipStatusCal', $params) - ) { + if (empty($params['is_override']) && empty($params['skipStatusCal'])) { $dates = array('start_date', 'end_date', 'join_date'); $start_date = $end_date = $join_date = NULL; // declare these out of courtesy as IDEs don't pick up the setting of them below foreach ($dates as $date) { @@ -244,9 +242,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { $excludeIsAdmin = CRM_Utils_Array::value('exclude_is_admin', $params, FALSE); //CRM-3724 always skip is_admin if is_override != true. - if (!$excludeIsAdmin && - !CRM_Utils_Array::value('is_override', $params) - ) { + if (!$excludeIsAdmin && empty($params['is_override'])) { $excludeIsAdmin = TRUE; } @@ -309,7 +305,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { } //record contribution for this membership - if (!empty($params['contribution_status_id']) && !CRM_Utils_Array::value('relate_contribution_id', $params)) { + if (!empty($params['contribution_status_id']) && empty($params['relate_contribution_id'])) { $memInfo = array_merge($params, array('membership_id' => $membership->id)); $params['contribution'] = self::recordMembershipContribution($memInfo, $ids); } @@ -329,9 +325,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { // add activity record only during create mode and renew mode // also add activity if status changed CRM-3984 and CRM-2521 if (empty($ids['membership']) || - $activityType == 'Membership Renewal' || - CRM_Utils_Array::value('createActivity', $params) - ) { + $activityType == 'Membership Renewal' || !empty($params['createActivity'])) { if (!empty($ids['membership'])) { $data = array(); CRM_Core_DAO::commonRetrieveAll('CRM_Member_DAO_Membership', @@ -1358,8 +1352,7 @@ AND civicrm_membership.is_test = %2"; $index = !empty($memBlockDetails['is_separate_payment']) ? 2 : 1; if (empty($errors[$index])) { - if (isset($membershipParams['onbehalf']) && - CRM_Utils_Array::value('member_campaign_id', $membershipParams['onbehalf'])) { + if (isset($membershipParams['onbehalf']) && !empty($membershipParams['onbehalf']['member_campaign_id'])) { $form->_params['campaign_id'] = $membershipParams['onbehalf']['member_campaign_id']; } if (is_array($membershipTypeID)) { @@ -1530,14 +1523,11 @@ AND civicrm_membership.is_test = %2"; //@todo this is a BAO function & should not inspect the form - the form should do this // & pass required params to the BAO if (CRM_Utils_Array::value('minimum_fee', $membershipTypeDetails) > 0.0) { - if (((isset($form->_contributeMode) && $form->_contributeMode == 'notify') || - CRM_Utils_Array::value('is_pay_later', $form->_params) || - (CRM_Utils_Array::value('is_recur', $form->_params) - && $form->_contributeMode == 'direct' + if (((isset($form->_contributeMode) && $form->_contributeMode == 'notify') || !empty($form->_params['is_pay_later']) || + (!empty($form->_params['is_recur']) && $form->_contributeMode == 'direct' ) ) && - (($form->_values['is_monetary'] && $form->_amount > 0.0) || - CRM_Utils_Array::value('separate_membership_payment', $form->_params) || + (($form->_values['is_monetary'] && $form->_amount > 0.0) || !empty($form->_params['separate_membership_payment']) || CRM_Utils_Array::value('record_contribution', $form->_params) ) ) { @@ -1689,7 +1679,7 @@ AND civicrm_membership.is_test = %2"; if (!empty($form->_params['membership_source'])) { $memParams['source'] = $form->_params['membership_source']; } - elseif (property_exists($form, '_values') && CRM_Utils_Array::value('title', $form->_values)) { + elseif (property_exists($form, '_values') && !empty($form->_values['title'])) { $memParams['source'] = ts('Online Contribution:') . ' ' . $form->_values['title']; } else { @@ -2690,9 +2680,7 @@ WHERE civicrm_membership.is_test = 0"; //insert payment record for this membership - if (empty($ids['contribution']) || - CRM_Utils_Array::value('is_recur', $params) - ) { + if (empty($ids['contribution']) || !empty($params['is_recur'])) { $mpDAO = new CRM_Member_DAO_MembershipPayment(); $mpDAO->membership_id = $membershipId; $mpDAO->contribution_id = $contribution->id; diff --git a/CRM/Member/BAO/MembershipStatus.php b/CRM/Member/BAO/MembershipStatus.php index 58deb11703..0dd99f87c8 100644 --- a/CRM/Member/BAO/MembershipStatus.php +++ b/CRM/Member/BAO/MembershipStatus.php @@ -134,18 +134,13 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus { } //copy name to label when not passed. - if (empty($params['label']) && - CRM_Utils_Array::value('name', $params) - ) { + if (empty($params['label']) && !empty($params['name'])) { $params['label'] = $params['name']; } //for add mode, copy label to name. $statusId = CRM_Utils_Array::value('membershipStatus', $ids); - if (!$statusId && - CRM_Utils_Array::value('label', $params) && - !CRM_Utils_Array::value('name', $params) - ) { + if (!$statusId && !empty($params['label']) && empty($params['name'])) { $params['name'] = $params['label']; } diff --git a/CRM/Member/BAO/Query.php b/CRM/Member/BAO/Query.php index 10f36ff01f..20e1a7cc3a 100644 --- a/CRM/Member/BAO/Query.php +++ b/CRM/Member/BAO/Query.php @@ -457,7 +457,7 @@ class CRM_Member_BAO_Query { static function tableNames(&$tables) { //add membership table - if (!empty($tables['civicrm_membership_log']) || CRM_Utils_Array::value('civicrm_membership_status', $tables) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) { + if (!empty($tables['civicrm_membership_log']) || !empty($tables['civicrm_membership_status']) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) { $tables = array_merge(array('civicrm_membership' => 1), $tables); } } diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index 51bebebc0b..81c9835040 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -183,7 +183,7 @@ class CRM_Member_Form extends CRM_Core_Form { //CRM-10375 Where the payer differs to the member the payer should get the email. // here we store details in order to do that - if (!empty($formValues['contribution_contact_select_id']) && CRM_Utils_Array::value('1', $formValues['contribution_contact_select_id'])) { + if (!empty($formValues['contribution_contact_select_id']) && !empty($formValues['contribution_contact_select_id']['1'])) { $this->_receiptContactId = $this->_contributorContactID = $formValues['contribution_contact_select_id'][1]; list( $this->_contributorDisplayName, $this->_contributorEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails( $this->_contributorContactID ); diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index ce8a346e7b..96b64b1736 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -468,7 +468,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { // build price set form. $buildPriceSet = FALSE; - if ($this->_priceSetId || CRM_Utils_Array::value('price_set_id', $_POST)) { + if ($this->_priceSetId || !empty($_POST['price_set_id'])) { if (!empty($_POST['price_set_id'])) { $buildPriceSet = TRUE; } @@ -562,7 +562,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { foreach ($allMemberships as $key => $values) { if (!empty($values['is_active'])) { $membershipType[$key] = CRM_Utils_Array::value('name', $values); - if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) { + if ($this->_mode && empty($values['minimum_fee'])) { continue; } else { @@ -923,15 +923,15 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; return $errors; } - if ($priceSetId && !$self->_mode && !CRM_Utils_Array::value('record_contribution', $params)) { + if ($priceSetId && !$self->_mode && empty($params['record_contribution'])) { $errors['record_contribution'] = ts('Record Membership Payment is required when you using price set.'); } - if (!$priceSetId && $self->_mode && !CRM_Utils_Array::value('financial_type_id', $params)) { + if (!$priceSetId && $self->_mode && empty($params['financial_type_id'])) { $errors['financial_type_id'] = ts('Please enter the financial Type.'); } - if (!empty($params['record_contribution']) && !CRM_Utils_Array::value('payment_instrument_id', $params)) { + if (!empty($params['record_contribution']) && empty($params['payment_instrument_id'])) { $errors['payment_instrument_id'] = ts('Paid By is a required field.'); } @@ -1035,9 +1035,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } if (isset($params['is_override']) && - $params['is_override'] && - !CRM_Utils_Array::value('status_id', $params) - ) { + $params['is_override'] && empty($params['status_id'])) { $errors['status_id'] = ts('Please enter the status.'); } @@ -1053,8 +1051,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } // validate contribution status for 'Failed'. - if ($self->_onlinePendingContributionId && - CRM_Utils_Array::value('record_contribution', $params) && + if ($self->_onlinePendingContributionId && !empty($params['record_contribution']) && (CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Failed', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')) ) @@ -1091,7 +1088,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } //take the required membership recur values. - if ($this->_mode && CRM_Utils_Array::value('auto_renew', $this->_params)) { + if ($this->_mode && !empty($this->_params['auto_renew'])) { $params['is_recur'] = $this->_params['is_recur'] = $formValues['is_recur'] = TRUE; $mapping = array( 'frequency_interval' => 'duration_interval', @@ -1539,22 +1536,20 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } else { $params['action'] = $this->_action; - if ($this->_onlinePendingContributionId && - CRM_Utils_Array::value('record_contribution', $formValues) - ) { + if ($this->_onlinePendingContributionId && !empty($formValues['record_contribution'])) { // update membership as well as contribution object, CRM-4395 $params['contribution_id'] = $this->_onlinePendingContributionId; $params['componentId'] = $params['id']; $params['componentName'] = 'contribute'; $result = CRM_Contribute_BAO_Contribution::transitionComponents($params, TRUE); - if (!empty($result) && CRM_Utils_Array::value('contribution_id', $params)) { + if (!empty($result) && !empty($params['contribution_id'])) { $lineItem = array(); $lineItems = CRM_Price_BAO_LineItem::getLineItems($params['contribution_id'], 'contribution'); $itemId = key($lineItems); $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id'); $fieldType = NULL; - if ($itemId && CRM_Utils_Array::value('price_field_id', $lineItems[$itemId])) { + if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) { $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type'); } $lineItems[$itemId]['unit_price'] = $params['total_amount']; @@ -1610,8 +1605,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; else { $count = 0; foreach ($this->_memTypeSelected as $memType) { - if ($count && - CRM_Utils_Array::value('record_contribution', $formValues) && + if ($count && !empty($formValues['record_contribution']) && ($relateContribution = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id)) ) { $membershipTypeValues[$memType]['relate_contribution_id'] = $relateContribution; @@ -1687,7 +1681,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $memEndDate = ($membership->end_date) ? $membership->end_date : $endDate; //get the end date from calculated dates. - if (!$memEndDate && !CRM_Utils_Array::value('is_recur', $params)) { + if (!$memEndDate && empty($params['is_recur'])) { $memEndDate = CRM_Utils_Array::value('end_date', $calcDates[$memType]); } diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index d8dc8b8388..795d014c3a 100644 --- a/CRM/Member/Form/MembershipBlock.php +++ b/CRM/Member/Form/MembershipBlock.php @@ -251,7 +251,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa } } - if ($contributionPageId && CRM_Utils_Array::value('member_price_set_id', $params) && + if ($contributionPageId && !empty($params['member_price_set_id']) && CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active')) { $errors['member_price_set_id'] = ts('You cannot use Membership Price Sets with the Contribution Amounts section. However, a membership price set may include additional fields for non-membership options that requires an additional fee (e.g. magazine subscription) or an additional voluntary contribution.'); } @@ -291,7 +291,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa if ($contributionPageId) { $amountBlock = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active'); - if (!$amountBlock && CRM_Utils_Array::value('is_separate_payment', $params)) { + if (!$amountBlock && !empty($params['is_separate_payment'])) { $errors['is_separate_payment'] = ts('Please enable the contribution amount section to use this option.'); } } diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index a6aafefaf9..307369316e 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -337,7 +337,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { foreach( $allMemberships as $key => $values ) { if (!empty($values['is_active'])) { $membershipType[$key] = CRM_Utils_Array::value('name', $values); - if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) { + if ($this->_mode && empty($values['minimum_fee'])) { continue; } else { diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index c3189c9bd0..b24043531f 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -67,7 +67,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form { $defaults = parent::setDefaultValues(); // get the member org display name - if ( $this->_id && CRM_Utils_Array::value('member_of_contact_id', $defaults)) { + if ( $this->_id && !empty($defaults['member_of_contact_id'])) { $this->assign('member_org_id', $defaults['member_of_contact_id']); } @@ -398,9 +398,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form { $periods = array('fixed_period_start_day', 'fixed_period_rollover_day'); foreach ($periods as $per) { - if (!empty($params[$per]['M']) && - CRM_Utils_Array::value('d', $params[$per]) - ) { + if (!empty($params[$per]['M']) && !empty($params[$per]['d'])) { $mon = $params[$per]['M']; $dat = $params[$per]['d']; $mon = ($mon < 10) ? '0' . $mon : $mon; diff --git a/CRM/Member/Form/MembershipView.php b/CRM/Member/Form/MembershipView.php index 7b87250e4a..80e05bec3c 100644 --- a/CRM/Member/Form/MembershipView.php +++ b/CRM/Member/Form/MembershipView.php @@ -222,8 +222,7 @@ END AS 'relType' $this->assign('has_related', FALSE); // if membership can be granted, and we are the owner of the membership - if (!empty($membershipType['relationship_type_id']) && !CRM_Utils_Array::value('owner_membership_id', $values) - ) { + if (!empty($membershipType['relationship_type_id']) && empty($values['owner_membership_id'])) { // display related contacts/membership block $this->assign('has_related', TRUE); $this->assign('max_related', CRM_Utils_Array::value('max_related', $values, ts('Unlimited'))); diff --git a/CRM/Member/Import/Parser/Membership.php b/CRM/Member/Import/Parser/Membership.php index e23a1b3265..7fbedc15b8 100644 --- a/CRM/Member/Import/Parser/Membership.php +++ b/CRM/Member/Import/Parser/Membership.php @@ -161,7 +161,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $errorMessage = NULL; //To check whether start date or join date is provided - if (empty($params['membership_start_date']) && !CRM_Utils_Array::value('join_date', $params)) { + if (empty($params['membership_start_date']) && empty($params['join_date'])) { $errorMessage = 'Membership Start Date is required to create a memberships.'; CRM_Contact_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); } @@ -266,9 +266,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $params = &$this->getActiveFieldParams(); //assign join date equal to start date if join date is not provided - if (empty($params['join_date']) && - CRM_Utils_Array::value('membership_start_date', $params) - ) { + if (empty($params['join_date']) && !empty($params['membership_start_date'])) { $params['join_date'] = $params['membership_start_date']; } @@ -359,9 +357,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { else { //fix for CRM-2219 Update Membership // onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE - if (!empty($formatted['is_override']) && - !CRM_Utils_Array::value('status_id', $formatted) - ) { + if (!empty($formatted['is_override']) && empty($formatted['status_id'])) { array_unshift($values, 'Required parameter missing: Status'); return CRM_Import_Parser::ERROR; } diff --git a/CRM/PCP/Form/Campaign.php b/CRM/PCP/Form/Campaign.php index 197fe5053e..2f071ea491 100644 --- a/CRM/PCP/Form/Campaign.php +++ b/CRM/PCP/Form/Campaign.php @@ -165,9 +165,7 @@ class CRM_PCP_Form_Campaign extends CRM_Core_Form { if (strlen($fields['donate_link_text']) >= 64) { $errors['donate_link_text'] = ts('Button Text must be less than 64 characters.'); } - if (isset($files['attachFile_1']) && - CRM_Utils_Array::value('tmp_name', $files['attachFile_1']) - ) { + if (isset($files['attachFile_1']) && !empty($files['attachFile_1']['tmp_name'])) { list($width, $height) = getimagesize($files['attachFile_1']['tmp_name']); if ($width > 360 || $height > 360) { $errors['attachFile_1'] = ts('Your picture or image file cannot be larger than 360 x 360 pixels in size.') . ' ' . ts("The dimensions of the image you have selected are %1 x %2.", array(1 => $width, 2 => $height)) . ' ' . ts('Please shrink or crop the file or find another smaller image and try again.'); diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index 0964327bae..3f0e375ba7 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -198,9 +198,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { } // skip payment stuff inedit mode - if (!isset($params['id']) || - CRM_Utils_Array::value('is_pledge_pending', $params) - ) { + if (!isset($params['id']) || !empty($params['is_pledge_pending'])) { //if pledge is pending delete all payments and recreate. diff --git a/CRM/Pledge/BAO/Query.php b/CRM/Pledge/BAO/Query.php index 26b70453d0..22ebe26572 100644 --- a/CRM/Pledge/BAO/Query.php +++ b/CRM/Pledge/BAO/Query.php @@ -46,9 +46,7 @@ class CRM_Pledge_BAO_Query { * @access public */ static function select(&$query) { - if (($query->_mode & CRM_Contact_BAO_Query::MODE_PLEDGE) || - CRM_Utils_Array::value('pledge_id', $query->_returnProperties) - ) { + if (($query->_mode & CRM_Contact_BAO_Query::MODE_PLEDGE) || !empty($query->_returnProperties['pledge_id'])) { $query->_select['pledge_id'] = 'civicrm_pledge.id as pledge_id'; $query->_element['pledge_id'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; @@ -629,9 +627,7 @@ class CRM_Pledge_BAO_Query { static function tableNames(&$tables) { //add status table - if (!empty($tables['pledge_status']) || - CRM_Utils_Array::value('civicrm_pledge_payment', $tables) - ) { + if (!empty($tables['pledge_status']) || !empty($tables['civicrm_pledge_payment'])) { $tables = array_merge(array('civicrm_pledge' => 1), $tables); } } diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index ab11019031..eeffdabcae 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -294,8 +294,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { 'id' => $type, ); //see if we need to include this paneName in the current form - if ($this->_formType == $type || - CRM_Utils_Array::value("hidden_{$type}", $_POST) || + if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) || CRM_Utils_Array::value("hidden_{$type}", $defaults) ) { $showAdditionalInfo = TRUE; @@ -576,7 +575,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $dates = array('create_date', 'start_date', 'acknowledge_date', 'cancel_date'); foreach ($dates as $d) { - if ($this->_id && (!$this->_isPending) && CRM_Utils_Array::value($d, $this->_values)) { + if ($this->_id && (!$this->_isPending) && !empty($this->_values[$d])) { if ($d == 'start_date') { $params['scheduled_date'] = CRM_Utils_Date::processDate($this->_values[$d]); } diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 0bf6ee817c..3b2fe77753 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -298,7 +298,7 @@ AND li.entity_id = {$entityId})"; $line['entity_id'] = $entityId; // if financial type is not set and if price field value is NOT NULL // get financial type id of price field value - if (!empty($line['price_field_value_id']) && !CRM_Utils_Array::value('financial_type_id', $line)) { + if (!empty($line['price_field_value_id']) && empty($line['financial_type_id'])) { $line['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $line['price_field_value_id'], 'financial_type_id'); } $lineItems = CRM_Price_BAO_LineItem::create($line); diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 1e2bebc6fe..87af39f3bc 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -121,8 +121,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { for ($index = 1; $index <= $maxIndex; $index++) { if (array_key_exists('option_amount', $params) && array_key_exists($index, $params['option_amount']) && - (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || - CRM_Utils_Array::value('is_quick_config', $params)) && + (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || !empty($params['is_quick_config'])) && !CRM_Utils_System::isNull($params['option_amount'][$index]) ) { $options = array( @@ -389,7 +388,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { if (!empty($otherAmount['is_allow_other_amount']) && $field->name == 'contribution_amount') { $none = ts('Other Amount'); } - elseif (!empty($qf->_membershipBlock) && !CRM_Utils_Array::value('is_required', $qf->_membershipBlock) && $field->name == 'membership_amount') { + elseif (!empty($qf->_membershipBlock) && empty($qf->_membershipBlock['is_required']) && $field->name == 'membership_amount') { $none = ts('No thank you'); } else { diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index eaff867fab..f62c9cbb2e 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -874,7 +874,7 @@ WHERE id = %1"; $_contact_memberships[$userid][$value['membership_type_id']] = CRM_Member_BAO_Membership::getContactMembership($userid, $value['membership_type_id'], FALSE); } $currentMembership = $_contact_memberships[$userid][$value['membership_type_id']]; - if (!empty($currentMembership) && !CRM_Utils_Array::value('end_date', $currentMembership)) { + if (!empty($currentMembership) && empty($currentMembership['end_date'])) { unset($options[$key]); $checklifetime = TRUE; } diff --git a/CRM/Price/Form/Field.php b/CRM/Price/Form/Field.php index 002b25dd6e..c61c1dad06 100644 --- a/CRM/Price/Form/Field.php +++ b/CRM/Price/Form/Field.php @@ -489,7 +489,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { $_flagOption = 1; } } - if (!$noLabel && !$noAmount && CRM_Utils_Array::value('option_financial_type_id', $fields) && $fields['option_financial_type_id'][$index] == '' && $fields['html_type'] != 'Text') { + if (!$noLabel && !$noAmount && !empty($fields['option_financial_type_id']) && $fields['option_financial_type_id'][$index] == '' && $fields['html_type'] != 'Text') { $errors["option_financial_type_id[{$index}]"] = ts('Financial Type is a Required field.'); } if ($noLabel && !$noAmount) { diff --git a/CRM/Price/Form/Option.php b/CRM/Price/Form/Option.php index 3faaf8f62b..4fd62e2c03 100644 --- a/CRM/Price/Form/Option.php +++ b/CRM/Price/Form/Option.php @@ -277,7 +277,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form { */ static function formRule($fields, $files, $form) { $errors = array(); - if (!empty($fields['count']) && CRM_Utils_Array::value('max_value', $fields) && + if (!empty($fields['count']) && !empty($fields['max_value']) && $fields['count'] > $fields['max_value'] ) { $errors['count'] = ts('Participant count can not be greater than max participants.'); diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index b243bd1b46..a369e4cb12 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -882,7 +882,7 @@ class CRM_Profile_Form extends CRM_Core_Form { $profileActivityTypes = CRM_Core_BAO_UFGroup::groupTypeValues($gid, 'Activity'); - if ((CRM_Utils_Array::value('Activity', $profileActivityTypes) && + if ((!empty($profileActivityTypes['Activity']) && !in_array($activityDetails['activity_type_id'], $profileActivityTypes['Activity']) ) || (!in_array($contactId, $activityDetails['assignee_contact']) && @@ -927,16 +927,14 @@ class CRM_Profile_Form extends CRM_Core_Form { } // dont check for duplicates during registration validation: CRM-375 - if (!$register && !CRM_Utils_Array::value('_qf_Edit_upload_duplicate', $fields)) { + if (!$register && empty($fields['_qf_Edit_upload_duplicate'])) { // fix for CRM-3240 if (!empty($fields['email-Primary'])) { $fields['email'] = CRM_Utils_Array::value('email-Primary', $fields); } // fix for CRM-6141 - if (!empty($fields['phone-Primary-1']) && - !CRM_Utils_Array::value('phone-Primary', $fields) - ) { + if (!empty($fields['phone-Primary-1']) && empty($fields['phone-Primary'])) { $fields['phone-Primary'] = $fields['phone-Primary-1']; } @@ -1125,8 +1123,7 @@ class CRM_Profile_Form extends CRM_Core_Form { ); $details = $contactDetails[0][$this->_id]; } - if (!(CRM_Utils_Array::value('addressee_id', $details) || - CRM_Utils_Array::value('email_greeting_id', $details) || + if (!(!empty($details['addressee_id']) || !empty($details['email_greeting_id']) || CRM_Utils_Array::value('postal_greeting_id', $details) )) { @@ -1219,8 +1216,7 @@ class CRM_Profile_Form extends CRM_Core_Form { substr($groupTypes, 1, -1) ); //filter group of mailing type and unset it from params - if (in_array(2, $groupType) && - CRM_Utils_Array::value('email', $result) && + if (in_array(2, $groupType) && !empty($result['email']) && CRM_Core_BAO_UFGroup::isProfileAddToGroupDoubleOptin() ) { if (!count($contactGroup)) { diff --git a/CRM/Profile/Form/Dynamic.php b/CRM/Profile/Form/Dynamic.php index c7815bda33..d1a1b04d5b 100644 --- a/CRM/Profile/Form/Dynamic.php +++ b/CRM/Profile/Form/Dynamic.php @@ -109,7 +109,7 @@ class CRM_Profile_Form_Dynamic extends CRM_Profile_Form { $errors = array(); // if no values, return - if (empty($fields) || !CRM_Utils_Array::value('edit', $fields)) { + if (empty($fields) || empty($fields['edit'])) { return TRUE; } diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index cbaa13ed48..0ea8cfc1e7 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -388,9 +388,7 @@ SELECT module function validate() { $errors = parent::validate(); - if (!$errors && - CRM_Utils_Array::value('errorURL', $_POST) - ) { + if (!$errors && !empty($_POST['errorURL'])) { $message = NULL; foreach ($this->_errors as $name => $mess) { $message .= $mess; diff --git a/CRM/Profile/Page/Listings.php b/CRM/Profile/Page/Listings.php index ffa8023de1..db6d43bdb0 100644 --- a/CRM/Profile/Page/Listings.php +++ b/CRM/Profile/Page/Listings.php @@ -157,7 +157,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page { ); foreach ($this->_fields as $name => $field) { - if ((substr($name, 0, 6) == 'custom') && CRM_Utils_Array::value('is_search_range', $field)) { + if ((substr($name, 0, 6) == 'custom') && !empty($field['is_search_range'])) { $from = CRM_Utils_Request::retrieve($name . '_from', 'String', $this, FALSE, NULL, 'REQUEST' ); @@ -227,7 +227,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page { $customField = CRM_Utils_Array::value($name, $this->_customFields); - if (!empty($_POST) && !CRM_Utils_Array::value($name, $_POST)) { + if (!empty($_POST) && empty($_POST[$name])) { if ($customField) { // reset checkbox/radio because a form does not send null checkbox values if (in_array($customField['html_type'], @@ -327,9 +327,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page { $this->assign('search', $this->_search); // search if search returned a form error? - if ((!CRM_Utils_Array::value('reset', $_GET) || - CRM_Utils_Array::value('force', $_GET) - ) && + if ((empty($_GET['reset']) || !empty($_GET['force'])) && !$searchError ) { $this->assign('isReset', FALSE); diff --git a/CRM/Report/BAO/ReportInstance.php b/CRM/Report/BAO/ReportInstance.php index 322e2e2ed7..a44debf132 100644 --- a/CRM/Report/BAO/ReportInstance.php +++ b/CRM/Report/BAO/ReportInstance.php @@ -188,9 +188,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance { // add / update navigation as required if (!empty($navigationParams)) { - if (empty($params['id']) && - !CRM_Utils_Array::value('instance_id',$params) && - CRM_Utils_Array::value('id', $navigationParams)) { + if (empty($params['id']) && empty($params['instance_id']) && !empty($navigationParams['id'])) { unset($navigationParams['id']); } $navigationParams['url'] = "civicrm/report/instance/{$instance->id}&reset=1"; diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index adf4c666ac..d419a6f15c 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -699,11 +699,8 @@ class CRM_Report_Form extends CRM_Core_Form { $this->_defaults['order_bys'] = array(); } foreach ($table['order_bys'] as $fieldName => $field) { - if (!empty($field['default']) || - CRM_Utils_Array::value('default_order', $field) || - CRM_Utils_Array::value('default_is_section', $field) || - CRM_Utils_Array::value('default_weight', $field) - ) { + if (!empty($field['default']) || !empty($field['default_order']) || + CRM_Utils_Array::value('default_is_section', $field) || !empty($field['default_weight'])) { $order_by = array( 'column' => $fieldName, 'order' => CRM_Utils_Array::value('default_order', $field, 'ASC'), @@ -838,7 +835,7 @@ class CRM_Report_Form extends CRM_Core_Form { } $colGroups[$tableName]['fields'][$fieldName] = CRM_Utils_Array::value('title', $field); - if ($groupTitle && !CRM_Utils_Array::value('group_title', $colGroups[$tableName])) { + if ($groupTitle && empty($colGroups[$tableName]['group_title'])) { $colGroups[$tableName]['group_title'] = $groupTitle; } @@ -1827,9 +1824,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND $this->_phoneField = TRUE; } - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { // 1. In many cases we want select clause to be built in slightly different way // for a particular field of a particular type. @@ -1915,8 +1910,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND continue; } - if (!empty($this->_params['group_bys']) && CRM_Utils_Array::value($fieldName, $this->_params['group_bys']) - && !empty($this->_params['group_bys_freq'])) { + if (!empty($this->_params['group_bys']) && !empty($this->_params['group_bys'][$fieldName]) && !empty($this->_params['group_bys_freq'])) { switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) { case 'YEARWEEK': $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start"; @@ -2165,7 +2159,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND $this->_select .= ", {$section['dbAlias']} as {$alias}"; } - if ($applyLimit && !CRM_Utils_Array::value('charts', $this->_params)) { + if ($applyLimit && empty($this->_params['charts'])) { $this->limit(); } CRM_Utils_Hook::alterReportVar('sql', $this, $this); @@ -2265,9 +2259,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $selectColumns["{$tableName}_{$fieldName}"] = 1; } @@ -3014,9 +3006,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a } //might be survey response field. - if (!empty($this->_params['fields']['survey_response']) && - CRM_Utils_Array::value('isSurveyResponseField', $prop['fields'][$fieldAlias]) - ) { + if (!empty($this->_params['fields']['survey_response']) && !empty($prop['fields'][$fieldAlias]['isSurveyResponseField'])) { return TRUE; } } @@ -3133,9 +3123,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $this->_selectedTables[] = $tableName; break; } diff --git a/CRM/Report/Form/Activity.php b/CRM/Report/Form/Activity.php index c5648d9529..c901274d53 100644 --- a/CRM/Report/Form/Activity.php +++ b/CRM/Report/Form/Activity.php @@ -579,8 +579,7 @@ GROUP BY civicrm_activity_id {$this->_having} {$this->_orderBy}"; //Assign those recordtype to array which have filter operator as 'Is not empty' or 'Is empty' $nullFilters = array(); foreach (array('target', 'source', 'assignee') as $type) { - if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) == 'nnll' || - CRM_Utils_Array::value("contact_{$type}_value", $this->_params)) { + if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) == 'nnll' || !empty($this->_params["contact_{$type}_value"])) { $nullFilters[] = " civicrm_contact_contact_{$type} IS NOT NULL "; } else if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) == 'nll') { diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php index 96062ec0da..221ee3d397 100644 --- a/CRM/Report/Form/ActivitySummary.php +++ b/CRM/Report/Form/ActivitySummary.php @@ -235,9 +235,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { } if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_email') { $this->_emailField = TRUE; } @@ -401,9 +399,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { if (!empty($field['chart'])) { $this->assign('chartSupported', TRUE); } - if (!empty($table['group_bys'][$fieldName]['frequency']) && - CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) - ) { + if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) { $append = "YEAR({$field['dbAlias']}),"; if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]), @@ -434,9 +430,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { $contactFields = array('sort_name', 'email', 'phone'); if (!empty($fields['group_bys'])) { - if (!empty($fields['group_bys']['activity_type_id']) && - !CRM_Utils_Array::value('sort_name', $fields['group_bys']) - ) { + if (!empty($fields['group_bys']['activity_type_id']) && empty($fields['group_bys']['sort_name'])) { foreach ($fields['fields'] as $fieldName => $val) { if (in_array($fieldName, $contactFields)) { $errors['fields'] = ts("Please select GroupBy 'Contact' to display Contact Fields"); diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index ef9ae9ff20..a7de7788a4 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -286,8 +286,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { continue; } foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) || CRM_Utils_Array::value('is_required', $field) + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName]) || CRM_Utils_Array::value('is_required', $field) ) { $fieldsName = CRM_Utils_Array::value(1, explode('_', $tableName)); @@ -340,7 +339,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { if($this->_locationBasedPhoneField){ foreach($this->_surveyResponseFields as $key => $value){ - if(substr($key,0,5) == 'phone' && CRM_Utils_Array::value('location_type_id',$value)){ + if(substr($key,0,5) == 'phone' && !empty($value['location_type_id'])){ $fName = str_replace('-','_',$key); $this->_from .= "LEFT JOIN civicrm_phone ".$this->_aliases["civicrm_phone_{$fName}"]." ON {$this->_aliases['civicrm_contact']}.id = ".$this->_aliases["civicrm_phone_{$fName}"].".contact_id AND ".$this->_aliases["civicrm_phone_{$fName}"].".location_type_id = {$value['location_type_id']} AND ".$this->_aliases["civicrm_phone_{$fName}"].".phone_type_id = {$value['phone_type_id']}\n"; } @@ -637,8 +636,7 @@ INNER JOIN civicrm_option_value val ON ( val.option_group_id = survey.result_id private function _formatSurveyResult(&$rows) { $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params); - if (CRM_Utils_System::isNull($surveyIds) || - !CRM_Utils_Array::value('result', $this->_params['fields']) || + if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['result']) || !in_array($this->_outputMode, array('print', 'pdf')) ) { return; @@ -685,9 +683,7 @@ INNER JOIN civicrm_survey survey ON ( survey.result_id = grp.id ) private function _formatSurveyResponseData(&$rows) { $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params); - if (CRM_Utils_System::isNull($surveyIds) || - !CRM_Utils_Array::value('survey_response', $this->_params['fields']) - ) { + if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['survey_response'])) { return; } @@ -807,9 +803,7 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) private function _addSurveyResponseColumns() { $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params); - if (CRM_Utils_System::isNull($surveyIds) || - !CRM_Utils_Array::value('survey_response', $this->_params['fields']) - ) { + if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['survey_response'])) { return; } @@ -819,7 +813,7 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) $this->_surveyResponseFields = $responseFields; } foreach($responseFields as $key => $value){ - if(substr($key,0,5) == 'phone' && CRM_Utils_Array::value('location_type_id',$value)){ + if(substr($key,0,5) == 'phone' && !empty($value['location_type_id'])){ $fName = str_replace('-','_',$key); $this->_columns["civicrm_{$fName}"] = array( 'dao' => 'CRM_Core_DAO_Phone', diff --git a/CRM/Report/Form/Case/Demographics.php b/CRM/Report/Form/Case/Demographics.php index 12c03e0e9b..6a31e539c0 100644 --- a/CRM/Report/Form/Case/Demographics.php +++ b/CRM/Report/Form/Case/Demographics.php @@ -249,9 +249,7 @@ where (cg.extends='Contact' OR cg.extends='Individual' OR cg.extends_entity_colu foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_email') { $this->_emailField = TRUE; } diff --git a/CRM/Report/Form/Case/Detail.php b/CRM/Report/Form/Case/Detail.php index 3a68446e8a..3336d9a1d2 100644 --- a/CRM/Report/Form/Case/Detail.php +++ b/CRM/Report/Form/Case/Detail.php @@ -304,9 +304,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_email') { $this->_emailField = TRUE; } @@ -412,7 +410,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { else { $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params); - if ($fieldName == 'case_type_id' && CRM_Utils_Array::value('case_type_id_value', $this->_params)) { + if ($fieldName == 'case_type_id' && !empty($this->_params['case_type_id_value'])) { foreach ($this->_params['case_type_id_value'] as $key => $value) { if (strpos($value, CRM_Core_DAO::VALUE_SEPARATOR) === FALSE) { $value = CRM_Core_DAO::VALUE_SEPARATOR . $value . CRM_Core_DAO::VALUE_SEPARATOR; @@ -550,8 +548,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { $this->_relField = TRUE; } - if (!empty($this->_params['activity_date_time_relative']) || - CRM_Utils_Array::value('activity_date_time_from', $this->_params) || + if (!empty($this->_params['activity_date_time_relative']) || !empty($this->_params['activity_date_time_from']) || CRM_Utils_Array::value('activity_date_time_to', $this->_params) ) { $this->_activityLast = TRUE; @@ -616,9 +613,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { } $entryFound = TRUE; } - if (array_key_exists('civicrm_activity_last_completed_last_completed_activity_subject', $row) && - !CRM_Utils_Array::value('civicrm_activity_last_completed_last_completed_activity_subject', $row) - ) { + if (array_key_exists('civicrm_activity_last_completed_last_completed_activity_subject', $row) && empty($row['civicrm_activity_last_completed_last_completed_activity_subject'])) { $rows[$rowNum]['civicrm_activity_last_completed_last_completed_activity_subject'] = ts('(No Subject)'); $entryFound = TRUE; } diff --git a/CRM/Report/Form/Case/Summary.php b/CRM/Report/Form/Case/Summary.php index e7f56531eb..0e6c8e8b71 100644 --- a/CRM/Report/Form/Case/Summary.php +++ b/CRM/Report/Form/Case/Summary.php @@ -179,9 +179,7 @@ class CRM_Report_Form_Case_Summary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_relationship_type') { $this->_relField = TRUE; @@ -322,9 +320,7 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id } } - if (array_key_exists('civicrm_case_case_type_id', $row) && - CRM_Utils_Array::value('civicrm_case_case_type_id', $rows[$rowNum]) - ) { + if (array_key_exists('civicrm_case_case_type_id', $row) && !empty($rows[$rowNum]['civicrm_case_case_type_id'])) { $value = $row['civicrm_case_case_type_id']; $typeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value); $value = array(); @@ -338,9 +334,7 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id } // convert Case ID and Subject to links to Manage Case - if (array_key_exists('civicrm_case_id', $row) && - CRM_Utils_Array::value('civicrm_c2_id', $rows[$rowNum]) - ) { + if (array_key_exists('civicrm_case_id', $row) && !empty($rows[$rowNum]['civicrm_c2_id'])) { $url = CRM_Utils_System::url("civicrm/contact/view/case", 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' . $row['civicrm_case_id'], $this->_absoluteUrl @@ -349,9 +343,7 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id $rows[$rowNum]['civicrm_case_id_hover'] = ts("Manage Case"); $entryFound = TRUE; } - if (array_key_exists('civicrm_case_subject', $row) && - CRM_Utils_Array::value('civicrm_c2_id', $rows[$rowNum]) - ) { + if (array_key_exists('civicrm_case_subject', $row) && !empty($rows[$rowNum]['civicrm_c2_id'])) { $url = CRM_Utils_System::url("civicrm/contact/view/case", 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' . $row['civicrm_case_id'], $this->_absoluteUrl diff --git a/CRM/Report/Form/Case/TimeSpent.php b/CRM/Report/Form/Case/TimeSpent.php index 9f92d61c8c..3448b04ffc 100644 --- a/CRM/Report/Form/Case/TimeSpent.php +++ b/CRM/Report/Form/Case/TimeSpent.php @@ -181,8 +181,7 @@ class CRM_Report_Form_Case_TimeSpent extends CRM_Report_Form { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { if (!empty($field['required']) || - (CRM_Utils_Array::value($fieldName, $this->_params['fields']) - && ((!$this->has_grouping) || !in_array($fieldName, array('case_id', 'subject', 'status_id'))) + (!empty($this->_params['fields'][$fieldName]) && ((!$this->has_grouping) || !in_array($fieldName, array('case_id', 'subject', 'status_id'))) ) ) { diff --git a/CRM/Report/Form/Contact/CurrentEmployer.php b/CRM/Report/Form/Contact/CurrentEmployer.php index 44b213486e..95760c35ce 100644 --- a/CRM/Report/Form/Contact/CurrentEmployer.php +++ b/CRM/Report/Form/Contact/CurrentEmployer.php @@ -206,9 +206,7 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); diff --git a/CRM/Report/Form/Contact/Detail.php b/CRM/Report/Form/Contact/Detail.php index f23ea602de..7b08391601 100644 --- a/CRM/Report/Form/Contact/Detail.php +++ b/CRM/Report/Form/Contact/Detail.php @@ -397,9 +397,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { //isolate the select clause compoenent wise if (in_array($table['alias'], $this->_component)) { $select[$table['alias']][] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; diff --git a/CRM/Report/Form/Contact/Log.php b/CRM/Report/Form/Contact/Log.php index f05615f11b..858829f66e 100644 --- a/CRM/Report/Form/Contact/Log.php +++ b/CRM/Report/Form/Contact/Log.php @@ -158,9 +158,7 @@ class CRM_Report_Form_Contact_Log extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php index d92004cc3a..22a5eca553 100644 --- a/CRM/Report/Form/Contact/Relationship.php +++ b/CRM/Report/Form/Contact/Relationship.php @@ -267,9 +267,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($fieldName == 'email_a') { $this->_emailField_a = TRUE; diff --git a/CRM/Report/Form/Contact/Summary.php b/CRM/Report/Form/Contact/Summary.php index a20a351526..0e30ab76a1 100644 --- a/CRM/Report/Form/Contact/Summary.php +++ b/CRM/Report/Form/Contact/Summary.php @@ -222,9 +222,7 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_email') { $this->_emailField = TRUE; } diff --git a/CRM/Report/Form/Contribute/Bookkeeping.php b/CRM/Report/Form/Contribute/Bookkeeping.php index f3e34cbd7d..fe2d65d638 100644 --- a/CRM/Report/Form/Contribute/Bookkeeping.php +++ b/CRM/Report/Form/Contribute/Bookkeeping.php @@ -305,9 +305,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { switch ($fieldName) { case 'credit_accounting_code' : $select[] = " CASE @@ -381,8 +379,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { // please note this will just add the order-by columns to select query, and not display in column-headers. // This is a solution to not throw fatal errors when there is a column in order-by, not present in select/display columns. foreach ($this->_orderByFields as $orderBy) { - if (!array_key_exists($orderBy['name'], $this->_params['fields']) - && !CRM_Utils_Array::value('section', $orderBy)) { + if (!array_key_exists($orderBy['name'], $this->_params['fields']) && empty($orderBy['section'])) { $this->_select .= ", {$orderBy['dbAlias']} as {$orderBy['tplField']}"; } } @@ -486,8 +483,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(); foreach ($rows as $rowNum => $row) { // convert display name to links - if (array_key_exists('civicrm_contact_sort_name', $row) && - CRM_Utils_Array::value('civicrm_contact_sort_name', $rows[$rowNum]) && + if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) && array_key_exists('civicrm_contact_id', $row) ) { $url = CRM_Utils_System::url('civicrm/contact/view', diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index d5a8c264ee..b2c4ca6afc 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -375,8 +375,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { // please note this will just add the order-by columns to select query, and not display in column-headers. // This is a solution to not throw fatal errors when there is a column in order-by, not present in select/display columns. foreach ($this->_orderByFields as $orderBy) { - if (!array_key_exists($orderBy['name'], $this->_params['fields']) - && !CRM_Utils_Array::value('section', $orderBy)) { + if (!array_key_exists($orderBy['name'], $this->_params['fields']) && empty($orderBy['section'])) { $this->_select .= ", {$orderBy['dbAlias']} as {$orderBy['tplField']}"; } } @@ -430,8 +429,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { {$this->_aliases['civicrm_email']}.is_primary = 1\n"; } // include contribution note - if (!empty($this->_params['fields']['contribution_note']) || - CRM_Utils_Array::value('note_value', $this->_params)) { + if (!empty($this->_params['fields']['contribution_note']) || !empty($this->_params['note_value'])) { $this->_from.= " LEFT JOIN civicrm_note {$this->_aliases['civicrm_note']} ON ( {$this->_aliases['civicrm_note']}.entity_table = 'civicrm_contribution' AND @@ -439,7 +437,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { } //for contribution batches if ($this->_allBatches && - (CRM_Utils_Array::value('batch_id', $this->_params['fields']) || !empty($this->_params['bid_value']))) { + (!empty($this->_params['fields']['batch_id']) || !empty($this->_params['bid_value']))) { $this->_from .= " LEFT JOIN civicrm_entity_financial_trxn tx ON (tx.entity_id = {$this->_aliases['civicrm_contribution']}.id AND tx.entity_table = 'civicrm_contribution') @@ -536,9 +534,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency"; $this->beginPostProcess(); - if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only' && - CRM_Utils_Array::value('soft_credit_type_id', $this->_params['fields']) - ) { + if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only' && !empty($this->_params['fields']['soft_credit_type_id'])) { unset($this->_params['fields']['soft_credit_type_id']); if (!empty($this->_params['soft_credit_type_id_value'])) { $this->_params['soft_credit_type_id_value'] = array(); @@ -666,8 +662,7 @@ UNION ALL // convert donor sort name to link - if (array_key_exists('civicrm_contact_sort_name', $row) && - CRM_Utils_Array::value('civicrm_contact_sort_name', $rows[$rowNum]) && + if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) && array_key_exists('civicrm_contact_id', $row) ) { $url = CRM_Utils_System::url("civicrm/contact/view", diff --git a/CRM/Report/Form/Contribute/History.php b/CRM/Report/Form/Contribute/History.php index da10eef143..7542ebaf9d 100644 --- a/CRM/Report/Form/Contribute/History.php +++ b/CRM/Report/Form/Contribute/History.php @@ -281,9 +281,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } @@ -306,11 +304,8 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { continue; } elseif ($fieldName == 'receive_date') { - if ((CRM_Utils_Array::value('this_year_op', $this->_params) == 'fiscal' && - CRM_Utils_Array::value('this_year_value', $this->_params)) || - (CRM_Utils_Array::value('other_year_op', $this->_params == 'fiscal') && - CRM_Utils_Array::value('other_year_value', $this->_params) - )){ + if ((CRM_Utils_Array::value('this_year_op', $this->_params) == 'fiscal' && !empty($this->_params['this_year_value'])) || + (CRM_Utils_Array::value('other_year_op', $this->_params == 'fiscal') && !empty($this->_params['other_year_value']))){ $select[] = self::fiscalYearOffset($field['dbAlias']) . " as {$tableName}_{$fieldName}"; }else{ $select[] = " YEAR(".$field['dbAlias'].")" . " as {$tableName}_{$fieldName}"; @@ -477,8 +472,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { static function formRule($fields, $files, $self) { $errors = array(); - if (!empty($fields['this_year_value']) && - CRM_Utils_Array::value('other_year_value', $fields) && + if (!empty($fields['this_year_value']) && !empty($fields['other_year_value']) && ($fields['this_year_value'] == $fields['other_year_value']) ) { $errors['other_year_value'] = ts("Value for filters 'This Year' and 'Other Years' can not be same."); @@ -731,9 +725,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { } // Convert Display name into link - if (!empty($row['civicrm_contact_sort_name']) && - CRM_Utils_Array::value('civicrm_contact_id', $row) - ) { + if (!empty($row['civicrm_contact_sort_name']) && !empty($row['civicrm_contact_id'])) { $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail', 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'], $this->_absoluteUrl, $this->_id diff --git a/CRM/Report/Form/Contribute/HouseholdSummary.php b/CRM/Report/Form/Contribute/HouseholdSummary.php index d403172742..163184477b 100644 --- a/CRM/Report/Form/Contribute/HouseholdSummary.php +++ b/CRM/Report/Form/Contribute/HouseholdSummary.php @@ -220,9 +220,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } diff --git a/CRM/Report/Form/Contribute/Lybunt.php b/CRM/Report/Form/Contribute/Lybunt.php index 990c4f411f..222e78be72 100644 --- a/CRM/Report/Form/Contribute/Lybunt.php +++ b/CRM/Report/Form/Contribute/Lybunt.php @@ -224,9 +224,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($fieldName == 'total_amount') { $select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}"; @@ -385,7 +383,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { $this->setPager(); } - if (!empty($contactIds) || CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($contactIds) || !empty($this->_params['charts'])) { if (!empty($this->_params['charts'])) { $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}"; } diff --git a/CRM/Report/Form/Contribute/OrganizationSummary.php b/CRM/Report/Form/Contribute/OrganizationSummary.php index 4ede8517b0..d3f9d05154 100644 --- a/CRM/Report/Form/Contribute/OrganizationSummary.php +++ b/CRM/Report/Form/Contribute/OrganizationSummary.php @@ -221,9 +221,7 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } @@ -449,10 +447,8 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { } // convert Organization display name to links - if (array_key_exists('civicrm_contact_organization_organization_name', $row) && - CRM_Utils_Array::value('civicrm_contact_organization_organization_name', - $rows[$rowNum] - ) && + if (array_key_exists('civicrm_contact_organization_organization_name', $row) && !empty($rows[$rowNum] +['civicrm_contact_organization_organization_name']) && array_key_exists('civicrm_contact_organization_id', $row) ) { $url = CRM_Utils_System::url('civicrm/contact/view', diff --git a/CRM/Report/Form/Contribute/Repeat.php b/CRM/Report/Form/Contribute/Repeat.php index 1e23eabf26..bb29ab17e3 100644 --- a/CRM/Report/Form/Contribute/Repeat.php +++ b/CRM/Report/Form/Contribute/Repeat.php @@ -281,9 +281,7 @@ contribution_civireport2.total_amount_sum as contribution2_total_amount_sum', foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if (isset($field['clause'])) { $select[] = $field['clause']; @@ -527,7 +525,7 @@ LEFT JOIN civicrm_temp_civireport_repeat2 {$this->_aliases['civicrm_contribution } } - if (!empty($fields['gid_value']) && CRM_Utils_Array::value('group_bys', $fields)) { + if (!empty($fields['gid_value']) && !empty($fields['group_bys'])) { if (!array_key_exists('id', $fields['group_bys'])) { $errors['gid_value'] = ts("Filter with Group only allow with group by Contact"); } diff --git a/CRM/Report/Form/Contribute/SoftCredit.php b/CRM/Report/Form/Contribute/SoftCredit.php index 5565a2deec..e0c6c853c9 100644 --- a/CRM/Report/Form/Contribute/SoftCredit.php +++ b/CRM/Report/Form/Contribute/SoftCredit.php @@ -281,9 +281,7 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { // include email column if set if ($tableName == 'civicrm_email') { diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index 2ebe975693..59d00fc0ee 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -363,9 +363,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { // only include statistics columns if set if (!empty($field['statistics'])) { @@ -436,8 +434,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { function from() { $softCreditJoin = "LEFT"; - if (!empty($this->_params['fields']['soft_amount']) && - !CRM_Utils_Array::value('total_amount', $this->_params['fields'])) { + if (!empty($this->_params['fields']['soft_amount']) && empty($this->_params['fields']['total_amount'])) { // if its only soft credit stats, use inner join $softCreditJoin = "INNER"; } @@ -482,9 +479,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { $this->assign('chartSupported', TRUE); } - if (!empty($table['group_bys'][$fieldName]['frequency']) && - CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) - ) { + if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) { $append = "YEAR({$field['dbAlias']}),"; if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]), @@ -654,11 +649,8 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_ foreach ($rows as $rowNum => $row) { // make count columns point to detail report - if (!empty($this->_params['group_bys']['receive_date']) && - CRM_Utils_Array::value('civicrm_contribution_receive_date_start', $row) && - CRM_Utils_Array::value('civicrm_contribution_receive_date_start', $row) && - CRM_Utils_Array::value('civicrm_contribution_receive_date_subtotal', $row) - ) { + if (!empty($this->_params['group_bys']['receive_date']) && !empty($row['civicrm_contribution_receive_date_start']) && + CRM_Utils_Array::value('civicrm_contribution_receive_date_start', $row) && !empty($row['civicrm_contribution_receive_date_subtotal'])) { $dateStart = CRM_Utils_Date::customFormat($row['civicrm_contribution_receive_date_start'], '%Y%m%d'); $endDate = new DateTime($dateStart); diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index d6b3111133..259943fa1f 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -221,9 +221,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($fieldName == 'total_amount') { $select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}"; @@ -384,7 +382,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { $this->setPager(); } - if (!empty($contactIds) || CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($contactIds) || !empty($this->_params['charts'])) { if (!empty($this->_params['charts'])) { $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}"; } diff --git a/CRM/Report/Form/Contribute/TopDonor.php b/CRM/Report/Form/Contribute/TopDonor.php index 108d3a7509..cca2b3e7e4 100644 --- a/CRM/Report/Form/Contribute/TopDonor.php +++ b/CRM/Report/Form/Contribute/TopDonor.php @@ -198,9 +198,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { // only include statistics columns if set if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { @@ -434,9 +432,7 @@ ORDER BY civicrm_contribution_total_amount_sum DESC $rows[$rowNum]['civicrm_donor_rank'] = $rank++; // convert display name to links if (array_key_exists('civicrm_contact_display_name', $row) && - array_key_exists('civicrm_contact_id', $row) && - CRM_Utils_Array::value('civicrm_contribution_currency', $row) - ) { + array_key_exists('civicrm_contact_id', $row) && !empty($row['civicrm_contribution_currency'])) { $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail', 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'] . "¤cy_value=" . $row['civicrm_contribution_currency'], $this->_absoluteUrl, $this->_id, $this->_drilldownReport diff --git a/CRM/Report/Form/Event/IncomeCountSummary.php b/CRM/Report/Form/Event/IncomeCountSummary.php index 5ec9785871..6dd84ce2e9 100644 --- a/CRM/Report/Form/Event/IncomeCountSummary.php +++ b/CRM/Report/Form/Event/IncomeCountSummary.php @@ -152,9 +152,7 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form_Event { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { diff --git a/CRM/Report/Form/Event/ParticipantListCount.php b/CRM/Report/Form/Event/ParticipantListCount.php index db21c59cc3..5215b31ef6 100644 --- a/CRM/Report/Form/Event/ParticipantListCount.php +++ b/CRM/Report/Form/Event/ParticipantListCount.php @@ -321,16 +321,14 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event { $this->_columnHeaders = array(); //add blank column at the Start - if (array_key_exists('options', $this->_params) && CRM_Utils_Array::value('blank_column_begin', $this->_params['options'])) { + if (array_key_exists('options', $this->_params) && !empty($this->_params['options']['blank_column_begin'])) { $select[] = " '' as blankColumnBegin"; $this->_columnHeaders['blankColumnBegin']['title'] = '_ _ _ _'; } foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php index 905f991fb9..20aa8213b4 100644 --- a/CRM/Report/Form/Event/ParticipantListing.php +++ b/CRM/Report/Form/Event/ParticipantListing.php @@ -418,8 +418,7 @@ GROUP BY cv.label $this->_columnHeaders = array(); //add blank column at the Start - if (array_key_exists('options', $this->_params) && - CRM_Utils_Array::value('blank_column_begin', $this->_params['options'])) { + if (array_key_exists('options', $this->_params) && !empty($this->_params['options']['blank_column_begin'])) { $select[] = " '' as blankColumnBegin"; $this->_columnHeaders['blankColumnBegin']['title'] = '_ _ _ _'; } @@ -429,9 +428,7 @@ GROUP BY cv.label } if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_contribution') { $this->_contribField = TRUE; } diff --git a/CRM/Report/Form/Event/Summary.php b/CRM/Report/Form/Event/Summary.php index 6559b2649e..2f30586ef4 100644 --- a/CRM/Report/Form/Event/Summary.php +++ b/CRM/Report/Form/Event/Summary.php @@ -111,9 +111,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form_Event { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; } } @@ -240,9 +238,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form_Event { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field); diff --git a/CRM/Report/Form/Extended.php b/CRM/Report/Form/Extended.php index 70b3949c40..298c8703c9 100644 --- a/CRM/Report/Form/Extended.php +++ b/CRM/Report/Form/Extended.php @@ -105,7 +105,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form { } function postProcess() { - if (!empty($this->_aclTable) && CRM_Utils_Array::value($this->_aclTable, $this->_aliases)) { + if (!empty($this->_aclTable) && !empty($this->_aliases[$this->_aclTable])) { $this->buildACLClause($this->_aliases[$this->_aclTable]); } parent::postProcess(); diff --git a/CRM/Report/Form/Grant/Detail.php b/CRM/Report/Form/Grant/Detail.php index 876ffd945f..219c53e18f 100644 --- a/CRM/Report/Form/Grant/Detail.php +++ b/CRM/Report/Form/Grant/Detail.php @@ -250,9 +250,7 @@ class CRM_Report_Form_Grant_Detail extends CRM_Report_Form { } if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; diff --git a/CRM/Report/Form/Grant/Statistics.php b/CRM/Report/Form/Grant/Statistics.php index 1e02807114..c06c01e519 100644 --- a/CRM/Report/Form/Grant/Statistics.php +++ b/CRM/Report/Form/Grant/Statistics.php @@ -248,9 +248,7 @@ class CRM_Report_Form_Grant_Statistics extends CRM_Report_Form { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; diff --git a/CRM/Report/Form/Mailing/Bounce.php b/CRM/Report/Form/Mailing/Bounce.php index 4c7e2ec687..ceb97ff1dc 100644 --- a/CRM/Report/Form/Mailing/Bounce.php +++ b/CRM/Report/Form/Mailing/Bounce.php @@ -221,9 +221,7 @@ class CRM_Report_Form_Mailing_Bounce extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_email') { $this->_emailField = TRUE; } diff --git a/CRM/Report/Form/Mailing/Clicks.php b/CRM/Report/Form/Mailing/Clicks.php index 7c787c286a..63ad86d35d 100644 --- a/CRM/Report/Form/Mailing/Clicks.php +++ b/CRM/Report/Form/Mailing/Clicks.php @@ -183,9 +183,7 @@ class CRM_Report_Form_Mailing_Clicks extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_email') { $this->_emailField = TRUE; } diff --git a/CRM/Report/Form/Mailing/Detail.php b/CRM/Report/Form/Mailing/Detail.php index 5678af385a..ae75540d9c 100644 --- a/CRM/Report/Form/Mailing/Detail.php +++ b/CRM/Report/Form/Mailing/Detail.php @@ -281,9 +281,7 @@ class CRM_Report_Form_Mailing_Detail extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if (in_array($fieldName, array( 'unsubscribe_id', 'optout_id', 'forward_id', 'reply_id'))) { $select[] = "IF({$field['dbAlias']} IS NULL, 'No', 'Yes') as {$tableName}_{$fieldName}"; diff --git a/CRM/Report/Form/Mailing/Opened.php b/CRM/Report/Form/Mailing/Opened.php index 2944c77c95..ef4ae1b3a9 100644 --- a/CRM/Report/Form/Mailing/Opened.php +++ b/CRM/Report/Form/Mailing/Opened.php @@ -174,9 +174,7 @@ class CRM_Report_Form_Mailing_Opened extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_email') { $this->_emailField = TRUE; } diff --git a/CRM/Report/Form/Mailing/Summary.php b/CRM/Report/Form/Mailing/Summary.php index 954bf40d04..8682fb7e4c 100644 --- a/CRM/Report/Form/Mailing/Summary.php +++ b/CRM/Report/Form/Mailing/Summary.php @@ -287,9 +287,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { # for statistics if (!empty($field['statistics'])) { diff --git a/CRM/Report/Form/Member/ContributionDetail.php b/CRM/Report/Form/Member/ContributionDetail.php index 4e650135fe..27bded09b0 100644 --- a/CRM/Report/Form/Member/ContributionDetail.php +++ b/CRM/Report/Form/Member/ContributionDetail.php @@ -427,9 +427,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } @@ -497,7 +495,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { "; //for premiums - if (!empty($this->_params['fields']['product_name']) || CRM_Utils_Array::value('product_option', $this->_params['fields'])) { + if (!empty($this->_params['fields']['product_name']) || !empty($this->_params['fields']['product_option'])) { $this->_from .= " LEFT JOIN civicrm_contribution_product {$this->_aliases['civicrm_contribution_product']} ON ({$this->_aliases['civicrm_contribution_product']}.contribution_id = {$this->_aliases['civicrm_contribution']}.id) @@ -527,7 +525,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { } //for contribution batches if ($this->_allBatches && - (CRM_Utils_Array::value('batch_id', $this->_params['fields']) || !empty($this->_params['bid_value']))) { + (!empty($this->_params['fields']['batch_id']) || !empty($this->_params['bid_value']))) { $this->_from .= " LEFT JOIN civicrm_entity_financial_trxn tx ON (tx.entity_id = {$this->_aliases['civicrm_contribution']}.id AND tx.entity_table = 'civicrm_contribution') @@ -593,7 +591,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { $this->_select .= ", {$section['dbAlias']} as {$alias}"; } - if ($applyLimit && !CRM_Utils_Array::value('charts', $this->_params)) { + if ($applyLimit && empty($this->_params['charts'])) { $this->limit(); } @@ -607,7 +605,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { function orderBy() { $this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id "; - if (!empty($this->_params['fields']['first_donation_date']) || CRM_Utils_Array::value('first_donation_amount', $this->_params['fields'])) { + if (!empty($this->_params['fields']['first_donation_date']) || !empty($this->_params['fields']['first_donation_amount'])) { $this->_orderBy .= ", {$this->_aliases['civicrm_contribution']}.receive_date"; } } @@ -661,7 +659,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['csv_display']) && CRM_Utils_Array::value('no_display', $field)) { + if (!empty($field['csv_display']) && !empty($field['no_display'])) { $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field); $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); } @@ -761,8 +759,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { } // convert donor sort name to link - if (array_key_exists('civicrm_contact_sort_name', $row) && - CRM_Utils_Array::value('civicrm_contact_sort_name', $rows[$rowNum]) && + if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) && array_key_exists('civicrm_contact_id', $row) ) { $url = CRM_Utils_System::url('civicrm/contact/view', diff --git a/CRM/Report/Form/Member/Detail.php b/CRM/Report/Form/Member/Detail.php index 6087588cb6..e42c0f463c 100644 --- a/CRM/Report/Form/Member/Detail.php +++ b/CRM/Report/Form/Member/Detail.php @@ -309,9 +309,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } diff --git a/CRM/Report/Form/Member/Lapse.php b/CRM/Report/Form/Member/Lapse.php index 0fd672c810..77916921ed 100644 --- a/CRM/Report/Form/Member/Lapse.php +++ b/CRM/Report/Form/Member/Lapse.php @@ -232,9 +232,7 @@ class CRM_Report_Form_Member_Lapse extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { // to include optional columns address ,email and phone only if checked if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; diff --git a/CRM/Report/Form/Member/Summary.php b/CRM/Report/Form/Member/Summary.php index 871fe7d776..202c21b67e 100644 --- a/CRM/Report/Form/Member/Summary.php +++ b/CRM/Report/Form/Member/Summary.php @@ -270,9 +270,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { // only include statistics columns if set if (!empty($field['statistics'])) { @@ -303,9 +301,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { } } elseif ($fieldName == 'membership_type_id') { - if (empty($this->_params['group_bys']['membership_type_id']) && - CRM_Utils_Array::value('join_date', $this->_params['group_bys']) - ) { + if (empty($this->_params['group_bys']['membership_type_id']) && !empty($this->_params['group_bys']['join_date'])) { $select[] = "GROUP_CONCAT(DISTINCT {$field['dbAlias']} ORDER BY {$field['dbAlias']} ) as {$tableName}_{$fieldName}"; } else { @@ -366,9 +362,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { if (!empty($field['chart'])) { $this->assign('chartSupported', TRUE); } - if (!empty($table['group_bys'][$fieldName]['frequency']) && - CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) - ) { + if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) { $append = "YEAR({$field['dbAlias']}),"; if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]), @@ -528,8 +522,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency $entryFound = FALSE; foreach ($rows as $rowNum => $row) { // make count columns point to detail report - if (!empty($this->_params['group_bys']['join_date']) && - CRM_Utils_Array::value('civicrm_membership_join_date_start', $row) && + if (!empty($this->_params['group_bys']['join_date']) && !empty($row['civicrm_membership_join_date_start']) && $row['civicrm_membership_join_date_start'] && $row['civicrm_membership_join_date_subtotal'] ) { diff --git a/CRM/Report/Form/Membership/Summary.php b/CRM/Report/Form/Membership/Summary.php index c7477ca115..a4e1bb1920 100644 --- a/CRM/Report/Form/Membership/Summary.php +++ b/CRM/Report/Form/Membership/Summary.php @@ -170,9 +170,7 @@ class CRM_Report_Form_Membership_Summary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { // to include optional columns address and email, only if checked if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; diff --git a/CRM/Report/Form/Pledge/Pbnp.php b/CRM/Report/Form/Pledge/Pbnp.php index 660bdaf490..9d71cf2109 100644 --- a/CRM/Report/Form/Pledge/Pbnp.php +++ b/CRM/Report/Form/Pledge/Pbnp.php @@ -214,9 +214,7 @@ class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { // to include optional columns address and email, only if checked if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; diff --git a/CRM/Report/Form/Pledge/Summary.php b/CRM/Report/Form/Pledge/Summary.php index e47fdd7b55..91118532f5 100644 --- a/CRM/Report/Form/Pledge/Summary.php +++ b/CRM/Report/Form/Pledge/Summary.php @@ -265,9 +265,7 @@ class CRM_Report_Form_Pledge_Summary extends CRM_Report_Form { $this->assign('chartSupported', TRUE); } - if (!empty($table['group_bys'][$fieldName]['frequency']) && - CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) - ) { + if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) { $append = "YEAR({$field['dbAlias']}),"; if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]), diff --git a/CRM/Report/Form/Walklist/Walklist.php b/CRM/Report/Form/Walklist/Walklist.php index d2c9a7e0a7..8813c65fc6 100644 --- a/CRM/Report/Form/Walklist/Walklist.php +++ b/CRM/Report/Form/Walklist/Walklist.php @@ -137,9 +137,7 @@ class CRM_Report_Form_Walklist_Walklist extends CRM_Report_Form { $this->_columnHeaders = array(); foreach ($this->_columns as $tableName => $table) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } diff --git a/CRM/SMS/Form/Upload.php b/CRM/SMS/Form/Upload.php index 3a9476bde5..a8d8422885 100644 --- a/CRM/SMS/Form/Upload.php +++ b/CRM/SMS/Form/Upload.php @@ -352,7 +352,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { } } } - if (!empty($params['saveTemplate']) && !CRM_Utils_Array::value('saveTemplateName', $params)) { + if (!empty($params['saveTemplate']) && empty($params['saveTemplateName'])) { $errors['saveTemplateName'] = ts('Please provide a Template Name.'); } } diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index 120917cdf6..e8e15465e0 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -678,9 +678,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form { $params = array('id' => $customField->custom_group_id); $customGroup = array(); CRM_Core_BAO_CustomGroup::retrieve($params, $customGroup); - if (($fieldType != CRM_Utils_Array::value('extends', $customGroup)) || - !CRM_Utils_Array::value('extends_entity_column_value', $customGroup) - ) { + if (($fieldType != CRM_Utils_Array::value('extends', $customGroup)) || empty($customGroup['extends_entity_column_value'])) { return $errors; } diff --git a/CRM/Upgrade/Incremental/php/FourTwo.php b/CRM/Upgrade/Incremental/php/FourTwo.php index 4d13d29594..07ac5fde6f 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -443,7 +443,7 @@ WHERE cpse.price_set_id IS NULL"; if (empty($optionValue)) return; } - elseif (empty($options['otherAmount']) && !CRM_Utils_Array::value('membership', $options)) { + elseif (empty($options['otherAmount']) && empty($options['membership'])) { //CRM-12273 //if options group, otherAmount, membersip is empty then return, contribution should be default price set return; diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php index ab11ee7f68..2339fd37bb 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php @@ -123,8 +123,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p if (array_key_exists('option_amount', $params) && array_key_exists($index, $params['option_amount']) && - (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || - CRM_Utils_Array::value('is_quick_config', $params)) && + (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || !empty($params['is_quick_config'])) && !CRM_Utils_System::isNull($params['option_amount'][$index]) ) { $options = array( @@ -241,7 +240,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p $currencyName = $config->defaultCurrency; if (!isset($label)) { - $label = (property_exists($qf,'_membershipBlock') && CRM_Utils_Array::value('is_separate_payment', $qf->_membershipBlock) && $field->name == 'contribution_amount' && !CRM_Utils_Array::value('is_allow_other_amount', $otherAmount)) ? ts('Additional Contribution') : $field->label; + $label = (property_exists($qf,'_membershipBlock') && !empty($qf->_membershipBlock['is_separate_payment']) && $field->name == 'contribution_amount' && empty($otherAmount['is_allow_other_amount'])) ? ts('Additional Contribution') : $field->label; } if ($field->name == 'contribution_amount') { @@ -274,7 +273,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p } // if seperate membership payment is used with quick config priceset then change the other amount label - if (property_exists($qf,'_membershipBlock') && CRM_Utils_Array::value('is_separate_payment', $qf->_membershipBlock) && $qf->_quickConfig && $field->name == 'other_amount' && !property_exists($qf,'_contributionAmount')) { + if (property_exists($qf,'_membershipBlock') && !empty($qf->_membershipBlock['is_separate_payment']) && $qf->_quickConfig && $field->name == 'other_amount' && !property_exists($qf,'_contributionAmount')) { $label = ts('Additional Contribution'); $useRequired = 0; } elseif (!empty($fieldOptions[$optionKey]['label'])) { //check for label. @@ -347,7 +346,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p } } - if (property_exists($qf, '_membershipBlock') && CRM_Utils_Array::value('is_separate_payment', $qf->_membershipBlock) && $field->name == 'contribution_amount') { + if (property_exists($qf, '_membershipBlock') && !empty($qf->_membershipBlock['is_separate_payment']) && $field->name == 'contribution_amount') { $choice[] = $qf->createElement('radio', NULL, '', 'No thank you', '-1', array( 'onclick' => 'clearAmountOther();', @@ -359,7 +358,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p // add "none" option if (!empty($otherAmount['is_allow_other_amount']) && $field->name == 'contribution_amount') { $none = ts('Other Amount'); - } elseif (property_exists($qf, '_membershipBlock') && !CRM_Utils_Array::value('is_required', $qf->_membershipBlock) && $field->name == 'membership_amount') { + } elseif (property_exists($qf, '_membershipBlock') && empty($qf->_membershipBlock['is_required']) && $field->name == 'membership_amount') { $none = ts('No thank you'); } else { $none = ts('-none-'); diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php index 0db307c695..f63ad3743f 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php @@ -831,7 +831,7 @@ if (!isset($_contact_memberships[$userid][$value['membership_type_id']])) { $_contact_memberships[$userid][$value['membership_type_id']] = CRM_Member_BAO_Membership::getContactMembership($userid, $value['membership_type_id'], FALSE); } $currentMembership = $_contact_memberships[$userid][$value['membership_type_id']]; -if (!empty($currentMembership) && !CRM_Utils_Array::value('end_date', $currentMembership)) { +if (!empty($currentMembership) && empty($currentMembership['end_date'])) { unset($options[$key]); $checklifetime = TRUE; } diff --git a/CRM/Utils/Address/BatchUpdate.php b/CRM/Utils/Address/BatchUpdate.php index 7d73c323cb..4d8811e42f 100644 --- a/CRM/Utils/Address/BatchUpdate.php +++ b/CRM/Utils/Address/BatchUpdate.php @@ -211,9 +211,7 @@ class CRM_Utils_Address_BatchUpdate { $success = TRUE; // consider address is automatically parseable, // when we should found street_number and street_name - if (empty($parsedFields['street_name']) || - !CRM_Utils_Array::value('street_number', $parsedFields) - ) { + if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) { $success = FALSE; } diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 17bdae1d4b..84d488674e 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -1355,7 +1355,7 @@ function _civicrm_api3_deprecated_contact_check_params( } } - if (empty($params['contact_id']) && CRM_Utils_Array::value('id', $params)) { + if (empty($params['contact_id']) && !empty($params['id'])) { $valid = FALSE; $error = ''; foreach ($fields as $field) { diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index b45a48359c..877da59912 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -72,9 +72,7 @@ class CRM_Utils_Mail { CRM_Utils_Hook::alterMailParams($params); // check if any module has aborted mail sending - if (!empty($params['abortMailSend']) || - !CRM_Utils_Array::value('toEmail', $params) - ) { + if (!empty($params['abortMailSend']) || empty($params['toEmail'])) { return FALSE; } diff --git a/CRM/Utils/Rule.php b/CRM/Utils/Rule.php index 5f81e2cb91..89ee771865 100644 --- a/CRM/Utils/Rule.php +++ b/CRM/Utils/Rule.php @@ -175,7 +175,7 @@ class CRM_Utils_Rule { } // CRM-9017 CiviContribute/CiviMember form with expiration date format 'm Y' - if (!$m && CRM_Utils_Array::value('m', $date)) { + if (!$m && !empty($date['m'])) { $m = CRM_Utils_Array::value('m', $date); } diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index 19201c9442..2a679152bb 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -230,9 +230,7 @@ class CRM_Utils_Token { ) { $key = 'domain'; if ( - !$knownTokens || - !CRM_Utils_Array::value($key, $knownTokens) - ) { + !$knownTokens || empty($knownTokens[$key])) { return $str; } @@ -519,7 +517,7 @@ class CRM_Utils_Token { // so that we remove anything we do not recognize // I hope to move this step out of here soon and // then we will just iterate on a list of tokens that are passed to us - if (!$knownTokens || !CRM_Utils_Array::value($key, $knownTokens)) { + if (!$knownTokens || empty($knownTokens[$key])) { return $str; } @@ -607,7 +605,7 @@ class CRM_Utils_Token { // so that we remove anything we do not recognize // I hope to move this step out of here soon and // then we will just iterate on a list of tokens that are passed to us - if (!$knownTokens || !CRM_Utils_Array::value($key, $knownTokens)) { + if (!$knownTokens || empty($knownTokens[$key])) { return $str; } @@ -1367,7 +1365,7 @@ class CRM_Utils_Token { * @return string string with replacements made */ public static function replaceEntityTokens($entity, $entityArray, $str, $knownTokens = array(), $escapeSmarty = FALSE) { - if (!$knownTokens || !CRM_Utils_Array::value($entity, $knownTokens)) { + if (!$knownTokens || empty($knownTokens[$entity])) { return $str; } @@ -1389,7 +1387,7 @@ class CRM_Utils_Token { // I hope to move this step out of here soon and // then we will just iterate on a list of tokens that are passed to us $key = 'contribution'; - if (!$knownTokens || !CRM_Utils_Array::value($key, $knownTokens)) { + if (!$knownTokens || empty($knownTokens[$key])) { return $str; } diff --git a/api/v3/Activity.php b/api/v3/Activity.php index 99a6ca2cf9..96b40dd26a 100644 --- a/api/v3/Activity.php +++ b/api/v3/Activity.php @@ -408,9 +408,7 @@ SELECT count(*) //if adding a new activity & date_time not set make it now // this should be managed by the wrapper layer & setting ['api.default'] in speces // needs testing - if (empty($params['id']) && - !CRM_Utils_Array::value('activity_date_time', $params) - ) { + if (empty($params['id']) && empty($params['activity_date_time'])) { $params['activity_date_time'] = CRM_Utils_Date::processDate(date('Y-m-d H:i:s')); } diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 7ba429de30..1aac290b2f 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -307,7 +307,7 @@ function _civicrm_api3_contact_check_params( &$params, $dupeCheck = true, $dupeE $params['preferred_communication_method'] = CRM_Utils_Array::implodePadded($params['preferred_communication_method']); } - if (!empty($params['contact_sub_type']) && CRM_Utils_Array::value('contact_type', $params)) { + if (!empty($params['contact_sub_type']) && !empty($params['contact_type'])) { if (!(CRM_Contact_BAO_ContactType::isExtendsContactType($params['contact_sub_type'], $params['contact_type']))) { throw new API_Exception("Invalid or Mismatched Contact SubType: " . implode(', ', (array)$params['contact_sub_type'])); } @@ -534,7 +534,7 @@ function civicrm_api3_contact_getquick($params) { $list = array(); foreach ($acpref as $value) { - if ($value && CRM_Utils_Array::value($value, $acOptions)) { + if ($value && !empty($acOptions[$value])) { $list[$value] = $acOptions[$value]; } } diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 0bc5a5fec5..eb2ffc7d71 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -60,7 +60,7 @@ function civicrm_api3_contribution_create(&$params) { 'amount' => $params['total_amount'])); } - if (!empty($params['id']) && CRM_Utils_Array::value('contribution_status_id', $params)) { + if (!empty($params['id']) && !empty($params['contribution_status_id'])) { $error = array(); //throw error for invalid status change such as setting completed back to pending //@todo this sort of validation belongs in the BAO not the API - if it is not an OK diff --git a/api/v3/Participant.php b/api/v3/Participant.php index d552f8175f..aa1daa8af1 100644 --- a/api/v3/Participant.php +++ b/api/v3/Participant.php @@ -69,7 +69,7 @@ function civicrm_api3_participant_create($params) { $participantBAO = CRM_Event_BAO_Participant::create($params); - if(empty($params['price_set_id']) && empty($params['id']) && CRM_Utils_Array::value('fee_level', $params)){ + if(empty($params['price_set_id']) && empty($params['id']) && !empty($params['fee_level'])){ _civicrm_api3_participant_createlineitem($params, $participantBAO); } _civicrm_api3_object_to_array($participantBAO, $participant[$participantBAO->id]); diff --git a/api/v3/PledgePayment.php b/api/v3/PledgePayment.php index 122b22c2de..c638cb6406 100644 --- a/api/v3/PledgePayment.php +++ b/api/v3/PledgePayment.php @@ -56,7 +56,7 @@ function civicrm_api3_pledge_payment_create($params) { $paymentParams = $params; - if (empty($params['id']) && !CRM_Utils_Array::value('option.create_new', $params)) { + if (empty($params['id']) && empty($params['option.create_new'])) { $paymentDetails = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($params['pledge_id']); if (empty($paymentDetails)) { return civicrm_api3_create_error("There are no unmatched payment on this pledge. Pass in the pledge_payment id to specify one or 'option.create_new' to create one"); diff --git a/api/v3/utils.php b/api/v3/utils.php index c65a2850f3..0f489960cd 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -161,7 +161,7 @@ function civicrm_api3_create_error($msg, $data = array(), &$dao = NULL) { if(isset($data['sql']) && CRM_Core_Permission::check('Administer CiviCRM')) { $data['debug_information'] = $data['sql']; } - if (is_array($dao) && isset($dao['params']) && is_array($dao['params']) && CRM_Utils_Array::value('api.has_parent', $dao['params'])) { + if (is_array($dao) && isset($dao['params']) && is_array($dao['params']) && !empty($dao['params']['api.has_parent'])) { $errorCode = empty($data['error_code']) ? 'chained_api_failed' : $data['error_code']; throw new API_Exception('Error in call to ' . $dao['entity'] . '_' . $dao['action'] . ' : ' . $msg, $errorCode, $data); } @@ -777,7 +777,7 @@ function _civicrm_api3_get_unique_name_array(&$bao) { */ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $entity = "") { $result = array(); - if(isset($params['options']) && CRM_Utils_Array::value('is_count', $params['options'])) { + if(isset($params['options']) && !empty($params['options']['is_count'])) { return $dao->count(); } if (empty($dao) || !$dao->find()) { @@ -788,7 +788,7 @@ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, return $dao->count; } //if custom fields are required we will endeavour to set them . NB passing $entity in might be a bit clunky / unrequired - if (!empty($entity) && CRM_Utils_Array::value('return', $params) && is_array($params['return'])) { + if (!empty($entity) && !empty($params['return']) && is_array($params['return'])) { foreach ($params['return'] as $return) { if (substr($return, 0, 6) == 'custom') { $custom = TRUE; @@ -1236,7 +1236,7 @@ function _civicrm_api3_validate_date(&$params, &$fieldName, &$fieldInfo) { } $params[$fieldInfo['name']] = CRM_Utils_Date::processDate($params[$fieldInfo['name']]); } - if ((CRM_Utils_Array::value('name', $fieldInfo) != $fieldName) && CRM_Utils_Array::value($fieldName, $params)) { + if ((CRM_Utils_Array::value('name', $fieldInfo) != $fieldName) && !empty($params[$fieldName])) { //If the unique field name differs from the db name & is set handle it here if (strtotime($params[$fieldName]) === FALSE) { throw new Exception($fieldName . " is not a valid date: " . $params[$fieldName]); @@ -1532,9 +1532,7 @@ function _civicrm_api3_swap_out_aliases(&$apiRequest, $fields) { } } } - if (!isset($apiRequest['params'][$field]) - && CRM_Utils_Array::value('name', $values) - && $field != $values['name'] + if (!isset($apiRequest['params'][$field]) && !empty($values['name']) && $field != $values['name'] && isset($apiRequest['params'][$values['name']]) ) { $apiRequest['params'][$field] = $apiRequest['params'][$values['name']]; @@ -1588,9 +1586,7 @@ function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $ent } // Check our field length - if(is_string($params[$fieldName]) && - CRM_Utils_Array::value('maxlength',$fieldInfo) - && strlen($params[$fieldName]) > $fieldInfo['maxlength'] + if(is_string($params[$fieldName]) && !empty($fieldInfo['maxlength']) && strlen($params[$fieldName]) > $fieldInfo['maxlength'] ){ throw new API_Exception( $params[$fieldName] . " is " . strlen($params[$fieldName]) . " characters - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters', 2100, array('field' => $fieldName, "max_length"=>$fieldInfo['maxlength']) diff --git a/bin/deprecated/UpdateAddress.php b/bin/deprecated/UpdateAddress.php index 3c1b139adc..6f9d8b9fbf 100644 --- a/bin/deprecated/UpdateAddress.php +++ b/bin/deprecated/UpdateAddress.php @@ -224,9 +224,7 @@ WHERE {$whereClause} $success = TRUE; // consider address is automatically parseable, // when we should found street_number and street_name - if (empty($parsedFields['street_name']) || - !CRM_Utils_Array::value('street_number', $parsedFields) - ) { + if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) { $success = FALSE; } diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 119b05db8d..be51c1cb67 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -910,9 +910,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { */ private function _contactCreate($params) { $result = $this->callAPISuccess('contact', 'create', $params); - if (!empty($result['is_error']) || - !CRM_Utils_Array::value('id', $result) - ) { + if (!empty($result['is_error']) || empty($result['id'])) { throw new Exception('Could not create test contact, with message: ' . CRM_Utils_Array::value('error_message', $result) . "\nBacktrace:" . CRM_Utils_Array::value('trace', $result)); } return $result['id']; diff --git a/tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php b/tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php index dc008e1642..6ed3cc63c0 100755 --- a/tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php +++ b/tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php @@ -316,9 +316,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } @@ -583,8 +581,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form { } // convert display name to links - if (array_key_exists('civicrm_contact_display_name', $row) && - CRM_Utils_Array::value('civicrm_contact_display_name', $rows[$rowNum]) && + if (array_key_exists('civicrm_contact_display_name', $row) && !empty($rows[$rowNum]['civicrm_contact_display_name']) && array_key_exists('civicrm_contact_id', $row) ) { $url = CRM_Utils_System::url("civicrm/contact/view", @@ -596,8 +593,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form { } // convert soft credit id to link - if (array_key_exists('soft_credit_display_name', $row) && - CRM_Utils_Array::value('soft_credit_display_name', $rows[$rowNum]) && + if (array_key_exists('soft_credit_display_name', $row) && !empty($rows[$rowNum]['soft_credit_display_name']) && array_key_exists('id', $row) ) { $url = CRM_Utils_System::url("civicrm/contact/view", @@ -609,8 +605,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form { } // convert hon/mem contact to link - if (array_key_exists('civicrm_contact_hon_mem_display_name', $row) && - CRM_Utils_Array::value('civicrm_contribution_honor_contact_id', $rows[$rowNum]) && + if (array_key_exists('civicrm_contact_hon_mem_display_name', $row) && !empty($rows[$rowNum]['civicrm_contribution_honor_contact_id']) && array_key_exists('civicrm_contribution_honor_contact_id', $row) ) { $url = CRM_Utils_System::url("civicrm/contact/view", @@ -622,9 +617,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form { } // honor of/memory of type - if ($value = CRM_Utils_Array::value('civicrm_contribution_honor_type_id', $row) && - CRM_Utils_Array::value('civicrm_contribution_honor_type_id', $rows[$rowNum]) - ) { + if ($value = CRM_Utils_Array::value('civicrm_contribution_honor_type_id', $row) && !empty($rows[$rowNum]['civicrm_contribution_honor_type_id'])) { // rather than do a join, just change the output here, since there these values are pretty static diff --git a/tools/extensions/org.civicrm.report.grant/Grant.php b/tools/extensions/org.civicrm.report.grant/Grant.php index b8d40be8e9..a4ad27669e 100644 --- a/tools/extensions/org.civicrm.report.grant/Grant.php +++ b/tools/extensions/org.civicrm.report.grant/Grant.php @@ -216,9 +216,7 @@ class org_civicrm_report_grant extends CRM_Report_Form { } if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || - CRM_Utils_Array::value($fieldName, $this->_params['fields']) - ) { + if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; -- 2.25.1