From a74880802265c949ef3284b795d320396966629f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 21 Jan 2014 21:25:13 -0800 Subject: [PATCH] CRM-14106 - Regex targeting the first part of if statements Pattern used if\s*\(\s*CRM_Utils_Array::value\s*\([ ]*(['"$0-9][^,]*),\s*(\$[^ )]*)\s*\)\s*(\&\&|\|\||\)) if \(!empty\($2\[$1\]\)$3 --- CRM/ACL/Page/ACLBasic.php | 2 +- CRM/Activity/BAO/Activity.php | 46 ++++---- CRM/Activity/BAO/Query.php | 32 +++--- CRM/Activity/Form/Activity.php | 32 +++--- CRM/Activity/Form/ActivityView.php | 2 +- CRM/Activity/Form/Task/AddToTag.php | 4 +- CRM/Activity/Form/Task/Batch.php | 16 +-- CRM/Activity/Form/Task/RemoveFromTag.php | 4 +- CRM/Activity/Import/Form/MapField.php | 8 +- CRM/Activity/Import/Form/Preview.php | 4 +- CRM/Activity/Import/Parser/Activity.php | 10 +- CRM/Activity/Page/AJAX.php | 2 +- CRM/Activity/Selector/Activity.php | 2 +- CRM/Activity/StateMachine/Search.php | 2 +- CRM/Admin/Form.php | 2 +- CRM/Admin/Form/Job.php | 2 +- CRM/Admin/Form/MessageTemplates.php | 2 +- CRM/Admin/Form/Navigation.php | 2 +- CRM/Admin/Form/OptionGroup.php | 2 +- CRM/Admin/Form/OptionValue.php | 6 +- CRM/Admin/Form/Options.php | 4 +- CRM/Admin/Form/ParticipantStatus.php | 2 +- CRM/Admin/Form/PaymentProcessor.php | 4 +- CRM/Admin/Form/PaymentProcessorType.php | 4 +- CRM/Admin/Form/Preferences.php | 2 +- CRM/Admin/Form/Preferences/Display.php | 2 +- CRM/Admin/Form/Preferences/Mailing.php | 2 +- CRM/Admin/Form/RelationshipType.php | 4 +- CRM/Admin/Form/ScheduleReminders.php | 16 +-- CRM/Admin/Form/Setting.php | 8 +- CRM/Admin/Form/Setting/Localization.php | 4 +- CRM/Admin/Form/Setting/Smtp.php | 10 +- .../Form/Setting/UpdateConfigBackend.php | 2 +- CRM/Admin/Form/WordReplacements.php | 6 +- CRM/Admin/Page/ContactType.php | 4 +- CRM/Admin/Page/LabelFormats.php | 2 +- CRM/Badge/BAO/Badge.php | 24 ++-- CRM/Batch/BAO/Batch.php | 8 +- CRM/Batch/Form/Entry.php | 46 ++++---- CRM/Campaign/BAO/Campaign.php | 22 ++-- CRM/Campaign/BAO/Petition.php | 8 +- CRM/Campaign/BAO/Survey.php | 14 +-- CRM/Campaign/Form/Campaign.php | 2 +- CRM/Campaign/Form/Petition.php | 6 +- CRM/Campaign/Form/Search.php | 4 +- CRM/Campaign/Form/Survey/Main.php | 6 +- CRM/Campaign/Form/Survey/Results.php | 12 +- CRM/Campaign/Form/Task/Interview.php | 6 +- CRM/Campaign/Form/Task/Reserve.php | 2 +- CRM/Campaign/Page/AJAX.php | 20 ++-- CRM/Campaign/Page/DashBoard.php | 6 +- CRM/Campaign/StateMachine/Search.php | 2 +- CRM/Case/BAO/Case.php | 30 ++--- CRM/Case/BAO/Query.php | 44 ++++---- CRM/Case/Form/Activity.php | 14 +-- .../Form/Activity/ChangeCaseStartDate.php | 2 +- CRM/Case/Form/Activity/ChangeCaseType.php | 2 +- CRM/Case/Form/Case.php | 9 +- CRM/Case/Form/CaseView.php | 4 +- CRM/Case/Form/Search.php | 4 +- CRM/Case/StateMachine/Search.php | 2 +- CRM/Case/XMLProcessor/Process.php | 4 +- CRM/Case/XMLProcessor/Report.php | 20 ++-- CRM/Contact/BAO/Contact.php | 28 ++--- CRM/Contact/BAO/Contact/Permission.php | 2 +- CRM/Contact/BAO/Contact/Utils.php | 6 +- CRM/Contact/BAO/ContactType.php | 6 +- CRM/Contact/BAO/Group.php | 24 ++-- CRM/Contact/BAO/GroupContact.php | 4 +- CRM/Contact/BAO/GroupOrganization.php | 8 +- CRM/Contact/BAO/Individual.php | 4 +- CRM/Contact/BAO/Query.php | 44 ++++---- CRM/Contact/BAO/Relationship.php | 12 +- CRM/Contact/BAO/RelationshipType.php | 10 +- CRM/Contact/BAO/SavedSearch.php | 6 +- CRM/Contact/Form/Contact.php | 36 +++--- CRM/Contact/Form/CustomData.php | 4 +- CRM/Contact/Form/DedupeFind.php | 2 +- CRM/Contact/Form/DedupeRules.php | 8 +- CRM/Contact/Form/Edit/Address.php | 10 +- CRM/Contact/Form/Edit/CustomData.php | 2 +- CRM/Contact/Form/Edit/Household.php | 2 +- CRM/Contact/Form/Edit/Organization.php | 2 +- CRM/Contact/Form/Inline/Address.php | 4 +- CRM/Contact/Form/Inline/Demographics.php | 2 +- CRM/Contact/Form/Inline/Email.php | 4 +- CRM/Contact/Form/Inline/IM.php | 4 +- CRM/Contact/Form/Inline/OpenID.php | 4 +- CRM/Contact/Form/Inline/Phone.php | 4 +- CRM/Contact/Form/Location.php | 2 +- CRM/Contact/Form/Merge.php | 4 +- CRM/Contact/Form/Relationship.php | 38 +++---- CRM/Contact/Form/Search.php | 4 +- CRM/Contact/Form/Search/Advanced.php | 4 +- CRM/Contact/Form/Search/Basic.php | 10 +- CRM/Contact/Form/Search/Builder.php | 4 +- CRM/Contact/Form/Search/Criteria.php | 2 +- .../Form/Search/Custom/ContribSYBNT.php | 2 +- .../Form/Search/Custom/MultipleValues.php | 4 +- CRM/Contact/Form/Search/Custom/Proximity.php | 4 +- CRM/Contact/Form/Task/AddToHousehold.php | 6 +- CRM/Contact/Form/Task/AddToOrganization.php | 2 +- CRM/Contact/Form/Task/AddToTag.php | 4 +- CRM/Contact/Form/Task/Batch.php | 4 +- CRM/Contact/Form/Task/EmailCommon.php | 11 +- CRM/Contact/Form/Task/Label.php | 16 +-- CRM/Contact/Form/Task/LabelCommon.php | 10 +- CRM/Contact/Form/Task/PDFLetterCommon.php | 14 +-- CRM/Contact/Form/Task/ProximityCommon.php | 6 +- CRM/Contact/Form/Task/RemoveFromTag.php | 4 +- CRM/Contact/Form/Task/SMSCommon.php | 15 ++- CRM/Contact/Import/Form/MapField.php | 12 +- CRM/Contact/Import/Form/Preview.php | 4 +- CRM/Contact/Import/Parser/Contact.php | 40 +++---- CRM/Contact/Page/AJAX.php | 18 +-- CRM/Contact/Page/Inline/Address.php | 2 +- .../Page/Inline/CommunicationPreferences.php | 2 +- CRM/Contact/Page/Inline/ContactInfo.php | 2 +- CRM/Contact/Page/Inline/Demographics.php | 2 +- CRM/Contact/Page/View/Summary.php | 15 ++- CRM/Contact/Page/View/UserDashBoard.php | 10 +- CRM/Contact/Page/View/Vcard.php | 24 ++-- CRM/Contact/Selector.php | 13 +-- CRM/Contribute/BAO/Contribution.php | 64 +++++------ CRM/Contribute/BAO/Contribution/Utils.php | 25 ++--- CRM/Contribute/BAO/ContributionPage.php | 16 +-- CRM/Contribute/BAO/ContributionRecur.php | 4 +- CRM/Contribute/BAO/Query.php | 30 ++--- CRM/Contribute/Form.php | 2 +- CRM/Contribute/Form/AbstractEditPayment.php | 4 +- CRM/Contribute/Form/AdditionalInfo.php | 28 ++--- CRM/Contribute/Form/AdditionalPayment.php | 20 ++-- CRM/Contribute/Form/Contribution.php | 55 +++++---- CRM/Contribute/Form/Contribution/Confirm.php | 62 +++++------ CRM/Contribute/Form/Contribution/Main.php | 72 ++++++------ CRM/Contribute/Form/Contribution/ThankYou.php | 6 +- CRM/Contribute/Form/ContributionBase.php | 10 +- CRM/Contribute/Form/ContributionPage.php | 10 +- .../Form/ContributionPage/Amount.php | 53 +++++---- .../Form/ContributionPage/Premium.php | 4 +- .../Form/ContributionPage/Settings.php | 11 +- .../Form/ContributionPage/ThankYou.php | 2 +- .../Form/ContributionPage/Widget.php | 6 +- CRM/Contribute/Form/ContributionView.php | 10 +- CRM/Contribute/Form/ManagePremiums.php | 2 +- CRM/Contribute/Form/Search.php | 5 +- CRM/Contribute/Form/SoftCredit.php | 8 +- CRM/Contribute/Form/Task/Batch.php | 12 +- CRM/Contribute/Form/UpdateBilling.php | 6 +- CRM/Contribute/Form/UpdateSubscription.php | 2 +- CRM/Contribute/Import/Form/MapField.php | 6 +- CRM/Contribute/Import/Parser/Contribution.php | 24 ++-- CRM/Contribute/Page/ContributionPage.php | 2 +- CRM/Contribute/Page/ContributionRecur.php | 4 +- CRM/Contribute/Selector/Search.php | 2 +- CRM/Contribute/StateMachine/Search.php | 2 +- CRM/Core/BAO/ActionSchedule.php | 2 +- CRM/Core/BAO/Address.php | 16 +-- CRM/Core/BAO/Block.php | 14 +-- CRM/Core/BAO/CMSUser.php | 2 +- CRM/Core/BAO/ConfigSetting.php | 2 +- CRM/Core/BAO/CustomField.php | 17 ++- CRM/Core/BAO/CustomGroup.php | 8 +- CRM/Core/BAO/CustomValueTable.php | 6 +- CRM/Core/BAO/Dashboard.php | 4 +- CRM/Core/BAO/Email.php | 2 +- CRM/Core/BAO/FinancialTrxn.php | 8 +- CRM/Core/BAO/Mapping.php | 14 +-- CRM/Core/BAO/Note.php | 2 +- CRM/Core/BAO/OptionValue.php | 6 +- CRM/Core/BAO/SchemaHandler.php | 20 ++-- CRM/Core/BAO/Setting.php | 2 +- CRM/Core/BAO/Tag.php | 2 +- CRM/Core/BAO/UFField.php | 4 +- CRM/Core/BAO/UFGroup.php | 24 ++-- CRM/Core/BAO/UFJoin.php | 2 +- CRM/Core/BAO/Website.php | 4 +- CRM/Core/Component.php | 6 +- CRM/Core/Controller.php | 4 +- CRM/Core/DAO.php | 8 +- CRM/Core/Form.php | 16 +-- CRM/Core/Form/Tag.php | 2 +- CRM/Core/Invoke.php | 4 +- CRM/Core/Menu.php | 2 +- CRM/Core/OptionValue.php | 8 +- CRM/Core/Page.php | 2 +- CRM/Core/Page/AJAX.php | 4 +- CRM/Core/Page/Basic.php | 8 +- CRM/Core/Payment/AuthorizeNet.php | 6 +- CRM/Core/Payment/BaseIPN.php | 38 +++---- CRM/Core/Payment/Google.php | 2 +- CRM/Core/Payment/GoogleIPN.php | 4 +- CRM/Core/Payment/PayPalImpl.php | 4 +- CRM/Core/Payment/ProcessorForm.php | 4 +- CRM/Core/SelectValues.php | 2 +- CRM/Core/Session.php | 2 +- CRM/Core/StateMachine.php | 2 +- CRM/Custom/Form/Field.php | 8 +- CRM/Custom/Form/Group.php | 6 +- CRM/Custom/Form/Option.php | 6 +- CRM/Custom/Form/Preview.php | 2 +- CRM/Custom/Import/Form/MapField.php | 8 +- CRM/Dedupe/Finder.php | 10 +- CRM/Dedupe/Merger.php | 16 +-- CRM/Event/BAO/Event.php | 25 ++--- CRM/Event/BAO/Participant.php | 26 ++--- CRM/Event/BAO/ParticipantStatusType.php | 4 +- CRM/Event/BAO/Query.php | 42 +++---- CRM/Event/Cart/Form/Checkout/Payment.php | 10 +- CRM/Event/Form/EventFees.php | 10 +- CRM/Event/Form/ManageEvent/EventInfo.php | 14 +-- CRM/Event/Form/ManageEvent/Fee.php | 36 +++--- CRM/Event/Form/ManageEvent/Location.php | 6 +- CRM/Event/Form/ManageEvent/Registration.php | 32 +++--- .../Form/ManageEvent/ScheduleReminders.php | 8 +- CRM/Event/Form/Participant.php | 57 +++++----- CRM/Event/Form/ParticipantView.php | 6 +- CRM/Event/Form/Registration.php | 34 +++--- .../Registration/AdditionalParticipant.php | 30 ++--- CRM/Event/Form/Registration/Confirm.php | 48 ++++---- .../Form/Registration/ParticipantConfirm.php | 2 +- CRM/Event/Form/Registration/Register.php | 50 ++++----- CRM/Event/Form/Registration/ThankYou.php | 2 +- CRM/Event/Form/Search.php | 4 +- CRM/Event/Form/SearchEvent.php | 2 +- CRM/Event/Form/Task/Batch.php | 10 +- CRM/Event/Import/Form/MapField.php | 6 +- CRM/Event/Import/Parser/Participant.php | 12 +- CRM/Event/Page/EventInfo.php | 4 +- CRM/Event/Selector/Search.php | 4 +- CRM/Event/StateMachine/Search.php | 2 +- CRM/Export/BAO/Export.php | 38 +++---- CRM/Export/Form/Map.php | 6 +- CRM/Financial/BAO/ExportFormat.php | 4 +- CRM/Financial/BAO/FinancialAccount.php | 2 +- CRM/Financial/BAO/FinancialItem.php | 6 +- CRM/Financial/BAO/FinancialType.php | 4 +- CRM/Financial/BAO/FinancialTypeAccount.php | 2 +- CRM/Financial/BAO/PaymentProcessor.php | 2 +- CRM/Financial/Form/FinancialBatch.php | 8 +- CRM/Financial/Form/FinancialTypeAccount.php | 4 +- CRM/Financial/Form/Search.php | 2 +- CRM/Financial/Page/FinancialType.php | 2 +- CRM/Friend/BAO/Friend.php | 6 +- CRM/Friend/Form.php | 2 +- CRM/Friend/Form/Event.php | 2 +- CRM/Grant/BAO/Grant.php | 10 +- CRM/Grant/BAO/Query.php | 10 +- CRM/Grant/Form/Grant.php | 8 +- CRM/Grant/StateMachine/Search.php | 2 +- CRM/Group/Form/Edit.php | 16 +-- CRM/Group/Page/AJAX.php | 2 +- CRM/Logging/Differ.php | 2 +- CRM/Logging/ReportSummary.php | 14 +-- CRM/Mailing/BAO/Mailing.php | 6 +- CRM/Mailing/BAO/Query.php | 18 +-- CRM/Mailing/Event/BAO/Forward.php | 2 +- CRM/Mailing/Form/Group.php | 2 +- CRM/Mailing/Form/Test.php | 10 +- CRM/Mailing/Form/Upload.php | 25 ++--- CRM/Member/BAO/Membership.php | 77 +++++++------ CRM/Member/BAO/MembershipStatus.php | 2 +- CRM/Member/BAO/MembershipType.php | 10 +- CRM/Member/BAO/Query.php | 26 ++--- CRM/Member/Form.php | 4 +- CRM/Member/Form/Membership.php | 104 +++++++++--------- CRM/Member/Form/MembershipBlock.php | 20 ++-- CRM/Member/Form/MembershipRenewal.php | 40 +++---- CRM/Member/Form/MembershipStatus.php | 2 +- CRM/Member/Form/MembershipType.php | 2 +- CRM/Member/Form/MembershipView.php | 5 +- CRM/Member/Form/Task/Batch.php | 10 +- CRM/Member/Import/Form/MapField.php | 12 +- CRM/Member/Import/Form/Preview.php | 4 +- CRM/Member/Import/Parser/Membership.php | 28 ++--- CRM/Member/Page/Tab.php | 4 +- CRM/Member/Page/UserDashboard.php | 2 +- CRM/Member/Selector/Search.php | 2 +- CRM/Member/StateMachine/Search.php | 2 +- CRM/PCP/BAO/PCP.php | 4 +- CRM/PCP/Form/Contribute.php | 8 +- CRM/PCP/Form/Event.php | 8 +- CRM/PCP/Page/PCP.php | 10 +- CRM/PCP/Page/PCPInfo.php | 2 +- CRM/Pledge/BAO/Pledge.php | 22 ++-- CRM/Pledge/BAO/PledgeBlock.php | 8 +- CRM/Pledge/BAO/PledgePayment.php | 4 +- CRM/Pledge/BAO/Query.php | 50 ++++----- CRM/Pledge/Form/Pledge.php | 12 +- CRM/Pledge/Form/PledgeView.php | 2 +- CRM/Pledge/Selector/Search.php | 2 +- CRM/Pledge/StateMachine/Search.php | 2 +- CRM/Price/BAO/LineItem.php | 4 +- CRM/Price/BAO/PriceField.php | 10 +- CRM/Price/BAO/PriceFieldValue.php | 6 +- CRM/Price/BAO/PriceSet.php | 4 +- CRM/Price/Form/Field.php | 6 +- CRM/Price/Form/Option.php | 2 +- CRM/Price/Form/Preview.php | 2 +- CRM/Price/Page/Option.php | 4 +- CRM/Profile/Form.php | 24 ++-- CRM/Profile/Form/Edit.php | 2 +- CRM/Profile/Page/Listings.php | 4 +- CRM/Profile/Selector/Listings.php | 8 +- CRM/Report/BAO/ReportInstance.php | 12 +- CRM/Report/Form.php | 61 +++++----- CRM/Report/Form/ActivitySummary.php | 24 ++-- CRM/Report/Form/Campaign/SurveyDetails.php | 12 +- CRM/Report/Form/Case/Demographics.php | 2 +- CRM/Report/Form/Case/Detail.php | 6 +- CRM/Report/Form/Case/Summary.php | 2 +- CRM/Report/Form/Case/TimeSpent.php | 2 +- CRM/Report/Form/Contact/CurrentEmployer.php | 4 +- CRM/Report/Form/Contact/Detail.php | 20 ++-- CRM/Report/Form/Contact/Log.php | 2 +- CRM/Report/Form/Contact/LoggingSummary.php | 4 +- CRM/Report/Form/Contact/Relationship.php | 8 +- CRM/Report/Form/Contact/Summary.php | 2 +- CRM/Report/Form/Contribute/Bookkeeping.php | 2 +- CRM/Report/Form/Contribute/Detail.php | 2 +- CRM/Report/Form/Contribute/History.php | 22 ++-- .../Form/Contribute/HouseholdSummary.php | 10 +- CRM/Report/Form/Contribute/Lybunt.php | 8 +- .../Form/Contribute/OrganizationSummary.php | 8 +- CRM/Report/Form/Contribute/PCP.php | 2 +- CRM/Report/Form/Contribute/Repeat.php | 10 +- CRM/Report/Form/Contribute/SoftCredit.php | 4 +- CRM/Report/Form/Contribute/Summary.php | 32 +++--- CRM/Report/Form/Contribute/Sybunt.php | 8 +- CRM/Report/Form/Contribute/TopDonor.php | 4 +- CRM/Report/Form/Event/IncomeCountSummary.php | 6 +- .../Form/Event/ParticipantListCount.php | 8 +- CRM/Report/Form/Event/ParticipantListing.php | 2 +- CRM/Report/Form/Event/Summary.php | 6 +- CRM/Report/Form/Grant/Detail.php | 6 +- CRM/Report/Form/Grant/Statistics.php | 10 +- CRM/Report/Form/Instance.php | 10 +- CRM/Report/Form/Mailing/Bounce.php | 6 +- CRM/Report/Form/Mailing/Clicks.php | 6 +- CRM/Report/Form/Mailing/Detail.php | 2 +- CRM/Report/Form/Mailing/Opened.php | 6 +- CRM/Report/Form/Mailing/Summary.php | 6 +- CRM/Report/Form/Member/ContributionDetail.php | 15 ++- CRM/Report/Form/Member/Detail.php | 4 +- CRM/Report/Form/Member/Lapse.php | 4 +- CRM/Report/Form/Member/Summary.php | 24 ++-- CRM/Report/Form/Membership/Summary.php | 8 +- CRM/Report/Form/Pledge/Pbnp.php | 2 +- CRM/Report/Form/Pledge/Summary.php | 8 +- CRM/Report/Form/Walklist/Walklist.php | 2 +- CRM/Report/Utils/Report.php | 2 +- CRM/SMS/Form/Group.php | 2 +- CRM/SMS/Form/Upload.php | 19 ++-- CRM/UF/Form/AbstractPreview.php | 2 +- CRM/UF/Form/Field.php | 2 +- CRM/UF/Form/Group.php | 2 +- CRM/UF/Page/Group.php | 2 +- CRM/Upgrade/Incremental/php/FourTwo.php | 14 +-- CRM/Upgrade/Incremental/php/ThreeFour.php | 2 +- CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php | 9 +- .../Snapshot/V4p2/Price/BAO/FieldValue.php | 6 +- CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php | 4 +- CRM/Upgrade/Snapshot/V4p2/Price/DAO/Field.php | 4 +- .../Snapshot/V4p2/Price/DAO/FieldValue.php | 4 +- .../Snapshot/V4p2/Price/DAO/LineItem.php | 4 +- CRM/Upgrade/Snapshot/V4p2/Price/DAO/Set.php | 4 +- .../Snapshot/V4p2/Price/DAO/SetEntity.php | 4 +- CRM/Utils/Address/BatchUpdate.php | 2 +- CRM/Utils/Date.php | 14 +-- CRM/Utils/DeprecatedUtils.php | 58 +++++----- CRM/Utils/Geocode/Google.php | 12 +- CRM/Utils/Geocode/Yahoo.php | 10 +- CRM/Utils/Mail.php | 11 +- CRM/Utils/OpenFlashChart.php | 10 +- CRM/Utils/REST.php | 4 +- CRM/Utils/Sort.php | 2 +- CRM/Utils/System.php | 8 +- CRM/Utils/System/Drupal.php | 4 +- CRM/Utils/System/Drupal6.php | 4 +- CRM/Utils/System/WordPress.php | 4 +- CRM/Utils/Token.php | 12 +- api/api.php | 16 +-- api/v3/ActionSchedule.php | 2 +- api/v3/Activity.php | 8 +- api/v3/Contact.php | 20 ++-- api/v3/Contribution.php | 2 +- api/v3/CustomValue.php | 4 +- api/v3/Dashboard.php | 4 +- api/v3/Domain.php | 2 +- api/v3/Event.php | 12 +- api/v3/Generic.php | 2 +- api/v3/Membership.php | 8 +- api/v3/MembershipStatus.php | 4 +- api/v3/Participant.php | 2 +- api/v3/ParticipantPayment.php | 2 +- api/v3/Profile.php | 2 +- api/v3/Relationship.php | 8 +- api/v3/Setting.php | 2 +- api/v3/utils.php | 22 ++-- bin/deprecated/ParticipantProcessor.php | 4 +- bin/deprecated/UpdateAddress.php | 2 +- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 4 +- tests/phpunit/CiviTest/CiviUnitTestCase.php | 4 +- .../Contribute/OfflineContributionTest.php | 2 +- tests/phpunit/api/v3/GrantTest.php | 2 +- .../phpunit/api/v3/SyntaxConformanceTest.php | 2 +- tools/CRM/Auction/BAO/Auction.php | 4 +- tools/CRM/Auction/BAO/Item.php | 4 +- tools/CRM/Auction/Form/SearchAuction.php | 2 +- .../Baykeeper.php | 8 +- .../org.civicrm.report.grant/Grant.php | 6 +- .../MultiValue.php | 4 +- 412 files changed, 2057 insertions(+), 2088 deletions(-) diff --git a/CRM/ACL/Page/ACLBasic.php b/CRM/ACL/Page/ACLBasic.php index 7c3334d83f..645ade3a90 100644 --- a/CRM/ACL/Page/ACLBasic.php +++ b/CRM/ACL/Page/ACLBasic.php @@ -180,7 +180,7 @@ ORDER BY entity_id $dao->entity_id ); } - elseif (CRM_Utils_Array::value($dao->object_table, $permissions)) { + elseif (!empty($permissions[$dao->object_table])) { $acl[$dao->entity_id]['object_table'] .= ", {$permissions[$dao->object_table]}"; } } diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index f8ff6340a6..b5e2878552 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -64,7 +64,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { * @access public */ public static function dataExists(&$params) { - if (CRM_Utils_Array::value('source_contact_id', $params) || + if (!empty($params['source_contact_id']) || CRM_Utils_Array::value('id', $params) ) { return TRUE; @@ -157,7 +157,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { */ public static function deleteActivity(&$params, $moveToTrash = FALSE) { // CRM-9137 - if (CRM_Utils_Array::value('id', $params) && !is_array($params['id'])) { + if (!empty($params['id']) && !is_array($params['id'])) { CRM_Utils_Hook::pre('delete', 'Activity', $params['id'], $params); } else { @@ -294,7 +294,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { unset($params['id']); } - if (!CRM_Utils_Array::value('status_id', $params) && + if (empty($params['status_id']) && !CRM_Utils_Array::value('activity_status_id', $params) && !CRM_Utils_Array::value('id', $params) ) { @@ -325,7 +325,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } // CRM-9137 - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Activity', $activity->id, $params); } else { @@ -373,7 +373,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { // attempt to save activity assignment $resultAssignment = NULL; - if (CRM_Utils_Array::value('assignee_contact_id', $params)) { + if (!empty($params['assignee_contact_id'])) { $assignmentParams = array('activity_id' => $activityId); @@ -399,7 +399,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { else { $assignmentParams['contact_id'] = $params['assignee_contact_id']; $assignmentParams['record_type_id'] = $assigneeID; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $assignment = new CRM_Activity_BAO_ActivityContact(); $assignment->activity_id = $activityId; $assignment->record_type_id = $assigneeID; @@ -428,7 +428,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { // attempt to save activity targets $resultTarget = NULL; - if (CRM_Utils_Array::value('target_contact_id', $params)) { + if (!empty($params['target_contact_id'])) { $targetParams = array('activity_id' => $activityId); $resultTarget = array(); @@ -455,7 +455,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { else { $targetParams['contact_id'] = $params['target_contact_id']; $targetParams['record_type_id'] = $targetID; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $target = new CRM_Activity_BAO_ActivityContact(); $target->activity_id = $activityId; $target->record_type_id = $targetID; @@ -479,7 +479,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { // write to changelog before transaction is committed/rolled // back (and prepare status to display) - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $logMsg = "Activity (id: {$result->id} ) updated with "; } else { @@ -491,7 +491,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $msgs[] = "source={$params['source_contact_id']}"; } - if (CRM_Utils_Array::value('target_contact_id', $params)) { + if (!empty($params['target_contact_id'])) { if (is_array($params['target_contact_id']) && !CRM_Utils_array::crmIsEmptyArray($params['target_contact_id'])) { $msgs[] = "target=" . implode(',', $params['target_contact_id']); // take only first target @@ -522,16 +522,16 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { self::logActivityAction($result, $logMsg); - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_activity', $result->id); } $transaction->commit(); - if (!CRM_Utils_Array::value('skipRecentView', $params)) { + if (empty($params['skipRecentView'])) { $recentOther = array(); - if (CRM_Utils_Array::value('case_id', $params)) { + if (!empty($params['case_id'])) { $caseContactID = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseContact', $params['case_id'], 'contact_id', 'case_id'); $url = CRM_Utils_System::url('civicrm/case/activity/view', "reset=1&aid={$activity->id}&cid={$caseContactID}&caseID={$params['case_id']}&context=home" @@ -580,7 +580,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } $title = $title . $recentContactDisplay; - if (CRM_Utils_Array::value($activity->activity_type_id, $activityTypes)) { + if (!empty($activityTypes[$activity->activity_type_id])) { $title .= ' (' . $activityTypes[$activity->activity_type_id] . ')'; } @@ -598,7 +598,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { // reset the group contact cache since smart groups might be affected due to this CRM_Contact_BAO_GroupContactCache::remove(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'Activity', $activity->id, $activity); } else { @@ -832,11 +832,11 @@ ORDER BY fixed_sort_order $values[$activityID]['campaign'] = $allCampaigns[$dao->campaign_id]; } - if (!CRM_Utils_Array::value('assignee_contact_name', $values[$activityID])) { + if (empty($values[$activityID]['assignee_contact_name'])) { $values[$activityID]['assignee_contact_name'] = array(); } - if (!CRM_Utils_Array::value('target_contact_name', $values[$activityID])) { + if (empty($values[$activityID]['target_contact_name'])) { $values[$activityID]['target_contact_name'] = array(); } @@ -890,7 +890,7 @@ ORDER BY fixed_sort_order $components = array(); $compInfo = CRM_Core_Component::getEnabledComponents(); foreach ($compInfo as $compObj) { - if (CRM_Utils_Array::value('showActivitiesInCore', $compObj->info)) { + if (!empty($compObj->info['showActivitiesInCore'])) { if ($compObj->info['name'] == 'CiviCampaign') { $componentPermission = "administer {$compObj->name}"; } @@ -1789,10 +1789,10 @@ SELECT display_name $status = CRM_Event_PseudoConstant::participantStatus(); $subject = $event[$activity->event_id]; - if (CRM_Utils_Array::value($activity->role_id, $roles)) { + if (!empty($roles[$activity->role_id])) { $subject .= ' - ' . $roles[$activity->role_id]; } - if (CRM_Utils_Array::value($activity->status_id, $status)) { + if (!empty($status[$activity->status_id])) { $subject .= ' - ' . $status[$activity->status_id]; } $date = date('YmdHis'); @@ -2026,7 +2026,7 @@ AND cl.modified_id = c.id $followupParams['assignee_contact_id'] = CRM_Utils_Array::value('followup_assignee_contact_id', $params); //create target contact for followup - if (CRM_Utils_Array::value('target_contact_id', $params)) { + if (!empty($params['target_contact_id'])) { $followupParams['target_contact_id'] = $params['target_contact_id']; } @@ -2437,7 +2437,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n 'civicrm/mailing/report/event', "mid={$values['source_record_id']}&reset=1&event=queue&cid={$params['contact_id']}&context=activitySelector"); } - elseif (CRM_Utils_Array::value('recipients', $values)) { + elseif (!empty($values['recipients'])) { $contactActivities[$activityId]['target_contact'] = $values['recipients']; } elseif (!$values['target_contact_name']) { @@ -2502,7 +2502,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n // build links $contactActivities[$activityId]['links'] = ''; $accessMailingReport = FALSE; - if (CRM_Utils_Array::value('mailingId', $values)) { + if (!empty($values['mailingId'])) { $accessMailingReport = TRUE; } diff --git a/CRM/Activity/BAO/Query.php b/CRM/Activity/BAO/Query.php index 38278d6b97..75ba22c180 100644 --- a/CRM/Activity/BAO/Query.php +++ b/CRM/Activity/BAO/Query.php @@ -42,13 +42,13 @@ class CRM_Activity_BAO_Query { * @access public */ static function select(&$query) { - if (CRM_Utils_Array::value('activity_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_id'])) { $query->_select['activity_id'] = "civicrm_activity.id as activity_id"; $query->_element['activity_id'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('activity_type_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_type_id'])) { $query->_select['activity_type_id'] = "activity_type.id as activity_type_id"; $query->_element['activity_type_id'] = 1; $query->_tables['civicrm_activity'] = 1; @@ -57,7 +57,7 @@ class CRM_Activity_BAO_Query { $query->_whereTables['activity_type'] = 1; } - if (CRM_Utils_Array::value('activity_type', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_type'])) { $query->_select['activity_type'] = "activity_type.label as activity_type"; $query->_element['activity_type'] = 1; $query->_tables['civicrm_activity'] = 1; @@ -66,19 +66,19 @@ class CRM_Activity_BAO_Query { $query->_whereTables['activity_type'] = 1; } - if (CRM_Utils_Array::value('activity_subject', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_subject'])) { $query->_select['activity_subject'] = "civicrm_activity.subject as activity_subject"; $query->_element['activity_subject'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('activity_date_time', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_date_time'])) { $query->_select['activity_date_time'] = "civicrm_activity.activity_date_time as activity_date_time"; $query->_element['activity_date_time'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('activity_status_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_status_id'])) { $query->_select['activity_status_id'] = "activity_status.value as activity_status_id"; $query->_element['activity_status_id'] = 1; $query->_tables['civicrm_activity'] = 1; @@ -87,7 +87,7 @@ class CRM_Activity_BAO_Query { $query->_whereTables['activity_status'] = 1; } - if (CRM_Utils_Array::value('activity_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_status'])) { $query->_select['activity_status'] = "activity_status.label as activity_status"; $query->_element['activity_status'] = 1; $query->_tables['civicrm_activity'] = 1; @@ -96,55 +96,55 @@ class CRM_Activity_BAO_Query { $query->_whereTables['activity_status'] = 1; } - if (CRM_Utils_Array::value('activity_duration', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_duration'])) { $query->_select['activity_duration'] = "civicrm_activity.duration as activity_duration"; $query->_element['activity_duration'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('activity_location', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_location'])) { $query->_select['activity_location'] = "civicrm_activity.location as activity_location"; $query->_element['activity_location'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('activity_details', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_details'])) { $query->_select['activity_details'] = "civicrm_activity.details as activity_details"; $query->_element['activity_details'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('source_record_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['source_record_id'])) { $query->_select['source_record_id'] = "civicrm_activity.source_record_id as source_record_id"; $query->_element['source_record_id'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('activity_is_test', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_is_test'])) { $query->_select['activity_is_test'] = "civicrm_activity.is_test as activity_is_test"; $query->_element['activity_is_test'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('activity_campaign_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_campaign_id'])) { $query->_select['activity_campaign_id'] = 'civicrm_activity.campaign_id as activity_campaign_id'; $query->_element['activity_campaign_id'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('activity_engagement_level', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_engagement_level'])) { $query->_select['activity_engagement_level'] = 'civicrm_activity.engagement_level as activity_engagement_level'; $query->_element['activity_engagement_level'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; } - if (CRM_Utils_Array::value('source_contact', $query->_returnProperties)) { + if (!empty($query->_returnProperties['source_contact'])) { $query->_select['source_contact'] = 'source_contact.sort_name as source_contact'; $query->_element['source_contact'] = 1; $query->_tables['source_contact'] = $query->_whereTables['source_contact'] = 1; } - if (CRM_Utils_Array::value('activity_result', $query->_returnProperties)) { + if (!empty($query->_returnProperties['activity_result'])) { $query->_select['activity_result'] = 'civicrm_activity.result as activity_result'; $query->_element['result'] = 1; $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1; diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 2a5a58d757..6f02353848 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -451,7 +451,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { // we need to set it in the session for the below code to work // CRM-3014 //need to assign custom data subtype to the template @@ -540,7 +540,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } - if (!CRM_Utils_Array::value('activity_date_time', $defaults)) { + if (empty($defaults['activity_date_time'])) { list($defaults['activity_date_time'], $defaults['activity_date_time_time']) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime'); } elseif ($this->_action & CRM_Core_Action::UPDATE) { @@ -613,11 +613,11 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $className = "CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}"; $defaults += $className::setDefaultValues($this); } - if (!CRM_Utils_Array::value('priority_id', $defaults)) { + if (empty($defaults['priority_id'])) { $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'); $defaults['priority_id'] = array_search('Normal', $priority); } - if (!CRM_Utils_Array::value('status_id', $defaults)) { + if (empty($defaults['status_id'])) { $defaults['status_id'] = CRM_Core_OptionGroup::getDefaultValue('activity_status'); } return $defaults; @@ -701,14 +701,14 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } foreach ($this->_fields as $field => $values) { - if (CRM_Utils_Array::value($field, $this->_fields)) { + if (!empty($this->_fields[$field])) { $attribute = NULL; - if (CRM_Utils_Array::value('attributes', $values)) { + if (!empty($values['attributes'])) { $attribute = $values['attributes']; } $required = FALSE; - if (CRM_Utils_Array::value('required', $values)) { + if (!empty($values['required'])) { $required = TRUE; } if ($values['type'] == 'wysiwyg') { @@ -960,7 +960,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $errors['status_id'] = ts('You cannot record scheduled SMS activity.'); } - if (CRM_Utils_Array::value('followup_activity_type_id', $fields) && !CRM_Utils_Array::value('followup_date', $fields)) { + if (!empty($fields['followup_activity_type_id']) && !CRM_Utils_Array::value('followup_date', $fields)) { $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 @@ -1003,11 +1003,11 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } //set activity type id - if (!CRM_Utils_Array::value('activity_type_id', $params)) { + if (empty($params['activity_type_id'])) { $params['activity_type_id'] = $this->_activityTypeId; } - if (CRM_Utils_Array::value('hidden_custom', $params) && + if (!empty($params['hidden_custom']) && !isset($params['custom']) ) { $customFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, @@ -1037,14 +1037,14 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } // assigning formated value to related variable - if (CRM_Utils_Array::value('assignee_contact_id', $params)) { + if (!empty($params['assignee_contact_id'])) { $params['assignee_contact_id'] = explode(',', $params['assignee_contact_id']); } else { $params['assignee_contact_id'] = array(); } // civicrm-10043 - 14/12/13 - if ( CRM_Utils_Array::value( 'followup_assignee_contact_id', $params ) ) { + if (!empty($params['followup_assignee_contact_id'])) { $params['followup_assignee_contact_id'] = explode( ',', $params['followup_assignee_contact_id'] ); } else { @@ -1076,7 +1076,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } $activity = array(); - if (CRM_Utils_Array::value('is_multi_activity', $params) && + if (!empty($params['is_multi_activity']) && !CRM_Utils_Array::crmIsEmptyArray($params['target_contact_id']) ) { $targetContacts = $params['target_contact_id']; @@ -1142,7 +1142,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->endPostProcess($params, $activity); // CRM-9590 - if (CRM_Utils_Array::value('is_multi_activity', $params)) { + if (!empty($params['is_multi_activity'])) { $this->_activityIds[] = $activity->id; } else { @@ -1152,7 +1152,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { // create follow up activity if needed $followupStatus = ''; $followupActivity = NULL; - if (CRM_Utils_Array::value('followup_activity_type_id', $params)) { + if (!empty($params['followup_activity_type_id'])) { $followupActivity = CRM_Activity_BAO_Activity::createFollowupActivity($activity->id, $params); $followupStatus = ts('A followup activity has been scheduled.'); } @@ -1219,7 +1219,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { // set status message $subject = ''; - if (CRM_Utils_Array::value('subject', $params)) { + if (!empty($params['subject'])) { $subject = "'" . $params['subject'] . "'"; } diff --git a/CRM/Activity/Form/ActivityView.php b/CRM/Activity/Form/ActivityView.php index 1fbd56f27e..9f965e9e23 100644 --- a/CRM/Activity/Form/ActivityView.php +++ b/CRM/Activity/Form/ActivityView.php @@ -78,7 +78,7 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form { $this->assign('activityTypeName', $activityTypeName); $this->assign('activityTypeDescription', $activityTypeDescription); - if (CRM_Utils_Array::value('mailingId', $defaults)) { + if (!empty($defaults['mailingId'])) { $this->_mailing_id = CRM_Utils_Array::value('source_record_id', $defaults); $mailingReport = CRM_Mailing_BAO_Mailing::report($this->_mailing_id, TRUE); CRM_Mailing_BAO_Mailing::getMailingContent($mailingReport, $this); diff --git a/CRM/Activity/Form/Task/AddToTag.php b/CRM/Activity/Form/Task/AddToTag.php index 1a6a2e9500..ea0853b487 100644 --- a/CRM/Activity/Form/Task/AddToTag.php +++ b/CRM/Activity/Form/Task/AddToTag.php @@ -101,12 +101,12 @@ class CRM_Activity_Form_Task_AddToTag extends CRM_Activity_Form_Task { $activityTags = $tagList = array(); // check if contact tags exists - if (CRM_Utils_Array::value('tag', $params)) { + if (!empty($params['tag'])) { $activityTags = $params['tag']; } // check if tags are selected from taglists - if (CRM_Utils_Array::value('activity_taglist', $params)) { + if (!empty($params['activity_taglist'])) { foreach ($params['activity_taglist'] as $val) { if ($val) { if (is_numeric($val)) { diff --git a/CRM/Activity/Form/Task/Batch.php b/CRM/Activity/Form/Task/Batch.php index 9f7ca2a86f..c981330a0d 100755 --- a/CRM/Activity/Form/Task/Batch.php +++ b/CRM/Activity/Form/Task/Batch.php @@ -162,12 +162,12 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { foreach ($this->_fields as $name => $field) { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) { $customValue = CRM_Utils_Array::value($customFieldID, $customFields); - if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) { + if (!empty($customValue['extends_entity_column_value'])) { $entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue['extends_entity_column_value'] ); } - if (CRM_Utils_Array::value($typeId, $entityColumnValue) || + if (!empty($entityColumnValue[$typeId]) || CRM_Utils_System::isNull($entityColumnValue[$typeId]) ) { CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $activityId); @@ -236,23 +236,23 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { $value['activity_date_time'] = CRM_Utils_Date::processDate($value['activity_date_time'], $value['activity_date_time_time']); } - if (CRM_Utils_Array::value('activity_status_id', $value)) { + if (!empty($value['activity_status_id'])) { $value['status_id'] = $value['activity_status_id']; } - if (CRM_Utils_Array::value('activity_details', $value)) { + if (!empty($value['activity_details'])) { $value['details'] = $value['activity_details']; } - if (CRM_Utils_Array::value('activity_duration', $value)) { + if (!empty($value['activity_duration'])) { $value['duration'] = $value['activity_duration']; } - if (CRM_Utils_Array::value('activity_location', $value)) { + if (!empty($value['activity_location'])) { $value['location'] = $value['activity_location']; } - if (CRM_Utils_Array::value('activity_subject', $value)) { + if (!empty($value['activity_subject'])) { $value['subject'] = $value['activity_subject']; } @@ -280,7 +280,7 @@ WHERE a.id = %1 "; $activityId = civicrm_api('activity', 'update', $value); // add custom field values - if (CRM_Utils_Array::value('custom', $value) && + if (!empty($value['custom']) && is_array($value['custom']) ) { CRM_Core_BAO_CustomValueTable::store($value['custom'], 'civicrm_activity', $activityId['id']); diff --git a/CRM/Activity/Form/Task/RemoveFromTag.php b/CRM/Activity/Form/Task/RemoveFromTag.php index ac3148d3b0..af331fdc8e 100644 --- a/CRM/Activity/Form/Task/RemoveFromTag.php +++ b/CRM/Activity/Form/Task/RemoveFromTag.php @@ -98,12 +98,12 @@ class CRM_Activity_Form_Task_RemoveFromTag extends CRM_Activity_Form_Task { $activityTags = $tagList = array(); // check if contact tags exists - if (CRM_Utils_Array::value('tag', $params)) { + if (!empty($params['tag'])) { $activityTags = $params['tag']; } // check if tags are selected from taglists - if (CRM_Utils_Array::value('activity_taglist', $params)) { + if (!empty($params['activity_taglist'])) { foreach ($params['activity_taglist'] as $val) { if ($val) { if (is_numeric($val)) { diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index 9142c95afd..ee6b9ebeb9 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -340,7 +340,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { } } - if (CRM_Utils_Array::value('saveMapping', $fields)) { + if (!empty($fields['saveMapping'])) { $nameField = CRM_Utils_Array::value('saveMappingName', $fields); if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); @@ -418,12 +418,12 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { $this->set('mapper', $mapper); // store mapping Id to display it in the preview page - if (CRM_Utils_Array::value('mappingId', $params)) { + if (!empty($params['mappingId'])) { $this->set('loadMappingId', $params['mappingId']); } //Updating Mapping Records - if (CRM_Utils_Array::value('updateMapping', $params)) { + if (!empty($params['updateMapping'])) { $mappingFields = new CRM_Core_DAO_MappingField(); $mappingFields->mapping_id = $params['mappingId']; @@ -448,7 +448,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { } //Saving Mapping Details and Records - if (CRM_Utils_Array::value('saveMapping', $params)) { + if (!empty($params['saveMapping'])) { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], diff --git a/CRM/Activity/Import/Form/Preview.php b/CRM/Activity/Import/Form/Preview.php index 2506fa79b5..3b1bbf2ee5 100644 --- a/CRM/Activity/Import/Form/Preview.php +++ b/CRM/Activity/Import/Form/Preview.php @@ -128,14 +128,14 @@ class CRM_Activity_Import_Form_Preview extends CRM_Import_Form_Preview { foreach ($mapper as $key => $value) { $mapperKeys[$key] = $mapper[$key][0]; - if (CRM_Utils_Array::value(1, $mapper[$key]) && is_numeric($mapper[$key][1])) { + if (!empty($mapper[$key][1]) && is_numeric($mapper[$key][1])) { $mapperLocType[$key] = $mapper[$key][1]; } else { $mapperLocType[$key] = NULL; } - if (CRM_Utils_Array::value(2, $mapper[$key]) && (!is_numeric($mapper[$key][2]))) { + if (!empty($mapper[$key][2]) && (!is_numeric($mapper[$key][2]))) { $mapperPhoneType[$key] = $mapper[$key][2]; } else { diff --git a/CRM/Activity/Import/Parser/Activity.php b/CRM/Activity/Import/Parser/Activity.php index def4d8e0dd..d272c2e347 100644 --- a/CRM/Activity/Import/Parser/Activity.php +++ b/CRM/Activity/Import/Parser/Activity.php @@ -309,7 +309,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $params['target_contact_id'] = $cid; $params['version'] = 3; $newActivity = civicrm_api('activity', 'create', $params); - if (CRM_Utils_Array::value('is_error', $newActivity)) { + if (!empty($newActivity['is_error'])) { array_unshift($values, $newActivity['error_message']); return CRM_Import_Parser::ERROR; } @@ -339,7 +339,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { } } - if (CRM_Utils_Array::value('external_identifier', $params)) { + if (!empty($params['external_identifier'])) { if ($disp) { $disp .= "AND {$params['external_identifier']}"; } @@ -353,12 +353,12 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { } } else { - if (CRM_Utils_Array::value('external_identifier', $params)) { + if (!empty($params['external_identifier'])) { $targetContactId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['external_identifier'], 'id', 'external_identifier' ); - if (CRM_Utils_Array::value('target_contact_id', $params) && + if (!empty($params['target_contact_id']) && $params['target_contact_id'] != $targetContactId ) { array_unshift($values, 'Mismatch of External identifier :' . $params['external_identifier'] . ' and Contact Id:' . $params['target_contact_id']); @@ -375,7 +375,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $params['version'] = 3; $newActivity = civicrm_api('activity', 'create', $params); - if (CRM_Utils_Array::value('is_error', $newActivity)) { + if (!empty($newActivity['is_error'])) { array_unshift($values, $newActivity['error_message']); return CRM_Import_Parser::ERROR; } diff --git a/CRM/Activity/Page/AJAX.php b/CRM/Activity/Page/AJAX.php index d762756be5..dd1516fde1 100644 --- a/CRM/Activity/Page/AJAX.php +++ b/CRM/Activity/Page/AJAX.php @@ -196,7 +196,7 @@ class CRM_Activity_Page_AJAX { foreach ($caseRelationships as $key => $value) { //calculate roles that don't have relationships - if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) { + if (!empty($caseRoles[$value['relation_type']])) { //keep naming from careRoles array $caseRelationships[$key]['relation'] = $caseRoles[$value['relation_type']]; unset($caseRoles[$value['relation_type']]); diff --git a/CRM/Activity/Selector/Activity.php b/CRM/Activity/Selector/Activity.php index c6293d2e4b..e23498a8fd 100644 --- a/CRM/Activity/Selector/Activity.php +++ b/CRM/Activity/Selector/Activity.php @@ -401,7 +401,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C //CRM-3553 $accessMailingReport = FALSE; - if (CRM_Utils_Array::value('mailingId', $row)) { + if (!empty($row['mailingId'])) { $accessMailingReport = TRUE; } diff --git a/CRM/Activity/StateMachine/Search.php b/CRM/Activity/StateMachine/Search.php index 690fc46ac1..04366f8d7c 100644 --- a/CRM/Activity/StateMachine/Search.php +++ b/CRM/Activity/StateMachine/Search.php @@ -78,7 +78,7 @@ class CRM_Activity_StateMachine_Search extends CRM_Core_StateMachine { function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff // fix value if print button is pressed - if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) { + if (!empty($_POST['_qf_' . $formName . '_next_print'])) { $value = CRM_Activity_Task::PRINT_ACTIVITIES; } else { diff --git a/CRM/Admin/Form.php b/CRM/Admin/Form.php index 5d72d72d86..2133e39794 100644 --- a/CRM/Admin/Form.php +++ b/CRM/Admin/Form.php @@ -99,7 +99,7 @@ class CRM_Admin_Form extends CRM_Core_Form { // its ok if there is no element called is_active $defaults['is_active'] = ($this->_id) ? CRM_Utils_Array::value('is_active', $defaults) : 1; - if (CRM_Utils_Array::value('parent_id', $defaults)) { + if (!empty($defaults['parent_id'])) { $this->assign('is_parent', TRUE); } return $defaults; diff --git a/CRM/Admin/Form/Job.php b/CRM/Admin/Form/Job.php index 2d82d9612d..17f090e8f6 100644 --- a/CRM/Admin/Form/Job.php +++ b/CRM/Admin/Form/Job.php @@ -153,7 +153,7 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form { // CRM-10708 // job entity thats shipped with core is all lower case. // this makes sure camel casing is followed for proper working of default population. - if (CRM_Utils_Array::value('api_entity', $defaults)) { + if (!empty($defaults['api_entity'])) { $defaults['api_entity'] = ucfirst($defaults['api_entity']); } diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index a84436628b..fbb5b3098c 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -65,7 +65,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { public function setDefaultValues() { $defaults = $this->_values; - if (!CRM_Utils_Array::value('pdf_format_id', $defaults)) { + if (empty($defaults['pdf_format_id'])) { $defaults['pdf_format_id'] = 'null'; } diff --git a/CRM/Admin/Form/Navigation.php b/CRM/Admin/Form/Navigation.php index 2f0aeea889..3a34470595 100644 --- a/CRM/Admin/Form/Navigation.php +++ b/CRM/Admin/Form/Navigation.php @@ -119,7 +119,7 @@ class CRM_Admin_Form_Navigation extends CRM_Admin_Form { public function setDefaultValues() { $defaults = $this->_defaults; if (isset($this->_id)) { - if (CRM_Utils_Array::value('permission', $this->_defaults)) { + if (!empty($this->_defaults['permission'])) { foreach (explode(',', $this->_defaults['permission']) as $value) { $components[$value] = $value; } diff --git a/CRM/Admin/Form/OptionGroup.php b/CRM/Admin/Form/OptionGroup.php index 8ebe02e0f9..6b38277355 100644 --- a/CRM/Admin/Form/OptionGroup.php +++ b/CRM/Admin/Form/OptionGroup.php @@ -90,7 +90,7 @@ class CRM_Admin_Form_OptionGroup extends CRM_Admin_Form { $element->freeze(); } } - if (CRM_Utils_Array::value('is_reserved', $this->_values)) { + if (!empty($this->_values['is_reserved'])) { $this->freeze(array('name', 'is_active')); } } diff --git a/CRM/Admin/Form/OptionValue.php b/CRM/Admin/Form/OptionValue.php index 28670a5a7c..bf4290c354 100644 --- a/CRM/Admin/Form/OptionValue.php +++ b/CRM/Admin/Form/OptionValue.php @@ -88,7 +88,7 @@ class CRM_Admin_Form_OptionValue extends CRM_Admin_Form { function setDefaultValues() { $defaults = array(); $defaults = parent::setDefaultValues(); - if (!CRM_Utils_Array::value('weight', $defaults)) { + if (empty($defaults['weight'])) { $query = "SELECT max( `weight` ) as weight FROM `civicrm_option_value` where option_group_id=" . $this->_gid; $dao = new CRM_Core_DAO(); $dao->query($query); @@ -272,14 +272,14 @@ class CRM_Admin_Form_OptionValue extends CRM_Admin_Form { } //set defaultGreeting option in params to save default value as per contactOption-defaultValue mapping - if (CRM_Utils_Array::value('contactOptions', $params)) { + if (!empty($params['contactOptions'])) { $params['filter'] = CRM_Utils_Array::value('contactOptions', $params); $params['defaultGreeting'] = 1; } $optionValue = CRM_Core_BAO_OptionValue::add($params, $ids); // CRM-11516 - if (CRM_Utils_Array::value('financial_account_id', $params)) { + if (!empty($params['financial_account_id'])) { $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' ")); $params = array( 'entity_table' => 'civicrm_option_value', diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index bc6b3e03e4..a23d9a1329 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -353,7 +353,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { } $formName = explode('"', $fields['label']); - if (!CRM_Utils_Array::value(1, $formName) || count($formName) != 3) { + if (empty($formName[1]) || count($formName) != 3) { $errors['label'] = ts('Please follow the proper format for From Email Address'); } } @@ -419,7 +419,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { $optionValue = CRM_Core_OptionValue::addOptionValue($params, $groupParams, $this->_action, $this->_id); // CRM-11516 - if (CRM_Utils_Array::value('financial_account_id', $params)) { + if (!empty($params['financial_account_id'])) { $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' ")); $params = array( 'entity_table' => 'civicrm_option_value', diff --git a/CRM/Admin/Form/ParticipantStatus.php b/CRM/Admin/Form/ParticipantStatus.php index 72c12a962e..ae10122449 100644 --- a/CRM/Admin/Form/ParticipantStatus.php +++ b/CRM/Admin/Form/ParticipantStatus.php @@ -67,7 +67,7 @@ class CRM_Admin_Form_ParticipantStatus extends CRM_Admin_Form { function setDefaultValues() { $defaults = parent::setDefaultValues(); - if (!CRM_Utils_Array::value('weight', $defaults)) { + if (empty($defaults['weight'])) { $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Event_DAO_ParticipantStatusType'); } $this->_isReserved = CRM_Utils_Array::value('is_reserved', $defaults); diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index 39832402c9..efd457bc80 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -217,7 +217,7 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { $this->add('text', "test_{$field['name']}", $field['label'], $attributes[$field['name']] ); - if (CRM_Utils_Array::value('rule', $field)) { + if (!empty($field['rule'])) { $this->addRule($field['name'], $field['msg'], $field['rule']); $this->addRule("test_{$field['name']}", $field['msg'], $field['rule']); } @@ -336,7 +336,7 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { $values = $this->controller->exportValues($this->_name); $domainID = CRM_Core_Config::domainID(); - if (CRM_Utils_Array::value('is_default', $values)) { + if (!empty($values['is_default'])) { $query = "UPDATE civicrm_payment_processor SET is_default = 0 WHERE domain_id = $domainID"; CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); } diff --git a/CRM/Admin/Form/PaymentProcessorType.php b/CRM/Admin/Form/PaymentProcessorType.php index e276412ba9..cbfdeb382b 100644 --- a/CRM/Admin/Form/PaymentProcessorType.php +++ b/CRM/Admin/Form/PaymentProcessorType.php @@ -165,7 +165,7 @@ class CRM_Admin_Form_PaymentProcessorType extends CRM_Admin_Form { $this->add('text', $field['name'], $field['label'], $attributes['name'], $required ); - if (CRM_Utils_Array::value('rule', $field)) { + if (!empty($field['rule'])) { $this->addRule($field['name'], $field['msg'], $field['rule']); } } @@ -217,7 +217,7 @@ class CRM_Admin_Form_PaymentProcessorType extends CRM_Admin_Form { $values = $this->controller->exportValues($this->_name); - if (CRM_Utils_Array::value('is_default', $values)) { + if (!empty($values['is_default'])) { $query = " UPDATE civicrm_payment_processor SET is_default = 0"; CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); diff --git a/CRM/Admin/Form/Preferences.php b/CRM/Admin/Form/Preferences.php index 2794f78f5c..7eb2a30a90 100644 --- a/CRM/Admin/Form/Preferences.php +++ b/CRM/Admin/Form/Preferences.php @@ -245,7 +245,7 @@ class CRM_Admin_Form_Preferences extends CRM_Core_Form { foreach ($groupValues as $settingName => $fieldValue) { switch ($fieldValue['html_type']) { case 'checkboxes': - if (CRM_Utils_Array::value($settingName, $this->_params) && + if (!empty($this->_params[$settingName]) && is_array($this->_params[$settingName]) ) { $this->_config->$settingName = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, diff --git a/CRM/Admin/Form/Preferences/Display.php b/CRM/Admin/Form/Preferences/Display.php index 69e228f7dc..c7909a7c5b 100644 --- a/CRM/Admin/Form/Preferences/Display.php +++ b/CRM/Admin/Form/Preferences/Display.php @@ -211,7 +211,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { $this->_params = $this->controller->exportValues($this->_name); - if (CRM_Utils_Array::value('contact_edit_preferences', $this->_params)) { + if (!empty($this->_params['contact_edit_preferences'])) { $preferenceWeights = explode(',', $this->_params['contact_edit_preferences']); foreach ($preferenceWeights as $key => $val) { if (!$val) { diff --git a/CRM/Admin/Form/Preferences/Mailing.php b/CRM/Admin/Form/Preferences/Mailing.php index 16ca93f8e2..cb98e4b035 100644 --- a/CRM/Admin/Form/Preferences/Mailing.php +++ b/CRM/Admin/Form/Preferences/Mailing.php @@ -116,7 +116,7 @@ class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences { // check if mailing tab is enabled, if not prompt user to enable the tab if "write_activity_record" is disabled $params = $this->controller->exportValues($this->_name); - if (!CRM_Utils_Array::value('write_activity_record', $params)) { + if (empty($params['write_activity_record'])) { $existingViewOptions = CRM_Core_BAO_Setting::getItem( CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_view_options' diff --git a/CRM/Admin/Form/RelationshipType.php b/CRM/Admin/Form/RelationshipType.php index 4b45602dba..76d627e0f4 100644 --- a/CRM/Admin/Form/RelationshipType.php +++ b/CRM/Admin/Form/RelationshipType.php @@ -111,12 +111,12 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form { $baoName = $this->_BAOName; $baoName::retrieve($params, $defaults); $defaults['contact_types_a'] = CRM_Utils_Array::value('contact_type_a', $defaults); - if (CRM_Utils_Array::value('contact_sub_type_a', $defaults)) { + if (!empty($defaults['contact_sub_type_a'])) { $defaults['contact_types_a'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_a']; } $defaults['contact_types_b'] = $defaults['contact_type_b']; - if (CRM_Utils_Array::value('contact_sub_type_b', $defaults)) { + if (!empty($defaults['contact_sub_type_b'])) { $defaults['contact_types_b'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_b']; } return $defaults; diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index ccda529b21..4c78e29624 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -202,10 +202,10 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { FALSE, array('onClick' => "showHideByValue('recipient','manual','recipientManual','table-row','select',false); showHideByValue('recipient','group','recipientGroup','table-row','select',false);") ); - if (CRM_Utils_Array::value('is_recipient_listing', $_POST)) { + if (!empty($_POST['is_recipient_listing'])) { $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($_POST['entity'][0], $_POST['recipient']); } - elseif (CRM_Utils_Array::value('recipient_listing', $this->_values)) { + elseif (!empty($this->_values['recipient_listing'])) { $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($this->_values['mapping_id'], $this->_values['recipient']); } $recipientListing = $this->add('select', 'recipient_listing', ts('Recipient Listing'), $recipientListingOptions); @@ -262,7 +262,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $errors['entity'] = ts('Please select appropriate value'); } - if (CRM_Utils_Array::value('is_active', $fields) && + if (!empty($fields['is_active']) && CRM_Utils_System::isNull($fields['subject']) ) { $errors['subject'] = ts('Subject is a required field.'); @@ -315,10 +315,10 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $defaults['text_message'] = CRM_Utils_Array::value('body_text', $defaults); $defaults['html_message'] = CRM_Utils_Array::value('body_html', $defaults); $defaults['template'] = CRM_Utils_Array::value('msg_template_id', $defaults); - if (CRM_Utils_Array::value('group_id', $defaults)) { + if (!empty($defaults['group_id'])) { $defaults['recipient'] = 'group'; } - elseif (CRM_Utils_Array::value('recipient_manual', $defaults)) { + elseif (!empty($defaults['recipient_manual'])) { $defaults['recipient'] = 'manual'; $recipients = array(); foreach (explode(',', $defaults['recipient_manual']) as $cid) { @@ -458,12 +458,12 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $composeParams = array(); foreach ($composeFields as $key) { - if (CRM_Utils_Array::value($key, $values)) { + if (!empty($values[$key])) { $composeParams[$key] = $values[$key]; } } - if (CRM_Utils_Array::value('updateTemplate', $composeParams)) { + if (!empty($composeParams['updateTemplate'])) { $templateParams = array( 'msg_text' => $params['body_text'], 'msg_html' => $params['body_html'], @@ -476,7 +476,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } - if (CRM_Utils_Array::value('saveTemplate', $composeParams)) { + if (!empty($composeParams['saveTemplate'])) { $templateParams = array( 'msg_text' => $params['body_text'], 'msg_html' => $params['body_html'], diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index a0bc05acc7..6220d38133 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -183,7 +183,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { public function commonProcess(&$params) { // save autocomplete search options - if (CRM_Utils_Array::value('autocompleteContactSearch', $params)) { + if (!empty($params['autocompleteContactSearch'])) { $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactSearch']) ) . CRM_Core_DAO::VALUE_SEPARATOR; @@ -197,7 +197,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { } // save autocomplete contact reference options - if (CRM_Utils_Array::value('autocompleteContactReference', $params)) { + if (!empty($params['autocompleteContactReference'])) { $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactReference']) ) . CRM_Core_DAO::VALUE_SEPARATOR; @@ -221,7 +221,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { } // save checksum timeout - if (CRM_Utils_Array::value('checksumTimeout', $params)) { + if (!empty($params['checksumTimeout'])) { CRM_Core_BAO_Setting::setItem($params['checksumTimeout'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'checksum_timeout' @@ -229,7 +229,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { } // update time for date formats when global time is changed - if (CRM_Utils_Array::value('timeInputFormat', $params)) { + if (!empty($params['timeInputFormat'])) { $query = " UPDATE civicrm_preferences_date SET time_format = %1 diff --git a/CRM/Admin/Form/Setting/Localization.php b/CRM/Admin/Form/Setting/Localization.php index 16fcc9a480..8ef3af4c02 100644 --- a/CRM/Admin/Form/Setting/Localization.php +++ b/CRM/Admin/Form/Setting/Localization.php @@ -304,12 +304,12 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { unset($values['currencyLimit']); // make the site multi-lang if requested - if (CRM_Utils_Array::value('makeMultilingual', $values)) { + if (!empty($values['makeMultilingual'])) { CRM_Core_I18n_Schema::makeMultilingual($values['lcMessages']); $values['languageLimit'][$values['lcMessages']] = 1; // make the site single-lang if requested } - elseif (CRM_Utils_Array::value('makeSinglelingual', $values)) { + elseif (!empty($values['makeSinglelingual'])) { CRM_Core_I18n_Schema::makeSinglelingual($values['lcMessages']); $values['languageLimit'] = ''; } diff --git a/CRM/Admin/Form/Setting/Smtp.php b/CRM/Admin/Form/Setting/Smtp.php index 22a7609990..63403a2c51 100644 --- a/CRM/Admin/Form/Setting/Smtp.php +++ b/CRM/Admin/Form/Setting/Smtp.php @@ -211,17 +211,17 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting { */ static function formRule($fields) { if ($fields['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_SMTP) { - if (!CRM_Utils_Array::value('smtpServer', $fields)) { + if (empty($fields['smtpServer'])) { $errors['smtpServer'] = 'SMTP Server name is a required field.'; } - if (!CRM_Utils_Array::value('smtpPort', $fields)) { + if (empty($fields['smtpPort'])) { $errors['smtpPort'] = 'SMTP Port is a required field.'; } - if (CRM_Utils_Array::value('smtpAuth', $fields)) { - if (!CRM_Utils_Array::value('smtpUsername', $fields)) { + if (!empty($fields['smtpAuth'])) { + if (empty($fields['smtpUsername'])) { $errors['smtpUsername'] = 'If your SMTP server requires authentication please provide a valid user name.'; } - if (!CRM_Utils_Array::value('smtpPassword', $fields)) { + if (empty($fields['smtpPassword'])) { $errors['smtpPassword'] = 'If your SMTP server requires authentication, please provide a password.'; } } diff --git a/CRM/Admin/Form/Setting/UpdateConfigBackend.php b/CRM/Admin/Form/Setting/UpdateConfigBackend.php index 2fa8a5facc..15753df248 100644 --- a/CRM/Admin/Form/Setting/UpdateConfigBackend.php +++ b/CRM/Admin/Form/Setting/UpdateConfigBackend.php @@ -104,7 +104,7 @@ class CRM_Admin_Form_Setting_UpdateConfigBackend extends CRM_Admin_Form_Setting } function postProcess() { - if (CRM_Utils_Array::value('_qf_UpdateConfigBackend_next_cleanup', $_POST)) { + if (!empty($_POST['_qf_UpdateConfigBackend_next_cleanup'])) { $config = CRM_Core_Config::singleton(); diff --git a/CRM/Admin/Form/WordReplacements.php b/CRM/Admin/Form/WordReplacements.php index a4f76f9ef1..88989ec6b5 100644 --- a/CRM/Admin/Form/WordReplacements.php +++ b/CRM/Admin/Form/WordReplacements.php @@ -126,7 +126,7 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { if ($this->_soInstance) { $soInstances = array($this->_soInstance); } - elseif (CRM_Utils_Array::value('old', $_POST)) { + elseif (!empty($_POST['old'])) { $soInstances = $stringOverrideInstances = array_keys($_POST['old']); } elseif (!empty($this->_defaults) && is_array($this->_defaults)) { @@ -211,11 +211,11 @@ 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 (CRM_Utils_Array::value($i, $params['new']) && + if (!empty($params['new'][$i]) && CRM_Utils_Array::value($i, $params['old']) ) { if (isset($params['enabled']) && CRM_Utils_Array::value($i, $params['enabled'])) { - if (CRM_Utils_Array::value('cb', $params) && + if (!empty($params['cb']) && CRM_Utils_Array::value($i, $params['cb']) ) { $enabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]); diff --git a/CRM/Admin/Page/ContactType.php b/CRM/Admin/Page/ContactType.php index 169a06b14c..1b3b21602b 100644 --- a/CRM/Admin/Page/ContactType.php +++ b/CRM/Admin/Page/ContactType.php @@ -109,12 +109,12 @@ class CRM_Admin_Page_ContactType extends CRM_Core_Page_Basic { $rows = CRM_Contact_BAO_ContactType::contactTypeInfo(TRUE); foreach ($rows as $key => $value) { $mask = NULL; - if (CRM_Utils_Array::value('is_reserved', $value)) { + if (!empty($value['is_reserved'])) { $mask = CRM_Core_Action::UPDATE; } else { $mask -= CRM_Core_Action::DELETE - 2; - if (CRM_Utils_Array::value('is_active', $value)) { + if (!empty($value['is_active'])) { $mask -= CRM_Core_Action::ENABLE; } else { diff --git a/CRM/Admin/Page/LabelFormats.php b/CRM/Admin/Page/LabelFormats.php index b3050f8208..5aab022c31 100644 --- a/CRM/Admin/Page/LabelFormats.php +++ b/CRM/Admin/Page/LabelFormats.php @@ -132,7 +132,7 @@ class CRM_Admin_Page_LabelFormats extends CRM_Core_Page_Basic { // Add action links to each of the Label Formats foreach ($labelFormatList as & $format) { $action = array_sum(array_keys($this->links())); - if (CRM_Utils_Array::value('is_reserved', $format)) { + if (!empty($format['is_reserved'])) { $action -= CRM_Core_Action::DELETE; } diff --git a/CRM/Badge/BAO/Badge.php b/CRM/Badge/BAO/Badge.php index 6dbcf61ea7..6c0d49fd8b 100644 --- a/CRM/Badge/BAO/Badge.php +++ b/CRM/Badge/BAO/Badge.php @@ -84,7 +84,7 @@ class CRM_Badge_BAO_Badge { static function formatLabel(&$row, &$layout) { $formattedRow = array('labelFormat' => $layout['label_format_name']); - if (CRM_Utils_Array::value('rowElements', $layout['data'])) { + if (!empty($layout['data']['rowElements'])) { foreach ($layout['data']['rowElements'] as $key => $element) { $value = ''; if ($element) { @@ -106,27 +106,27 @@ class CRM_Badge_BAO_Badge { } } - if (CRM_Utils_Array::value('image_1', $layout['data'])) { + if (!empty($layout['data']['image_1'])) { $formattedRow['image_1'] = $layout['data']['image_1']; } - if (CRM_Utils_Array::value('width_image_1', $layout['data'])) { + if (!empty($layout['data']['width_image_1'])) { $formattedRow['width_image_1'] = $layout['data']['width_image_1']; } - if (CRM_Utils_Array::value('height_image_1', $layout['data'])) { + if (!empty($layout['data']['height_image_1'])) { $formattedRow['height_image_1'] = $layout['data']['height_image_1']; } - if (CRM_Utils_Array::value('image_2', $layout['data'])) { + if (!empty($layout['data']['image_2'])) { $formattedRow['image_2'] = $layout['data']['image_2']; } - if (CRM_Utils_Array::value('width_image_2', $layout['data'])) { + if (!empty($layout['data']['width_image_2'])) { $formattedRow['width_image_2'] = $layout['data']['width_image_2']; } - if (CRM_Utils_Array::value('height_image_2', $layout['data'])) { + if (!empty($layout['data']['height_image_2'])) { $formattedRow['height_image_2'] = $layout['data']['height_image_2']; } - if (CRM_Utils_Array::value('add_barcode', $layout['data'])) { + if (!empty($layout['data']['add_barcode'])) { $formattedRow['barcode'] = array( 'alignment' => $layout['data']['barcode_alignment'], 'type' => $layout['data']['barcode_type'], @@ -160,12 +160,12 @@ class CRM_Badge_BAO_Badge { $y = $this->pdf->getY(); $startOffset = 0; - if (CRM_Utils_Array::value('image_1', $formattedRow)) { + if (!empty($formattedRow['image_1'])) { $this->printImage($formattedRow['image_1'], NULL, NULL, CRM_Utils_Array::value('width_image_1', $formattedRow), CRM_Utils_Array::value('height_image_1', $formattedRow)); } - if (CRM_Utils_Array::value('image_2', $formattedRow)) { + if (!empty($formattedRow['image_2'])) { $this->printImage($formattedRow['image_2'], $x + 68, NULL, CRM_Utils_Array::value('width_image_2', $formattedRow), CRM_Utils_Array::value('height_image_2', $formattedRow)); } @@ -175,7 +175,7 @@ class CRM_Badge_BAO_Badge { CRM_Utils_Array::value('height_image_1', $formattedRow)) { $startOffset = CRM_Utils_Array::value('height_image_1', $formattedRow); } - elseif (CRM_Utils_Array::value('height_image_2', $formattedRow)) { + elseif (!empty($formattedRow['height_image_2'])) { $startOffset = CRM_Utils_Array::value('height_image_2', $formattedRow); } @@ -207,7 +207,7 @@ class CRM_Badge_BAO_Badge { } } - if (CRM_Utils_Array::value('barcode', $formattedRow)) { + if (!empty($formattedRow['barcode'])) { $data = $formattedRow['values']; if ($formattedRow['barcode']['type'] == 'barcode') { diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 368fa5f1bf..8b6c74c741 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -60,7 +60,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { * @access public */ static function create(&$params, $ids = NULL, $context = NULL) { - if (!CRM_Utils_Array::value('id', $params)) { + if (empty($params['id'])) { $params['name'] = CRM_Utils_String::titleToVar($params['title']); } @@ -215,7 +215,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { $batch['total'] = $batch['item_count'] = ''; $batch['payment_instrument'] = $value['payment_instrument']; $batch['item_count'] = CRM_Utils_Array::value('item_count', $value); - if (CRM_Utils_Array::value('total', $value)) { + if (!empty($value['total'])) { $batch['total'] = CRM_Utils_Money::format($value['total']); } @@ -261,7 +261,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { {$limit}"; $object = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Batch_DAO_Batch'); - if (CRM_Utils_Array::value('context', $params)) { + if (!empty($params['context'])) { $links = self::links($params['context']); } else { @@ -302,7 +302,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { CRM_Utils_Array::remove($newLinks, 'close', 'edit', 'reopen', 'export'); } } - if (CRM_Utils_Array::value('type_id', $values)) { + if (!empty($values['type_id'])) { $values['batch_type'] = $batchTypes[$values['type_id']]; } $values['batch_status'] = $batchStatus[$values['status_id']]; diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 742cd04f8a..367200592b 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -247,7 +247,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { static function formRule($params, $files, $self) { $errors = array(); - if (CRM_Utils_Array::value('_qf_Entry_upload_force', $params)) { + if (!empty($params['_qf_Entry_upload_force'])) { return TRUE; } @@ -256,7 +256,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $batchTotal += $value['total_amount']; //validate for soft credit fields - if (CRM_Utils_Array::value($key, $params['soft_credit_contact_select_id']) && !CRM_Utils_Array::value($key, $params['soft_credit_amount'])) { + if (!empty($params['soft_credit_contact_select_id'][$key]) && !CRM_Utils_Array::value($key, $params['soft_credit_amount'])) { $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']) @@ -266,7 +266,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { //membership type is required for membership batch entry if ( $self->_batchInfo['type_id'] == 2 ) { - if ( !CRM_Utils_Array::value( 1, $value['membership_type'] ) ) { + if (empty($value['membership_type'][1])) { $errors["field[$key][membership_type]"] = ts('Membership type is a required field.'); } } @@ -407,7 +407,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { if (isset($params['field'])) { foreach ($params['field'] as $key => $value) { // if contact is not selected we should skip the row - if (!CRM_Utils_Array::value($key, $params['primary_contact_select_id'])) { + if (empty($params['primary_contact_select_id'][$key])) { continue; } @@ -417,7 +417,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $this->updateContactInfo($value); //build soft credit params - if (CRM_Utils_Array::value($key, $params['soft_credit_contact_select_id']) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) { + if (!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]); $value['soft_credit'][$key]['soft_credit_type_id'] = $params['field'][$key]['soft_credit_type']; @@ -430,12 +430,12 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { ); foreach ($dates as $val) { - if ( CRM_Utils_Array::value( $val, $value ) ) { + if (!empty($value[$val])) { $value[$val] = CRM_Utils_Date::processDate( $value[$val], $value[$val . '_time'], TRUE ); } } - if (CRM_Utils_Array::value('send_receipt', $value)) { + if (!empty($value['send_receipt'])) { $value['receipt_date'] = date('Y-m-d His'); } @@ -443,15 +443,15 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $value['financial_type_id'] = $value['financial_type']; } - if (CRM_Utils_Array::value('payment_instrument', $value)) { + if (!empty($value['payment_instrument'])) { $value['payment_instrument_id'] = $value['payment_instrument']; } - if (CRM_Utils_Array::value('contribution_source', $value)) { + if (!empty($value['contribution_source'])) { $value['source'] = $value['contribution_source']; } - if (CRM_Utils_Array::value('contribution_note', $value)) { + if (!empty($value['contribution_note'])) { $value['note'] = $value['contribution_note']; } @@ -477,7 +477,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 (CRM_Utils_Array::value('financial_type_id', $value) && CRM_Utils_Array::value($priceSetId, $lineItem)) { + if (!empty($value['financial_type_id']) && CRM_Utils_Array::value($priceSetId, $lineItem)) { foreach ($lineItem[$priceSetId] as &$values) { $values['financial_type_id'] = $value['financial_type_id']; } @@ -488,7 +488,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $contribution = CRM_Contribute_BAO_Contribution::create($value, CRM_Core_DAO::$_nullArray); //process premiums - if (CRM_Utils_Array::value('product_name', $value)) { + if (!empty($value['product_name'])) { if ($value['product_name'][0] > 0) { list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo(); @@ -556,7 +556,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $customFields = array(); foreach ($params['field'] as $key => $value) { // if contact is not selected we should skip the row - if (!CRM_Utils_Array::value($key, $params['primary_contact_select_id'])) { + if (empty($params['primary_contact_select_id'][$key])) { continue; } @@ -588,18 +588,18 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('send_receipt', $value)) { + if (!empty($value['send_receipt'])) { $value['receipt_date'] = date('Y-m-d His'); } - if (CRM_Utils_Array::value('membership_source', $value)) { + if (!empty($value['membership_source'])) { $value['source'] = $value['membership_source']; } unset($value['membership_source']); //Get the membership status - if ( CRM_Utils_Array::value('membership_status', $value) ) { + if (!empty($value['membership_status'])) { $value['status_id'] = $value['membership_status']; unset($value['membership_status']); } @@ -623,11 +623,11 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $membershipTypeId ); - if (CRM_Utils_Array::value('financial_type', $value)) { + if (!empty($value['financial_type'])) { $value['financial_type_id'] = $value['financial_type']; } - if (CRM_Utils_Array::value('payment_instrument', $value)) { + if (!empty($value['payment_instrument'])) { $value['payment_instrument_id'] = $value['payment_instrument']; } @@ -637,7 +637,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $value['soft_credit'][$key]['amount'] = CRM_Utils_Rule::cleanMoney($params['soft_credit_amount'][$key]); } - if ( CRM_Utils_Array::value('receive_date', $value) ) { + if (!empty($value['receive_date'])) { $value['receive_date'] = CRM_Utils_Date::processDate( $value['receive_date'], $value['receive_date_time'] , TRUE ); } @@ -672,7 +672,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $editedResults = array(); CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults); $this->_priceSet['fields'][$fid]['options'][$editedResults['id']] = $priceSets['fields'][$fid]['options'][$editedResults['id']]; - if (CRM_Utils_Array::value('total_amount', $value)) { + if (!empty($value['total_amount'])) { $this->_priceSet['fields'][$fid]['options'][$editedResults['id']]['amount'] = $value['total_amount']; } @@ -687,7 +687,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 (CRM_Utils_Array::value('financial_type_id', $value) && CRM_Utils_Array::value($priceSetId, $lineItem)) { + if (!empty($value['financial_type_id']) && CRM_Utils_Array::value($priceSetId, $lineItem)) { foreach ($lineItem[$priceSetId] as &$values) { $values['financial_type_id'] = $value['financial_type_id']; } @@ -703,7 +703,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { unset($value['membership_end_date']); $value['is_renew'] = false; - if ( CRM_Utils_Array::value('member_option', $params) && CRM_Utils_Array::value( $key, $params['member_option'] ) == 2 ) { + if (!empty($params['member_option']) && CRM_Utils_Array::value( $key, $params['member_option'] ) == 2 ) { $this->_params = $params; $value['is_renew'] = true; $membership = CRM_Member_BAO_Membership::renewMembership( @@ -721,7 +721,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { } //process premiums - if (CRM_Utils_Array::value('product_name', $value)) { + if (!empty($value['product_name'])) { if ($value['product_name'][0] > 0) { list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo(); diff --git a/CRM/Campaign/BAO/Campaign.php b/CRM/Campaign/BAO/Campaign.php index 8a4979e916..707005b282 100644 --- a/CRM/Campaign/BAO/Campaign.php +++ b/CRM/Campaign/BAO/Campaign.php @@ -89,7 +89,7 @@ Class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign { } //store custom data - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_campaign', $campaign->id); @@ -320,7 +320,7 @@ Order By camp.title"; 'sortOrder' => 'desc', ); foreach ($sortParams as $name => $default) { - if (CRM_Utils_Array::value($name, $params)) { + if (!empty($params[$name])) { $sortParams[$name] = $params[$name]; } } @@ -354,40 +354,40 @@ INNER JOIN civicrm_option_group grp ON ( campaign_type.option_group_id = grp.id //build the where clause. $queryParams = $where = array(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $where[] = "( campaign.id = %1 )"; $queryParams[1] = array($params['id'], 'Positive'); } - if (CRM_Utils_Array::value('name', $params)) { + if (!empty($params['name'])) { $where[] = "( campaign.name LIKE %2 )"; $queryParams[2] = array('%' . trim($params['name']) . '%', 'String'); } - if (CRM_Utils_Array::value('title', $params)) { + if (!empty($params['title'])) { $where[] = "( campaign.title LIKE %3 )"; $queryParams[3] = array('%' . trim($params['title']) . '%', 'String'); } - if (CRM_Utils_Array::value('start_date', $params)) { + if (!empty($params['start_date'])) { $startDate = CRM_Utils_Date::processDate($params['start_date']); $where[] = "( campaign.start_date >= %4 OR campaign.start_date IS NULL )"; $queryParams[4] = array($startDate, 'String'); } - if (CRM_Utils_Array::value('end_date', $params)) { + if (!empty($params['end_date'])) { $endDate = CRM_Utils_Date::processDate($params['end_date'], '235959'); $where[] = "( campaign.end_date <= %5 OR campaign.end_date IS NULL )"; $queryParams[5] = array($endDate, 'String'); } - if (CRM_Utils_Array::value('description', $params)) { + if (!empty($params['description'])) { $where[] = "( campaign.description LIKE %6 )"; $queryParams[6] = array('%' . trim($params['description']) . '%', 'String'); } - if (CRM_Utils_Array::value('campaign_type_id', $params)) { + if (!empty($params['campaign_type_id'])) { $typeId = $params['campaign_type_id']; if (is_array($params['campaign_type_id'])) { $typeId = implode(' , ', $params['campaign_type_id']); } $where[] = "( campaign.campaign_type_id IN ( {$typeId} ) )"; } - if (CRM_Utils_Array::value('status_id', $params)) { + if (!empty($params['status_id'])) { $statusId = $params['status_id']; if (is_array($params['status_id'])) { $statusId = implode(' , ', $params['status_id']); @@ -396,7 +396,7 @@ INNER JOIN civicrm_option_group grp ON ( campaign_type.option_group_id = grp.id } if (array_key_exists('is_active', $params)) { $active = "( campaign.is_active = 1 )"; - if (CRM_Utils_Array::value('is_active', $params)) { + if (!empty($params['is_active'])) { $active = "( campaign.is_active = 0 OR campaign.is_active IS NULL )"; } $where[] = $active; diff --git a/CRM/Campaign/BAO/Petition.php b/CRM/Campaign/BAO/Petition.php index 9f01f56a6e..ec01af5130 100644 --- a/CRM/Campaign/BAO/Petition.php +++ b/CRM/Campaign/BAO/Petition.php @@ -55,7 +55,7 @@ class CRM_Campaign_BAO_Petition extends CRM_Campaign_BAO_Survey { 'sortOrder' => 'desc', ); foreach ($sortParams as $name => $default) { - if (CRM_Utils_Array::value($name, $params)) { + if (!empty($params[$name])) { $sortParams[$name] = $params[$name]; } } @@ -95,11 +95,11 @@ INNER JOIN civicrm_option_group grp ON ( activity_type.option_group_id = grp.id $where[] = "( petition.activity_type_id = %1 )"; $queryParams[1] = array($petitionTypeID, 'Positive'); } - if (CRM_Utils_Array::value('title', $params)) { + if (!empty($params['title'])) { $where[] = "( petition.title LIKE %2 )"; $queryParams[2] = array('%' . trim($params['title']) . '%', 'String'); } - if (CRM_Utils_Array::value('campaign_id', $params)) { + if (!empty($params['campaign_id'])) { $where[] = '( petition.campaign_id = %3 )'; $queryParams[3] = array($params['campaign_id'], 'Positive'); } @@ -213,7 +213,7 @@ SELECT petition.id as id, $activity = CRM_Activity_BAO_Activity::create($activityParams); // save activity custom data - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_activity', $activity->id); diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index 4fca214d9d..19088c53ef 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -79,7 +79,7 @@ class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey { return false; } - if (CRM_Utils_Array::value('is_default', $params)) { + if (!empty($params['is_default'])) { $query = "UPDATE civicrm_survey SET is_default = 0"; CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); } @@ -99,7 +99,7 @@ class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey { $dao->copyValues($params); $dao->save(); - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_survey', $dao->id); @@ -124,7 +124,7 @@ class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey { 'sortOrder' => 'desc', ); foreach ($sortParams as $name => $default) { - if (CRM_Utils_Array::value($name, $params)) { + if (!empty($params[$name])) { $sortParams[$name] = $params[$name]; } } @@ -165,15 +165,15 @@ INNER JOIN civicrm_option_group grp ON ( activity_type.option_group_id = grp.id $queryParams[1] = array($petitionTypeID, 'Positive'); } - if (CRM_Utils_Array::value('title', $params)) { + if (!empty($params['title'])) { $where[] = "( survey.title LIKE %2 )"; $queryParams[2] = array('%' . trim($params['title']) . '%', 'String'); } - if (CRM_Utils_Array::value('campaign_id', $params)) { + if (!empty($params['campaign_id'])) { $where[] = '( survey.campaign_id = %3 )'; $queryParams[3] = array($params['campaign_id'], 'Positive'); } - if (CRM_Utils_Array::value('activity_type_id', $params)) { + if (!empty($params['activity_type_id'])) { $typeId = $params['activity_type_id']; if (is_array($params['activity_type_id'])) { $typeId = implode(' , ', $params['activity_type_id']); @@ -812,7 +812,7 @@ INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a $ids = array('id' => $surveyId); foreach ($voterLinks as $link) { - if (CRM_Utils_Array::value('qs', $link) && + if (!empty($link['qs']) && !CRM_Utils_System::isNull($link['qs']) ) { $urlPath = CRM_Utils_System::url(CRM_Core_Action::replace($link['url'], $ids), diff --git a/CRM/Campaign/Form/Campaign.php b/CRM/Campaign/Form/Campaign.php index 4f10650bb8..903f02bcac 100644 --- a/CRM/Campaign/Form/Campaign.php +++ b/CRM/Campaign/Form/Campaign.php @@ -119,7 +119,7 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { } // when custom data is included in form. - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { $this->set('type', 'Campaign'); $this->set('subType', CRM_Utils_Array::value('campaign_type_id', $_POST)); $this->set('entityId', $this->_campaignId); diff --git a/CRM/Campaign/Form/Petition.php b/CRM/Campaign/Form/Petition.php index 76a5fa775d..883cc36d37 100644 --- a/CRM/Campaign/Form/Petition.php +++ b/CRM/Campaign/Form/Petition.php @@ -77,7 +77,7 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { } // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { CRM_Custom_Form_CustomData::preProcess($this); CRM_Custom_Form_CustomData::buildQuickForm($this); } @@ -341,13 +341,13 @@ WHERE $whereClause if ($this->_surveyId) { CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams); } - if (CRM_Utils_Array::value('profile_id', $params)) { + if (!empty($params['profile_id'])) { $ufJoinParams['weight'] = 1; $ufJoinParams['uf_group_id'] = $params['profile_id']; CRM_Core_BAO_UFJoin::create($ufJoinParams); } - if (CRM_Utils_Array::value('contact_profile_id', $params)) { + if (!empty($params['contact_profile_id'])) { $ufJoinParams['weight'] = 2; $ufJoinParams['uf_group_id'] = $params['contact_profile_id']; CRM_Core_BAO_UFJoin::create($ufJoinParams); diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index 9ffa03d362..c7ba98a9d7 100755 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -437,7 +437,7 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form { $interviewerId = CRM_Utils_Array::value('survey_interviewer_id', $this->_formValues); if ($interviewerId) { $this->set('interviewerId', $interviewerId); - if (!CRM_Utils_Array::value('survey_interviewer_name', $this->_formValues)) { + if (empty($this->_formValues['survey_interviewer_name'])) { $this->_formValues['survey_interviewer_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $interviewerId, 'sort_name', @@ -469,7 +469,7 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form { } if ($this->_operation == 'reserve') { - if (CRM_Utils_Array::value('campaign_survey_id', $this->_formValues)) { + if (!empty($this->_formValues['campaign_survey_id'])) { $campaignId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $this->_formValues['campaign_survey_id'], 'campaign_id' diff --git a/CRM/Campaign/Form/Survey/Main.php b/CRM/Campaign/Form/Survey/Main.php index 737d4ce18c..8fe6110308 100644 --- a/CRM/Campaign/Form/Survey/Main.php +++ b/CRM/Campaign/Form/Survey/Main.php @@ -74,7 +74,7 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey { } // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { CRM_Custom_Form_CustomData::preProcess($this); CRM_Custom_Form_CustomData::buildQuickForm($this); } @@ -118,7 +118,7 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey { if ($this->_surveyId) { - if (CRM_Utils_Array::value('result_id', $defaults) && + if (!empty($defaults['result_id']) && CRM_Utils_Array::value('recontact_interval', $defaults) ) { @@ -226,7 +226,7 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey { $survey = CRM_Campaign_BAO_Survey::create($params); $this->_surveyId = $survey->id; - if (CRM_Utils_Array::value('result_id', $this->_values)) { + if (!empty($this->_values['result_id'])) { $query = "SELECT COUNT(*) FROM civicrm_survey WHERE result_id = %1"; $countSurvey = (int)CRM_Core_DAO::singleValueQuery($query, array( diff --git a/CRM/Campaign/Form/Survey/Results.php b/CRM/Campaign/Form/Survey/Results.php index 53235137c7..f4daeef730 100644 --- a/CRM/Campaign/Form/Survey/Results.php +++ b/CRM/Campaign/Form/Survey/Results.php @@ -134,7 +134,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { if (empty($optionGroups) || !CRM_Utils_Array::value('result_id', $this->_values)) { $this->setdefaults(array('option_type' => 1)); } - elseif (CRM_Utils_Array::value('result_id', $this->_values)) { + elseif (!empty($this->_values['result_id'])) { $this->setdefaults(array( 'option_type' => 2, 'option_group_id' => $this->_values['result_id'], @@ -206,8 +206,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { */ static function formRule($fields, $files, $form) { $errors = array(); - if ( - CRM_Utils_Array::value('option_label', $fields) && + if (!empty($fields['option_label']) && CRM_Utils_Array::value('option_value', $fields) && (count(array_filter($fields['option_label'])) == 0) && (count(array_filter($fields['option_value'])) == 0) @@ -215,8 +214,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { $errors['option_label[1]'] = ts('Enter at least one result option.'); return $errors; } - elseif ( - !CRM_Utils_Array::value('option_label', $fields) && + elseif (empty($fields['option_label']) && !CRM_Utils_Array::value('option_value', $fields) ) { return $errors; @@ -299,7 +297,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { } } - if (CRM_Utils_Array::value($i, $fields['option_interval']) && !CRM_Utils_Rule::integer($fields['option_interval'][$i])) { + if (!empty($fields['option_interval'][$i]) && !CRM_Utils_Rule::integer($fields['option_interval'][$i])) { $_flagOption = 1; $errors['option_interval[' . $i . ']'] = ts('Please enter a valid integer.'); } @@ -382,7 +380,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey { $optionValue->weight = $params['option_weight'][$k]; $optionValue->is_active = 1; - if (CRM_Utils_Array::value('default_option', $params) && + if (!empty($params['default_option']) && $params['default_option'] == $k ) { $optionValue->is_default = 1; diff --git a/CRM/Campaign/Form/Task/Interview.php b/CRM/Campaign/Form/Task/Interview.php index 96f1e90b9f..e6a451c42b 100755 --- a/CRM/Campaign/Form/Task/Interview.php +++ b/CRM/Campaign/Form/Task/Interview.php @@ -136,7 +136,7 @@ class CRM_Campaign_Form_Task_Interview extends CRM_Campaign_Form_Task { $orderBy = array(); if ( !empty($orderByParams) ) { foreach ( $orderByParams as $key => $val ) { - if (CRM_Utils_Array::value('column', $val)) { + if (!empty($val['column'])) { $orderBy[] = "{$val['column']} {$val['order']}"; } } @@ -537,7 +537,7 @@ WHERE {$clause} $activity->activity_date_time = date('YmdHis'); $activity->status_id = $statusId; - if (CRM_Utils_Array::value('activity_date_time', $params)) { + if (!empty($params['activity_date_time'])) { $activity->activity_date_time = CRM_Utils_Date::processDate($params['activity_date_time'], $params['activity_date_time_time']); } @@ -562,7 +562,7 @@ WHERE {$clause} 'duration' => 'activity_duration' ); foreach ($activityParams as $key => $field) { - if (CRM_Utils_Array::value($field, $params)) { + if (!empty($params[$field])) { $activity->$key = $params[$field]; } } diff --git a/CRM/Campaign/Form/Task/Reserve.php b/CRM/Campaign/Form/Task/Reserve.php index 174cb44898..c2d0747873 100644 --- a/CRM/Campaign/Form/Task/Reserve.php +++ b/CRM/Campaign/Form/Task/Reserve.php @@ -212,7 +212,7 @@ class CRM_Campaign_Form_Task_Reserve extends CRM_Campaign_Form_Task { static function formRule($fields, $files, $self) { $errors = array(); $invalidGroupName = FALSE; - if (CRM_Utils_Array::value('newGroupName', $fields)) { + if (!empty($fields['newGroupName'])) { $title = trim($fields['newGroupName']); $name = CRM_Utils_String::titleToVar($title); $query = 'select count(*) from civicrm_group where name like %1 OR title like %2'; diff --git a/CRM/Campaign/Page/AJAX.php b/CRM/Campaign/Page/AJAX.php index b0d26d2a5b..29ec3fa06a 100644 --- a/CRM/Campaign/Page/AJAX.php +++ b/CRM/Campaign/Page/AJAX.php @@ -155,7 +155,7 @@ class CRM_Campaign_Page_AJAX { $params = $searchRows = array(); foreach ($searchParams as $param) { - if (CRM_Utils_Array::value($param, $_POST)) { + if (!empty($_POST[$param])) { $params[$param] = $_POST[$param]; } } @@ -182,7 +182,7 @@ class CRM_Campaign_Page_AJAX { $interviewerId = $surveyTypeId = $surveyId = NULL; $searchVoterFor = $params['campaign_search_voter_for']; if ($searchVoterFor == 'reserve') { - if (CRM_Utils_Array::value('campaign_survey_id', $params)) { + if (!empty($params['campaign_survey_id'])) { $survey = new CRM_Campaign_DAO_Survey(); $survey->id = $surveyId = $params['campaign_survey_id']; $survey->selectAdd('campaign_id, activity_type_id'); @@ -258,7 +258,7 @@ class CRM_Campaign_Page_AJAX { ); foreach ($dataTableParams as $pName => $pValues) { $$pName = $pValues['default']; - if (CRM_Utils_Array::value($pValues['name'], $_POST)) { + if (!empty($_POST[$pValues['name']])) { $$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']); if ($pName == 'sort')$$pName = $selectorCols[$$pName]; } @@ -375,7 +375,7 @@ class CRM_Campaign_Page_AJAX { elseif ($operation == 'reserve') { $activityId = NULL; $createActivity = TRUE; - if (CRM_Utils_Array::value('activity_id', $_POST)) { + if (!empty($_POST['activity_id'])) { $activityId = CRM_Utils_Type::escape($_POST['activity_id'], 'Integer'); if ($activityId) { $createActivity = FALSE; @@ -565,7 +565,7 @@ class CRM_Campaign_Page_AJAX { $params = $searchRows = array(); foreach ($searchParams as $param) { - if (CRM_Utils_Array::value($param, $_POST)) { + if (!empty($_POST[$param])) { $params[$param] = $_POST[$param]; } } @@ -616,7 +616,7 @@ class CRM_Campaign_Page_AJAX { ); foreach ($dataTableParams as $pName => $pValues) { $$pName = $pValues['default']; - if (CRM_Utils_Array::value($pValues['name'], $_POST)) { + if (!empty($_POST[$pValues['name']])) { $$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']); if ($pName == 'sort') { $$pName = $selectorCols[$$pName]; @@ -661,7 +661,7 @@ class CRM_Campaign_Page_AJAX { $params = $searchRows = array(); foreach ($searchParams as $param) { - if (CRM_Utils_Array::value($param, $_POST)) { + if (!empty($_POST[$param])) { $params[$param] = $_POST[$param]; } } @@ -714,7 +714,7 @@ class CRM_Campaign_Page_AJAX { ); foreach ($dataTableParams as $pName => $pValues) { $$pName = $pValues['default']; - if (CRM_Utils_Array::value($pValues['name'], $_POST)) { + if (!empty($_POST[$pValues['name']])) { $$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']); if ($pName == 'sort') { $$pName = $selectorCols[$$pName]; @@ -759,7 +759,7 @@ class CRM_Campaign_Page_AJAX { $params = $searchRows = array(); foreach ($searchParams as $param) { - if (CRM_Utils_Array::value($param, $_POST)) { + if (!empty($_POST[$param])) { $params[$param] = $_POST[$param]; } } @@ -807,7 +807,7 @@ class CRM_Campaign_Page_AJAX { ); foreach ($dataTableParams as $pName => $pValues) { $$pName = $pValues['default']; - if (CRM_Utils_Array::value($pValues['name'], $_POST)) { + if (!empty($_POST[$pValues['name']])) { $$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']); if ($pName == 'sort') { $$pName = $selectorCols[$$pName]; diff --git a/CRM/Campaign/Page/DashBoard.php b/CRM/Campaign/Page/DashBoard.php index a30603468b..98006ee351 100644 --- a/CRM/Campaign/Page/DashBoard.php +++ b/CRM/Campaign/Page/DashBoard.php @@ -223,12 +223,12 @@ class CRM_Campaign_Page_DashBoard extends CRM_Core_Page { } $campaignsData[$cmpid]['isActive'] = $isActive; - if (CRM_Utils_Array::value('start_date', $campaignsData[$cmpid])) { + if (!empty($campaignsData[$cmpid]['start_date'])) { $campaignsData[$cmpid]['start_date'] = CRM_Utils_Date::customFormat($campaignsData[$cmpid]['start_date'], $config->dateformatFull ); } - if (CRM_Utils_Array::value('end_date', $campaignsData[$cmpid])) { + if (!empty($campaignsData[$cmpid]['end_date'])) { $campaignsData[$cmpid]['end_date'] = CRM_Utils_Date::customFormat($campaignsData[$cmpid]['end_date'], $config->dateformatFull ); @@ -287,7 +287,7 @@ class CRM_Campaign_Page_DashBoard extends CRM_Core_Page { $campaignId = CRM_Utils_Array::value('campaign_id', $survey); $surveysData[$sid]['campaign'] = CRM_Utils_Array::value($campaignId, $campaigns); $surveysData[$sid]['activity_type'] = $surveyType[$survey['activity_type_id']]; - if (CRM_Utils_Array::value('release_frequency', $survey)) { + if (!empty($survey['release_frequency'])) { $surveysData[$sid]['release_frequency'] = $survey['release_frequency'] . ' Day(s)'; } diff --git a/CRM/Campaign/StateMachine/Search.php b/CRM/Campaign/StateMachine/Search.php index 180c06e13c..715cc765ce 100755 --- a/CRM/Campaign/StateMachine/Search.php +++ b/CRM/Campaign/StateMachine/Search.php @@ -80,7 +80,7 @@ class CRM_Campaign_StateMachine_Search extends CRM_Core_StateMachine { function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff // fix value if print button is pressed - if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) { + if (!empty($_POST['_qf_' . $formName . '_next_print'])) { $value = CRM_Campaign_Task::PRINT_VOTERS; } else { diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index a2c43f11e7..f748309dce 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -109,7 +109,7 @@ class CRM_Case_BAO_Case extends CRM_Case_DAO_Case { static function &create(&$params) { $transaction = new CRM_Core_Transaction(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Case', $params['id'], $params); } else { @@ -118,7 +118,7 @@ class CRM_Case_BAO_Case extends CRM_Case_DAO_Case { $case = self::add($params); - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_case', $case->id); @@ -129,7 +129,7 @@ class CRM_Case_BAO_Case extends CRM_Case_DAO_Case { return $case; } - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'Case', $case->id, $case); } else { @@ -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 (CRM_Utils_Array::value($res->case_type, $rows) && CRM_Utils_Array::value($res->case_status, $rows[$res->case_type])) { + if (!empty($rows[$res->case_type]) && CRM_Utils_Array::value($res->case_status, $rows[$res->case_type])) { $rows[$res->case_type][$res->case_status]['count'] = $rows[$res->case_type][$res->case_status]['count'] + 1; } else { @@ -1057,29 +1057,29 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type $where = 'WHERE cca.case_id= %1 AND ca.is_current_revision = 1'; - if (CRM_Utils_Array::value('reporter_id', $params)) { + if (!empty($params['reporter_id'])) { $where .= " AND cac.contact_id = " . CRM_Utils_Type::escape($params['reporter_id'], 'Integer'); } - if (CRM_Utils_Array::value('status_id', $params)) { + if (!empty($params['status_id'])) { $where .= " AND ca.status_id = " . CRM_Utils_Type::escape($params['status_id'], 'Integer'); } - if (CRM_Utils_Array::value('activity_deleted', $params)) { + if (!empty($params['activity_deleted'])) { $where .= " AND ca.is_deleted = 1"; } else { $where .= " AND ca.is_deleted = 0"; } - if (CRM_Utils_Array::value('activity_type_id', $params)) { + if (!empty($params['activity_type_id'])) { $where .= " AND ca.activity_type_id = " . CRM_Utils_Type::escape($params['activity_type_id'], 'Integer'); } - if (CRM_Utils_Array::value('activity_date_low', $params)) { + if (!empty($params['activity_date_low'])) { $fromActivityDate = CRM_Utils_Type::escape(CRM_Utils_Date::processDate($params['activity_date_low']), 'Date'); } - if (CRM_Utils_Array::value('activity_date_high', $params)) { + if (!empty($params['activity_date_high'])) { $toActivityDate = CRM_Utils_Type::escape(CRM_Utils_Date::processDate($params['activity_date_high']), 'Date'); $toActivityDate = $toActivityDate ? $toActivityDate + 235959 : NULL; } @@ -1401,7 +1401,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type if ($caseId) { $activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityId, 'activity_type_id'); $nonCaseActivityTypes = CRM_Core_PseudoConstant::activityType(); - if (CRM_Utils_Array::value($activityTypeId, $nonCaseActivityTypes)) { + if (!empty($nonCaseActivityTypes[$activityTypeId])) { $anyActivity = TRUE; } else { @@ -1599,7 +1599,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type // (Or for efficiency call the global one outside the loop and then union with this each time.) $contactDetails = self::getRelatedContacts($caseId, TRUE); - if (CRM_Utils_Array::value($result['from']['id'], $contactDetails)) { + if (!empty($contactDetails[$result['from']['id']])) { $params = array(); $params['subject'] = $result['subject']; $params['activity_date_time'] = $result['date']; @@ -1819,13 +1819,13 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type } if ($latestDate) { - if (CRM_Utils_Array::value('activity_type_id', $criteriaParams)) { + if (!empty($criteriaParams['activity_type_id'])) { $where .= " AND ca.activity_type_id = " . CRM_Utils_Type::escape($criteriaParams['activity_type_id'], 'Integer'); $where .= " AND ca.is_current_revision = 1"; $groupBy .= " GROUP BY ca.activity_type_id"; } - if (CRM_Utils_Array::value('newest', $criteriaParams)) { + if (!empty($criteriaParams['newest'])) { $selectDate = " max(ca.activity_date_time) "; } else { @@ -2687,7 +2687,7 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')'; 'activity_type_id', 'id' ); - if (CRM_Utils_Array::value('isCaseActivity', $tplParams)) { + if (!empty($tplParams['isCaseActivity'])) { $tplParams['editActURL'] = CRM_Utils_System::url('civicrm/case/activity', "reset=1&cid={$activityParams['target_id']}&caseid={$activityParams['case_id']}&action=update&id={$activityParams['source_record_id']}", TRUE ); diff --git a/CRM/Case/BAO/Query.php b/CRM/Case/BAO/Query.php index 8e7c5c4146..2a5ffa0e61 100644 --- a/CRM/Case/BAO/Query.php +++ b/CRM/Case/BAO/Query.php @@ -60,66 +60,66 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1; } - if (CRM_Utils_Array::value('case_type_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_type_id'])) { $query->_select['case_type_id'] = "case_type.id as case_type_id"; $query->_element['case_type_id'] = 1; $query->_tables['case_type'] = $query->_whereTables['case_type'] = 1; $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_type', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_type'])) { $query->_select['case_type'] = "case_type.label as case_type"; $query->_element['case_type'] = 1; $query->_tables['case_type'] = $query->_whereTables['case_type'] = 1; $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_start_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_start_date'])) { $query->_select['case_start_date'] = "civicrm_case.start_date as case_start_date"; $query->_element['case_start_date'] = 1; $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_end_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_end_date'])) { $query->_select['case_end_date'] = "civicrm_case.end_date as case_end_date"; $query->_element['case_end_date'] = 1; $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_status_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_status_id'])) { $query->_select['case_status_id'] = "case_status.id as case_status_id"; $query->_element['case_status_id'] = 1; $query->_tables['case_status_id'] = $query->_whereTables['case_status_id'] = 1; $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_status'])) { $query->_select['case_status'] = "case_status.label as case_status"; $query->_element['case_status'] = 1; $query->_tables['case_status_id'] = $query->_whereTables['case_status_id'] = 1; $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_deleted', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_deleted'])) { $query->_select['case_deleted'] = "civicrm_case.is_deleted as case_deleted"; $query->_element['case_deleted'] = 1; $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_role', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_role'])) { $query->_select['case_role'] = "case_relation_type.label_b_a as case_role"; $query->_element['case_role'] = 1; $query->_tables['case_relationship'] = $query->_whereTables['case_relationship'] = 1; $query->_tables['case_relation_type'] = $query->_whereTables['case_relation_type'] = 1; } - if (CRM_Utils_Array::value('case_recent_activity_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_recent_activity_date'])) { $query->_select['case_recent_activity_date'] = "case_activity.activity_date_time as case_recent_activity_date"; $query->_element['case_recent_activity_date'] = 1; $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1; } - if (CRM_Utils_Array::value('case_activity_subject', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_activity_subject'])) { $query->_select['case_activity_subject'] = "case_activity.subject as case_activity_subject"; $query->_element['case_activity_subject'] = 1; $query->_tables['case_activity'] = 1; @@ -127,14 +127,14 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_subject', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_subject'])) { $query->_select['case_subject'] = "civicrm_case.subject as case_subject"; $query->_element['case_subject'] = 1; $query->_tables['civicrm_case_contact'] = 1; $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_source_contact_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_source_contact_id'])) { $query->_select['case_source_contact_id'] = "civicrm_case_reporter.sort_name as case_source_contact_id"; $query->_element['case_source_contact_id'] = 1; $query->_tables['civicrm_case_reporter'] = 1; @@ -143,7 +143,7 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_activity_status_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_activity_status_id'])) { $query->_select['case_activity_status_id'] = "rec_activity_status.id as case_activity_status_id"; $query->_element['case_activity_status_id'] = 1; $query->_tables['case_activity'] = 1; @@ -152,7 +152,7 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_activity_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_activity_status'])) { $query->_select['case_activity_status'] = "rec_activity_status.label as case_activity_status"; $query->_element['case_activity_status'] = 1; $query->_tables['case_activity'] = 1; @@ -161,7 +161,7 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_activity_duration', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_activity_duration'])) { $query->_select['case_activity_duration'] = "case_activity.duration as case_activity_duration"; $query->_element['case_activity_duration'] = 1; $query->_tables['case_activity'] = 1; @@ -169,7 +169,7 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_activity_medium_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_activity_medium_id'])) { $query->_select['case_activity_medium_id'] = "recent_activity_medium.label as case_activity_medium_id"; $query->_element['case_activity_medium_id'] = 1; $query->_tables['case_activity'] = 1; @@ -178,7 +178,7 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_activity_details', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_activity_details'])) { $query->_select['case_activity_details'] = "case_activity.details as case_activity_details"; $query->_element['case_activity_details'] = 1; $query->_tables['case_activity'] = 1; @@ -186,7 +186,7 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_activity_is_auto', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_activity_is_auto'])) { $query->_select['case_activity_is_auto'] = "case_activity.is_auto as case_activity_is_auto"; $query->_element['case_activity_is_auto'] = 1; $query->_tables['case_activity'] = 1; @@ -194,14 +194,14 @@ class CRM_Case_BAO_Query { $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_scheduled_activity_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_scheduled_activity_date'])) { $query->_select['case_scheduled_activity_date'] = "case_activity.activity_date_time as case_scheduled_activity_date"; $query->_element['case_scheduled_activity_date'] = 1; $query->_tables['case_activity'] = 1; $query->_tables['civicrm_case_contact'] = 1; $query->_tables['civicrm_case'] = 1; } - if (CRM_Utils_Array::value('case_recent_activity_type', $query->_returnProperties)) { + if (!empty($query->_returnProperties['case_recent_activity_type'])) { $query->_select['case_recent_activity_type'] = "rec_activity_type.label as case_recent_activity_type"; $query->_element['case_recent_activity_type'] = 1; $query->_tables['case_activity'] = 1; @@ -654,11 +654,11 @@ case_relation_type.id = case_relationship.relationship_type_id )"; } static function tableNames(&$tables) { - if (CRM_Utils_Array::value('civicrm_case', $tables)) { + if (!empty($tables['civicrm_case'])) { $tables = array_merge(array('civicrm_case_contact' => 1), $tables); } - if (CRM_Utils_Array::value('case_relation_type', $tables)) { + if (!empty($tables['case_relation_type'])) { $tables = array_merge(array('case_relationship' => 1), $tables); } } diff --git a/CRM/Case/Form/Activity.php b/CRM/Case/Form/Activity.php index be60a2c26d..715e8ac658 100644 --- a/CRM/Case/Form/Activity.php +++ b/CRM/Case/Form/Activity.php @@ -426,7 +426,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { } // format activity custom data - if (CRM_Utils_Array::value('hidden_custom', $params)) { + if (!empty($params['hidden_custom'])) { if ($this->_activityId) { // unset custom fields-id from params since we want custom // fields to be saved for new activity. @@ -460,7 +460,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { } // assigning formatted value - if (CRM_Utils_Array::value('assignee_contact_id', $params)) { + if (!empty($params['assignee_contact_id'])) { $params['assignee_contact_id'] = explode(',', $params['assignee_contact_id']); } else { @@ -516,7 +516,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { // have been modified/created by user if (isset($newActParams)) { // set proper original_id - if (CRM_Utils_Array::value('original_id', $this->_defaults)) { + if (!empty($this->_defaults['original_id'])) { $newActParams['original_id'] = $this->_defaults['original_id']; } else { @@ -541,7 +541,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { // copy files attached to old activity if any, to new one, // as long as users have not selected the 'delete attachment' option. - if (!CRM_Utils_Array::value('is_delete_attachment', $newActParams)) { + if (empty($newActParams['is_delete_attachment'])) { CRM_Core_BAO_File::copyEntityFile('civicrm_activity', $this->_activityId, 'civicrm_activity', $activity->id ); @@ -573,10 +573,10 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { $caseParams = $params; $caseParams['id'] = $this->_caseId; - if (CRM_Utils_Array::value('case_type_id', $caseParams)) { + if (!empty($caseParams['case_type_id'])) { $caseParams['case_type_id'] = CRM_Core_DAO::VALUE_SEPARATOR . $caseParams['case_type_id'] . CRM_Core_DAO::VALUE_SEPARATOR; } - if (CRM_Utils_Array::value('case_status_id', $caseParams)) { + if (!empty($caseParams['case_status_id'])) { $caseParams['status_id'] = $caseParams['case_status_id']; } @@ -671,7 +671,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { // create follow up activity if needed $followupStatus = ''; - if (CRM_Utils_Array::value('followup_activity_type_id', $params)) { + if (!empty($params['followup_activity_type_id'])) { $followupActivity = CRM_Activity_BAO_Activity::createFollowupActivity($activity->id, $params); if ($followupActivity) { diff --git a/CRM/Case/Form/Activity/ChangeCaseStartDate.php b/CRM/Case/Form/Activity/ChangeCaseStartDate.php index 9bfd20249c..b64a9e0324 100644 --- a/CRM/Case/Form/Activity/ChangeCaseStartDate.php +++ b/CRM/Case/Form/Activity/ChangeCaseStartDate.php @@ -120,7 +120,7 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate { * @return void */ static function endPostProcess(&$form, &$params, $activity) { - if (CRM_Utils_Array::value('start_date', $params)) { + if (!empty($params['start_date'])) { $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']); } diff --git a/CRM/Case/Form/Activity/ChangeCaseType.php b/CRM/Case/Form/Activity/ChangeCaseType.php index 739ebba334..3e07013f19 100644 --- a/CRM/Case/Form/Activity/ChangeCaseType.php +++ b/CRM/Case/Form/Activity/ChangeCaseType.php @@ -138,7 +138,7 @@ class CRM_Case_Form_Activity_ChangeCaseType { $caseTypes = CRM_Case_PseudoConstant::caseType('name'); $allCaseTypes = CRM_Case_PseudoConstant::caseType('label', FALSE); - if (CRM_Utils_Array::value($params['case_type_id'], $caseTypes)) { + if (!empty($caseTypes[$params['case_type_id']])) { $caseType = $caseTypes[$params['case_type_id']]; } diff --git a/CRM/Case/Form/Case.php b/CRM/Case/Form/Case.php index a410b9bcce..255ecc6b32 100644 --- a/CRM/Case/Form/Case.php +++ b/CRM/Case/Form/Case.php @@ -193,7 +193,7 @@ class CRM_Case_Form_Case extends CRM_Core_Form { $activityGroupTree = $this->_groupTree; // for case custom fields to populate with defaults - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { CRM_Custom_Form_CustomData::preProcess($this); CRM_Custom_Form_CustomData::buildQuickForm($this); } @@ -370,8 +370,7 @@ class CRM_Case_Form_Case extends CRM_Core_Form { $className::beginPostProcess($this, $params ); } - if ( - CRM_Utils_Array::value('hidden_custom', $params) && + if (!empty($params['hidden_custom']) && !isset($params['custom']) ) { $customFields = array(); @@ -384,7 +383,7 @@ class CRM_Case_Form_Case extends CRM_Core_Form { } // 2. create/edit case - if (CRM_Utils_Array::value('case_type_id', $params)) { + if (!empty($params['case_type_id'])) { $caseType = CRM_Case_PseudoConstant::caseType('name'); $params['case_type'] = $caseType[$params['case_type_id']]; $params['subject'] = $params['activity_subject']; @@ -418,7 +417,7 @@ class CRM_Case_Form_Case extends CRM_Core_Form { $session->pushUserContext($url); // 3. format activity custom data - if (CRM_Utils_Array::value('hidden_custom', $params)) { + if (!empty($params['hidden_custom'])) { $customFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, $this->_activityTypeId); $customFields = CRM_Utils_Array::crmArrayMerge($customFields, CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index ef53359441..8acee3dc87 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -358,7 +358,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { } //calculate roles that don't have relationships - if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) { + if (!empty($caseRoles[$value['relation_type']])) { unset($caseRoles[$value['relation_type']]); } } @@ -488,7 +488,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { $session = CRM_Core_Session::singleton(); $session->pushUserContext($url); - if (CRM_Utils_Array::value('timeline_id', $params) && + if (!empty($params['timeline_id']) && CRM_Utils_Array::value('_qf_CaseView_next', $_POST) ) { $session = CRM_Core_Session::singleton(); diff --git a/CRM/Case/Form/Search.php b/CRM/Case/Form/Search.php index 5d96464c41..9a1b2e7641 100644 --- a/CRM/Case/Form/Search.php +++ b/CRM/Case/Form/Search.php @@ -276,7 +276,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form { $tasks = array('' => ts('- actions -')) + CRM_Case_Task::permissionedTaskTitles($permission); - if (CRM_Utils_Array::value('case_deleted', $this->_formValues)) { + if (!empty($this->_formValues['case_deleted'])) { unset($tasks[1]); } else { @@ -357,7 +357,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form { $this->_formValues['case_owner'] = 2; } - if (!CRM_Utils_Array::value('case_deleted', $this->_formValues)) { + if (empty($this->_formValues['case_deleted'])) { $this->_formValues['case_deleted'] = 0; } CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues); diff --git a/CRM/Case/StateMachine/Search.php b/CRM/Case/StateMachine/Search.php index 5be22b837a..c9883ff9a6 100644 --- a/CRM/Case/StateMachine/Search.php +++ b/CRM/Case/StateMachine/Search.php @@ -82,7 +82,7 @@ class CRM_Case_StateMachine_Search extends CRM_Core_StateMachine { function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff // fix value if print button is pressed - if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) { + if (!empty($_POST['_qf_' . $formName . '_next_print'])) { $value = CRM_Case_Task::PRINT_CASES; } else { diff --git a/CRM/Case/XMLProcessor/Process.php b/CRM/Case/XMLProcessor/Process.php index 2dda1d36df..297447699c 100644 --- a/CRM/Case/XMLProcessor/Process.php +++ b/CRM/Case/XMLProcessor/Process.php @@ -388,7 +388,7 @@ AND a.is_deleted = 0 if ($referenceActivityName = (string) $activityTypeXML->reference_activity) { //we skip open case as reference activity.CRM-4374. - if (CRM_Utils_Array::value('resetTimeline', $params) && $referenceActivityName == 'Open Case') { + if (!empty($params['resetTimeline']) && $referenceActivityName == 'Open Case') { $activityDate = $params['activity_date_time']; } else { @@ -434,7 +434,7 @@ AND a.is_deleted = 0 return TRUE; } $activityParams['case_id'] = $params['caseID']; - if (CRM_Utils_Array::value('is_auto', $activityParams)) { + if (!empty($activityParams['is_auto'])) { $activityParams['skipRecentView'] = TRUE; } diff --git a/CRM/Case/XMLProcessor/Report.php b/CRM/Case/XMLProcessor/Report.php index 869db441c7..bc8d94b90d 100644 --- a/CRM/Case/XMLProcessor/Report.php +++ b/CRM/Case/XMLProcessor/Report.php @@ -667,7 +667,7 @@ LIMIT 1 $template->assign('clientID', $clientID); $template->assign('activitySetName', $activitySetName); - if (CRM_Utils_Array::value('is_redact', $params)) { + if (!empty($params['is_redact'])) { $form->_isRedact = TRUE; $template->assign('_isRedact', 'true'); } @@ -746,7 +746,7 @@ LIMIT 1 $xmlProcessor = new CRM_Case_XMLProcessor_Process(); $caseRoles = $xmlProcessor->get($caseType, 'CaseRoles'); foreach ($caseRelationships as $key => & $value) { - if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) { + if (!empty($caseRoles[$value['relation_type']])) { unset($caseRoles[$value['relation_type']]); } if ($isRedact) { @@ -756,7 +756,7 @@ LIMIT 1 ); } $value['name'] = self::redact($value['name'], TRUE, $report->_redactionStringRules); - if (CRM_Utils_Array::value('email', $value) && + if (!empty($value['email']) && !array_key_exists($value['email'], $report->_redactionStringRules) ) { $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, @@ -766,7 +766,7 @@ LIMIT 1 $value['email'] = self::redact($value['email'], TRUE, $report->_redactionStringRules); - if (CRM_Utils_Array::value('phone', $value) && + if (!empty($value['phone']) && !array_key_exists($value['phone'], $report->_redactionStringRules) ) { $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, @@ -788,7 +788,7 @@ LIMIT 1 $report->_redactionStringRules[$caseRoles['client']['display_name']] = $report->_redactionStringRules[$caseRoles['client']['sort_name']]; } $caseRoles['client']['sort_name'] = self::redact($caseRoles['client']['sort_name'], TRUE, $report->_redactionStringRules); - if (CRM_Utils_Array::value('email', $caseRoles['client']) && + if (!empty($caseRoles['client']['email']) && !array_key_exists($caseRoles['client']['email'], $report->_redactionStringRules) ) { $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, @@ -797,7 +797,7 @@ LIMIT 1 } $caseRoles['client']['email'] = self::redact($caseRoles['client']['email'], TRUE, $report->_redactionStringRules); - if (CRM_Utils_Array::value('phone', $caseRoles['client']) && + if (!empty($caseRoles['client']['phone']) && !array_key_exists($caseRoles['client']['phone'], $report->_redactionStringRules) ) { $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, @@ -824,7 +824,7 @@ LIMIT 1 } $r['name'] = self::redact($r['name'], TRUE, $report->_redactionStringRules); - if (CRM_Utils_Array::value('phone', $r) && + if (!empty($r['phone']) && !array_key_exists($r['phone'], $report->_redactionStringRules) ) { $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, @@ -833,7 +833,7 @@ LIMIT 1 } $r['phone'] = self::redact($r['phone'], TRUE, $report->_redactionStringRules); - if (CRM_Utils_Array::value('email', $r) && + if (!empty($r['email']) && !array_key_exists($r['email'], $report->_redactionStringRules) ) { $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, @@ -862,7 +862,7 @@ LIMIT 1 $r['sort_name'] = self::redact($r['sort_name'], TRUE, $report->_redactionStringRules); - if (CRM_Utils_Array::value('phone', $r) && + if (!empty($r['phone']) && !array_key_exists($r['phone'], $report->_redactionStringRules) ) { $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, @@ -871,7 +871,7 @@ LIMIT 1 } $r['phone'] = self::redact($r['phone'], TRUE, $report->_redactionStringRules); - if (CRM_Utils_Array::value('email', $r) && + if (!empty($r['email']) && !array_key_exists($r['email'], $report->_redactionStringRules) ) { $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 333451e9ff..da63d1e565 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -272,7 +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 (!CRM_Utils_Array::value('contact_type', $params) && + if (empty($params['contact_type']) && !CRM_Utils_Array::value('contact_id', $params) ) { return $contact; @@ -327,7 +327,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { // Enabling multisite causes the contact to be added to the domain group $domainGroupID = CRM_Core_BAO_Domain::getGroupId(); if(!empty($domainGroupID)){ - if (CRM_Utils_Array::value('group', $params) && is_array($params['group'])) { + if (!empty($params['group']) && is_array($params['group'])) { $params['group'][$domainGroupID] = 1; } else { @@ -361,7 +361,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { $session = CRM_Core_Session::singleton(); $userID = $session->get('userID'); // add notes - if (CRM_Utils_Array::value('note', $params)) { + if (!empty($params['note'])) { if (is_array($params['note'])) { foreach ($params['note'] as $note) { $contactId = $contact->id; @@ -408,14 +408,14 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { // update the UF user_unique_id if that has changed CRM_Core_BAO_UFMatch::updateUFName($contact->id); - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contact', $contact->id); } // make a civicrm_subscription_history entry only on contact create (CRM-777) - if (!CRM_Utils_Array::value('contact_id', $params)) { + if (empty($params['contact_id'])) { $subscriptionParams = array( 'contact_id' => $contact->id, 'status' => 'Added', @@ -511,7 +511,7 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); */ static function resolveDefaults(&$defaults, $reverse = FALSE) { // hack for birth_date - if (CRM_Utils_Array::value('birth_date', $defaults)) { + if (!empty($defaults['birth_date'])) { if (is_array($defaults['birth_date'])) { $defaults['birth_date'] = CRM_Utils_Date::format($defaults['birth_date'], '-'); } @@ -544,7 +544,7 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); if ($name == 'address') { // FIXME: lookupValue doesn't work for vcard_name - if (CRM_Utils_Array::value('location_type_id', $values)) { + if (!empty($values['location_type_id'])) { $vcardNames = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'vcard_name')); $values['vcard_name'] = $vcardNames[$values['location_type_id']]; } @@ -1570,10 +1570,10 @@ WHERE id={$id}; "; } } - if (!CRM_Utils_Array::value('location', $returnProperties)) { + if (empty($returnProperties['location'])) { $returnProperties['location'] = array(); } - if (!CRM_Utils_Array::value($locationTypeName, $returnProperties['location'])) { + if (empty($returnProperties['location'][$locationTypeName])) { $returnProperties['location'][$locationTypeName] = array(); $returnProperties['location'][$locationTypeName]['location_type'] = $id; } @@ -1625,7 +1625,7 @@ WHERE id={$id}; "; $entityBlock = array('contact_id' => $contactId); $blocks = CRM_Core_BAO_Location::getValues($entityBlock); foreach($blocks[$block] as $key => $value){ - if (CRM_Utils_Array::value('is_primary', $value)){ + if (!empty($value['is_primary'])){ $locationType = CRM_Utils_Array::value('location_type_id',$value); } } @@ -1789,7 +1789,7 @@ ORDER BY civicrm_email.is_primary DESC"; } // Process group and tag - if (CRM_Utils_Array::value('group', $fields)) { + if (!empty($fields['group'])) { $method = 'Admin'; // this for sure means we are coming in via profile since i added it to fix // removing contacts from user groups -- lobo @@ -1799,7 +1799,7 @@ ORDER BY civicrm_email.is_primary DESC"; CRM_Contact_BAO_GroupContact::create($params['group'], $contactID, $visibility, $method); } - if (CRM_Utils_Array::value('tag', $fields)) { + if (!empty($fields['tag'])) { CRM_Core_BAO_EntityTag::create($params['tag'], 'civicrm_contact', $contactID); } @@ -2087,7 +2087,7 @@ ORDER BY civicrm_email.is_primary DESC"; } $valueId = NULL; - if (CRM_Utils_Array::value('customRecordValues', $params)) { + if (!empty($params['customRecordValues'])) { if (is_array($params['customRecordValues']) && !empty($params['customRecordValues'])) { foreach ($params['customRecordValues'] as $recId => $customFields) { if (is_array($customFields) && !empty($customFields)) { @@ -2103,7 +2103,7 @@ ORDER BY civicrm_email.is_primary DESC"; } $type = $data['contact_type']; - if ( CRM_Utils_Array::value('contact_sub_type', $data) ) { + if (!empty($data['contact_sub_type'])) { $type = $data['contact_sub_type']; $type = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($type, CRM_Core_DAO::VALUE_SEPARATOR)); // generally a contact even if, has multiple subtypes the parent-type is going to be one only diff --git a/CRM/Contact/BAO/Contact/Permission.php b/CRM/Contact/BAO/Contact/Permission.php index 0f80d5208f..4c363b10aa 100644 --- a/CRM/Contact/BAO/Contact/Permission.php +++ b/CRM/Contact/BAO/Contact/Permission.php @@ -104,7 +104,7 @@ WHERE contact_a.id = %1 AND $permission"; } if (!$force) { - if (CRM_Utils_Array::value($userID, $_processed)) { + if (!empty($_processed[$userID])) { return; } diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index a54925188f..c1d31856ff 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -59,7 +59,7 @@ class CRM_Contact_BAO_Contact_Utils { $params = array('name' => $contactType); CRM_Contact_BAO_ContactType::retrieve($params, $typeInfo); - if (CRM_Utils_Array::value('image_URL', $typeInfo)) { + if (!empty($typeInfo['image_URL'])) { $imageUrl = $typeInfo['image_URL']; $config = CRM_Core_Config::singleton(); @@ -848,7 +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 (!CRM_Utils_Array::value('master_id', $values) || + if (empty($values['master_id']) || !CRM_Utils_Array::value('use_shared_address', $values) ) { // we should unset master id when use uncheck share address for existing address @@ -889,7 +889,7 @@ Group By componentId"; // get the list of master id's for address $masterAddressIds = array(); foreach ($addresses as $key => $addressValue) { - if (CRM_Utils_Array::value('master_id', $addressValue)) { + if (!empty($addressValue['master_id'])) { $masterAddressIds[] = $addressValue['master_id']; } } diff --git a/CRM/Contact/BAO/ContactType.php b/CRM/Contact/BAO/ContactType.php index 62719aa01e..6d6484578e 100644 --- a/CRM/Contact/BAO/ContactType.php +++ b/CRM/Contact/BAO/ContactType.php @@ -588,10 +588,10 @@ WHERE name = %1"; static function add($params) { // label or name - if (!CRM_Utils_Array::value('label', $params)) { + if (empty($params['label'])) { return; } - if (CRM_Utils_Array::value('parent_id', $params) && + if (!empty($params['parent_id']) && !CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $params['parent_id']) ) { return; @@ -609,7 +609,7 @@ WHERE name = %1"; $active = $contactType->is_active; } - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $params = array('name' => "New $contactName"); $newParams = array( 'label' => "New $contact", diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index c9ff150ea6..dcc59a8b4d 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -346,7 +346,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { */ public static function &create(&$params) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Group', $params['id'], $params); } else { @@ -396,7 +396,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { array_keys($group->parents) ) . CRM_Core_DAO::VALUE_SEPARATOR; } - if (!CRM_Utils_Array::value('id', $params) && + if (empty($params['id']) && !$nameParam ) { $group->name .= "_tmp"; @@ -407,7 +407,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { return NULL; } - if (!CRM_Utils_Array::value('id', $params) && + if (empty($params['id']) && !$nameParam ) { $group->name = substr($group->name, 0, -4) . "_{$group->id}"; @@ -417,7 +417,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { $group->save(); // add custom field values - if (CRM_Utils_Array::value('custom', $params)) { + if (!empty($params['custom'])) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_group', $group->id); } @@ -461,7 +461,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { } } - if (CRM_Utils_Array::value('organization_id', $params)) { + if (!empty($params['organization_id'])) { $groupOrg = array(); $groupOrg = $params; $groupOrg['group_id'] = $group->id; @@ -470,7 +470,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { CRM_Contact_BAO_GroupContactCache::add($group->id); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'Group', $group->id, $group); } else { @@ -529,7 +529,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { * @static */ public static function createSmartGroup(&$params) { - if (CRM_Utils_Array::value('formValues', $params)) { + if (!empty($params['formValues'])) { $ssParams = $params; unset($ssParams['id']); if (isset($ssParams['saved_search_id'])) { @@ -653,7 +653,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { } $smartGroupId = NULL; - if (CRM_Utils_Array::value('saved_search_id', $params)) { + if (!empty($params['saved_search_id'])) { $smartGroupId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $ssId, 'id', 'saved_search_id'); } else { @@ -692,7 +692,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { $groups = CRM_Contact_BAO_Group::getGroupList($params); //skip total if we are making call to show only children - if ( !CRM_Utils_Array::value('parent_id', $params) ) { + if (empty($params['parent_id'])) { // add total $params['total'] = CRM_Contact_BAO_Group::getGroupCount($params); @@ -709,7 +709,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 ( !CRM_Utils_Array::value('parent_id', $params) && + if (empty($params['parent_id']) && CRM_Utils_Array::value( 'parents', $value ) ) { $groupIds = explode(',', $value['parents']); $title = array(); @@ -721,7 +721,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { } $groupList[$id]['group_description'] = CRM_Utils_Array::value('description', $value); - if ( CRM_Utils_Array::value('group_type', $value) ) { + if (!empty($value['group_type'])) { $groupList[$id]['group_type'] = $value['group_type']; } else { @@ -1038,7 +1038,7 @@ WHERE id IN $groupIdString $whereClause = self::whereClause($params, FALSE); $query = "SELECT COUNT(*) FROM civicrm_group groups"; - if (CRM_Utils_Array::value('created_by', $params)) { + if (!empty($params['created_by'])) { $query .= " INNER JOIN civicrm_contact createdBy ON createdBy.id = groups.created_id"; diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index 1d792ec283..7043d6a209 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -535,11 +535,11 @@ SELECT * // check which values has to be add/remove contact from group foreach ($allGroup as $key => $varValue) { - if (CRM_Utils_Array::value($key, $params) && !array_key_exists($key, $contactGroup)) { + if (!empty($params[$key]) && !array_key_exists($key, $contactGroup)) { // add contact to group CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $key, $method); } - elseif (!CRM_Utils_Array::value($key, $params) && array_key_exists($key, $contactGroup)) { + elseif (empty($params[$key]) && array_key_exists($key, $contactGroup)) { // remove contact from group CRM_Contact_BAO_GroupContact::removeContactsFromGroup($contactIds, $key, $method); } diff --git a/CRM/Contact/BAO/GroupOrganization.php b/CRM/Contact/BAO/GroupOrganization.php index b10bd0d772..db3c0d0b4f 100644 --- a/CRM/Contact/BAO/GroupOrganization.php +++ b/CRM/Contact/BAO/GroupOrganization.php @@ -77,15 +77,15 @@ class CRM_Contact_BAO_GroupOrganization extends CRM_Contact_DAO_GroupOrganizatio * @static */ static function formatValues(&$params, &$formatedValues) { - if (CRM_Utils_Array::value('group_organization', $params)) { + if (!empty($params['group_organization'])) { $formatedValues['id'] = $params['group_organization']; } - if (CRM_Utils_Array::value('group_id', $params)) { + if (!empty($params['group_id'])) { $formatedValues['group_id'] = $params['group_id']; } - if (CRM_Utils_Array::value('organization_id', $params)) { + if (!empty($params['organization_id'])) { $formatedValues['organization_id'] = $params['organization_id']; } } @@ -101,7 +101,7 @@ class CRM_Contact_BAO_GroupOrganization extends CRM_Contact_DAO_GroupOrganizatio */ static function dataExists($params) { // return if no data present - if (CRM_Utils_Array::value('organization_id', $params) && + if (!empty($params['organization_id']) && CRM_Utils_Array::value('group_id', $params) ) { return TRUE; diff --git a/CRM/Contact/BAO/Individual.php b/CRM/Contact/BAO/Individual.php index 386e6cd66c..5d13d0c5e5 100644 --- a/CRM/Contact/BAO/Individual.php +++ b/CRM/Contact/BAO/Individual.php @@ -200,7 +200,7 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { ); // make sure we have all the name fields. foreach ($nameParams as $name => $value) { - if (!CRM_Utils_Array::value($name, $formatted) && $value) { + if (empty($formatted[$name]) && $value) { $formatted[$name] = $value; } } @@ -236,7 +236,7 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { //start further check for email. if (empty($sortName) || empty($displayName)) { $email = NULL; - if (CRM_Utils_Array::value('email', $params) && + if (!empty($params['email']) && is_array($params['email']) ) { foreach ($params['email'] as $emailBlock) { diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index e313c4a62c..56c7d8f0ca 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -541,7 +541,7 @@ class CRM_Contact_BAO_Query { } foreach ($this->_params as $value) { - if (!CRM_Utils_Array::value(0, $value)) { + if (empty($value[0])) { continue; } $cfID = CRM_Core_BAO_CustomField::getKeyID($value[0]); @@ -569,7 +569,7 @@ class CRM_Contact_BAO_Query { function addSpecialFields() { static $special = array('contact_type', 'contact_sub_type', 'sort_name', 'display_name'); foreach ($special as $name) { - if (CRM_Utils_Array::value($name, $this->_returnProperties)) { + if (!empty($this->_returnProperties[$name])) { $this->_select[$name] = "contact_a.{$name} as $name"; $this->_element[$name] = 1; } @@ -647,8 +647,7 @@ class CRM_Contact_BAO_Query { } $cfID = CRM_Core_BAO_CustomField::getKeyID($name); - if ( - CRM_Utils_Array::value($name, $this->_paramLookup) || + if (!empty($this->_paramLookup[$name]) || CRM_Utils_Array::value($name, $this->_returnProperties) || $makeException ) { @@ -843,7 +842,7 @@ class CRM_Contact_BAO_Query { CRM_Utils_Array::value('is_search_range', $field) ) { // this is a custom field with range search enabled, so we better check for two/from values - if (CRM_Utils_Array::value($name . '_from', $this->_paramLookup)) { + if (!empty($this->_paramLookup[$name . '_from'])) { if (!array_key_exists($cfID, $this->_cfIDs)) { $this->_cfIDs[$cfID] = array(); } @@ -862,7 +861,7 @@ class CRM_Contact_BAO_Query { } } } - if (CRM_Utils_Array::value($name . '_to', $this->_paramLookup)) { + if (!empty($this->_paramLookup[$name . '_to'])) { if (!array_key_exists($cfID, $this->_cfIDs)) { $this->_cfIDs[$cfID] = array(); } @@ -914,7 +913,7 @@ class CRM_Contact_BAO_Query { * @access public */ function addHierarchicalElements() { - if (!CRM_Utils_Array::value('location', $this->_returnProperties)) { + if (empty($this->_returnProperties['location'])) { return; } if (!is_array($this->_returnProperties['location'])) { @@ -1119,7 +1118,7 @@ class CRM_Contact_BAO_Query { $this->_element["{$name}-{$elementFullName}"] = 1; } - if (!CRM_Utils_Array::value("`$tName`", $processed)) { + if (empty($processed["`$tName`"])) { $processed["`$tName`"] = 1; $newName = $tableName . '_' . $index; switch ($tableName) { @@ -1194,7 +1193,7 @@ class CRM_Contact_BAO_Query { if ($addWhereCount) { $locClause = array(); foreach ($this->_whereTables as $tableName => $clause) { - if (CRM_Utils_Array::value($tableName, $locationTypeJoin)) { + if (!empty($locationTypeJoin[$tableName])) { $locClause[] = $locationTypeJoin[$tableName]; } } @@ -1231,7 +1230,7 @@ class CRM_Contact_BAO_Query { * @access public */ function addMultipleElements() { - if (!CRM_Utils_Array::value('website', $this->_returnProperties)) { + if (empty($this->_returnProperties['website'])) { return; } if (!is_array($this->_returnProperties['website'])) { @@ -1293,7 +1292,7 @@ class CRM_Contact_BAO_Query { $from = $this->_simpleFromClause; } else { - if (CRM_Utils_Array::value('group', $this->_paramLookup)) { + if (!empty($this->_paramLookup['group'])) { // make sure there is only one element // this is used when we are running under smog and need to know // how the contact was added (CRM-1203) @@ -1754,7 +1753,7 @@ class CRM_Contact_BAO_Query { $this->includeContactIds(); if (!empty($this->_params)) { foreach (array_keys($this->_params) as $id) { - if (!CRM_Utils_Array::value(0, $this->_params[$id])) { + if (empty($this->_params[$id][0])) { continue; } // check for both id and contact_id @@ -2116,7 +2115,7 @@ class CRM_Contact_BAO_Query { } $type = NULL; - if (CRM_Utils_Array::value('type', $field)) { + if (!empty($field['type'])) { $type = CRM_Utils_Type::typeToString($field['type']); } @@ -2279,7 +2278,7 @@ class CRM_Contact_BAO_Query { return $from; } - if (CRM_Utils_Array::value('civicrm_worldregion', $tables)) { + if (!empty($tables['civicrm_worldregion'])) { $tables = array_merge(array('civicrm_country' => 1), $tables); } @@ -2295,15 +2294,14 @@ class CRM_Contact_BAO_Query { } // add group_contact table if group table is present - if (CRM_Utils_Array::value('civicrm_group', $tables) && + if (!empty($tables['civicrm_group']) && !CRM_Utils_Array::value('civicrm_group_contact', $tables) ) { $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 (CRM_Utils_Array::value('civicrm_subscription_history', $tables) - && !CRM_Utils_Array::value('civicrm_group', $tables) + if (!empty($tables['civicrm_subscription_history']) && !CRM_Utils_Array::value('civicrm_group', $tables) ) { $tables = array_merge(array( 'civicrm_group' => 1, @@ -2354,10 +2352,10 @@ class CRM_Contact_BAO_Query { continue; } - if (CRM_Utils_Array::value($name, $inner)) { + if (!empty($inner[$name])) { $side = 'INNER'; } - elseif (CRM_Utils_Array::value($name, $right)) { + elseif (!empty($right[$name])) { $side = 'RIGHT'; } else { @@ -2662,7 +2660,7 @@ class CRM_Contact_BAO_Query { // left join $groupIDs = array_keys($value); - if (CRM_Utils_Array::value(0, $groupIDs) && + if (!empty($groupIDs[0]) && CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $groupIDs[0], 'saved_search_id' @@ -3369,7 +3367,7 @@ WHERE id IN ( $groupIDs ) */ function postalCode(&$values) { // skip if the fields dont have anything to do with postal_code - if (!CRM_Utils_Array::value('postal_code', $this->_fields)) { + if (empty($this->_fields['postal_code'])) { return; } @@ -5227,7 +5225,7 @@ AND displayRelType.is_active = 1 } $values = array(); foreach ($this->_pseudoConstantsSelect as $key => $value) { - if (CRM_Utils_Array::value('sorting', $this->_pseudoConstantsSelect[$key])) { + if (!empty($this->_pseudoConstantsSelect[$key]['sorting'])) { continue; } @@ -5288,7 +5286,7 @@ AND displayRelType.is_active = 1 $present = array(); foreach ($this->_pseudoConstantsSelect as $name => $value) { - if (CRM_Utils_Array::value('table', $value)) { + if (!empty($value['table'])) { $regex = "/({$value['table']}\.|{$name})/"; if (preg_match($regex, $sort)) { $this->_elemnt[$value['element']] = 1; diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 67f89428ef..7ec060ba96 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -132,7 +132,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $validContacts = TRUE; //validate contacts in update mode also. - if (CRM_Utils_Array::value('contact', $ids) && + if (!empty($ids['contact']) && CRM_Utils_Array::value('contactTarget', $ids) ) { if (self::checkValidRelationship($params, $ids, $ids['contactTarget'])) { @@ -257,7 +257,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $relationship->save(); // add custom field values - if (CRM_Utils_Array::value('custom', $params)) { + if (!empty($params['custom'])) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_relationship', $relationship->id); } @@ -774,7 +774,7 @@ WHERE relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer'); $v = array(); // get the specific number of relationship or all relationships. - if (CRM_Utils_Array::value('numRelationship', $params)) { + if (!empty($params['numRelationship'])) { $v['data'] = &CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], NULL, $params['numRelationship']); } else { @@ -1296,10 +1296,10 @@ SELECT relationship_type_id, relationship_direction $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($membershipValues['membership_type_id']); // Check if contact's relationship type exists in membership type $relTypeDirs = array(); - if (CRM_Utils_Array::value('relationship_type_id', $membershipType)) { + if (!empty($membershipType['relationship_type_id'])) { $relTypeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $membershipType['relationship_type_id']); } - if (CRM_Utils_Array::value('relationship_direction', $membershipType)) { + if (!empty($membershipType['relationship_direction'])) { $relDirections = explode(CRM_Core_DAO::VALUE_SEPARATOR, $membershipType['relationship_direction']); } foreach ($relTypeIds as $key => $value) { @@ -1326,7 +1326,7 @@ SELECT relationship_type_id, relationship_direction } foreach (array( 'join_date', 'start_date', 'end_date') as $dateField) { - if (CRM_Utils_Array::value($dateField, $membershipValues)) { + if (!empty($membershipValues[$dateField])) { $membershipValues[$dateField] = CRM_Utils_Date::processDate($membershipValues[$dateField]); } } diff --git a/CRM/Contact/BAO/RelationshipType.php b/CRM/Contact/BAO/RelationshipType.php index 3246acd890..390a90dd5d 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 (!CRM_Utils_Array::value('label_a_b', $params) && CRM_Utils_Array::value('name_a_b', $params)) { + if (empty($params['label_a_b']) && CRM_Utils_Array::value('name_a_b', $params)) { $params['label_a_b'] = $params['name_a_b']; } - if (!CRM_Utils_Array::value('label_b_a', $params) && CRM_Utils_Array::value('name_b_a', $params)) { + if (empty($params['label_b_a']) && CRM_Utils_Array::value('name_b_a', $params)) { $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 (!CRM_Utils_Array::value('relationshipType', $ids)) { - if (!CRM_Utils_Array::value('name_a_b', $params) && CRM_Utils_Array::value('label_a_b', $params)) { + if (empty($ids['relationshipType'])) { + if (empty($params['name_a_b']) && CRM_Utils_Array::value('label_a_b', $params)) { $params['name_a_b'] = $params['label_a_b']; } - if (!CRM_Utils_Array::value('name_b_a', $params) && CRM_Utils_Array::value('label_b_a', $params)) { + if (empty($params['name_b_a']) && CRM_Utils_Array::value('label_b_a', $params)) { $params['name_b_a'] = $params['label_b_a']; } } diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php index d9aa603cb3..3c74e1fd13 100644 --- a/CRM/Contact/BAO/SavedSearch.php +++ b/CRM/Contact/BAO/SavedSearch.php @@ -136,7 +136,7 @@ class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch { if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $id, 'mapping_id')) { return CRM_Core_BAO_Mapping::formattedFields($fv); } - elseif (CRM_Utils_Array::value('customSearchID', $fv)) { + elseif (!empty($fv['customSearchID'])) { return $fv; } else { @@ -158,7 +158,7 @@ class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch { static function whereClause($id, &$tables, &$whereTables) { $params = self::getSearchParams($id); if ($params) { - if (CRM_Utils_Array::value('customSearchID', $params)) { + if (!empty($params['customSearchID'])) { // this has not yet been implemented } else { return CRM_Contact_BAO_Query::getWhereClause($params, NULL, $tables, $whereTables); @@ -192,7 +192,7 @@ WHERE $where"; $params = self::getSearchParams($id); if ($params) { - if (CRM_Utils_Array::value('customSearchID', $params)) { + if (!empty($params['customSearchID'])) { return CRM_Contact_BAO_SearchCustom::fromWhereEmail(NULL, $id); } else { diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index c5944e8b89..b1b89e79e5 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -197,7 +197,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $returnProperities = array('id', 'contact_type', 'contact_sub_type', 'modified_date'); CRM_Core_DAO::commonRetrieve('CRM_Contact_DAO_Contact', $params, $defaults, $returnProperities); - if (!CRM_Utils_Array::value('id', $defaults)) { + if (empty($defaults['id'])) { CRM_Core_Error::statusBounce(ts('A Contact with that ID does not exist: %1', array(1 => $this->_contactId))); } @@ -265,7 +265,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { 'address_options' ); $this->_parseStreetAddress = FALSE; - if (CRM_Utils_Array::value('street_address', $addressOptions) && + if (!empty($addressOptions['street_address']) && CRM_Utils_Array::value('street_address_parsing', $addressOptions) ) { $this->_parseStreetAddress = TRUE; @@ -327,7 +327,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { CRM_Contact_Form_Location::preProcess($this); // retain the multiple count custom fields value - if(CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { $customGroupCount = CRM_Utils_Array::value('hidden_custom_group_count', $_POST); if ($contactSubType = CRM_Utils_Array::value( 'contact_sub_type', $_POST)) { @@ -374,7 +374,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { else { $contactSubType = $this->_contactSubType; // need contact sub type to build related grouptree array during post process - if (CRM_Utils_Array::value('contact_sub_type', $_POST)) { + if (!empty($_POST['contact_sub_type'])) { $contactSubType = $_POST['contact_sub_type']; } //only custom data has preprocess hence directly call it @@ -425,7 +425,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('contact_sub_type', $defaults)) { + if (!empty($defaults['contact_sub_type'])) { $defaults['contact_sub_type'] = $this->_oldSubtypes; } } @@ -442,7 +442,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { //set address block defaults CRM_Contact_Form_Edit_Address::setDefaultValues( $defaults, $this ); - if (CRM_Utils_Array::value('image_URL', $defaults)) { + if (!empty($defaults['image_URL'])) { list($imageWidth, $imageHeight) = getimagesize($defaults['image_URL']); list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight); $this->assign('imageWidth', $imageWidth); @@ -552,7 +552,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } // set defaults for country-state widget - if (CRM_Utils_Array::value('address', $defaults) && is_array($defaults['address'])) { + if (!empty($defaults['address']) && is_array($defaults['address'])) { foreach ($defaults['address'] as $blockId => $values) { CRM_Contact_Form_Edit_Address::fixStateSelect($this, "address[$blockId][country_id]", @@ -640,7 +640,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { foreach ($blocks as $name => $label) { $hasData = $hasPrimary = array(); $name = strtolower($name); - if (CRM_Utils_Array::value($name, $fields) && is_array($fields[$name])) { + if (!empty($fields[$name]) && is_array($fields[$name])) { foreach ($fields[$name] as $instance => $blockValues) { $dataExists = self::blockDataExists($blockValues); @@ -655,7 +655,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } $hasData[] = $instance; - if (CRM_Utils_Array::value('is_primary', $blockValues)) { + if (!empty($blockValues['is_primary'])) { $hasPrimary[] = $instance; if (!$primaryID && in_array($name, array( @@ -666,7 +666,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } } - if (!CRM_Utils_Array::value('location_type_id', $blockValues)) { + if (empty($blockValues['location_type_id'])) { $errors["{$name}[$instance][location_type_id]"] = ts('The Location Type should be set if there is %1 information.', array(1 => $label)); } } @@ -716,7 +716,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { foreach ($fields['address'] as $cnt => $address) { if ($streetNumber = CRM_Utils_Array::value('street_number', $address)) { $parsedAddress = CRM_Core_BAO_Address::parseStreetAddress($address['street_number']); - if (!CRM_Utils_Array::value('street_number', $parsedAddress)) { + if (empty($parsedAddress['street_number'])) { $invalidStreetNumbers[] = $cnt; } } @@ -854,7 +854,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { ), ); - if (CRM_Utils_Array::value('contact_sub_type', $this->_values)) { + if (!empty($this->_values['contact_sub_type'])) { $this->_oldSubtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($this->_values['contact_sub_type'], CRM_Core_DAO::VALUE_SEPARATOR) ); @@ -891,7 +891,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { CRM_Contact_BAO_Contact_Optimizer::edit( $params, $this->_preEditValues ); - if (CRM_Utils_Array::value('image_URL', $params)) { + if (!empty($params['image_URL'])) { CRM_Contact_BAO_Contact::processImageParams($params); } @@ -975,7 +975,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { unset($params['group']); } - if (CRM_Utils_Array::value('contact_id', $params) && ($this->_action & CRM_Core_Action::UPDATE)) { + if (!empty($params['contact_id']) && ($this->_action & CRM_Core_Action::UPDATE)) { // figure out which all groups are intended to be removed $contactGroupList = CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], 'Added'); if (is_array($contactGroupList)) { @@ -1138,7 +1138,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { */ static function checkDuplicateContacts(&$fields, &$errors, $contactID, $contactType) { // if this is a forced save, ignore find duplicate rule - if (!CRM_Utils_Array::value('_qf_Contact_upload_duplicate', $fields)) { + if (empty($fields['_qf_Contact_upload_duplicate'])) { $dedupeParams = CRM_Dedupe_Finder::formatParams($fields, $contactType); $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $contactType, 'Supervised', array($contactID)); @@ -1189,7 +1189,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $template = CRM_Core_Smarty::singleton(); $template->assign('isDuplicate', 1); } - elseif (CRM_Utils_Array::value('_qf_Contact_refresh_dedupe', $fields)) { + elseif (!empty($fields['_qf_Contact_refresh_dedupe'])) { // add a session message for no matching contacts CRM_Core_Session::setStatus(ts('No matching contact found.'), ts('None Found'), 'info'); } @@ -1231,7 +1231,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $parseFieldName = 'street_address'; foreach (array( 'street_number', 'street_name', 'street_unit') as $fld) { - if (CRM_Utils_Array::value($fld, $address)) { + if (!empty($address[$fld])) { $parseFieldName = 'street_number'; $buildStreetAddress = TRUE; break; @@ -1273,7 +1273,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 (!CRM_Utils_Array::value('street_name', $parsedFields) || + if (empty($parsedFields['street_name']) || !CRM_Utils_Array::value('street_number', $parsedFields) ) { $success = FALSE; diff --git a/CRM/Contact/Form/CustomData.php b/CRM/Contact/Form/CustomData.php index e65e3f74a9..f7931ef13e 100644 --- a/CRM/Contact/Form/CustomData.php +++ b/CRM/Contact/Form/CustomData.php @@ -133,7 +133,7 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form { CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName); // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { for ($i = 0; $i <= $_POST['hidden_custom_group_count'][$this->_groupID]; $i++) { CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, $i); CRM_Custom_Form_CustomData::buildQuickForm($this); @@ -193,7 +193,7 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form { $this->_contactSubType ); - if (!CRM_Utils_Array::value('hidden_custom_group_count', $_POST)) { + if (empty($_POST['hidden_custom_group_count'])) { // custom data building in edit mode (required to handle multi-value) $groupTree = &CRM_Core_BAO_CustomGroup::getTree($this->_contactType, $this, $this->_tableID, $this->_groupID, $this->_contactSubType diff --git a/CRM/Contact/Form/DedupeFind.php b/CRM/Contact/Form/DedupeFind.php index 72f142cb83..fc3f24001f 100644 --- a/CRM/Contact/Form/DedupeFind.php +++ b/CRM/Contact/Form/DedupeFind.php @@ -96,7 +96,7 @@ class CRM_Contact_Form_DedupeFind extends CRM_Admin_Form { */ public function postProcess() { $values = $this->exportValues(); - if (CRM_Utils_Array::value('_qf_DedupeFind_submit', $_POST)) { + if (!empty($_POST['_qf_DedupeFind_submit'])) { //used for cancel button CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/deduperules', 'reset=1')); return; diff --git a/CRM/Contact/Form/DedupeRules.php b/CRM/Contact/Form/DedupeRules.php index e3215b7931..85e21738aa 100644 --- a/CRM/Contact/Form/DedupeRules.php +++ b/CRM/Contact/Form/DedupeRules.php @@ -112,7 +112,7 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form { $disabled = array(); $reserved = $this->add('checkbox', 'is_reserved', ts('Reserved?')); - if (CRM_Utils_Array::value('is_reserved', $this->_defaults)) { + if (!empty($this->_defaults['is_reserved'])) { $reserved->freeze(); $disabled = array('disabled' => TRUE); } @@ -154,13 +154,13 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form { */ static function formRule($fields, $files, $self) { $errors = array(); - if (CRM_Utils_Array::value('is_reserved', $fields)) { + if (!empty($fields['is_reserved'])) { return TRUE; } $fieldSelected = FALSE; for ($count = 0; $count < self::RULES_COUNT; $count++) { - if (CRM_Utils_Array::value("where_$count", $fields)) { + if (!empty($fields["where_$count"])) { $fieldSelected = TRUE; break; } @@ -240,7 +240,7 @@ UPDATE civicrm_dedupe_rule_group $daoObj = new CRM_Core_DAO(); $database = $daoObj->database(); for ($count = 0; $count < self::RULES_COUNT; $count++) { - if (!CRM_Utils_Array::value("where_$count", $values)) { + if (empty($values["where_$count"])) { continue; } list($table, $field) = explode('.', CRM_Utils_Array::value("where_$count", $values)); diff --git a/CRM/Contact/Form/Edit/Address.php b/CRM/Contact/Form/Edit/Address.php index 1bd02d5cb8..2f89b7e7a1 100644 --- a/CRM/Contact/Form/Edit/Address.php +++ b/CRM/Contact/Form/Edit/Address.php @@ -137,7 +137,7 @@ class CRM_Contact_Form_Edit_Address { list($title, $attributes, $select) = $v; $nameWithoutID = strpos($name, '_id') !== FALSE ? substr($name, 0, -3) : $name; - if (!CRM_Utils_Array::value($nameWithoutID, $addressOptions)) { + if (empty($addressOptions[$nameWithoutID])) { $continue = TRUE; if (in_array($nameWithoutID, array( 'street_number', 'street_name', 'street_unit')) && @@ -328,7 +328,7 @@ class CRM_Contact_Form_Edit_Address { } // check for state/county match if not report error to user. - if (CRM_Utils_Array::value('address', $fields) && is_array($fields['address'])) { + if (!empty($fields['address']) && is_array($fields['address'])) { foreach ($fields['address'] as $instance => $addressValues) { if (CRM_Utils_System::isNull($addressValues)) { @@ -400,7 +400,7 @@ class CRM_Contact_Form_Edit_Address { } } - if (CRM_Utils_Array::value('use_shared_address', $addressValues) && !CRM_Utils_Array::value('master_id', $addressValues)) { + if (!empty($addressValues['use_shared_address']) && !CRM_Utils_Array::value('master_id', $addressValues)) { $errors["address[$instance][use_shared_address]"] = ts('Please select valid shared contact or a contact with valid address.'); } } @@ -508,7 +508,7 @@ class CRM_Contact_Form_Edit_Address { $shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($defaults['address']); foreach ($defaults['address'] as $key => $addressValue) { - if (CRM_Utils_Array::value('master_id', $addressValue) && !$shareAddressContactNames[$addressValue['master_id']]['is_deleted']) { + if (!empty($addressValue['master_id']) && !$shareAddressContactNames[$addressValue['master_id']]['is_deleted']) { $sharedAddresses[$key]['shared_address_display'] = array( 'address' => $addressValue['display'], 'name' => $shareAddressContactNames[$addressValue['master_id']]['name'], @@ -570,7 +570,7 @@ class CRM_Contact_Form_Edit_Address { foreach ($_POST['address'] as $cnt => $values) { $showField = 'streetAddress'; foreach (array('street_number', 'street_name', 'street_unit') as $fld) { - if (CRM_Utils_Array::value($fld, $values)) { + if (!empty($values[$fld])) { $showField = 'addressElements'; break; } diff --git a/CRM/Contact/Form/Edit/CustomData.php b/CRM/Contact/Form/Edit/CustomData.php index 962b461079..6bbaf902a6 100644 --- a/CRM/Contact/Form/Edit/CustomData.php +++ b/CRM/Contact/Form/Edit/CustomData.php @@ -89,7 +89,7 @@ class CRM_Contact_Form_Edit_CustomData { //build custom data. $contactSubType = NULL; - if (CRM_Utils_Array::value("hidden_custom", $_POST) && + if (!empty($_POST["hidden_custom"]) && CRM_Utils_Array::value('contact_sub_type', $_POST) ) { $contactSubType = $_POST['contact_sub_type']; diff --git a/CRM/Contact/Form/Edit/Household.php b/CRM/Contact/Form/Edit/Household.php index 967915eb02..7f206ac35c 100644 --- a/CRM/Contact/Form/Edit/Household.php +++ b/CRM/Contact/Form/Edit/Household.php @@ -91,7 +91,7 @@ class CRM_Contact_Form_Edit_Household { $primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID); // make sure that household name is set - if (!CRM_Utils_Array::value('household_name', $fields)) { + if (empty($fields['household_name'])) { $errors['household_name'] = 'Household Name should be set.'; } diff --git a/CRM/Contact/Form/Edit/Organization.php b/CRM/Contact/Form/Edit/Organization.php index fcb81085b7..f603aee8ab 100644 --- a/CRM/Contact/Form/Edit/Organization.php +++ b/CRM/Contact/Form/Edit/Organization.php @@ -91,7 +91,7 @@ class CRM_Contact_Form_Edit_Organization { $primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID); // make sure that organization name is set - if (!CRM_Utils_Array::value('organization_name', $fields)) { + if (empty($fields['organization_name'])) { $errors['organization_name'] = 'Organization Name should be set.'; } diff --git a/CRM/Contact/Form/Inline/Address.php b/CRM/Contact/Form/Inline/Address.php index 9e74ab31e2..8f10acdcde 100644 --- a/CRM/Contact/Form/Inline/Address.php +++ b/CRM/Contact/Form/Inline/Address.php @@ -111,7 +111,7 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline { 'address_options' ); $this->_parseStreetAddress = FALSE; - if (CRM_Utils_Array::value('street_address', $addressOptions) && + if (!empty($addressOptions['street_address']) && CRM_Utils_Array::value('street_address_parsing', $addressOptions) ) { $this->_parseStreetAddress = TRUE; @@ -143,7 +143,7 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline { $config = CRM_Core_Config::singleton(); //set address block defaults - if (CRM_Utils_Array::value('address', $defaults)) { + if (!empty($defaults['address'])) { CRM_Contact_Form_Edit_Address::setDefaultValues($defaults, $this); } else { diff --git a/CRM/Contact/Form/Inline/Demographics.php b/CRM/Contact/Form/Inline/Demographics.php index 7009b7ba25..95ffeb3078 100644 --- a/CRM/Contact/Form/Inline/Demographics.php +++ b/CRM/Contact/Form/Inline/Demographics.php @@ -59,7 +59,7 @@ class CRM_Contact_Form_Inline_Demographics extends CRM_Contact_Form_Inline { $params = $this->exportValues(); // Process / save demographics - if (!CRM_Utils_Array::value('is_deceased', $params)) { + if (empty($params['is_deceased'])) { $params['is_deceased'] = FALSE; $params['deceased_date'] = NULL; } diff --git a/CRM/Contact/Form/Inline/Email.php b/CRM/Contact/Form/Inline/Email.php index b801656e85..243889f033 100644 --- a/CRM/Contact/Form/Inline/Email.php +++ b/CRM/Contact/Form/Inline/Email.php @@ -108,13 +108,13 @@ class CRM_Contact_Form_Inline_Email extends CRM_Contact_Form_Inline { */ static function formRule($fields, $errors) { $hasData = $hasPrimary = $errors = array(); - if (CRM_Utils_Array::value('email', $fields) && is_array($fields['email'])) { + if (!empty($fields['email']) && is_array($fields['email'])) { foreach ($fields['email'] as $instance => $blockValues) { $dataExists = CRM_Contact_Form_Contact::blockDataExists($blockValues); if ($dataExists) { $hasData[] = $instance; - if (CRM_Utils_Array::value('is_primary', $blockValues)) { + if (!empty($blockValues['is_primary'])) { $hasPrimary[] = $instance; } } diff --git a/CRM/Contact/Form/Inline/IM.php b/CRM/Contact/Form/Inline/IM.php index b5c0cccc68..85e5777763 100644 --- a/CRM/Contact/Form/Inline/IM.php +++ b/CRM/Contact/Form/Inline/IM.php @@ -108,13 +108,13 @@ class CRM_Contact_Form_Inline_IM extends CRM_Contact_Form_Inline { */ static function formRule($fields, $errors) { $hasData = $hasPrimary = $errors = array(); - if (CRM_Utils_Array::value('im', $fields) && is_array($fields['im'])) { + if (!empty($fields['im']) && is_array($fields['im'])) { foreach ($fields['im'] as $instance => $blockValues) { $dataExists = CRM_Contact_Form_Contact::blockDataExists($blockValues); if ($dataExists) { $hasData[] = $instance; - if (CRM_Utils_Array::value('is_primary', $blockValues)) { + if (!empty($blockValues['is_primary'])) { $hasPrimary[] = $instance; if (!$primaryID && CRM_Utils_Array::value('im', $blockValues)) { diff --git a/CRM/Contact/Form/Inline/OpenID.php b/CRM/Contact/Form/Inline/OpenID.php index 21a0bd0bef..ca76f95874 100644 --- a/CRM/Contact/Form/Inline/OpenID.php +++ b/CRM/Contact/Form/Inline/OpenID.php @@ -108,13 +108,13 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline { */ static function formRule($fields, $errors) { $hasData = $hasPrimary = $errors = array(); - if (CRM_Utils_Array::value('openid', $fields) && is_array($fields['openid'])) { + if (!empty($fields['openid']) && is_array($fields['openid'])) { foreach ($fields['openid'] as $instance => $blockValues) { $dataExists = CRM_Contact_Form_Contact::blockDataExists($blockValues); if ($dataExists) { $hasData[] = $instance; - if (CRM_Utils_Array::value('is_primary', $blockValues)) { + if (!empty($blockValues['is_primary'])) { $hasPrimary[] = $instance; if (!$primaryID && CRM_Utils_Array::value('openid', $blockValues)) { diff --git a/CRM/Contact/Form/Inline/Phone.php b/CRM/Contact/Form/Inline/Phone.php index aa49219e20..1122945c8a 100644 --- a/CRM/Contact/Form/Inline/Phone.php +++ b/CRM/Contact/Form/Inline/Phone.php @@ -108,14 +108,14 @@ class CRM_Contact_Form_Inline_Phone extends CRM_Contact_Form_Inline { */ static function formRule($fields, $errors) { $hasData = $hasPrimary = $errors = array(); - if (CRM_Utils_Array::value('phone', $fields) && is_array($fields['phone'])) { + if (!empty($fields['phone']) && is_array($fields['phone'])) { $primaryID = null; foreach ($fields['phone'] as $instance => $blockValues) { $dataExists = CRM_Contact_Form_Contact::blockDataExists($blockValues); if ($dataExists) { $hasData[] = $instance; - if (CRM_Utils_Array::value('is_primary', $blockValues)) { + if (!empty($blockValues['is_primary'])) { $hasPrimary[] = $instance; if (!$primaryID && CRM_Utils_Array::value('phone', $blockValues)) { diff --git a/CRM/Contact/Form/Location.php b/CRM/Contact/Form/Location.php index 6290f630f1..3e36941105 100644 --- a/CRM/Contact/Form/Location.php +++ b/CRM/Contact/Form/Location.php @@ -88,7 +88,7 @@ class CRM_Contact_Form_Location { $name = strtolower($blockName); $instances = array(1); - if (CRM_Utils_Array::value($name, $_POST) && is_array($_POST[$name])) { + 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])) { diff --git a/CRM/Contact/Form/Merge.php b/CRM/Contact/Form/Merge.php index d4b897a2a8..8694ae9ffa 100644 --- a/CRM/Contact/Form/Merge.php +++ b/CRM/Contact/Form/Merge.php @@ -327,7 +327,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { CRM_Core_Session::setStatus(ts('Contact id %1 has been updated and contact id %2 has been deleted.', array(1 => $this->_cid, 2 => $this->_oid)), ts('Contacts Merged'), 'success'); $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_cid}"); - if (CRM_Utils_Array::value('_qf_Merge_submit', $formValues)) { + if (!empty($formValues['_qf_Merge_submit'])) { $listParamsURL = "reset=1&action=update&rgid={$this->_rgid}"; if ($this->_gid) { $listParamsURL .= "&gid={$this->_gid}"; @@ -337,7 +337,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { ); CRM_Utils_System::redirect($lisitingURL); } - if (CRM_Utils_Array::value('_qf_Merge_done', $formValues)) { + if (!empty($formValues['_qf_Merge_done'])) { CRM_Utils_System::redirect($url); } diff --git a/CRM/Contact/Form/Relationship.php b/CRM/Contact/Form/Relationship.php index d65ae542dd..6dddf7a7ca 100644 --- a/CRM/Contact/Form/Relationship.php +++ b/CRM/Contact/Form/Relationship.php @@ -161,7 +161,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { $this->_allRelationshipNames = CRM_Core_PseudoConstant::relationshipType('name'); // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { CRM_Custom_Form_CustomData::preProcess($this); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); @@ -186,10 +186,10 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { if ($this->_action & CRM_Core_Action::UPDATE) { if (!empty($this->_values)) { $defaults['relationship_type_id'] = $this->_rtypeId; - if (CRM_Utils_Array::value('start_date', $this->_values)) { + if (!empty($this->_values['start_date'])) { list($defaults['start_date']) = CRM_Utils_Date::setDateDefaults($this->_values['start_date']); } - if (CRM_Utils_Array::value('end_date', $this->_values)) { + if (!empty($this->_values['end_date'])) { list($defaults['end_date']) = CRM_Utils_Date::setDateDefaults($this->_values['end_date']); } $defaults['description'] = CRM_Utils_Array::value('description', $this->_values); @@ -469,7 +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 (CRM_Utils_Array::value('_qf_Relationship_refresh_save', $_POST) || + if (!empty($_POST['_qf_Relationship_refresh_save']) || CRM_Utils_Array::value('_qf_Relationship_refresh_savedetails', $_POST) ) { $quickSave = TRUE; @@ -477,7 +477,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { $this->set('searchDone', 0); $this->set('callAjax', FALSE); - if (CRM_Utils_Array::value('_qf_Relationship_refresh', $_POST) || $quickSave) { + if (!empty($_POST['_qf_Relationship_refresh']) || $quickSave) { if (is_numeric($params['contact_select_id'][1])) { if ($quickSave) { $params['contact_check'] = array($params['contact_select_id'][1] => 1); @@ -520,7 +520,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { //make sure we has to have employer id before firing queries, CRM-7306 $employerId = CRM_Utils_Array::value('current_employee_id', $this->_values); $isDisabled = TRUE; - if (CRM_Utils_Array::value('is_active', $params)) { + if (!empty($params['is_active'])) { $isDisabled = FALSE; } $relChanged = TRUE; @@ -538,12 +538,12 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { $params['is_permission_b_a'] = CRM_Utils_Array::value('is_permission_b_a', $params, FALSE); } elseif ($quickSave) { - if (CRM_Utils_Array::value('add_current_employee', $params) && + if (!empty($params['add_current_employee']) && $this->_allRelationshipNames[$relationshipTypeId]['name_a_b'] == 'Employee of' ) { $params['employee_of'] = $params['contact_select_id'][1]; } - elseif (CRM_Utils_Array::value('add_current_employer', $params) && + elseif (!empty($params['add_current_employer']) && $this->_allRelationshipNames[$relationshipTypeId]['name_b_a'] == 'Employer of' ) { $params['employer_of'] = array($params['contact_select_id'][1] => 1); @@ -631,11 +631,11 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { //handle current employee/employer relationship, CRM-3532 if ($this->_allRelationshipNames[$relationshipTypeId]["name_{$this->_rtype}"] == 'Employee of') { $orgId = NULL; - if (CRM_Utils_Array::value('employee_of', $params)) { + if (!empty($params['employee_of'])) { $orgId = $params['employee_of']; } elseif ($this->_action & CRM_Core_Action::UPDATE) { - if (CRM_Utils_Array::value('is_current_employer', $params) && + if (!empty($params['is_current_employer']) && CRM_Utils_Array::value('is_active', $params) ) { if (CRM_Utils_Array::value('contactTarget', $ids) != @@ -660,11 +660,11 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { } elseif ($this->_allRelationshipNames[$relationshipTypeId]["name_{$this->_rtype}"] == 'Employer of') { $individualIds = array(); - if (CRM_Utils_Array::value('employer_of', $params)) { + if (!empty($params['employer_of'])) { $individualIds = array_keys($params['employer_of']); } elseif ($this->_action & CRM_Core_Action::UPDATE) { - if (CRM_Utils_Array::value('is_current_employer', $params)) { + if (!empty($params['is_current_employer'])) { if (CRM_Utils_Array::value('contactTarget', $ids) != CRM_Utils_Array::value('current_employee_id', $this->_values) ) { @@ -710,7 +710,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { */ static function formRule($params, $files, $form) { // hack, no error check for refresh - if (CRM_Utils_Array::value('_qf_Relationship_refresh', $_POST) || + if (!empty($_POST['_qf_Relationship_refresh']) || CRM_Utils_Array::value('_qf_Relationship_refresh_save', $_POST) || CRM_Utils_Array::value('_qf_Relationship_refresh_savedetails', $_POST) ) { @@ -726,7 +726,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { $errors = array(); $employerId = NULL; - if (CRM_Utils_Array::value('contact_check', $params) && is_array($params['contact_check'])) { + if (!empty($params['contact_check']) && is_array($params['contact_check'])) { foreach ($params['contact_check'] as $cid => $dontCare) { $message = CRM_Contact_BAO_Relationship::checkValidRelationship($params, $ids, $cid); if ($message) { @@ -748,7 +748,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('employee_of', $params) && + if (!empty($params['employee_of']) && !$employerId ) { if ($form->_callAjax) { @@ -759,7 +759,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('employer_of', $params) && + if (!empty($params['employer_of']) && CRM_Utils_Array::value('contact_check', $params) && array_diff(array_keys($params['employer_of']), array_keys($params['contact_check'])) ) { @@ -787,7 +787,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { $errors = array(); // check start and end date - if (CRM_Utils_Array::value('start_date', $params) && + if (!empty($params['start_date']) && CRM_Utils_Array::value('end_date', $params) ) { $start_date = CRM_Utils_Date::format(CRM_Utils_Array::value('start_date', $params)); @@ -805,7 +805,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { return; } - if (CRM_Utils_Array::value('store_contacts', $params)) { + if (!empty($params['store_contacts'])) { $storedContacts = array(); foreach (explode(',', $params['store_contacts']) as $value) { if ($value) { @@ -815,7 +815,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { $params['contact_check'] = $storedContacts; } - if (CRM_Utils_Array::value('store_employers', $params)) { + if (!empty($params['store_employers'])) { $employeeContacts = array(); foreach (explode(',', $params['store_employers']) as $value) { if ($value) { diff --git a/CRM/Contact/Form/Search.php b/CRM/Contact/Form/Search.php index 0e3a69abcb..999aa71772 100644 --- a/CRM/Contact/Form/Search.php +++ b/CRM/Contact/Form/Search.php @@ -741,7 +741,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form { } // show the context menu only when we’re not searching for deleted contacts; CRM-5673 - if (!CRM_Utils_Array::value('deleted_contacts', $this->_formValues)) { + if (empty($this->_formValues['deleted_contacts'])) { $menuItems = CRM_Contact_BAO_Contact::contextMenu(); $primaryActions = CRM_Utils_Array::value('primaryActions', $menuItems, array()); $this->_contextMenu = CRM_Utils_Array::value('moreActions', $menuItems, array()); @@ -869,7 +869,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form { $this->_formValues['operator'] = $this->_operator; } - if (!CRM_Utils_Array::value('qfKey', $this->_formValues)) { + if (empty($this->_formValues['qfKey'])) { $this->_formValues['qfKey'] = $this->controller->_key; } diff --git a/CRM/Contact/Form/Search/Advanced.php b/CRM/Contact/Form/Search/Advanced.php index e5ade1234d..a74a9cdfc9 100644 --- a/CRM/Contact/Form/Search/Advanced.php +++ b/CRM/Contact/Form/Search/Advanced.php @@ -151,7 +151,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { ) { $allPanes[$name]['open'] = 'true'; - if (CRM_Utils_Array::value($type, $components)) { + if (!empty($components[$type])) { $c = $components[$type]; $this->add('hidden', "hidden_$type", 1); $c->buildAdvancedSearchPaneForm($this); @@ -275,7 +275,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { ) { foreach (array( 'case_type_id', 'case_status_id', 'case_deleted', 'case_tags') as $caseCriteria) { - if (CRM_Utils_Array::value($caseCriteria, $this->_formValues)) { + if (!empty($this->_formValues[$caseCriteria])) { $allCases = TRUE; $this->_formValues['case_owner'] = 1; continue; diff --git a/CRM/Contact/Form/Search/Basic.php b/CRM/Contact/Form/Search/Basic.php index 46f55c10a4..46e76dc98f 100644 --- a/CRM/Contact/Form/Search/Basic.php +++ b/CRM/Contact/Form/Search/Basic.php @@ -69,7 +69,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search { 'advanced_search_options' ); - if (CRM_Utils_Array::value('contactType', $searchOptions)) { + if (!empty($searchOptions['contactType'])) { $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements(); $this->add('select', 'contact_type', ts('is...'), @@ -77,7 +77,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search { ); } - if (CRM_Utils_Array::value('groups', $searchOptions)) { + if (!empty($searchOptions['groups'])) { // Arrange groups into hierarchical listing (child groups follow their parents and have indentation spacing in title) $groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($this->_group, NULL, '  ', TRUE); @@ -86,7 +86,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search { $this->_groupElement = &$this->addElement('select', 'group', ts('in'), $group); } - if (CRM_Utils_Array::value('tags', $searchOptions)) { + if (!empty($searchOptions['tags'])) { // tag criteria if (!empty($this->_tag)) { $tag = array( @@ -110,7 +110,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search { $defaults['sort_name'] = CRM_Utils_Array::value('sort_name', $this->_formValues); foreach (self::$csv as $v) { - if (CRM_Utils_Array::value($v, $this->_formValues) && is_array($this->_formValues[$v])) { + if (!empty($this->_formValues[$v]) && is_array($this->_formValues[$v])) { $tmpArray = array_keys($this->_formValues[$v]); $defaults[$v] = array_pop($tmpArray); } @@ -247,7 +247,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search { static function formRule($fields) { // check actionName and if next, then do not repeat a search, since we are going to the next page if (array_key_exists('_qf_Search_next', $fields)) { - if (!CRM_Utils_Array::value('task', $fields)) { + if (empty($fields['task'])) { return array('task' => 'Please select a valid action.'); } diff --git a/CRM/Contact/Form/Search/Builder.php b/CRM/Contact/Form/Search/Builder.php index 9927e51532..3159c6d644 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 (CRM_Utils_Array::value('addMore', $values) || CRM_Utils_Array::value('addBlock', $values)) { + if (!empty($values['addMore']) || CRM_Utils_Array::value('addBlock', $values)) { return TRUE; } $fields = self::fields(); @@ -358,7 +358,7 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { $this->_formValues = $this->controller->exportValues($this->_name); // set the group if group is submitted - if (CRM_Utils_Array::value('uf_group_id', $this->_formValues)) { + if (!empty($this->_formValues['uf_group_id'])) { $this->set('id', $this->_formValues['uf_group_id']); } else { diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index 7022d257f1..06433f915d 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -323,7 +323,7 @@ class CRM_Contact_Form_Search_Criteria { 'county' => 'county', ); if ($select == 'stateProvince') { - if (CRM_Utils_Array::value('country', $formValues)) { + if (!empty($formValues['country'])) { $selectElements = array('' => ts('- select -')) + CRM_Core_PseudoConstant::stateProvinceForCountry($formValues['country']); } else { diff --git a/CRM/Contact/Form/Search/Custom/ContribSYBNT.php b/CRM/Contact/Form/Search/Custom/ContribSYBNT.php index c99036b221..3c5f0c0553 100644 --- a/CRM/Contact/Form/Search/Custom/ContribSYBNT.php +++ b/CRM/Contact/Form/Search/Custom/ContribSYBNT.php @@ -75,7 +75,7 @@ class CRM_Contact_Form_Search_Custom_ContribSYBNT implements CRM_Contact_Form_Se } foreach ($this->_dates as $name => $title) { - if (CRM_Utils_Array::value($name, $this->_formValues)) { + if (!empty($this->_formValues[$name])) { $this->{$name} = CRM_Utils_Date::processDate($this->_formValues[$name]); } } diff --git a/CRM/Contact/Form/Search/Custom/MultipleValues.php b/CRM/Contact/Form/Search/Custom/MultipleValues.php index ebb039bd83..5458e0f9bd 100644 --- a/CRM/Contact/Form/Search/Custom/MultipleValues.php +++ b/CRM/Contact/Form/Search/Custom/MultipleValues.php @@ -67,7 +67,7 @@ class CRM_Contact_Form_Search_Custom_MultipleValues extends CRM_Contact_Form_Sea // add all the fields for chosen groups $this->_tables = $this->_options = array(); foreach ($this->_groupTree as $groupID => $group) { - if (!CRM_Utils_Array::value($groupID, $this->_customGroupIDs)) { + if (empty($this->_customGroupIDs[$groupID])) { continue; } @@ -131,7 +131,7 @@ class CRM_Contact_Form_Search_Custom_MultipleValues extends CRM_Contact_Form_Sea function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) { //redirect if custom group not select in search criteria - if (!CRM_Utils_Array::value('custom_group', $this->_formValues)) { + if (empty($this->_formValues['custom_group'])) { CRM_Core_Error::statusBounce(ts("You must select at least one Custom Group as a search criteria."), CRM_Utils_System::url('civicrm/contact/search/custom', "reset=1&csid={$this->_formValues['customSearchID']}", diff --git a/CRM/Contact/Form/Search/Custom/Proximity.php b/CRM/Contact/Form/Search/Custom/Proximity.php index d63023f4b4..fc6ebb4743 100644 --- a/CRM/Contact/Form/Search/Custom/Proximity.php +++ b/CRM/Contact/Form/Search/Custom/Proximity.php @@ -48,11 +48,11 @@ class CRM_Contact_Form_Search_Custom_Proximity extends CRM_Contact_Form_Search_C if (!empty($this->_formValues)) { // add the country and state - if (CRM_Utils_Array::value('country_id', $this->_formValues)) { + if (!empty($this->_formValues['country_id'])) { $this->_formValues['country'] = CRM_Core_PseudoConstant::country($this->_formValues['country_id']); } - if (CRM_Utils_Array::value('state_province_id', $this->_formValues)) { + if (!empty($this->_formValues['state_province_id'])) { $this->_formValues['state_province'] = CRM_Core_PseudoConstant::stateProvince($this->_formValues['state_province_id']); } diff --git a/CRM/Contact/Form/Task/AddToHousehold.php b/CRM/Contact/Form/Task/AddToHousehold.php index ccf515e060..128693830e 100644 --- a/CRM/Contact/Form/Task/AddToHousehold.php +++ b/CRM/Contact/Form/Task/AddToHousehold.php @@ -122,7 +122,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task { $params = $this->controller->exportValues($this->_name); $this->set('searchDone', 0); - if (CRM_Utils_Array::value('_qf_AddToHousehold_refresh', $_POST)) { + if (!empty($_POST['_qf_AddToHousehold_refresh'])) { $searchParams['contact_type'] = array('Household' => 'Household'); $searchParams['rel_contact'] = $params['name']; self::search($this, $searchParams); @@ -188,7 +188,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task { function search(&$form, &$params) { //max records that will be listed $searchValues = array(); - if (CRM_Utils_Array::value('rel_contact', $params)) { + if (!empty($params['rel_contact'])) { if (isset($params['rel_contact_id']) && is_numeric($params['rel_contact_id']) ) { @@ -205,7 +205,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task { $excludedContactIds[] = $form->_contactId; } - if (CRM_Utils_Array::value('relationship_type_id', $params)) { + if (!empty($params['relationship_type_id'])) { $relationshipType = new CRM_Contact_DAO_RelationshipType(); list($rid, $direction) = explode('_', $params['relationship_type_id'], 2); diff --git a/CRM/Contact/Form/Task/AddToOrganization.php b/CRM/Contact/Form/Task/AddToOrganization.php index 5be4210d8c..536d33a822 100644 --- a/CRM/Contact/Form/Task/AddToOrganization.php +++ b/CRM/Contact/Form/Task/AddToOrganization.php @@ -123,7 +123,7 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task { $params = $this->controller->exportValues($this->_name); $this->set('searchDone', 0); - if (CRM_Utils_Array::value('_qf_AddToOrganization_refresh', $_POST)) { + if (!empty($_POST['_qf_AddToOrganization_refresh'])) { $searchParams['contact_type'] = array('Organization' => 'Organization'); $searchParams['rel_contact'] = $params['name']; CRM_Contact_Form_Task_AddToHousehold::search($this, $searchParams); diff --git a/CRM/Contact/Form/Task/AddToTag.php b/CRM/Contact/Form/Task/AddToTag.php index 4115bccc7a..043bde2330 100644 --- a/CRM/Contact/Form/Task/AddToTag.php +++ b/CRM/Contact/Form/Task/AddToTag.php @@ -100,12 +100,12 @@ class CRM_Contact_Form_Task_AddToTag extends CRM_Contact_Form_Task { $contactTags = $tagList = array(); // check if contact tags exists - if (CRM_Utils_Array::value('tag', $params)) { + if (!empty($params['tag'])) { $contactTags = $params['tag']; } // check if tags are selected from taglists - if (CRM_Utils_Array::value('contact_taglist', $params)) { + if (!empty($params['contact_taglist'])) { foreach ($params['contact_taglist'] as $val) { if ($val) { if (is_numeric($val)) { diff --git a/CRM/Contact/Form/Task/Batch.php b/CRM/Contact/Form/Task/Batch.php index bc7d4bc18c..e6d67bcec9 100644 --- a/CRM/Contact/Form/Task/Batch.php +++ b/CRM/Contact/Form/Task/Batch.php @@ -265,7 +265,7 @@ class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task { //CRM-5521 //validate subtype before updating - if (CRM_Utils_Array::value('contact_sub_type', $value) && !CRM_Contact_BAO_ContactType::isAllowEdit($key)) { + if (!empty($value['contact_sub_type']) && !CRM_Contact_BAO_ContactType::isAllowEdit($key)) { unset($value['contact_sub_type']); $inValidSubtypeCnt++; } @@ -330,7 +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 (!CRM_Utils_Array::value('street_name', $parsedFields) || + if (empty($parsedFields['street_name']) || !CRM_Utils_Array::value('street_number', $parsedFields) ) { $parsedFields = array_fill_keys(array_keys($parsedFields), ''); diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index 8ec05a1086..484c44a318 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -312,7 +312,7 @@ class CRM_Contact_Form_Task_EmailCommon { } //Added for CRM-1393 - if (CRM_Utils_Array::value('saveTemplate', $fields) && empty($fields['saveTemplateName'])) { + if (!empty($fields['saveTemplate']) && empty($fields['saveTemplateName'])) { $errors['saveTemplateName'] = ts("Enter name to save message template"); } @@ -345,7 +345,7 @@ class CRM_Contact_Form_Task_EmailCommon { $additionalDetails = NULL; $ccValues = $bccValues = array(); foreach ($elements as $element) { - if (CRM_Utils_Array::value($element, $formValues)) { + if (!empty($formValues[$element])) { $allEmails = explode(',', $formValues[$element]); foreach ($allEmails as $value) { list($contactId, $email) = explode('::', $value); @@ -381,8 +381,7 @@ class CRM_Contact_Form_Task_EmailCommon { } // process message template - if (CRM_Utils_Array::value('saveTemplate', $formValues) - || CRM_Utils_Array::value('updateTemplate', $formValues) + if (!empty($formValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $formValues) ) { $messageTemplate = array( 'msg_text' => $formValues['text_message'], @@ -391,12 +390,12 @@ class CRM_Contact_Form_Task_EmailCommon { 'is_active' => TRUE, ); - if (CRM_Utils_Array::value('saveTemplate', $formValues)) { + if (!empty($formValues['saveTemplate'])) { $messageTemplate['msg_title'] = $formValues['saveTemplateName']; CRM_Core_BAO_MessageTemplate::add($messageTemplate); } - if (CRM_Utils_Array::value('template', $formValues) && + if (!empty($formValues['template']) && CRM_Utils_Array::value('updateTemplate', $formValues) ) { $messageTemplate['id'] = $formValues['template']; diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index d36c4efd6f..1fd7f30bb4 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -154,7 +154,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { if (stristr($mailingFormat, 'custom_')) { foreach ($mailingFormatProperties as $token => $true) { if (substr($token, 0, 7) == 'custom_') { - if (!CRM_Utils_Array::value($token, $customFormatProperties)) { + if (empty($customFormatProperties[$token])) { $customFormatProperties[$token] = $mailingFormatProperties[$token]; } } @@ -184,7 +184,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { //get the contacts information $params = array(); - if (CRM_Utils_Array::value('location_type_id', $fv)) { + if (!empty($fv['location_type_id'])) { $locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); $locName = $locType[$fv['location_type_id']]; $location = array('location' => array("{$locName}" => $address)); @@ -205,7 +205,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { } // fix for CRM-2651 - if (CRM_Utils_Array::value('do_not_mail', $fv)) { + if (!empty($fv['do_not_mail'])) { $params[] = array('do_not_mail', '=', 0, 0, 0); } // fix for CRM-2613 @@ -268,7 +268,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { unset($contact[$locName]); - if (CRM_Utils_Array::value('county_id', $contact)) { + if (!empty($contact['county_id'])) { unset($contact['county_id']); } @@ -279,7 +279,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { $valuesothers = array(); $paramsothers = array('contact_id' => $value); $valuesothers = CRM_Core_BAO_Location::getValues($paramsothers, $valuesothers); - if (CRM_Utils_Array::value('location_type_id', $fv)) { + if (!empty($fv['location_type_id'])) { foreach ($valuesothers as $vals) { if ( CRM_Utils_Array::value('location_type_id', $vals) == CRM_Utils_Array::value('location_type_id', $fv ) ) { @@ -304,10 +304,10 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { continue; } - if (CRM_Utils_Array::value('addressee_display', $contact)) { + if (!empty($contact['addressee_display'])) { $contact['addressee_display'] = trim($contact['addressee_display']); } - if (CRM_Utils_Array::value('addressee', $contact)) { + if (!empty($contact['addressee'])) { $contact['addressee'] = $contact['addressee_display']; } @@ -364,7 +364,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { */ function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) { foreach (array_merge($mailingFormatProperties, array_fill_keys($tokenFields, 1)) as $key => $dontCare) { - if (CRM_Utils_Array::value($key, $contact)) { + if (!empty($contact[$key])) { return TRUE; } } diff --git a/CRM/Contact/Form/Task/LabelCommon.php b/CRM/Contact/Form/Task/LabelCommon.php index ffbcbeb28b..33f4d6570a 100644 --- a/CRM/Contact/Form/Task/LabelCommon.php +++ b/CRM/Contact/Form/Task/LabelCommon.php @@ -114,7 +114,7 @@ class CRM_Contact_Form_Task_LabelCommon { if (stristr($mailingFormat, 'custom_')) { foreach ($mailingFormatProperties as $token => $true) { if (substr($token, 0, 7) == 'custom_') { - if (!CRM_Utils_Array::value($token, $customFormatProperties)) { + if (empty($customFormatProperties[$token])) { $customFormatProperties[$token] = $mailingFormatProperties[$token]; } } @@ -138,7 +138,7 @@ class CRM_Contact_Form_Task_LabelCommon { } // fix for CRM-2651 - if (CRM_Utils_Array::value('do_not_mail', $respectDoNotMail)) { + if (!empty($respectDoNotMail['do_not_mail'])) { $params[] = array('do_not_mail', '=', 0, 0, 0); } // fix for CRM-2613 @@ -198,7 +198,7 @@ class CRM_Contact_Form_Task_LabelCommon { unset($contact[$locName]); - if (CRM_Utils_Array::value('county_id', $contact)) { + if (!empty($contact['county_id'])) { unset($contact['county_id']); } @@ -234,10 +234,10 @@ class CRM_Contact_Form_Task_LabelCommon { continue; } - if (CRM_Utils_Array::value('addressee_display', $contact)) { + if (!empty($contact['addressee_display'])) { $contact['addressee_display'] = trim($contact['addressee_display']); } - if (CRM_Utils_Array::value('addressee', $contact)) { + if (!empty($contact['addressee'])) { $contact['addressee'] = $contact['addressee_display']; } diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index 7544b18201..21e049b9eb 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -231,7 +231,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { $template = CRM_Core_Smarty::singleton(); //Added for CRM-1393 - if (CRM_Utils_Array::value('saveTemplate', $fields) && empty($fields['saveTemplateName'])) { + if (!empty($fields['saveTemplate']) && empty($fields['saveTemplateName'])) { $errors['saveTemplateName'] = ts("Enter name to save message template"); } if (!is_numeric($fields['margin_left'])) { @@ -260,7 +260,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { $formValues = $form->controller->exportValues($form->getName()); // process message template - if (CRM_Utils_Array::value('saveTemplate', $formValues) || CRM_Utils_Array::value('updateTemplate', $formValues)) { + if (!empty($formValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $formValues)) { $messageTemplate = array( 'msg_text' => NULL, 'msg_html' => $formValues['html_message'], @@ -269,15 +269,15 @@ class CRM_Contact_Form_Task_PDFLetterCommon { ); $messageTemplate['pdf_format_id'] = 'null'; - if (CRM_Utils_Array::value('bind_format', $formValues) && $formValues['format_id'] > 0) { + if (!empty($formValues['bind_format']) && $formValues['format_id'] > 0) { $messageTemplate['pdf_format_id'] = $formValues['format_id']; } - if (CRM_Utils_Array::value('saveTemplate', $formValues) && $formValues['saveTemplate']) { + if (!empty($formValues['saveTemplate']) && $formValues['saveTemplate']) { $messageTemplate['msg_title'] = $formValues['saveTemplateName']; CRM_Core_BAO_MessageTemplate::add($messageTemplate); } - if (CRM_Utils_Array::value('updateTemplate', $formValues) && $formValues['template'] && $formValues['updateTemplate']) { + if (!empty($formValues['updateTemplate']) && $formValues['template'] && $formValues['updateTemplate']) { $messageTemplate['id'] = $formValues['template']; unset($messageTemplate['msg_title']); @@ -285,7 +285,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { } } elseif (CRM_Utils_Array::value('template', $formValues) > 0) { - if (CRM_Utils_Array::value('bind_format', $formValues) && $formValues['format_id'] > 0) { + if (!empty($formValues['bind_format']) && $formValues['format_id'] > 0) { $query = "UPDATE civicrm_msg_template SET pdf_format_id = {$formValues['format_id']} WHERE id = {$formValues['template']}"; } else { @@ -293,7 +293,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { } CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); } - if (CRM_Utils_Array::value('update_format', $formValues)) { + if (!empty($formValues['update_format'])) { $bao = new CRM_Core_BAO_PdfFormat(); $bao->savePdfFormat($formValues, $formValues['format_id']); } diff --git a/CRM/Contact/Form/Task/ProximityCommon.php b/CRM/Contact/Form/Task/ProximityCommon.php index 8a531bdd5b..ce4483a9ec 100644 --- a/CRM/Contact/Form/Task/ProximityCommon.php +++ b/CRM/Contact/Form/Task/ProximityCommon.php @@ -91,7 +91,7 @@ class CRM_Contact_Form_Task_ProximityCommon extends CRM_Contact_Form_Task { $form->add('text', 'prox_postal_code', ts('Postal Code'), NULL, FALSE); $defaults = self::setDefaultValues($form); - if (CRM_Utils_Array::value('prox_country_id', $defaults)) { + if (!empty($defaults['prox_country_id'])) { $stateProvince = array('' => ts('- select -')) + CRM_Core_PseudoConstant::stateProvinceForCountry($defaults['prox_country_id']); } else { @@ -133,8 +133,8 @@ class CRM_Contact_Form_Task_ProximityCommon extends CRM_Contact_Form_Task { static function formRule($fields, $files, $form) { $errors = array(); // If Distance is present, make sure state, country and city or postal code are populated. - if (CRM_Utils_Array::value('prox_distance', $fields)) { - if (!CRM_Utils_Array::value('prox_state_province_id', $fields) || + if (!empty($fields['prox_distance'])) { + if (empty($fields['prox_state_province_id']) || !CRM_Utils_Array::value('prox_country_id', $fields) ) { $errors["prox_state_province_id"] = ts("Country AND State/Province are required to search by distance."); diff --git a/CRM/Contact/Form/Task/RemoveFromTag.php b/CRM/Contact/Form/Task/RemoveFromTag.php index a0b6bc3cb1..8fdf88835f 100644 --- a/CRM/Contact/Form/Task/RemoveFromTag.php +++ b/CRM/Contact/Form/Task/RemoveFromTag.php @@ -98,12 +98,12 @@ class CRM_Contact_Form_Task_RemoveFromTag extends CRM_Contact_Form_Task { $contactTags = $tagList = array(); // check if contact tags exists - if (CRM_Utils_Array::value('tag', $params)) { + if (!empty($params['tag'])) { $contactTags = $params['tag']; } // check if tags are selected from taglists - if (CRM_Utils_Array::value('contact_taglist', $params)) { + if (!empty($params['contact_taglist'])) { foreach ($params['contact_taglist'] as $val) { if ($val) { if (is_numeric($val)) { diff --git a/CRM/Contact/Form/Task/SMSCommon.php b/CRM/Contact/Form/Task/SMSCommon.php index 0eb3ddf8d7..3ea82538e3 100644 --- a/CRM/Contact/Form/Task/SMSCommon.php +++ b/CRM/Contact/Form/Task/SMSCommon.php @@ -314,11 +314,11 @@ class CRM_Contact_Form_Task_SMSCommon { $template = CRM_Core_Smarty::singleton(); - if (!CRM_Utils_Array::value('text_message', $fields)) { + if (empty($fields['text_message'])) { $errors['text_message'] = ts('Please provide Text message.'); } else { - if (CRM_Utils_Array::value('text_message', $fields)) { + if (!empty($fields['text_message'])) { $messageCheck = CRM_Utils_Array::value('text_message', $fields); $messageCheck = str_replace("\r\n", "\n", $messageCheck); if ($messageCheck && (strlen($messageCheck) > CRM_SMS_Provider::MAX_SMS_CHAR)) { @@ -328,7 +328,7 @@ class CRM_Contact_Form_Task_SMSCommon { } //Added for CRM-1393 - if (CRM_Utils_Array::value('saveTemplate', $fields) && empty($fields['saveTemplateName'])) { + if (!empty($fields['saveTemplate']) && empty($fields['saveTemplateName'])) { $errors['saveTemplateName'] = ts("Enter name to save message template"); } @@ -350,20 +350,19 @@ class CRM_Contact_Form_Task_SMSCommon { $fromSmsProviderId = $thisValues['sms_provider_id']; // process message template - if (CRM_Utils_Array::value('saveTemplate', $thisValues) - || CRM_Utils_Array::value('updateTemplate', $thisValues) + if (!empty($thisValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $thisValues) ) { $messageTemplate = array( 'msg_text' => $thisValues['text_message'], 'is_active' => TRUE, ); - if (CRM_Utils_Array::value('saveTemplate', $thisValues)) { + if (!empty($thisValues['saveTemplate'])) { $messageTemplate['msg_title'] = $thisValues['saveTemplateName']; CRM_Core_BAO_MessageTemplate::add($messageTemplate); } - if (CRM_Utils_Array::value('template', $thisValues) && + if (!empty($thisValues['template']) && CRM_Utils_Array::value('updateTemplate', $thisValues) ) { $messageTemplate['id'] = $thisValues['template']; @@ -383,7 +382,7 @@ class CRM_Contact_Form_Task_SMSCommon { $phoneKey = "{$contactId}::{$phone}"; if (!in_array($phoneKey, $tempPhones)) { $tempPhones[] = $phoneKey; - if (CRM_Utils_Array::value($contactId, $form->_contactDetails)) { + if (!empty($form->_contactDetails[$contactId])) { $formattedContactDetails[] = $form->_contactDetails[$contactId]; } } diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 195d36649f..7f5c8d1e4f 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -309,7 +309,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { //CRM-5125 for contact subtype specific relationshiptypes $cSubType = NULL; - if (CRM_Utils_Array::value("contact_sub_type_{$second}", $contactRelationCache[$id])) { + if (!empty($contactRelationCache[$id]["contact_sub_type_{$second}"])) { $cSubType = $contactRelationCache[$id]["contact_sub_type_{$second}"]; } @@ -335,7 +335,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } //fix to append custom group name to field name, CRM-2676 - if (!CRM_Utils_Array::value($cType, $this->_formattedFieldNames) || $cType == $this->_contactType) { + if (empty($this->_formattedFieldNames[$cType]) || $cType == $this->_contactType) { $this->_formattedFieldNames[$cType] = $this->formatCustomFieldName($values); } @@ -624,7 +624,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { */ static function formRule($fields) { $errors = array(); - if (CRM_Utils_Array::value('saveMapping', $fields)) { + if (!empty($fields['saveMapping'])) { $nameField = CRM_Utils_Array::value('saveMappingName', $fields); if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); @@ -637,7 +637,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } } $template = CRM_Core_Smarty::singleton(); - if (CRM_Utils_Array::value('saveMapping', $fields)) { + if (!empty($fields['saveMapping'])) { $template->assign('isCheked', TRUE); } @@ -793,7 +793,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params)); //Updating Mapping Records - if (CRM_Utils_Array::value('updateMapping', $params)) { + if (!empty($params['updateMapping'])) { $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); @@ -862,7 +862,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } //Saving Mapping Details and Records - if (CRM_Utils_Array::value('saveMapping', $params)) { + if (!empty($params['saveMapping'])) { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], diff --git a/CRM/Contact/Import/Form/Preview.php b/CRM/Contact/Import/Form/Preview.php index c4da5dfbe0..8539638259 100644 --- a/CRM/Contact/Import/Form/Preview.php +++ b/CRM/Contact/Import/Form/Preview.php @@ -200,7 +200,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { $errors = array(); $invalidTagName = $invalidGroupName = FALSE; - if (CRM_Utils_Array::value('newTagName', $fields)) { + if (!empty($fields['newTagName'])) { if (!CRM_Utils_Rule::objectExists(trim($fields['newTagName']), array('CRM_Core_DAO_Tag') )) { @@ -211,7 +211,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { } } - if (CRM_Utils_Array::value('newGroupName', $fields)) { + if (!empty($fields['newGroupName'])) { $title = trim($fields['newGroupName']); $name = CRM_Utils_String::titleToVar($title); $query = 'select count(*) from civicrm_group where name like %1 OR title like %2'; diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 60ea53b99f..36af9e51b5 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -478,7 +478,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } //check if external identifier exists in database - if (CRM_Utils_Array::value('external_identifier', $params) && (CRM_Utils_Array::value('id', $params) || in_array($onDuplicate, array( + if (!empty($params['external_identifier']) && (CRM_Utils_Array::value('id', $params) || in_array($onDuplicate, array( CRM_Import_Parser::DUPLICATE_SKIP, CRM_Import_Parser::DUPLICATE_NOCHECK, )))) { @@ -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 (!CRM_Utils_Array::value('id', $params) && CRM_Utils_Array::value('external_identifier', $params)) { + if (empty($params['id']) && CRM_Utils_Array::value('external_identifier', $params)) { if ($cid) { $params['id'] = $cid; } @@ -572,7 +572,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { //validation of subtype for update mode //CRM-5125 $contactSubType = NULL; - if (CRM_Utils_Array::value('contact_sub_type', $params)) { + if (!empty($params['contact_sub_type'])) { $contactSubType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['id'], 'contact_sub_type'); } @@ -606,14 +606,14 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } else { $contactType = NULL; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $contactType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['id'], 'contact_type'); if ($contactType) { if ($formatted['contact_type'] == $contactType) { //validation of subtype for update mode //CRM-5125 $contactSubType = NULL; - if (CRM_Utils_Array::value('contact_sub_type', $params)) { + if (!empty($params['contact_sub_type'])) { $contactSubType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['id'], 'contact_sub_type'); } @@ -781,7 +781,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { $contactFields = CRM_Contact_DAO_Contact::import(); //Relation on the basis of External Identifier. - if (!CRM_Utils_Array::value('id', $params[$key]) && !empty($params[$key]['external_identifier'])) { + if (empty($params[$key]['id']) && !empty($params[$key]['external_identifier'])) { $params[$key]['id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$key]['external_identifier'], 'id', 'external_identifier'); } // check for valid related contact id in update/fill mode, CRM-4424 @@ -799,7 +799,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { //validation of related contact subtype for update mode //CRM-5125 $relatedCsType = NULL; - if (CRM_Utils_Array::value('contact_sub_type', $formatting)) { + if (!empty($formatting['contact_sub_type'])) { $relatedCsType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$key]['id'], 'contact_sub_type'); } @@ -830,7 +830,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } //fixed for CRM-4148 - if (CRM_Utils_Array::value('id', $params[$key])) { + if (!empty($params[$key]['id'])) { $contact = array( 'contact_id' => $params[$key]['id'], ); @@ -874,7 +874,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { //validation of related contact subtype for update mode //CRM-5125 $relatedCsType = NULL; - if (CRM_Utils_Array::value('contact_sub_type', $formatting)) { + if (!empty($formatting['contact_sub_type'])) { $relatedCsType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $matchedIDs[0], 'contact_sub_type'); } @@ -1038,7 +1038,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } if (civicrm_error($newContact)) { - if (!CRM_Utils_Array::value('params', $newContact['error_message'])) { + if (empty($newContact['error_message']['params'])) { // different kind of error other than DUPLICATE $errorMessage = $newContact['error_message']; array_unshift($values, $errorMessage); @@ -1128,11 +1128,11 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { $session = CRM_Core_Session::singleton(); $dateType = $session->get("dateTypes"); - if (CRM_Utils_Array::value('contact_sub_type', $params)) { + if (!empty($params['contact_sub_type'])) { $csType = CRM_Utils_Array::value('contact_sub_type', $params); } - if (!CRM_Utils_Array::value('contact_type', $params)) { + if (empty($params['contact_type'])) { $params['contact_type'] = 'Individual'; } $customFields = CRM_Core_BAO_CustomField::getFields($params['contact_type'], FALSE, FALSE, $csType); @@ -1468,7 +1468,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { case 'geo_code_1': if (!empty($value)) { foreach ($value as $codeValue) { - if (CRM_Utils_Array::value('geo_code_1', $codeValue)) { + if (!empty($codeValue['geo_code_1'])) { if (CRM_Utils_Rule::numeric($codeValue['geo_code_1'])) { continue; } @@ -1483,7 +1483,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { case 'geo_code_2': if (!empty($value)) { foreach ($value as $codeValue) { - if (CRM_Utils_Array::value('geo_code_2', $codeValue)) { + if (!empty($codeValue['geo_code_2'])) { if (CRM_Utils_Rule::numeric($codeValue['geo_code_2'])) { continue; } @@ -1557,7 +1557,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { case 'url': if (is_array($value)) { foreach ($value as $values) { - if (CRM_Utils_Array::value('url', $values) && !CRM_Utils_Rule::url($values['url'])) { + if (!empty($values['url']) && !CRM_Utils_Rule::url($values['url'])) { self::addToErrorMsg(ts('Website'), $errorMessage); break; } @@ -1579,7 +1579,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { case 'email': if (is_array($value)) { foreach ($value as $values) { - if (CRM_Utils_Array::value('email', $values) && !CRM_Utils_Rule::email($values['email'])) { + if (!empty($values['email']) && !CRM_Utils_Rule::email($values['email'])) { self::addToErrorMsg($key, $errorMessage); break; } @@ -1957,7 +1957,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { case 'AdvMulti-Select': case 'Multi-Select': - if ( CRM_Utils_Array::value( $key, $formatted ) && CRM_Utils_Array::value( $key, $params ) ) { + if (!empty($formatted[$key]) && CRM_Utils_Array::value( $key, $params ) ) { $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 (!CRM_Utils_Array::value('street_name', $parsedFields) || !CRM_Utils_Array::value('street_number', $parsedFields)) { + if (empty($parsedFields['street_name']) || !CRM_Utils_Array::value('street_number', $parsedFields)) { $parsedFields = array_fill_keys(array_keys($parsedFields), ''); } @@ -2063,7 +2063,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { continue; } - if ( CRM_Utils_Array::value($name, $relatedContactFields) && !is_array($relatedContactFields[$name])) { + if (!empty($relatedContactFields[$name]) && !is_array($relatedContactFields[$name])) { $relatedContactFields[$name] = array(); } $fldName = CRM_Utils_Array::value($key, $this->_mapperRelatedContactDetails); @@ -2079,7 +2079,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { //validate for passed data. if (is_array($relatedContactFields[$relKey])) { foreach ($relatedContactFields[$relKey] as $fld) { - if (CRM_Utils_Array::value($fld, $params)) { + if (!empty($params[$fld])) { $allowToCreate = TRUE; break; } diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 76e6d53fa4..c3d81ee0d9 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -132,7 +132,7 @@ class CRM_Contact_Page_AJAX { $config = CRM_Core_Config::singleton(); $limit = 10; - if (CRM_Utils_Array::value('limit', $_GET)) { + if (!empty($_GET['limit'])) { $limit = CRM_Utils_Type::escape($_GET['limit'], 'Positive'); } @@ -171,7 +171,7 @@ class CRM_Contact_Page_AJAX { $contact = civicrm_api('Contact', 'Get', $params); - if (CRM_Utils_Array::value('is_error', $contact)) { + if (!empty($contact['is_error'])) { echo "$name|error\n"; CRM_Utils_System::civiExit(); } @@ -180,7 +180,7 @@ class CRM_Contact_Page_AJAX { foreach ($contact['values'] as $value) { $view = array(); foreach ($return as $fld) { - if (CRM_Utils_Array::value($fld, $value)) { + if (!empty($value[$fld])) { $view[] = $value[$fld]; } } @@ -223,7 +223,7 @@ class CRM_Contact_Page_AJAX { $whereClause = " WHERE ( sort_name LIKE '$strSearch' $includeNickName ) {$where} "; } - if (CRM_Utils_Array::value('limit', $_GET)) { + if (!empty($_GET['limit'])) { $limit = CRM_Utils_Type::escape($_GET['limit'], 'Positive'); } @@ -312,7 +312,7 @@ class CRM_Contact_Page_AJAX { $return = CRM_Contact_BAO_Relationship::create($relationParams, $relationIds); $status = 'process-relationship-fail'; - if (CRM_Utils_Array::value(0, $return[4])) { + if (!empty($return[4][0])) { $relationshipID = $return[4][0]; $status = 'process-relationship-success'; @@ -377,7 +377,7 @@ class CRM_Contact_Page_AJAX { } $name = CRM_Utils_Type::escape($name, 'String'); $whereIdClause = ''; - if (CRM_Utils_Array::value('id', $_GET)) { + if (!empty($_GET['id'])) { $json = TRUE; if (is_numeric($_GET['id'])) { $id = CRM_Utils_Type::escape($_GET['id'], 'Integer'); @@ -472,7 +472,7 @@ WHERE civicrm_contact.contact_type ='Household' AND household_name LIKE '%$contactName%' {$addStreet} {$addCity} {$whereIdClause} ORDER BY household_name "; } elseif ($relType) { - if (CRM_Utils_Array::value('case', $_GET)) { + if (!empty($_GET['case'])) { $query = " SELECT distinct(c.id), c.sort_name FROM civicrm_contact c @@ -661,7 +661,7 @@ WHERE sort_name LIKE '%$name%'"; * Function to get email address of a contact */ static function getContactEmail() { - if (CRM_Utils_Array::value('contact_id', $_REQUEST)) { + if (!empty($_REQUEST['contact_id'])) { $contactID = CRM_Utils_Type::escape($_REQUEST['contact_id'], 'Positive'); list($displayName, $userEmail @@ -1111,7 +1111,7 @@ LIMIT {$offset}, {$rowCount} $searchRows[$mainId]['dst'] = CRM_Utils_System::href($main['dstName'], 'civicrm/contact/view', "reset=1&cid={$main['dstID']}"); $searchRows[$mainId]['weight'] = CRM_Utils_Array::value('weight', $main); - if (CRM_Utils_Array::value('canMerge', $main)) { + if (!empty($main['canMerge'])) { $mergeParams = "reset=1&cid={$main['srcID']}&oid={$main['dstID']}&action=update&rgid={$rgid}"; if ($gid) { $mergeParams .= "&gid={$gid}"; diff --git a/CRM/Contact/Page/Inline/Address.php b/CRM/Contact/Page/Inline/Address.php index d1dd9f14a1..9273c99981 100644 --- a/CRM/Contact/Page/Inline/Address.php +++ b/CRM/Contact/Page/Inline/Address.php @@ -75,7 +75,7 @@ class CRM_Contact_Page_Inline_Address extends CRM_Core_Page { $sharedAddresses = array(); $shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($currentAddressBlock['address']); foreach ($currentAddressBlock['address'] as $key => $addressValue) { - if (CRM_Utils_Array::value('master_id', $addressValue) && + if (!empty($addressValue['master_id']) && !$shareAddressContactNames[$addressValue['master_id']]['is_deleted'] ) { $sharedAddresses[$key]['shared_address_display'] = array( diff --git a/CRM/Contact/Page/Inline/CommunicationPreferences.php b/CRM/Contact/Page/Inline/CommunicationPreferences.php index 30e95eb1cd..ec02f1aade 100644 --- a/CRM/Contact/Page/Inline/CommunicationPreferences.php +++ b/CRM/Contact/Page/Inline/CommunicationPreferences.php @@ -60,7 +60,7 @@ class CRM_Contact_Page_Inline_CommunicationPreferences extends CRM_Core_Page { $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id'); if (!empty($communicationStyle)) { - if (CRM_Utils_Array::value('communication_style_id', $defaults)) { + if (!empty($defaults['communication_style_id'])) { $defaults['communication_style_display'] = $communicationStyle[CRM_Utils_Array::value('communication_style_id', $defaults)]; } else { diff --git a/CRM/Contact/Page/Inline/ContactInfo.php b/CRM/Contact/Page/Inline/ContactInfo.php index c45b93c707..bd91099d15 100644 --- a/CRM/Contact/Page/Inline/ContactInfo.php +++ b/CRM/Contact/Page/Inline/ContactInfo.php @@ -59,7 +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 (CRM_Utils_Array::value('employer_id', $defaults) && + if (!empty($defaults['employer_id']) && CRM_Utils_Array::value('organization_name', $defaults)) { $defaults['current_employer'] = $defaults['organization_name']; $defaults['current_employer_id'] = $defaults['employer_id']; diff --git a/CRM/Contact/Page/Inline/Demographics.php b/CRM/Contact/Page/Inline/Demographics.php index c3c46a0425..4584796ed6 100644 --- a/CRM/Contact/Page/Inline/Demographics.php +++ b/CRM/Contact/Page/Inline/Demographics.php @@ -57,7 +57,7 @@ class CRM_Contact_Page_Inline_Demographics extends CRM_Core_Page { $defaults = array(); CRM_Contact_BAO_Contact::getValues( $params, $defaults ); - if (CRM_Utils_Array::value('gender_id', $defaults)) { + if (!empty($defaults['gender_id'])) { $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); $defaults['gender_display'] = $gender[CRM_Utils_Array::value('gender_id', $defaults)]; } diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index b8197b6f90..2832c8f47d 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -180,10 +180,10 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { ); foreach ($communicationType as $key => $value) { - if (CRM_Utils_Array::value($key, $defaults)) { + if (!empty($defaults[$key])) { foreach ($defaults[$key] as & $val) { CRM_Utils_Array::lookupValue($val, 'location_type', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name')), FALSE); - if (!CRM_Utils_Array::value('skip', $value)) { + if (empty($value['skip'])) { $daoName = $value['daoName']; $pseudoConst = $daoName::buildOptions($value['fieldName'], 'get'); CRM_Utils_Array::lookupValue($val, $value['id'], $pseudoConst, FALSE); @@ -193,7 +193,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { foreach ($defaults[$key] as $blockId => $blockVal) { $idValue = $blockVal['id']; if ( $key == 'address' ) { - if ( CRM_Utils_Array::value( 'master_id', $blockVal ) ) { + if (!empty($blockVal['master_id'])) { $idValue = $blockVal['master_id']; } } @@ -210,13 +210,13 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { } } - if (CRM_Utils_Array::value('gender_id', $defaults)) { + if (!empty($defaults['gender_id'])) { $defaults['gender_display'] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'gender_id', $defaults['gender_id']); } $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id'); if (!empty($communicationStyle)) { - if (CRM_Utils_Array::value('communication_style_id', $defaults)) { + if (!empty($defaults['communication_style_id'])) { $defaults['communication_style_display'] = $communicationStyle[CRM_Utils_Array::value('communication_style_id', $defaults)]; } else { @@ -254,7 +254,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { $sharedAddresses = array(); $shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($defaults['address']); foreach ($defaults['address'] as $key => $addressValue) { - if (CRM_Utils_Array::value('master_id', $addressValue) && + if (!empty($addressValue['master_id']) && !$shareAddressContactNames[$addressValue['master_id']]['is_deleted'] ) { $sharedAddresses[$key]['shared_address_display'] = array( @@ -301,8 +301,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { $components = CRM_Core_Component::getEnabledComponents(); foreach ($components as $name => $component) { - if ( - CRM_Utils_Array::value($name, $this->_viewOptions) && + if (!empty($this->_viewOptions[$name]) && CRM_Core_Permission::access($component->name) ) { $elem = $component->registerTab(); diff --git a/CRM/Contact/Page/View/UserDashBoard.php b/CRM/Contact/Page/View/UserDashBoard.php index 466bc9efc4..e10a01829c 100644 --- a/CRM/Contact/Page/View/UserDashBoard.php +++ b/CRM/Contact/Page/View/UserDashBoard.php @@ -131,7 +131,7 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { continue; } - if (CRM_Utils_Array::value($name, $this->_userOptions) && + if (!empty($this->_userOptions[$name]) && (CRM_Core_Permission::access($component->name) || CRM_Core_Permission::check($elem['perm'][0]) ) @@ -148,7 +148,7 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { } } - if (CRM_Utils_Array::value('Permissioned Orgs', $this->_userOptions)) { + if (!empty($this->_userOptions['Permissioned Orgs'])) { $dashboardElements[] = array( 'class' => 'crm-dashboard-permissionedOrgs', 'templatePath' => 'CRM/Contact/Page/View/Relationship.tpl', @@ -165,7 +165,7 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { $this->assign('currentRelationships', $currentRelationships); } - if (CRM_Utils_Array::value('PCP', $this->_userOptions)) { + if (!empty($this->_userOptions['PCP'])) { $dashboardElements[] = array( 'class' => 'crm-dashboard-pcp', 'templatePath' => 'CRM/Contribute/Page/PcpUserDashboard.tpl', @@ -177,7 +177,7 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { $this->assign('pcpInfo', $pcpInfo); } - if (CRM_Utils_Array::value('Assigned Activities', $this->_userOptions)) { + if (!empty($this->_userOptions['Assigned Activities'])) { // Assigned Activities section $dashboardElements[] = array( 'class' => 'crm-dashboard-assignedActivities', @@ -192,7 +192,7 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { usort($dashboardElements, array('CRM_Utils_Sort', 'cmpFunc')); $this->assign('dashboardElements', $dashboardElements); - if (CRM_Utils_Array::value('Groups', $this->_userOptions)) { + if (!empty($this->_userOptions['Groups'])) { $this->assign('showGroup', TRUE); //build group selector $gContact = new CRM_Contact_Page_View_UserDashBoard_GroupContact(); diff --git a/CRM/Contact/Page/View/Vcard.php b/CRM/Contact/Page/View/Vcard.php index 2d4759a4a9..7ee1bc420b 100644 --- a/CRM/Contact/Page/View/Vcard.php +++ b/CRM/Contact/Page/View/Vcard.php @@ -84,46 +84,46 @@ class CRM_Contact_Page_View_Vcard extends CRM_Contact_Page_View { $vcard->setFormattedName($defaults['display_name']); $vcard->setSortString($defaults['sort_name']); - if (CRM_Utils_Array::value('nick_name', $defaults)) { + if (!empty($defaults['nick_name'])) { $vcard->addNickname($defaults['nick_name']); } - if (CRM_Utils_Array::value('job_title', $defaults)) { + if (!empty($defaults['job_title'])) { $vcard->setTitle($defaults['job_title']); } - if (CRM_Utils_Array::value('birth_date_display', $defaults)) { + if (!empty($defaults['birth_date_display'])) { $vcard->setBirthday(CRM_Utils_Array::value('birth_date_display', $defaults)); } - if (CRM_Utils_Array::value('home_URL', $defaults)) { + if (!empty($defaults['home_URL'])) { $vcard->setURL($defaults['home_URL']); } // TODO: $vcard->setGeo($lat, $lon); - if (CRM_Utils_Array::value('address', $defaults)) { + if (!empty($defaults['address'])) { $stateProvices = CRM_Core_PseudoConstant::stateProvince(); $countries = CRM_Core_PseudoConstant::country(); foreach ($defaults['address'] as $location) { // we don't keep PO boxes in separate fields $pob = ''; $extend = CRM_Utils_Array::value('supplemental_address_1', $location); - if (CRM_Utils_Array::value('supplemental_address_2', $location)) { + if (!empty($location['supplemental_address_2'])) { $extend .= ', ' . $location['supplemental_address_2']; } $street = CRM_Utils_Array::value('street_address', $location); $locality = CRM_Utils_Array::value('city', $location); $region = NULL; - if (CRM_Utils_Array::value('state_province_id', $location)) { + if (!empty($location['state_province_id'])) { $region = $stateProvices[CRM_Utils_Array::value('state_province_id', $location)]; } $country = NULL; - if (CRM_Utils_Array::value('country_id', $location)) { + if (!empty($location['country_id'])) { $country = $countries[CRM_Utils_Array::value('country_id', $location)]; } $postcode = CRM_Utils_Array::value('postal_code', $location); - if (CRM_Utils_Array::value('postal_code_suffix', $location)) { + if (!empty($location['postal_code_suffix'])) { $postcode .= '-' . $location['postal_code_suffix']; } @@ -132,12 +132,12 @@ class CRM_Contact_Page_View_Vcard extends CRM_Contact_Page_View { if ($vcardName) { $vcard->addParam('TYPE', $vcardName); } - if (CRM_Utils_Array::value('is_primary', $location)) { + if (!empty($location['is_primary'])) { $vcard->addParam('TYPE', 'PREF'); } } } - if (CRM_Utils_Array::value('phone', $defaults)) { + if (!empty($defaults['phone'])) { foreach ($defaults['phone'] as $phone) { $vcard->addTelephone($phone['phone']); $vcardName = $vcardNames[$phone['location_type_id']]; @@ -150,7 +150,7 @@ class CRM_Contact_Page_View_Vcard extends CRM_Contact_Page_View { } } - if (CRM_Utils_Array::value('email', $defaults)) { + if (!empty($defaults['email'])) { foreach ($defaults['email'] as $email) { $vcard->addEmail($email['email']); $vcardName = $vcardNames[$email['location_type_id']]; diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 5197f39abd..c9bf383854 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -380,7 +380,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); foreach ($this->_fields as $name => $field) { - if (CRM_Utils_Array::value('in_selector', $field) && + if (!empty($field['in_selector']) && !in_array($name, $skipFields) ) { if (strpos($name, '-') !== FALSE) { @@ -552,8 +552,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se $names = array(); static $skipFields = array('group', 'tag'); foreach ($this->_fields as $key => $field) { - if ( - CRM_Utils_Array::value('in_selector', $field) && + if (!empty($field['in_selector']) && !in_array($key, $skipFields) ) { if (strpos($key, '-') !== FALSE) { @@ -723,8 +722,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se if ($output != CRM_Core_Selector_Controller::EXPORT) { $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->contact_id; - if (CRM_Utils_Array::value('deleted_contacts', $this->_formValues) - && CRM_Core_Permission::check('access deleted contacts') + if (!empty($this->_formValues['deleted_contacts']) && CRM_Core_Permission::check('access deleted contacts') ) { $links = array( array( @@ -868,8 +866,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se foreach ($rows as $id => & $row) { - if (CRM_Utils_Array::value('deleted_contacts', $this->_formValues) - && CRM_Core_Permission::check('access deleted contacts') + if (!empty($this->_formValues['deleted_contacts']) && CRM_Core_Permission::check('access deleted contacts') ) { $links = array( array( @@ -1080,7 +1077,7 @@ SELECT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', contact_a.dis ); foreach ($defaultAddress as $columnName => $column) { - if (CRM_Utils_Array::value($columnName, $addressOptions)) { + if (!empty($addressOptions[$columnName])) { self::$_columnHeaders[$columnName] = $column; } } diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 812ad5455e..1201e6d9ea 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -115,7 +115,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { ); //if priceset is used, no need to cleanup money - if (CRM_Utils_Array::value('skipCleanMoney', $params)) { + if (!empty($params['skipCleanMoney'])) { unset($moneyFields[0]); } @@ -131,7 +131,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { FALSE, FALSE, FALSE, 'AND is_default = 1')); } - if (CRM_Utils_Array::value('payment_instrument_id', $params)) { + if (!empty($params['payment_instrument_id'])) { $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument('name'); if ($params['payment_instrument_id'] != array_search('Check', $paymentInstruments)) { $params['check_number'] = 'null'; @@ -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 (!CRM_Utils_Array::value('contribution', $ids) && !CRM_Utils_Array::value('contribution_status_id', $params)) { + if (empty($ids['contribution']) && !CRM_Utils_Array::value('contribution_status_id', $params)) { $params['contribution_status_id'] = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name'); } @@ -256,7 +256,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { $params['contribution_id'] = $contribution->id; - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contribution', $contribution->id); @@ -264,7 +264,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { $session = CRM_Core_Session::singleton(); - if (CRM_Utils_Array::value('note', $params)) { + if (!empty($params['note'])) { $noteParams = array( 'entity_table' => 'civicrm_contribution', 'note' => $params['note'], @@ -279,7 +279,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { } // make entry in batch entity batch table - if (CRM_Utils_Array::value('batch_id', $params)) { + if (!empty($params['batch_id'])) { // in some update cases we need to get extra fields - ie an update that doesn't pass in all these params $titleFields = array( 'contact_id', @@ -336,7 +336,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { $softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name'); CRM_Contribute_BAO_ContributionSoft::add($softParams); } - elseif (CRM_Utils_Array::value('soft_credit', $params)) { + elseif (!empty($params['soft_credit'])) { $softParams = $params['soft_credit']; if (!empty($softIDs)) { @@ -358,7 +358,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { $transaction->commit(); // do not add to recent items for import, CRM-4399 - if (!CRM_Utils_Array::value('skipRecentView', $params)) { + if (empty($params['skipRecentView'])) { $url = CRM_Utils_System::url('civicrm/contact/view/contribution', "action=view&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home" ); @@ -1314,7 +1314,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ } } - if (CRM_Utils_Array::value('contact_id', $componentDetails)) { + if (!empty($componentDetails['contact_id'])) { $componentDetails['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'contact_id' @@ -1322,7 +1322,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ } // do check for required ids. - if (!CRM_Utils_Array::value('membership', $componentDetails) && + if (empty($componentDetails['membership']) && !CRM_Utils_Array::value('participant', $componentDetails) && !CRM_Utils_Array::value('pledge_payment', $componentDetails) || !CRM_Utils_Array::value('contact_id', $componentDetails) @@ -1590,7 +1590,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ 'contribution_status_id', 'non_deductible_amount', 'receipt_date', 'check_number', ); foreach ($fields as $field) { - if (!CRM_Utils_Array::value($field, $params)) { + if (empty($params[$field])) { continue; } $contributionParams[$field] = $params[$field]; @@ -1909,7 +1909,7 @@ WHERE contribution_id = %1 "; ); } //fail to load payment processor id. - elseif (!CRM_Utils_Array::value('pledge_payment', $ids)) { + elseif (empty($ids['pledge_payment'])) { $loadObjectSuccess = TRUE; if ($required) { throw new Exception("Could not find contribution page for contribution record: " . $this->id); @@ -2030,7 +2030,7 @@ WHERE contribution_id = %1 "; } else { $values['contribution_id'] = $this->id; - if (CRM_Utils_Array::value('related_contact', $ids)) { + if (!empty($ids['related_contact'])) { $values['related_contact'] = $ids['related_contact']; if (isset($ids['onbehalf_dupe_alert'])) { $values['onbehalf_dupe_alert'] = $ids['onbehalf_dupe_alert']; @@ -2159,7 +2159,7 @@ WHERE contribution_id = %1 "; $this->contact_id ); // if this is onbehalf of contribution then set related contact - if (CRM_Utils_Array::value('individual_id', $relatedContact)) { + if (!empty($relatedContact['individual_id'])) { $values['related_contact'] = $ids['related_contact'] = $relatedContact['individual_id']; } } @@ -2236,7 +2236,7 @@ WHERE contribution_id = %1 "; $honorType = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id'); $template->assign('honor_block_is_active', 1); - if (CRM_Utils_Array::value('prefix_id', $honorDefault)) { + if (!empty($honorDefault['prefix_id'])) { $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'); $template->assign('honor_prefix', $prefix[$honorDefault['prefix_id']]); } @@ -2469,7 +2469,7 @@ WHERE contribution_id = %1 "; $entityID += $additionalParticipantId; } // prevContribution appears to mean - original contribution object- ie copy of contribution from before the update started that is being updated - if (!CRM_Utils_Array::value('prevContribution', $params)) { + if (empty($params['prevContribution'])) { $entityID = NULL; } else { @@ -2505,7 +2505,7 @@ WHERE contribution_id = %1 "; $balanceTrxnParams['status_id'] = $statusId; $balanceTrxnParams['payment_instrument_id'] = $params['contribution']->payment_instrument_id; $balanceTrxnParams['check_number'] = CRM_Utils_Array::value('check_number', $params); - if (CRM_Utils_Array::value('payment_processor', $params)) { + if (!empty($params['payment_processor'])) { $balanceTrxnParams['payment_processor_id'] = $params['payment_processor']; } CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams); @@ -2513,7 +2513,7 @@ WHERE contribution_id = %1 "; } // build line item array if its not set in $params - if (!CRM_Utils_Array::value('line_item', $params) || $additionalParticipantId) { + if (empty($params['line_item']) || $additionalParticipantId) { CRM_Price_BAO_LineItem::getLineItemArray($params, $entityID, str_replace('civicrm_', '', $entityTable)); } @@ -2524,10 +2524,10 @@ WHERE contribution_id = %1 "; $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' ")); $params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId); } - elseif (CRM_Utils_Array::value('payment_processor', $params)) { + elseif (!empty($params['payment_processor'])) { $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($params['payment_processor'], 'civicrm_payment_processor', 'financial_account_id'); } - elseif (CRM_Utils_Array::value('payment_instrument_id', $params)) { + elseif (!empty($params['payment_instrument_id'])) { $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($params['payment_instrument_id']); } else { @@ -2556,7 +2556,7 @@ WHERE contribution_id = %1 "; 'check_number' => CRM_Utils_Array::value('check_number', $params), ); - if (CRM_Utils_Array::value('payment_processor', $params)) { + if (!empty($params['payment_processor'])) { $trxnParams['payment_processor_id'] = $params['payment_processor']; } @@ -2571,7 +2571,7 @@ WHERE contribution_id = %1 "; $params['trxnParams'] = $trxnParams; - if (CRM_Utils_Array::value('prevContribution', $params)) { + if (!empty($params['prevContribution'])) { $params['trxnParams']['total_amount'] = $trxnParams['total_amount'] = $params['total_amount'] = $params['prevContribution']->total_amount; $params['trxnParams']['fee_amount'] = $params['prevContribution']->fee_amount; $params['trxnParams']['net_amount'] = $params['prevContribution']->net_amount; @@ -2581,7 +2581,7 @@ WHERE contribution_id = %1 "; $params['trxnParams']['check_number'] = $params['prevContribution']->check_number; //if financial type is changed - if (CRM_Utils_Array::value('financial_type_id', $params) && + if (!empty($params['financial_type_id']) && $params['contribution']->financial_type_id != $params['prevContribution']->financial_type_id) { $incomeTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' ")); $oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $incomeTypeId); @@ -2594,7 +2594,7 @@ WHERE contribution_id = %1 "; } else { $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC'); - if (CRM_Utils_Array::value('financialTrxnId', $lastFinancialTrxnId)) { + if (!empty($lastFinancialTrxnId['financialTrxnId'])) { $params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id'); } } @@ -2609,7 +2609,7 @@ WHERE contribution_id = %1 "; //Update contribution status $params['trxnParams']['status_id'] = $params['contribution']->contribution_status_id; - if (CRM_Utils_Array::value('contribution_status_id', $params) && + if (!empty($params['contribution_status_id']) && $params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id) { //Update Financial Records self::updateFinancialAccounts($params, 'changedStatus'); @@ -2675,12 +2675,12 @@ WHERE contribution_id = %1 "; } } // record line items and finacial items - if (!CRM_Utils_Array::value('skipLineItem', $params)) { + if (empty($params['skipLineItem'])) { CRM_Price_BAO_LineItem::processPriceSet($entityId, CRM_Utils_Array::value('line_item', $params), $params['contribution'], $entityTable, $update); } // create batch entry if batch_id is passed - if (CRM_Utils_Array::value('batch_id', $params)) { + if (!empty($params['batch_id'])) { $entityParams = array( 'batch_id' => $params['batch_id'], 'entity_table' => 'civicrm_financial_trxn', @@ -2690,12 +2690,12 @@ WHERE contribution_id = %1 "; } // when a fee is charged - if (CRM_Utils_Array::value('fee_amount', $params) && (!CRM_Utils_Array::value('prevContribution', $params) + if (!empty($params['fee_amount']) && (!CRM_Utils_Array::value('prevContribution', $params) || $params['contribution']->fee_amount != $params['prevContribution']->fee_amount) && $skipRecords) { CRM_Core_BAO_FinancialTrxn::recordFees($params); } - if (CRM_Utils_Array::value('prevContribution', $params) && $entityTable == 'civicrm_participant' + if (!empty($params['prevContribution']) && $entityTable == 'civicrm_participant' && $params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id) { $eventID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $entityId, 'event_id'); $feeLevel[] = str_replace('', '', $params['prevContribution']->amount_level); @@ -2756,7 +2756,7 @@ WHERE contribution_id = %1 "; elseif ($context == 'changePaymentInstrument') { if ($params['trxnParams']['total_amount'] < 0) { $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC'); - if (CRM_Utils_Array::value('financialTrxnId', $lastFinancialTrxnId)) { + if (!empty($lastFinancialTrxnId['financialTrxnId'])) { $params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id'); $params['trxnParams']['payment_instrument_id'] = $params['prevContribution']->payment_instrument_id; } @@ -2814,7 +2814,7 @@ WHERE contribution_id = %1 "; } $financialAccount = $prevfinancialItem->financial_account_id; - if (CRM_Utils_Array::value('financial_account_id', $params)) { + if (!empty($params['financial_account_id'])) { $financialAccount = $params['financial_account_id']; } @@ -2822,7 +2822,7 @@ WHERE contribution_id = %1 "; if ($params['contribution']->currency) { $currency = $params['contribution']->currency; } - if (CRM_Utils_Array::value('is_quick_config', $params)) { + if (!empty($params['is_quick_config'])) { $amount = $itemAmount; if (!$amount) { $amount = $params['total_amount']; diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 13ad6d9ecd..536105ba50 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -65,7 +65,7 @@ class CRM_Contribute_BAO_Contribution_Utils { if (isset($paymentParams['financial_type'])) { $contributionType->id = $paymentParams['financial_type']; } - elseif (CRM_Utils_Array::value('pledge_id', $form->_values)) { + elseif (!empty($form->_values['pledge_id'])) { $contributionType->id = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_Pledge', $form->_values['pledge_id'], 'financial_type_id' @@ -200,7 +200,7 @@ class CRM_Contribute_BAO_Contribution_Utils { } } elseif ($form->_values['is_monetary'] && $form->_amount > 0.0) { - if (CRM_Utils_Array::value('is_recur', $paymentParams) && + if (!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct' ) { @@ -240,10 +240,10 @@ class CRM_Contribute_BAO_Contribution_Utils { if (is_a($result, 'CRM_Core_Error')) { //make sure to cleanup db for recurring case. - if (CRM_Utils_Array::value('contributionID', $paymentParams)) { + if (!empty($paymentParams['contributionID'])) { CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']); } - if (CRM_Utils_Array::value('contributionRecurID', $paymentParams)) { + if (!empty($paymentParams['contributionRecurID'])) { CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']); } @@ -279,9 +279,8 @@ class CRM_Contribute_BAO_Contribution_Utils { // check if pending was set to true by payment processor $pending = FALSE; - if (CRM_Utils_Array::value('contribution_status_pending', - $form->_params - )) { + if (!empty($form->_params +['contribution_status_pending'])) { $pending = TRUE; } if (!(!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct')) { @@ -418,7 +417,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = contrib.contact_id ) } $created = TRUE; - if (CRM_Utils_Array::value('cms_create_account', $params)) { + if (!empty($params['cms_create_account'])) { $params['contactID'] = $contactID; if (!CRM_Core_BAO_CMSUser::create($params, $mail)) { CRM_Core_Error::statusBounce(ts('Your profile is not saved and Account is not created.')); @@ -602,10 +601,10 @@ INNER JOIN civicrm_contact contact ON ( contact.id = contrib.contact_id ) if ($riskInfo['google-order-number']['VALUE'] == $apiParams[2]['google-order-number']['VALUE']) { foreach ($riskInfo['risk-information']['billing-address'] as $field => $info) { - if (CRM_Utils_Array::value($field, $mapper['location'])) { + if (!empty($mapper['location'][$field])) { $params['address'][1][$mapper['location'][$field]] = $info['VALUE']; } - elseif (CRM_Utils_Array::value($field, $mapper['contact'])) { + elseif (!empty($mapper['contact'][$field])) { if ($newOrder && CRM_Utils_Array::value('structured-name', $newOrder['buyer-billing-address'])) { foreach ($newOrder['buyer-billing-address']['structured-name'] as $namePart => $nameValue) { $params[$mapper['contact'][$namePart]] = $nameValue['VALUE']; @@ -615,7 +614,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = contrib.contact_id ) $params[$mapper['contact'][$field]] = $info['VALUE']; } } - elseif (CRM_Utils_Array::value($field, $mapper['transaction'])) { + elseif (!empty($mapper['transaction'][$field])) { $transaction[$mapper['transaction'][$field]] = $info['VALUE']; } } @@ -661,7 +660,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = contrib.contact_id ) } foreach ($localMapper as $localKey => $localVal) { - if (CRM_Utils_Array::value($localKey, $mapper['transaction'])) { + if (!empty($mapper['transaction'][$localKey])) { $transaction[$mapper['transaction'][$localKey]] = $localVal; } } @@ -693,7 +692,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = contrib.contact_id ) $dedupeParams['check_permission'] = FALSE; $dupeIds = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual'); // if we find more than one contact, use the first one - if (CRM_Utils_Array::value(0, $dupeIds)) { + if (!empty($dupeIds[0])) { $params['contact_id'] = $dupeIds[0]; } $contact = CRM_Contact_BAO_Contact::create($params); diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 45e72eb880..6f66c4c610 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -49,7 +49,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio */ public static function &create(&$params) { $financialTypeId = NULL; - if (CRM_Utils_Array::value('id', $params) && !CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $params['id'], NULL, 1)) { + if (!empty($params['id']) && !CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $params['id'], NULL, 1)) { $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $params['id'], 'financial_type_id'); } $dao = new CRM_Contribute_DAO_ContributionPage(); @@ -173,8 +173,8 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $gIds['custom_post_id'] = $values['custom_post_id']; } - if (CRM_Utils_Array::value('is_for_organization', $values)) { - if (CRM_Utils_Array::value('membership_id', $values)) { + if (!empty($values['is_for_organization'])) { + if (!empty($values['membership_id'])) { $params['onbehalf_profile'] = array( array( 'member_id', @@ -185,7 +185,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio ), ); } - elseif (CRM_Utils_Array::value('contribution_id', $values)) { + elseif (!empty($values['contribution_id'])) { $params['onbehalf_profile'] = array( array( 'contribution_id', @@ -232,7 +232,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio } } - if ( CRM_Utils_Array::value('is_email_receipt', $values) || + if (!empty($values['is_email_receipt']) || CRM_Utils_Array::value('onbehalf_dupe_alert', $values) || $returnMessageText ) { @@ -269,7 +269,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio //IF Individual type not present in profile then it is consider as Organization data. $userID = $contactID; if ($preID = CRM_Utils_Array::value('custom_pre_id', $values)) { - if (CRM_Utils_Array::value('related_contact', $values)) { + if (!empty($values['related_contact'])) { $preProfileTypes = CRM_Core_BAO_UFGroup::profileGroups($preID); if (in_array('Individual', $preProfileTypes) || in_array('Contact', $postProfileTypes)) { //Take Individual contact ID @@ -280,7 +280,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio } $userID = $contactID; if ($postID = CRM_Utils_Array::value('custom_post_id', $values)) { - if (CRM_Utils_Array::value('related_contact', $values)) { + if (!empty($values['related_contact'])) { $postProfileTypes = CRM_Core_BAO_UFGroup::profileGroups($postID); if (in_array('Individual', $postProfileTypes) || in_array('Contact', $postProfileTypes)) { //Take Individual contact ID @@ -383,7 +383,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio } // send duplicate alert, if dupe match found during on-behalf-of processing. - if (CRM_Utils_Array::value('onbehalf_dupe_alert', $values)) { + if (!empty($values['onbehalf_dupe_alert'])) { $sendTemplateParams['groupName'] = 'msg_tpl_workflow_contribution'; $sendTemplateParams['valueName'] = 'contribution_dupalert'; $sendTemplateParams['from'] = ts('Automatically Generated') . " <{$values['receipt_from_email']}>"; diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index 96b363ae35..4c3b85b947 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -63,7 +63,7 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi * @todo move hook calls / extended logic to create - requires changing calls to call create not add */ static function add(&$params) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'ContributionRecur', $params['id'], $params); } else { @@ -95,7 +95,7 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi } $result = $recurring->save(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'ContributionRecur', $recurring->id, $recurring); } else { diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 1d0e57d4e6..b536430b4d 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -76,7 +76,7 @@ class CRM_Contribute_BAO_Query { } // get financial_type - if (CRM_Utils_Array::value('financial_type', $query->_returnProperties)) { + if (!empty($query->_returnProperties['financial_type'])) { $query->_select['financial_type'] = "civicrm_financial_type.name as financial_type"; $query->_element['financial_type'] = 1; $query->_tables['civicrm_contribution'] = 1; @@ -84,27 +84,27 @@ class CRM_Contribute_BAO_Query { } // get accounting code - if (CRM_Utils_Array::value( 'accounting_code', $query->_returnProperties)) { + if (!empty($query->_returnProperties['accounting_code'])) { $query->_select['accounting_code'] = "civicrm_financial_account.accounting_code as accounting_code"; $query->_element['accounting_code'] = 1; $query->_tables['civicrm_accounting_code'] = 1; $query->_tables['civicrm_financial_account'] = 1; } - if (CRM_Utils_Array::value('contribution_note', $query->_returnProperties)) { + if (!empty($query->_returnProperties['contribution_note'])) { $query->_select['contribution_note'] = "civicrm_note.note as contribution_note"; $query->_element['contribution_note'] = 1; $query->_tables['contribution_note'] = 1; } - if (CRM_Utils_Array::value('contribution_batch', $query->_returnProperties)) { + if (!empty($query->_returnProperties['contribution_batch'])) { $query->_select['contribution_batch'] = "civicrm_batch.title as contribution_batch"; $query->_element['contribution_batch'] = 1; $query->_tables['contribution_batch'] = 1; } // get contribution_status - if (CRM_Utils_Array::value('contribution_status_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['contribution_status_id'])) { $query->_select['contribution_status_id'] = "contribution_status.value as contribution_status_id"; $query->_element['contribution_status_id'] = 1; $query->_tables['civicrm_contribution'] = 1; @@ -112,7 +112,7 @@ class CRM_Contribute_BAO_Query { } // get contribution_status label - if (CRM_Utils_Array::value('contribution_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['contribution_status'])) { $query->_select['contribution_status'] = "contribution_status.label as contribution_status"; $query->_element['contribution_status'] = 1; $query->_tables['civicrm_contribution'] = 1; @@ -120,27 +120,27 @@ class CRM_Contribute_BAO_Query { } // get payment instruments - if (CRM_Utils_Array::value('payment_instrument', $query->_returnProperties)) { + if (!empty($query->_returnProperties['payment_instrument'])) { $query->_select['contribution_payment_instrument'] = "payment_instrument.name as contribution_payment_instrument"; $query->_element['contribution_payment_instrument'] = 1; $query->_tables['civicrm_contribution'] = 1; $query->_tables['contribution_payment_instrument'] = 1; } - if (CRM_Utils_Array::value('check_number', $query->_returnProperties)) { + if (!empty($query->_returnProperties['check_number'])) { $query->_select['contribution_check_number'] = "civicrm_contribution.check_number as contribution_check_number"; $query->_element['contribution_check_number'] = 1; $query->_tables['civicrm_contribution'] = 1; } - if (CRM_Utils_Array::value('contribution_campaign_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['contribution_campaign_id'])) { $query->_select['contribution_campaign_id'] = 'civicrm_contribution.campaign_id as contribution_campaign_id'; $query->_element['contribution_campaign_id'] = 1; $query->_tables['civicrm_contribution'] = 1; } // LCD 716 - if (CRM_Utils_Array::value('soft_credit_name', $query->_returnProperties)) { + if (!empty($query->_returnProperties['soft_credit_name'])) { $query->_select['contribution_soft_credit_name'] = "civicrm_contact_d.display_name as contribution_soft_credit_name"; $query->_element['contribution_soft_credit_name'] = 1; $query->_tables['civicrm_contribution'] = 1; @@ -148,7 +148,7 @@ class CRM_Contribute_BAO_Query { $query->_tables['civicrm_contribution_soft_contact'] = 1; } - if (CRM_Utils_Array::value('soft_credit_email', $query->_returnProperties)) { + if (!empty($query->_returnProperties['soft_credit_email'])) { $query->_select['contribution_soft_credit_email'] = "soft_email.email as contribution_soft_credit_email"; $query->_element['contribution_soft_credit_email'] = 1; $query->_tables['civicrm_contribution'] = 1; @@ -157,7 +157,7 @@ class CRM_Contribute_BAO_Query { $query->_tables['civicrm_contribution_soft_email'] = 1; } - if (CRM_Utils_Array::value('soft_credit_phone', $query->_returnProperties)) { + if (!empty($query->_returnProperties['soft_credit_phone'])) { $query->_select['contribution_soft_credit_email'] = "soft_phone.phone as contribution_soft_credit_phone"; $query->_element['contribution_soft_credit_phone'] = 1; $query->_tables['civicrm_contribution'] = 1; @@ -171,7 +171,7 @@ class CRM_Contribute_BAO_Query { static function where(&$query) { $grouping = NULL; foreach (array_keys($query->_params) as $id) { - if (!CRM_Utils_Array::value(0, $query->_params[$id])) { + if (empty($query->_params[$id][0])) { continue; } if (substr($query->_params[$id][0], 0, 13) == 'contribution_' || substr($query->_params[$id][0], 0, 10) == 'financial_') { @@ -860,11 +860,11 @@ class CRM_Contribute_BAO_Query { static function tableNames(&$tables) { // Add contribution table - if (CRM_Utils_Array::value('civicrm_product', $tables)) { + if (!empty($tables['civicrm_product'])) { $tables = array_merge(array('civicrm_contribution' => 1), $tables); } - if (CRM_Utils_Array::value('civicrm_contribution_product', $tables) && + if (!empty($tables['civicrm_contribution_product']) && !CRM_Utils_Array::value('civicrm_product', $tables)) { $tables['civicrm_product'] = 1; } diff --git a/CRM/Contribute/Form.php b/CRM/Contribute/Form.php index f7e7792ff9..60c7a7d9e2 100644 --- a/CRM/Contribute/Form.php +++ b/CRM/Contribute/Form.php @@ -88,7 +88,7 @@ class CRM_Contribute_Form extends CRM_Core_Form { } elseif ($this->_action & CRM_Core_Action::UPDATE) { - if (CRM_Utils_Array::value('contact_id', $defaults) || CRM_Utils_Array::value('created_id', $defaults)) { + if (!empty($defaults['contact_id']) || CRM_Utils_Array::value('created_id', $defaults)) { $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/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 71292d3ca3..09e146da67 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -164,7 +164,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Core_Form { //Check if this is an online transaction (financial_trxn.payment_processor_id NOT NULL) $this->_online = FALSE; $fids = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($id); - if (CRM_Utils_Array::value('financialTrxnId', $fids)) { + if (!empty($fids['financialTrxnId'])) { $this->_online = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $fids['financialTrxnId'], 'payment_processor_id'); } @@ -178,7 +178,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Core_Form { //unset the honor type id:when delete the honor_contact_id //and edit the contribution, honoree infomation pane open //since honor_type_id is present - if (!CRM_Utils_Array::value('honor_contact_id', $values)) { + if (empty($values['honor_contact_id'])) { unset($values['honor_type_id']); } //to get note id diff --git a/CRM/Contribute/Form/AdditionalInfo.php b/CRM/Contribute/Form/AdditionalInfo.php index ead4c9c4f9..713f870662 100644 --- a/CRM/Contribute/Form/AdditionalInfo.php +++ b/CRM/Contribute/Form/AdditionalInfo.php @@ -218,7 +218,7 @@ class CRM_Contribute_Form_AdditionalInfo { $productDetails = array(); CRM_Contribute_BAO_ManagePremiums::retrieve($premiumParams, $productDetails); $dao->financial_type_id = CRM_Utils_Array::value('financial_type_id', $productDetails); - if (CRM_Utils_Array::value($params['product_name'][0], $options)) { + if (!empty($options[$params['product_name'][0]])) { $dao->product_option = $options[$params['product_name'][0]][$params['product_name'][1]]; } if ($premiumID) { @@ -300,14 +300,14 @@ class CRM_Contribute_Form_AdditionalInfo { $formatted[$f] = CRM_Utils_Array::value($f, $params); } - if (CRM_Utils_Array::value('thankyou_date', $params) && !CRM_Utils_System::isNull($params['thankyou_date'])) { + if (!empty($params['thankyou_date']) && !CRM_Utils_System::isNull($params['thankyou_date'])) { $formatted['thankyou_date'] = CRM_Utils_Date::processDate($params['thankyou_date'], $params['thankyou_date_time']); } else { $formatted['thankyou_date'] = 'null'; } - if (CRM_Utils_Array::value('is_email_receipt', $params)) { + if (!empty($params['is_email_receipt'])) { $params['receipt_date'] = $formatted['receipt_date'] = date('YmdHis'); } @@ -342,13 +342,13 @@ class CRM_Contribute_Form_AdditionalInfo { // Retrieve Financial Type Name from financial_type_id $params['contributionType_name'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $params['financial_type_id']); - if (CRM_Utils_Array::value('payment_instrument_id', $params)) { + if (!empty($params['payment_instrument_id'])) { $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); $params['paidBy'] = $paymentInstrument[$params['payment_instrument_id']]; } // retrieve individual prefix value for honoree - if (CRM_Utils_Array::value('hidden_Honoree', $params)) { + if (!empty($params['hidden_Honoree'])) { $individualPrefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'); $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id'); $params['honor_prefix'] = CRM_Utils_Array::value(CRM_Utils_Array::value('honor_prefix_id', @@ -365,7 +365,7 @@ class CRM_Contribute_Form_AdditionalInfo { // retrieve premium product name and assigned fulfilled // date to template - if (CRM_Utils_Array::value('hidden_Premium', $params)) { + if (!empty($params['hidden_Premium'])) { if (isset($params['product_name']) && is_array($params['product_name']) && !empty($params['product_name']) @@ -376,7 +376,7 @@ class CRM_Contribute_Form_AdditionalInfo { $params['product_name'] = $productDAO->name; $params['product_sku'] = $productDAO->sku; - if (!CRM_Utils_Array::value('product_option', $params) && + if (empty($params['product_option']) && CRM_Utils_Array::value($params['product_name'][0], $form->_options ) @@ -385,7 +385,7 @@ class CRM_Contribute_Form_AdditionalInfo { } } - if (CRM_Utils_Array::value('fulfilled_date', $params)) { + if (!empty($params['fulfilled_date'])) { $form->assign('fulfilled_date', CRM_Utils_Date::processDate($params['fulfilled_date'])); } } @@ -394,7 +394,7 @@ class CRM_Contribute_Form_AdditionalInfo { if ($ccContribution) { //build the name. $name = CRM_Utils_Array::value('billing_first_name', $params); - if (CRM_Utils_Array::value('billing_middle_name', $params)) { + if (!empty($params['billing_middle_name'])) { $name .= " {$params['billing_middle_name']}"; } $name .= ' ' . CRM_Utils_Array::value('billing_last_name', $params); @@ -429,10 +429,10 @@ class CRM_Contribute_Form_AdditionalInfo { // assigned various dates to the templates $form->assign('receipt_date', CRM_Utils_Date::processDate($params['receipt_date'])); - if (CRM_Utils_Array::value('cancel_date', $params)) { + if (!empty($params['cancel_date'])) { $form->assign('cancel_date', CRM_Utils_Date::processDate($params['cancel_date'])); } - if (CRM_Utils_Array::value('thankyou_date', $params)) { + if (!empty($params['thankyou_date'])) { $form->assign('thankyou_date', CRM_Utils_Date::processDate($params['thankyou_date'])); } if ($form->_action & CRM_Core_Action::UPDATE) { @@ -441,7 +441,7 @@ class CRM_Contribute_Form_AdditionalInfo { } //handle custom data - if (CRM_Utils_Array::value('hidden_custom', $params)) { + if (!empty($params['hidden_custom'])) { $contribParams = array(array('contribution_id', '=', $params['contribution_id'], 0, 0)); if ($form->_mode == 'test') { $contribParams[] = array('contribution_test', '=', 1, 0, 0); @@ -475,11 +475,11 @@ class CRM_Contribute_Form_AdditionalInfo { $form->assign('contactID', $params['contact_id']); $form->assign('contributionID', $params['contribution_id']); - if (CRM_Utils_Array::value('currency', $params)) { + if (!empty($params['currency'])) { $form->assign('currency', $params['currency']); } - if (CRM_Utils_Array::value('receive_date', $params)) { + if (!empty($params['receive_date'])) { $form->assign('receive_date', CRM_Utils_Date::processDate($params['receive_date'])); } diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 3dc003ac85..20b5545531 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -130,11 +130,11 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $config = CRM_Core_Config::singleton(); // set default country from config if no country set - if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $defaults)) { + if (empty($defaults["billing_country_id-{$this->_bltID}"])) { $defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry; } - if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $defaults)) { + if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) { $defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince; } @@ -334,7 +334,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract } $statusMsg = ts('The payment record has been processed.'); - if (CRM_Utils_Array::value('is_email_receipt', $submittedValues) && $sendReceipt) { + if (!empty($submittedValues['is_email_receipt']) && $sendReceipt) { $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); } CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success'); @@ -411,7 +411,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract } } - if (CRM_Utils_Array::value('source', $params)) { + if (!empty($params['source'])) { unset($params['source']); } $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, @@ -436,7 +436,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $config->defaultCurrency ); $this->_params['payment_action'] = 'Sale'; - if (CRM_Utils_Array::value('trxn_date', $this->_params)) { + if (!empty($this->_params['trxn_date'])) { $this->_params['receive_date'] = CRM_Utils_Date::processDate($this->_params['trxn_date'], $this->_params['receive_date_time']); } @@ -466,7 +466,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract // if folks need to use it $paymentParams['contributionType_name'] = $this->_params['contributionType_name'] = $contributionType->name; $paymentParams['contributionPageID'] = NULL; - if (CRM_Utils_Array::value('is_email_receipt', $this->_params)) { + if (!empty($this->_params['is_email_receipt'])) { $paymentParams['email'] = $this->_contributorEmail; $paymentParams['is_email_receipt'] = 1; } @@ -474,10 +474,10 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $paymentParams['is_email_receipt'] = 0; $this->_params['is_email_receipt'] = 0; } - if (CRM_Utils_Array::value('receive_date', $this->_params)) { + if (!empty($this->_params['receive_date'])) { $paymentParams['receive_date'] = $this->_params['receive_date']; } - if (CRM_Utils_Array::value('receive_date', $this->_params)) { + if (!empty($this->_params['receive_date'])) { $paymentParams['receive_date'] = $this->_params['receive_date']; } @@ -529,7 +529,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract if ($trxnRecord->id) { $statusMsg = ts('The payment record has been processed.'); - if (CRM_Utils_Array::value('is_email_receipt', $this->_params) && $sendReceipt) { + if (!empty($this->_params['is_email_receipt']) && $sendReceipt) { $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); } CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success'); @@ -542,4 +542,4 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract static function emailReceipt(&$form, &$params) { // email receipt sending } -} \ No newline at end of file +} diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 007994119e..91cc25c756 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -239,7 +239,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { $this->applyCustomData('Contribution', CRM_Utils_Array::value('financial_type_id', $_POST), $this->_id); } @@ -297,11 +297,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP if ($this->_mode) { $config = CRM_Core_Config::singleton(); // set default country from config if no country set - if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $defaults)) { + if (empty($defaults["billing_country_id-{$this->_bltID}"])) { $defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry; } - if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $defaults)) { + if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) { $defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince; } @@ -340,11 +340,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $defaults['financial_type_id'] = $this->_contributionType; } - if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) { + if (empty($defaults['payment_instrument_id'])) { $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')); } - if (CRM_Utils_Array::value('is_test', $defaults)) { + if (!empty($defaults['is_test'])) { $this->assign('is_test', TRUE); } @@ -372,14 +372,14 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->assign('email', $this->userEmail); } - if (CRM_Utils_Array::value('is_pay_later', $defaults)) { + if (!empty($defaults['is_pay_later'])) { $this->assign('is_pay_later', TRUE); } $this->assign('contribution_status_id', CRM_Utils_Array::value('contribution_status_id', $defaults)); $dates = array('receive_date', 'receipt_date', 'cancel_date', 'thankyou_date'); foreach ($dates as $key) { - if (CRM_Utils_Array::value($key, $defaults)) { + if (!empty($defaults[$key])) { list($defaults[$key], $defaults[$key . '_time'] ) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value($key, $defaults), @@ -856,7 +856,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } // do the amount validations. - if (!CRM_Utils_Array::value('total_amount', $fields) && empty($self->_lineItems)) { + if (empty($fields['total_amount']) && empty($self->_lineItems)) { if ($priceSetId = CRM_Utils_Array::value('price_set_id', $fields)) { CRM_Price_BAO_PriceField::priceSetValidation($priceSetId, $fields, $errors); } @@ -864,7 +864,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $softErrors = CRM_Contribute_Form_SoftCredit::formRule($fields, $errors, $self); - if (CRM_Utils_Array::value('total_amount', $fields) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) { + if (!empty($fields['total_amount']) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) { $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'); @@ -876,8 +876,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } //FIXME FOR NEW DATA FLOW http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow - if (CRM_Utils_Array::value('fee_amount', $fields) - && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($fields['financial_type_id'])) { + if (!empty($fields['fee_amount']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($fields['financial_type_id'])) { $errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType; } @@ -918,7 +917,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // get the submitted form values. $submittedValues = $this->controller->exportValues($this->_name); - if (CRM_Utils_Array::value('price_set_id', $submittedValues) && $this->_action & CRM_Core_Action::UPDATE) { + if (!empty($submittedValues['price_set_id']) && $this->_action & CRM_Core_Action::UPDATE) { $line = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution'); $lineID = key($line); $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('price_field_id', $line[$lineID]), 'price_set_id'); @@ -1006,7 +1005,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } $this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE); - if (CRM_Utils_Array::value('pcp_made_through_id', $submittedValues)) { + if (!empty($submittedValues['pcp_made_through_id'])) { $pcp = array(); $fields = array( 'pcp_made_through_id', @@ -1036,7 +1035,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } // set the contact, when contact is selected - if (CRM_Utils_Array::value('contact_select_id', $submittedValues)) { + if (!empty($submittedValues['contact_select_id'])) { $this->_contactID = $submittedValues['contact_select_id'][1]; } @@ -1094,7 +1093,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $params[$d] = CRM_Utils_Date::processDate($formValues[$d], $formValues[$d . '_time'], TRUE); } - if (CRM_Utils_Array::value('is_email_receipt', $formValues)) { + if (!empty($formValues['is_email_receipt'])) { $params['receipt_date'] = date("Y-m-d"); } @@ -1264,7 +1263,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } $statusMsg = ts('The contribution record has been saved.'); - if (CRM_Utils_Array::value('is_email_receipt', $formValues) && $sendReceipt) { + if (!empty($formValues['is_email_receipt']) && $sendReceipt) { $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); } @@ -1369,7 +1368,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } } - if (CRM_Utils_Array::value('source', $params)) { + if (!empty($params['source'])) { unset($params['source']); } $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, @@ -1394,11 +1393,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $config->defaultCurrency ); $this->_params['payment_action'] = 'Sale'; - if (CRM_Utils_Array::value('receive_date', $this->_params)) { + if (!empty($this->_params['receive_date'])) { $this->_params['receive_date'] = CRM_Utils_Date::processDate($this->_params['receive_date'], $this->_params['receive_date_time']); } - if (CRM_Utils_Array::value('soft_credit_to', $params)) { + if (!empty($params['soft_credit_to'])) { $this->_params['soft_credit_to'] = $params['soft_credit_to']; $this->_params['pcp_made_through_id'] = $params['pcp_made_through_id']; } @@ -1434,7 +1433,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // if folks need to use it $paymentParams['contributionType_name'] = $this->_params['contributionType_name'] = $contributionType->name; $paymentParams['contributionPageID'] = NULL; - if (CRM_Utils_Array::value('is_email_receipt', $this->_params)) { + if (!empty($this->_params['is_email_receipt'])) { $paymentParams['email'] = $this->userEmail; $paymentParams['is_email_receipt'] = 1; } @@ -1442,10 +1441,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $paymentParams['is_email_receipt'] = 0; $this->_params['is_email_receipt'] = 0; } - if (CRM_Utils_Array::value('receive_date', $this->_params)) { + if (!empty($this->_params['receive_date'])) { $paymentParams['receive_date'] = $this->_params['receive_date']; } - if (CRM_Utils_Array::value('receive_date', $this->_params)) { + if (!empty($this->_params['receive_date'])) { $paymentParams['receive_date'] = $this->_params['receive_date']; } @@ -1454,7 +1453,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // For recurring contribution, create Contribution Record first. // Contribution ID, Recurring ID and Contact ID needed // When we get a callback from the payment processor, CRM-7115 - if (CRM_Utils_Array::value('is_recur', $paymentParams)) { + if (!empty($paymentParams['is_recur'])) { $contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($this, $this->_params, $result, @@ -1478,11 +1477,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP if (is_a($result, 'CRM_Core_Error')) { //make sure to cleanup db for recurring case. - if (CRM_Utils_Array::value('contributionID', $paymentParams)) { + if (!empty($paymentParams['contributionID'])) { CRM_Core_Error::debug_log_message(CRM_Core_Error::getMessages($result) . "contact id={$this->_contactID} (deleting contribution {$paymentParams['contributionID']}"); CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']); } - if (CRM_Utils_Array::value('contributionRecurID', $paymentParams)) { + if (!empty($paymentParams['contributionRecurID'])) { CRM_Core_Error::debug_log_message(CRM_Core_Error::getMessages($result) . "contact id={$this->_contactID} (deleting recurring contribution {$paymentParams['contributionRecurID']}"); CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']); } @@ -1505,7 +1504,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->_params['receive_date'] = $now; - if (CRM_Utils_Array::value('is_email_receipt', $this->_params)) { + if (!empty($this->_params['is_email_receipt'])) { $this->_params['receipt_date'] = $now; } else { @@ -1548,7 +1547,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP ); - if (!CRM_Utils_Array::value('is_recur', $paymentParams)) { + if (empty($paymentParams['is_recur'])) { $contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($this, $this->_params, $result, @@ -1592,7 +1591,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP if ($contribution->id) { $statusMsg = ts('The contribution record has been processed.'); - if (CRM_Utils_Array::value('is_email_receipt', $this->_params) && $sendReceipt) { + if (!empty($this->_params['is_email_receipt']) && $sendReceipt) { $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); } CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success'); diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 974ee3ff0f..b2c78593a5 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -187,11 +187,11 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->assign('pay_later_receipt', $this->_values['pay_later_receipt']); } // if onbehalf-of-organization - if (CRM_Utils_Array::value('hidden_onbehalf_profile', $this->_params)) { - if (CRM_Utils_Array::value('org_option', $this->_params) && + if (!empty($this->_params['hidden_onbehalf_profile'])) { + if (!empty($this->_params['org_option']) && CRM_Utils_Array::value('organization_id', $this->_params) ) { - if (CRM_Utils_Array::value('onbehalfof_id', $this->_params)) { + if (!empty($this->_params['onbehalfof_id'])) { $this->_params['organization_id'] = $this->_params['onbehalfof_id']; } } @@ -231,7 +231,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } $this->_params['onbehalf_location']['address'][$locType][$field] = $value; - if (!CRM_Utils_Array::value('is_primary', $this->_params['onbehalf_location']['address'][$locType])) { + if (empty($this->_params['onbehalf_location']['address'][$locType]['is_primary'])) { $this->_params['onbehalf_location']['address'][$locType]['is_primary'] = $isPrimary; } $this->_params['onbehalf_location']['address'][$locType]['location_type_id'] = $locType; @@ -310,7 +310,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } } } - elseif (CRM_Utils_Array::value('is_for_organization', $this->_values)) { + elseif (!empty($this->_values['is_for_organization'])) { // no on behalf of an organization, CRM-5519 // so reset loc blocks from main params. foreach (array( @@ -333,7 +333,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->_params['is_recur'] = $this->_values['is_recur'] = 1; // check if price set is not quick config - if (CRM_Utils_Array::value('priceSetId', $this->_params) && !$isQuickConfig) { + if (!empty($this->_params['priceSetId']) && !$isQuickConfig) { list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_PriceSet::getRecurDetails($this->_params['priceSetId']); } else { @@ -414,7 +414,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $amount_block_is_active = $this->get('amount_block_is_active'); $this->assign('amount_block_is_active', $amount_block_is_active); - if (CRM_Utils_Array::value('selectProduct', $params) && $params['selectProduct'] != 'no_thanks') { + if (!empty($params['selectProduct']) && $params['selectProduct'] != 'no_thanks') { $option = CRM_Utils_Array::value('options_' . $params['selectProduct'], $params); $productID = $params['selectProduct']; CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, FALSE, @@ -443,7 +443,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); - if (CRM_Utils_Array::value('hidden_onbehalf_profile', $params)) { + if (!empty($params['hidden_onbehalf_profile'])) { $ufJoinParams = array( 'module' => 'onBehalf', 'entity_table' => 'civicrm_contribution_page', @@ -622,7 +622,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $fields = array(); - if (CRM_Utils_Array::value('image_URL', $params)) { + if (!empty($params['image_URL'])) { CRM_Contact_BAO_Contact::processImageParams($params); } @@ -637,7 +637,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $fields[$name] = 1; // get the add to groups for uf fields - if (CRM_Utils_Array::value('add_to_group_id', $value)) { + if (!empty($value['add_to_group_id'])) { $addToGroups[$value['add_to_group_id']] = $value['add_to_group_id']; } } @@ -682,7 +682,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // organization params in a separate variable, to make sure // normal behavior is continued. And use that variable to // process on-behalf-of functionality. - if (CRM_Utils_Array::value('hidden_onbehalf_profile', $this->_params)) { + if (!empty($this->_params['hidden_onbehalf_profile'])) { $behalfOrganization = array(); $orgFields = array('organization_name', 'organization_id', 'org_option'); foreach ($orgFields as $fld) { @@ -728,7 +728,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } unset($params['onbehalf_location']); } - if (CRM_Utils_Array::value('onbehalf[image_URL]', $params)) { + if (!empty($params['onbehalf[image_URL]'])) { $behalfOrganization['image_URL'] = $params['onbehalf[image_URL]']; } } @@ -753,7 +753,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr if (empty($contactID)) { $dupeParams = $params; - if (CRM_Utils_Array::value('onbehalf', $dupeParams)) { + if (!empty($dupeParams['onbehalf'])) { unset($dupeParams['onbehalf']); } @@ -929,7 +929,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $membershipParams['financial_type_id'] = $contributionTypeID; $membershipParams['types_terms'] = $membershipTypeTerms; } - if (CRM_Utils_Array::value('selectMembership', $membershipParams)) { + if (!empty($membershipParams['selectMembership'])) { // CRM-12233 if ($this->_separateMembershipPayment && $this->_values['amount_block_is_active']) { foreach ($this->_values['fee'] as $key => $feeValues) { @@ -1068,7 +1068,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr 'start_date' => CRM_Utils_Date::customFormat($startDate, '%Y%m%d'), 'end_date' => CRM_Utils_Date::customFormat($endDate, '%Y%m%d'), ); - if( CRM_Utils_Array::value( 'selectProduct', $premiumParams ) ){ + if (!empty($premiumParams['selectProduct'])){ $daoPremiumsProduct = new CRM_Contribute_DAO_PremiumsProduct(); $daoPremiumsProduct->product_id = $premiumParams['selectProduct']; $daoPremiumsProduct->premiums_id = $dao->id; @@ -1191,7 +1191,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $now = date('YmdHis'); $receiptDate = CRM_Utils_Array::value('receipt_date', $params); - if (CRM_Utils_Array::value('is_email_receipt', $form->_values)) { + if (!empty($form->_values['is_email_receipt'])) { $receiptDate = $now; } @@ -1245,7 +1245,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } if (!$online || $form->_values['is_monetary']) { - if (!CRM_Utils_Array::value('is_pay_later', $params)) { + if (empty($params['is_pay_later'])) { $contribParams['payment_instrument_id'] = 1; } } @@ -1302,12 +1302,11 @@ 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 ( - CRM_Utils_Array::value('pcp_made_through_id', $params) || + if (!empty($params['pcp_made_through_id']) || CRM_Utils_Array::value('soft_credit_to', $params) ) { // if its due to pcp - if (CRM_Utils_Array::value('pcp_made_through_id', $params)) { + if (!empty($params['pcp_made_through_id'])) { $contribSoftContactId = CRM_Core_DAO::getFieldValue( 'CRM_PCP_DAO_PCP', $params['pcp_made_through_id'], @@ -1340,15 +1339,14 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution); //handle pledge stuff. - if ( - !CRM_Utils_Array::value('separate_membership_payment', $form->_params) && + 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 (CRM_Utils_Array::value('pledge_id', $form->_values)) { + if (!empty($form->_values['pledge_id'])) { //when user doing pledge payments. //update the schedule when payment(s) are made @@ -1436,7 +1434,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr elseif ($contribution) { //handle custom data. $params['contribution_id'] = $contribution->id; - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) && !is_a($contribution, 'CRM_Core_Error') ) { @@ -1467,7 +1465,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr //create contribution activity w/ individual and target //activity w/ organisation contact id when onbelf, CRM-4027 $targetContactID = NULL; - if (CRM_Utils_Array::value('hidden_onbehalf_profile', $params)) { + if (!empty($params['hidden_onbehalf_profile'])) { $targetContactID = $contribution->contact_id; $contribution->contact_id = $contactID; } @@ -1520,7 +1518,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } $recurParams['start_date'] = $recurParams['create_date'] = $recurParams['modified_date'] = date('YmdHis'); - if (CRM_Utils_Array::value('receive_date', $params)) { + if (!empty($params['receive_date'])) { $recurParams['start_date'] = $params['receive_date']; } $recurParams['invoice_id'] = CRM_Utils_Array::value('invoiceID', $params); @@ -1579,7 +1577,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 (CRM_Utils_Array::value('organization_id', $behalfOrganization) && + if (!empty($behalfOrganization['organization_id']) && CRM_Utils_Array::value('org_option', $behalfOrganization) ) { $orgID = $behalfOrganization['organization_id']; @@ -1622,7 +1620,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } // handling for image url - if (CRM_Utils_Array::value('image_URL', $behalfOrganization)) { + if (!empty($behalfOrganization['image_URL'])) { CRM_Contact_BAO_Contact::processImageParams($behalfOrganization); } @@ -1685,11 +1683,11 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr */ static function processPcpSoft(&$params, &$contribution) { //add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin. - if (CRM_Utils_Array::value('soft_credit_to', $params)) { + if (!empty($params['soft_credit_to'])) { $contribSoftParams = array(); foreach (array( 'pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note', 'amount') as $val) { - if (CRM_Utils_Array::value($val, $params)) { + if (!empty($params[$val])) { $contribSoftParams[$val] = $params[$val]; } } @@ -1720,7 +1718,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 (CRM_Utils_Array::value('pcp_display_in_roll', $params) && + if (!empty($params['pcp_display_in_roll']) && !CRM_Utils_Array::value('pcp_roll_nickname', $params) ) { $params['pcp_roll_nickname'] = ts('Anonymous'); @@ -1735,7 +1733,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr 'pcp_roll_nickname', 'pcp_personal_note' ) as $val) { - if (CRM_Utils_Array::value($val, $params)) { + if (!empty($params[$val])) { $page->assign($val, $params[$val]); } } diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 65c688ef2a..ac9ba33cf1 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -111,7 +111,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } $this->assign('onBehalfRequired', $this->_onBehalfRequired); - if (CRM_Utils_Array::value('honor_block_is_active', $this->_values)) { + if (!empty($this->_values['honor_block_is_active'])) { CRM_Contact_Form_ProfileContact::preprocess($this); } @@ -138,7 +138,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } //CRM-5001 - if (CRM_Utils_Array::value('is_for_organization', $this->_values)) { + if (!empty($this->_values['is_for_organization'])) { $msg = ts('Mixed profile not allowed for on behalf of registration/sign up.'); if ($preID = CRM_Utils_Array::value('custom_pre_id', $this->_values)) { $preProfile = CRM_Core_BAO_UFGroup::profileGroups($preID); @@ -236,7 +236,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu // $this->_defaults['bank_name'] = 'Bankname'; //build set default for pledge overdue payment. - if (CRM_Utils_Array::value('pledge_id', $this->_values)) { + if (!empty($this->_values['pledge_id'])) { //get all pledge payment records of current pledge id. $pledgePayments = array(); @@ -259,7 +259,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } - if (CRM_Utils_Array::value('honor_block_is_active', $this->_values) && count($completedContributionIds)) { + if (!empty($this->_values['honor_block_is_active']) && count($completedContributionIds)) { $softCredit = array(); foreach ($completedContributionIds as $id) { $softCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($id); @@ -280,7 +280,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } } - elseif (CRM_Utils_Array::value('pledge_block_id', $this->_values)) { + elseif (!empty($this->_values['pledge_block_id'])) { //set default to one time contribution. $this->_defaults['is_pledge'] = 0; } @@ -293,12 +293,12 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $config = CRM_Core_Config::singleton(); // set default country from config if no country set - if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $this->_defaults)) { + if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) { $this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry; } // set default state/province from config if no state/province set - if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $this->_defaults)) { + if (empty($this->_defaults["billing_state_province_id-{$this->_bltID}"])) { $this->_defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince; } @@ -323,7 +323,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } $selectedCurrentMemTypes[] = $values['membership_type_id']; } - elseif (CRM_Utils_Array::value('is_default', $values) && + elseif (!empty($values['is_default']) && !$opMemTypeId && (!isset($this->_defaults["price_{$key}"]) || ($val['html_type'] == 'CheckBox' && !isset($this->_defaults["price_{$key}"][$keys])) @@ -346,7 +346,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if (!empty($this->_paymentProcessors)) { foreach ($this->_paymentProcessors as $pid => $value) { - if (CRM_Utils_Array::value('is_default', $value)) { + if (!empty($value['is_default'])) { $this->_defaults['payment_processor'] = $pid; } } @@ -411,7 +411,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $pps[$key] = $name['name']; } } - if (CRM_Utils_Array::value('is_pay_later', $this->_values)) { + if (!empty($this->_values['is_pay_later'])) { $pps[0] = $this->_values['pay_later_text']; } @@ -437,7 +437,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu //build pledge block. $this->_useForMember = 0; //don't build membership block when pledge_id is passed - if (!CRM_Utils_Array::value('pledge_id', $this->_values)) { + if (empty($this->_values['pledge_id'])) { $this->_separateMembershipPayment = FALSE; if (in_array('CiviMember', $config->enableComponents)) { $isTest = 0; @@ -490,7 +490,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } //we allow premium for pledge during pledge creation only. - if (!CRM_Utils_Array::value('pledge_id', $this->_values)) { + if (empty($this->_values['pledge_id'])) { CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, TRUE); } @@ -648,7 +648,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $form->add('checkbox', 'is_recur', ts('I want to contribute this amount'), NULL); - if (CRM_Utils_Array::value('is_recur_interval', $form->_values) || $className == 'CRM_Contribute_Form_Contribution') { + if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') { $form->add('text', 'frequency_interval', ts('Every'), $attributes['frequency_interval']); $form->addRule('frequency_interval', ts('Frequency must be a whole number (EXAMPLE: Every 3 months).'), 'integer'); } @@ -673,7 +673,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $form->assign('one_frequency_unit', true); $unit = $unitVals[0]; $form->add('hidden', 'frequency_unit', $unit); - if (CRM_Utils_Array::value('is_recur_interval', $form->_values) || $className == 'CRM_Contribute_Form_Contribution') { + if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') { $unit .= "(s)"; } $form->assign('frequency_unit', $unit); @@ -684,7 +684,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu foreach ($unitVals as $key => $val) { if (array_key_exists($val, $frequencyUnits)) { $units[$val] = $frequencyUnits[$val]; - if (CRM_Utils_Array::value('is_recur_interval', $form->_values) || $className == 'CRM_Contribute_Form_Contribution') { + if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') { $units[$val] = "{$frequencyUnits[$val]}(s)"; } } @@ -738,7 +738,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } //check for atleast one pricefields should be selected - if (CRM_Utils_Array::value('priceSetId', $fields)) { + if (!empty($fields['priceSetId'])) { $priceField = new CRM_Price_DAO_PriceField(); $priceField->price_set_id = $fields['priceSetId']; $priceField->orderBy('weight'); @@ -828,7 +828,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu 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 (CRM_Utils_Array::value('price_' . $priceId, $fields) && is_array($fields['price_' . $priceId])) { + if (!empty($fields['price_' . $priceId]) && is_array($fields['price_' . $priceId])) { foreach ($fields['price_' . $priceId] as $priceFldVal => $isSet) { if ($isSet) { $priceFieldIDS[] = $priceFldVal; @@ -841,9 +841,9 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $priceFieldIDS[] = $fields['price_' . $priceId]; } - if (CRM_Utils_Array::value('options', $value)) { + if (!empty($value['options'])) { foreach ($value['options'] as $val) { - if (CRM_Utils_Array::value('membership_type_id', $val)) { + if (!empty($val['membership_type_id'])) { $priceFieldMemTypes[] = $val['membership_type_id']; } } @@ -903,7 +903,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } - if ( CRM_Utils_Array::value( 'is_recur', $fields ) ) { + if (!empty($fields['is_recur'])) { if ($fields['frequency_interval'] <= 0) { $errors['frequency_interval'] = ts('Please enter a number for how often you want to make this recurring contribution (EXAMPLE: Every 3 months).'); } @@ -912,20 +912,20 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } - if (CRM_Utils_Array::value('is_recur', $fields) && + if (!empty($fields['is_recur']) && CRM_Utils_Array::value('payment_processor', $fields) == 0) { $errors['_qf_default'] = ts('You cannot set up a recurring contribution if you are not paying online by credit card.'); } - if (CRM_Utils_Array::value('is_for_organization', $fields) && + if (!empty($fields['is_for_organization']) && !property_exists($self, 'organizationName') ) { - if (!CRM_Utils_Array::value('organization_name', $fields['onbehalf'])) { - if (CRM_Utils_Array::value('org_option', $fields) && !$fields['onbehalfof_id']) { + if (empty($fields['onbehalf']['organization_name'])) { + if (!empty($fields['org_option']) && !$fields['onbehalfof_id']) { $errors['organization_id'] = ts('Please select an organization or enter a new one.'); } - elseif (!CRM_Utils_Array::value('org_option', $fields)) { + elseif (empty($fields['org_option'])) { $errors['onbehalf']['organization_name'] = ts('Please enter the organization name.'); } } @@ -935,7 +935,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $emailLocType = explode('-', $key); } } - if (!CRM_Utils_Array::value("email-{$emailLocType[1]}", $fields['onbehalf'])) { + if (empty($fields['onbehalf']["email-{$emailLocType[1]}"])) { $errors['onbehalf']["email-{$emailLocType[1]}"] = ts('Organization email is required.'); } } @@ -953,7 +953,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 (CRM_Utils_Array::value($self->_expressButtonName . '_x', $fields) || + if (!empty($fields[$self->_expressButtonName . '_x']) || CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) || CRM_Utils_Array::value($self->_expressButtonName, $fields) ) { @@ -962,14 +962,14 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } //validate the pledge fields. - if (CRM_Utils_Array::value('pledge_block_id', $self->_values)) { + if (!empty($self->_values['pledge_block_id'])) { //validation for pledge payment. - if (CRM_Utils_Array::value('pledge_id', $self->_values)) { + if (!empty($self->_values['pledge_id'])) { if (empty($fields['pledge_amount'])) { $errors['pledge_amount'] = ts('At least one payment option needs to be checked.'); } } - elseif (CRM_Utils_Array::value('is_pledge', $fields)) { + elseif (!empty($fields['is_pledge'])) { if (CRM_Utils_Rule::positiveInteger(CRM_Utils_Array::value('pledge_installments', $fields)) == FALSE) { $errors['pledge_installments'] = ts('Please enter a valid number of pledge installments.'); } @@ -1051,7 +1051,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } else { - if (CRM_Utils_Array::value('amount', $form->_values)) { + if (!empty($form->_values['amount'])) { $amountID = CRM_Utils_Array::value('amount', $params); if ($amountID) { @@ -1079,7 +1079,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu // get the submitted form values. $params = $this->controller->exportValues($this->_name); - if (CRM_Utils_Array::value('priceSetId', $params)) { + if (!empty($params['priceSetId'])) { $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); $formValue = array(); if ($is_quick_config) { @@ -1143,7 +1143,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $params['campaign_id'] = $params['contribution_campaign_id']; } - if (CRM_Utils_Array::value('onbehalfof_id', $params)) { + if (!empty($params['onbehalfof_id'])) { $params['organization_id'] = $params['onbehalfof_id']; } @@ -1151,7 +1151,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $params['amount'] = self::computeAmount($params, $this); $params['separate_amount'] = $params['amount']; $memFee = NULL; - if (CRM_Utils_Array::value('selectMembership', $params)) { + if (!empty($params['selectMembership'])) { if (!empty($this->_membershipTypeValues)) { $membershipTypeValues = $this->_membershipTypeValues[$params['selectMembership']]; } @@ -1180,7 +1180,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $memPresent = TRUE; } else { - if (CRM_Utils_Array::value('price_' . $fieldKey, $params) && $memPresent && ($fieldVal['name'] == 'other_amount' || $fieldVal['name'] == 'contribution_amount')) { + if (!empty($params['price_' . $fieldKey]) && $memPresent && ($fieldVal['name'] == 'other_amount' || $fieldVal['name'] == 'contribution_amount')) { $fieldId = $fieldVal['id']; if ($fieldVal['name'] == 'other_amount') { $proceFieldAmount += $this->_submitValues['price_' . $fieldId]; @@ -1292,7 +1292,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } // should we skip the confirm page? - if (!CRM_Utils_Array::value('is_confirm_enabled', $this->_values)) { + if (empty($this->_values['is_confirm_enabled'])) { // call the post process hook for the main page before we switch to confirm $this->postProcessHook(); diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 5591e3e0c4..1a1ba4d4cc 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -162,7 +162,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->assign('pcpBlock', TRUE); foreach (array( 'pcp_display_in_roll', 'pcp_is_anonymous', 'pcp_roll_nickname', 'pcp_personal_note') as $val) { - if (CRM_Utils_Array::value($val, $this->_params)) { + if (!empty($this->_params[$val])) { $this->assign($val, $this->_params[$val]); } } @@ -193,7 +193,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); - if (CRM_Utils_Array::value('hidden_onbehalf_profile', $params)) { + if (!empty($params['hidden_onbehalf_profile'])) { $ufJoinParams = array( 'module' => 'onBehalf', 'entity_table' => 'civicrm_contribution_page', @@ -269,7 +269,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $tellAFriend = TRUE; } } - elseif (CRM_Utils_Array::value('is_active', $data)) { + elseif (!empty($data['is_active'])) { $friendText = $data['title']; $this->assign('friendText', $friendText); $subUrl = "eid={$this->_id}&pcomponent=contribute"; diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index f0763ae5aa..7d5600d89f 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -280,7 +280,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values); // check if form is active - if (!CRM_Utils_Array::value('is_active', $this->_values)) { + if (empty($this->_values['is_active'])) { // form is inactive, die a fatal death CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.')); } @@ -431,7 +431,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } //set pledge block if block id is set - if (CRM_Utils_Array::value('pledge_block_id', $this->_values)) { + if (!empty($this->_values['pledge_block_id'])) { $this->assign('pledgeBlock', TRUE); } @@ -512,7 +512,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { */ function assignToTemplate() { $name = CRM_Utils_Array::value('billing_first_name', $this->_params); - if (CRM_Utils_Array::value('billing_middle_name', $this->_params)) { + if (!empty($this->_params['billing_middle_name'])) { $name .= " {$this->_params['billing_middle_name']}"; } $name .= ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params); @@ -586,7 +586,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { $this->assign('address', CRM_Utils_Address::format($addressFields)); - if (CRM_Utils_Array::value('hidden_onbehalf_profile', $this->_params)) { + if (!empty($this->_params['hidden_onbehalf_profile'])) { $this->assign('onBehalfName', $this->_params['organization_name']); $locTypeId = array_keys($this->_params['onbehalf_location']['email']); $this->assign('onBehalfEmail', $this->_params['onbehalf_location']['email'][$locTypeId[0]]['email']); @@ -597,7 +597,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { if ($this->_amount > 0.0) { $assignCCInfo = TRUE; } - elseif (CRM_Utils_array::value('selectMembership', $this->_params)) { + elseif (!empty($this->_params['selectMembership'])) { $memFee = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_params['selectMembership'], 'minimum_fee'); if ($memFee > 0.0) { $assignCCInfo = TRUE; diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index 6107c73625..23749bb622 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -280,7 +280,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { foreach ($pledgeBlock as $key) { $defaults[$key] = CRM_Utils_Array::value($key, $pledgeBlockDefaults); } - if (CRM_Utils_Array::value('pledge_frequency_unit', $pledgeBlockDefaults)) { + if (!empty($pledgeBlockDefaults['pledge_frequency_unit'])) { $defaults['pledge_frequency_unit'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR, $pledgeBlockDefaults['pledge_frequency_unit'] ), '1'); @@ -299,11 +299,11 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { $defaults['price_set_id'] = $this->_priceSetID; } - if (CRM_Utils_Array::value('end_date', $defaults)) { + if (!empty($defaults['end_date'])) { list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['end_date']); } - if (CRM_Utils_Array::value('start_date', $defaults)) { + if (!empty($defaults['start_date'])) { list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['start_date']); } } @@ -317,7 +317,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { $defaults['for_organization'] = ts('I am contributing on behalf of an organization.'); } - if (CRM_Utils_Array::value('recur_frequency_unit', $defaults)) { + if (!empty($defaults['recur_frequency_unit'])) { $defaults['recur_frequency_unit'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR, $defaults['recur_frequency_unit'] ), '1'); @@ -327,7 +327,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { $defaults['recur_frequency_unit'] = array('month' => 1); } - if (CRM_Utils_Array::value('is_for_organization', $defaults)) { + if (!empty($defaults['is_for_organization'])) { $defaults['is_organization'] = 1; } else { diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index 44f5715418..d3cf75c7b2 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -196,11 +196,11 @@ SELECT id $title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title'); CRM_Utils_System::setTitle(ts('Contribution Amounts (%1)', array(1 => $title))); - if (!CRM_Utils_Array::value('pay_later_text', $defaults)) { + if (empty($defaults['pay_later_text'])) { $defaults['pay_later_text'] = ts('I will send payment by check'); } - if (CRM_Utils_Array::value('amount_block_is_active', $defaults)) { + if (!empty($defaults['amount_block_is_active'])) { if ($priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, NULL)) { if ($isQuick = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) { @@ -241,11 +241,11 @@ SELECT id } } - if (!CRM_Utils_Array::value('amount_label', $defaults)) { + if (empty($defaults['amount_label'])) { $defaults['amount_label'] = ts('Contribution Amount'); } - if (CRM_Utils_Array::value('value', $defaults) && is_array($defaults['value'])) { + if (!empty($defaults['value']) && is_array($defaults['value'])) { // CRM-4038: fix value display foreach ($defaults['value'] as & $amount) { @@ -262,7 +262,7 @@ SELECT id $defaults['max_amount'] = CRM_Utils_Money::format($defaults['max_amount'], NULL, '%a'); } - if (CRM_Utils_Array::value('payment_processor', $defaults)) { + if (!empty($defaults['payment_processor'])) { $defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR, $defaults['payment_processor'] ), '1'); @@ -295,7 +295,7 @@ SELECT id $membershipBlock->is_active = 1; $hasMembershipBlk = FALSE; if ($membershipBlock->find(TRUE)) { - if (CRM_Utils_Array::value('amount_block_is_active', $fields) && + if (!empty($fields['amount_block_is_active']) && ($setID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $self->_id, NULL, 1)) ) { $extends = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'extends'); @@ -311,7 +311,7 @@ SELECT id } //check for the amount label (mandatory) - if (CRM_Utils_Array::value('amount_block_is_active', $fields) && empty($fields['amount_label'])) { + if (!empty($fields['amount_block_is_active']) && empty($fields['amount_label'])) { $errors['amount_label'] = ts('Please enter the contribution amount label.'); } $minAmount = CRM_Utils_Array::value('min_amount', $fields); @@ -348,11 +348,11 @@ SELECT id } // validation for pledge fields. - if (CRM_Utils_array::value('is_pledge_active', $fields)) { + if (!empty($fields['is_pledge_active'])) { if (empty($fields['pledge_frequency_unit'])) { $errors['pledge_frequency_unit'] = ts('At least one pledge frequency option needs to be checked.'); } - if (CRM_Utils_array::value('is_recur', $fields)) { + if (!empty($fields['is_recur'])) { $errors['is_recur'] = ts('You cannot enable both Recurring Contributions AND Pledges on the same online contribution page.'); } } @@ -360,8 +360,8 @@ SELECT id // If Contribution amount section is enabled, then // Allow other amounts must be enabeld OR the Fixed Contribution // Contribution options must contain at least one set of values. - if (CRM_Utils_Array::value('amount_block_is_active', $fields)) { - if (!CRM_Utils_Array::value('is_allow_other_amount', $fields) && + if (!empty($fields['amount_block_is_active'])) { + if (empty($fields['is_allow_other_amount']) && !$priceSetId ) { //get the values of amount block @@ -379,12 +379,11 @@ SELECT id } } - if (CRM_Utils_Array::value('payment_processor', $fields) - && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($self->_defaultValues['financial_type_id'])) { + if (!empty($fields['payment_processor']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($self->_defaultValues['financial_type_id'])) { $errors['payment_processor'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType; } - if (CRM_Utils_Array::value('is_recur_interval', $fields)) { + if (!empty($fields['is_recur_interval'])) { foreach(array_keys($fields['payment_processor']) as $paymentProcessorID) { $paymentProcessorTypeId = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_PaymentProcessor', @@ -444,7 +443,7 @@ SELECT id $resetFields = array('min_amount', 'max_amount', 'is_allow_other_amount'); } - if (!CRM_Utils_Array::value('is_recur', $params)) { + if (empty($params['is_recur'])) { $resetFields = array_merge($resetFields, array('is_recur_interval', 'recur_frequency_unit')); } @@ -496,12 +495,12 @@ SELECT id if ($contributionPageID) { - if (CRM_Utils_Array::value('amount_block_is_active', $params)) { + if (!empty($params['amount_block_is_active'])) { // handle price set. if ($priceSetID) { // add/update price set. $deletePriceSet = FALSE; - if (CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params) ) { + if (!empty($params['price_field_id']) || CRM_Utils_Array::value('price_field_other', $params) ) { $deleteAmountBlk = TRUE; } @@ -530,7 +529,7 @@ SELECT id ); } } - /* || CRM_Utils_Array::value( 'price_field_value', $params )|| CRM_Utils_Array::value( 'price_field_other', $params )*/ + /* || 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)) { $fieldParams['is_quick_config'] = 1; $noContriAmount = NULL; @@ -586,7 +585,7 @@ SELECT id $editedResults = array(); $noContriAmount = 1; CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults); - if (!CRM_Utils_Array::value('id', $editedResults)) { + if (empty($editedResults['id'])) { $fieldParams['name'] = strtolower(CRM_Utils_String::munge("Contribution Amount", '_', 245)); } else { @@ -597,7 +596,7 @@ SELECT id $fieldParams['is_active'] = 1; $fieldParams['weight'] = 2; - if (CRM_Utils_Array::value('is_allow_other_amount', $params)) { + if (!empty($params['is_allow_other_amount'])) { $fieldParams['is_required'] = 0; } else { @@ -614,7 +613,7 @@ SELECT id $fieldParams['default_option'] = $params['default']; $priceField = CRM_Price_BAO_PriceField::create($fieldParams); } - if (CRM_Utils_Array::value('is_allow_other_amount', $params) && !CRM_Utils_Array::value('price_field_other', $params)) { + if (!empty($params['is_allow_other_amount']) && !CRM_Utils_Array::value('price_field_other', $params)) { $editedFieldParams = array( 'price_set_id' => $priceSetId, 'name' => 'other_amount', @@ -647,7 +646,7 @@ SELECT id $priceField = CRM_Price_BAO_PriceField::create($fieldParams); } else { - if (!CRM_Utils_Array::value('is_active', $editedResults)) { + if (empty($editedResults['is_active'])) { if (!$noContriAmount) { $priceFieldValueID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldID, 'id', 'price_field_id'); CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', $params['amount_label']); @@ -662,7 +661,7 @@ SELECT id } } } - elseif (!CRM_Utils_Array::value('is_allow_other_amount', $params) && CRM_Utils_Array::value('price_field_other', $params)) { + elseif (empty($params['is_allow_other_amount']) && CRM_Utils_Array::value('price_field_other', $params)) { CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0'); } elseif ($priceFieldID = CRM_Utils_Array::value('price_field_other', $params)) { @@ -683,7 +682,7 @@ SELECT id } } - if (CRM_Utils_Array::value('is_pledge_active', $params)) { + if (!empty($params['is_pledge_active'])) { $deletePledgeBlk = FALSE; $pledgeBlockParams = array( 'entity_id' => $contributionPageID, @@ -708,13 +707,13 @@ SELECT id } } else { - if (CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params)) { + if (!empty($params['price_field_id']) || CRM_Utils_Array::value('price_field_other', $params)) { $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3); if ($usedPriceSetId) { - if (CRM_Utils_Array::value('price_field_id', $params)) { + if (!empty($params['price_field_id'])) { CRM_Price_BAO_PriceField::setIsActive($params['price_field_id'], '0'); } - if (CRM_Utils_Array::value('price_field_other', $params)) { + if (!empty($params['price_field_other'])) { CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0'); } } diff --git a/CRM/Contribute/Form/ContributionPage/Premium.php b/CRM/Contribute/Form/ContributionPage/Premium.php index 01c40899ae..72537a6607 100644 --- a/CRM/Contribute/Form/ContributionPage/Premium.php +++ b/CRM/Contribute/Form/ContributionPage/Premium.php @@ -121,8 +121,8 @@ class CRM_Contribute_Form_ContributionPage_Premium extends CRM_Contribute_Form_C */ public static function formRule($params) { $errors = array(); - if (CRM_Utils_Array::value('premiums_active', $params)) { - if (!CRM_Utils_Array::value('premiums_nothankyou_label', $params)) { + if (!empty($params['premiums_active'])) { + if (empty($params['premiums_nothankyou_label'])) { $errors['premiums_nothankyou_label'] = ts('No Thank-you Label is a required field.'); } } diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index 9f966f957b..8f4c52801c 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -92,7 +92,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ CRM_Utils_System::setTitle(ts('Title and Settings')); } - if (!CRM_Utils_Array::value('soft_credit_types', $defaults)) { + if (empty($defaults['soft_credit_types'])) { $defaults['soft_credit_types'] = array(1, 2); } @@ -219,7 +219,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $this->addProfileSelector('honoree_profile', ts('Honoree Profile'), $allowCoreTypes, $allowSubTypes, $entities); - if (CRM_Utils_Array::value('honor_block_is_active', $this->_submitValues)) { + if (!empty($this->_submitValues['honor_block_is_active'])) { $this->addRule('soft_credit_types', ts('At least one value must be selected if Honor Section is active'), 'required'); $this->addRule('honoree_profile', ts('Please select a profile used for honoree'), 'required'); } @@ -250,7 +250,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $errors['title'] = ts("Please do not use '/' in Title"); } - if (CRM_Utils_Array::value('is_organization', $values) && + if (!empty($values['is_organization']) && !CRM_Utils_Array::value('onbehalf_profile_id', $values) ) { $errors['onbehalf_profile_id'] = ts('Please select a profile to collect organization information on this contribution page.'); @@ -263,8 +263,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $errors['end_date'] = ts('End date should be after Start date.'); } - if (CRM_Utils_Array::value('payment_processor', $self->_values) - && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($values['financial_type_id'])) { + if (!empty($self->_values['payment_processor']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($values['financial_type_id'])) { $errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType; } @@ -371,7 +370,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ foreach ($ufJoinParams as $index => $ufJoinParam) { - if (CRM_Utils_Array::value($index, $params)) { + if (!empty($params[$index])) { $ufJoinParam['weight'] = 1; if ($index == 'honor_block_is_active') { $ufJoinParam['is_active'] = 1; diff --git a/CRM/Contribute/Form/ContributionPage/ThankYou.php b/CRM/Contribute/Form/ContributionPage/ThankYou.php index 251d46fb4b..79cd831006 100644 --- a/CRM/Contribute/Form/ContributionPage/ThankYou.php +++ b/CRM/Contribute/Form/ContributionPage/ThankYou.php @@ -96,7 +96,7 @@ class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_ $errors = array(); // if is_email_receipt is set, the receipt message must be non-empty - if (CRM_Utils_Array::value('is_email_receipt', $fields)) { + if (!empty($fields['is_email_receipt'])) { //added for CRM-1348 $email = trim(CRM_Utils_Array::value('receipt_from_email', $fields)); if (empty($email) || !CRM_Utils_Rule::email($email)) { diff --git a/CRM/Contribute/Form/ContributionPage/Widget.php b/CRM/Contribute/Form/ContributionPage/Widget.php index 8b7a4f8a96..a00ba954df 100644 --- a/CRM/Contribute/Form/ContributionPage/Widget.php +++ b/CRM/Contribute/Form/ContributionPage/Widget.php @@ -205,11 +205,11 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co */ public static function formRule($params, $files, $self) { $errors = array(); - if (CRM_Utils_Array::value('is_active', $params)) { - if (!CRM_Utils_Array::value('title', $params)) { + if (!empty($params['is_active'])) { + if (empty($params['title'])) { $errors['title'] = ts('Title is a required field.'); } - if (!CRM_Utils_Array::value('about', $params)) { + if (empty($params['about'])) { $errors['about'] = ts('About is a required field.'); } diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index cd2e524bd4..362b7680f1 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -55,7 +55,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { CRM_Contribute_BAO_Contribution::getValues($params, $values, $ids); CRM_Contribute_BAO_Contribution::resolveDefaults($values); - if (CRM_Utils_Array::value('contribution_page_id', $values)) { + if (!empty($values['contribution_page_id'])) { $contribPages = CRM_Contribute_PseudoConstant::contributionPage(NULL, TRUE); $values['contribution_page_title'] = CRM_Utils_Array::value(CRM_Utils_Array::value('contribution_page_id', $values), $contribPages); } @@ -63,14 +63,14 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { // get recieved into i.e to_financial_account_id from last trxn $financialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($values['contribution_id'], 'DESC'); $values['to_financial_account'] = ''; - if (CRM_Utils_Array::value('financialTrxnId', $financialTrxnId)) { + if (!empty($financialTrxnId['financialTrxnId'])) { $values['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $financialTrxnId['financialTrxnId'], 'to_financial_account_id'); if ($values['to_financial_account_id']) { $values['to_financial_account'] = CRM_Contribute_PseudoConstant::financialAccount($values['to_financial_account_id']); } } - if (CRM_Utils_Array::value('honor_contact_id', $values)) { + if (!empty($values['honor_contact_id'])) { $sql = "SELECT display_name FROM civicrm_contact WHERE id = %1"; $params = array(1 => array($values['honor_contact_id'], 'Integer')); $dao = CRM_Core_DAO::executeQuery($sql, $params); @@ -82,7 +82,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { $values['honor_type'] = CRM_Utils_Array::value(CRM_Utils_Array::value('honor_type_id', $values), $honor); } - if (CRM_Utils_Array::value('contribution_recur_id', $values)) { + if (!empty($values['contribution_recur_id'])) { $sql = "SELECT installments, frequency_interval, frequency_unit FROM civicrm_contribution_recur WHERE id = %1"; $params = array(1 => array($values['contribution_recur_id'], 'Integer')); $dao = CRM_Core_DAO::executeQuery($sql, $params); @@ -121,7 +121,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { $values['note'] = array_values($noteValue); // show billing address location details, if exists - if (CRM_Utils_Array::value('address_id', $values)) { + if (!empty($values['address_id'])) { $addressParams = array('id' => CRM_Utils_Array::value('address_id', $values)); $addressDetails = CRM_Core_BAO_Address::getValues($addressParams, FALSE, 'id'); $addressDetails = array_values($addressDetails); diff --git a/CRM/Contribute/Form/ManagePremiums.php b/CRM/Contribute/Form/ManagePremiums.php index bbb6baa1a7..621b1800df 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 (CRM_Utils_Array::value('cost', $params) && !CRM_Utils_Array::value('financial_type_id', $params)) { + if (!empty($params['cost']) && !CRM_Utils_Array::value('financial_type_id', $params)) { $errors['financial_type_id'] = ts('Financial Type is required for product having cost.'); } $fileLocation = $files['uploadFile']['tmp_name']; diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index 40e9c60e33..64a36d293b 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -223,9 +223,8 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form { } function setDefaultValues() { - if (!CRM_Utils_Array::value('contribution_status', - $this->_defaults - )) { + if (empty($this->_defaults +['contribution_status'])) { $this->_defaults['contribution_status'][1] = 1; } return $this->_defaults; diff --git a/CRM/Contribute/Form/SoftCredit.php b/CRM/Contribute/Form/SoftCredit.php index 7a89a959fa..dba1314cec 100644 --- a/CRM/Contribute/Form/SoftCredit.php +++ b/CRM/Contribute/Form/SoftCredit.php @@ -142,7 +142,7 @@ class CRM_Contribute_Form_SoftCredit { ); // Tell tpl to hide soft credit field if contribution is linked directly to a PCP Page - if (CRM_Utils_Array::value('pcp_made_through_id', $form->_values)) { + if (!empty($form->_values['pcp_made_through_id'])) { $form->assign('pcpLinked', 1); } } @@ -158,7 +158,7 @@ class CRM_Contribute_Form_SoftCredit { $defaults["soft_credit_type[$key]"] = $value['soft_credit_type']; } } - elseif (CRM_Utils_Array::value('pcp_id', $form->_softCreditInfo)) { + elseif (!empty($form->_softCreditInfo['pcp_id'])) { $pcpInfo = $form->_softCreditInfo; $pcpId = CRM_Utils_Array::value('pcp_id', $pcpInfo); $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'title'); @@ -184,8 +184,8 @@ class CRM_Contribute_Form_SoftCredit { $errors = array(); // if honor roll fields are populated but no PCP is selected - if (!CRM_Utils_Array::value('pcp_made_through_id', $fields)) { - if (CRM_Utils_Array::value('pcp_display_in_roll', $fields) || + if (empty($fields['pcp_made_through_id'])) { + if (!empty($fields['pcp_display_in_roll']) || CRM_Utils_Array::value('pcp_roll_nickname', $fields) || CRM_Utils_Array::value('pcp_personal_note', $fields) ) { diff --git a/CRM/Contribute/Form/Task/Batch.php b/CRM/Contribute/Form/Task/Batch.php index f80cd33d12..c0a3975ac2 100644 --- a/CRM/Contribute/Form/Task/Batch.php +++ b/CRM/Contribute/Form/Task/Batch.php @@ -159,13 +159,13 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task { foreach ($this->_fields as $name => $field) { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) { $customValue = CRM_Utils_Array::value($customFieldID, $customFields); - if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) { + if (!empty($customValue['extends_entity_column_value'])) { $entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue['extends_entity_column_value'] ); } - if (CRM_Utils_Array::value($typeId, $entityColumnValue) || + if (!empty($entityColumnValue[$typeId]) || CRM_Utils_System::isNull($entityColumnValue[$typeId]) ) { CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $contributionId); @@ -241,15 +241,15 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task { $value[$val] = CRM_Utils_Date::processDate($value[$val]); } } - if (CRM_Utils_Array::value('financial_type', $value)) { + if (!empty($value['financial_type'])) { $value['financial_type_id'] = $value['financial_type']; } - if (CRM_Utils_Array::value('payment_instrument', $value)) { + if (!empty($value['payment_instrument'])) { $value['payment_instrument_id'] = $value['payment_instrument']; } - if (CRM_Utils_Array::value('contribution_source', $value)) { + if (!empty($value['contribution_source'])) { $value['source'] = $value['contribution_source']; } @@ -258,7 +258,7 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task { $contribution = CRM_Contribute_BAO_Contribution::add($value, $ids); // add custom field values - if (CRM_Utils_Array::value('custom', $value) && + if (!empty($value['custom']) && is_array($value['custom']) ) { CRM_Core_BAO_CustomValueTable::store($value['custom'], 'civicrm_contribution', $contribution->id); diff --git a/CRM/Contribute/Form/UpdateBilling.php b/CRM/Contribute/Form/UpdateBilling.php index 230ded9c7a..88d4f22c69 100644 --- a/CRM/Contribute/Form/UpdateBilling.php +++ b/CRM/Contribute/Form/UpdateBilling.php @@ -163,7 +163,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { $config = CRM_Core_Config::singleton(); // set default country from config if no country set - if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $this->_defaults)) { + if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) { $this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry; } @@ -317,7 +317,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { // format new billing name $name = $processorParams['first_name']; - if (CRM_Utils_Array::value('middle_name', $processorParams)) { + if (!empty($processorParams['middle_name'])) { $name .= " {$processorParams['middle_name']}"; } $name .= ' ' . $processorParams['last_name']; @@ -326,7 +326,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { // format old billing name $name = $this->_defaults['first_name']; - if (CRM_Utils_Array::value('middle_name', $this->_defaults)) { + if (!empty($this->_defaults['middle_name'])) { $name .= " {$this->_defaults['middle_name']}"; } $name .= ' ' . $this->_defaults['last_name']; diff --git a/CRM/Contribute/Form/UpdateSubscription.php b/CRM/Contribute/Form/UpdateSubscription.php index cdd4668df1..fa7486f876 100644 --- a/CRM/Contribute/Form/UpdateSubscription.php +++ b/CRM/Contribute/Form/UpdateSubscription.php @@ -264,7 +264,7 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form { } CRM_Activity_BAO_Activity::create($activityParams); - if (CRM_Utils_Array::value('is_notify', $params)) { + if (!empty($params['is_notify'])) { // send notification if ($this->_subscriptionDetails->contribution_page_id) { CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id', diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index b7fe2c42d5..07d336bbf7 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -423,7 +423,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { } } - if (CRM_Utils_Array::value('saveMapping', $fields)) { + if (!empty($fields['saveMapping'])) { $nameField = CRM_Utils_Array::value('saveMappingName', $fields); if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); @@ -496,7 +496,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params)); //Updating Mapping Records - if (CRM_Utils_Array::value('updateMapping', $params)) { + if (!empty($params['updateMapping'])) { $mappingFields = new CRM_Core_DAO_MappingField(); $mappingFields->mapping_id = $params['mappingId']; $mappingFields->find(); @@ -522,7 +522,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { } //Saving Mapping Details and Records - if (CRM_Utils_Array::value('saveMapping', $params)) { + if (!empty($params['saveMapping'])) { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 65700d3c6e..d9165c71d0 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -321,12 +321,12 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa elseif (!empty($params['soft_credit'])) { $paramValues['contact_type'] = $this->_contactType; } - elseif (CRM_Utils_Array::value('pledge_payment', $paramValues)) { + elseif (!empty($paramValues['pledge_payment'])) { $paramValues['contact_type'] = $this->_contactType; } //need to pass $onDuplicate to check import mode. - if (CRM_Utils_Array::value('pledge_payment', $paramValues)) { + if (!empty($paramValues['pledge_payment'])) { $paramValues['onDuplicate'] = $onDuplicate; } require_once 'CRM/Utils/DeprecatedUtils.php'; @@ -353,7 +353,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 (CRM_Utils_Array::value('invoice_id',$paramValues) || + if (!empty($paramValues['invoice_id']) || CRM_Utils_Array::value('trxn_id', $paramValues) || $paramValues['contribution_id']) { $dupeIds = array( 'id' => CRM_Utils_Array::value('contribution_id', $paramValues), @@ -371,7 +371,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa 'Contribution' ); //process note - if (CRM_Utils_Array::value('note', $paramValues)) { + if (!empty($paramValues['note'])) { $noteID = array(); $contactID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $ids['contribution'], 'contact_id'); $daoNote = new CRM_Core_BAO_Note(); @@ -392,7 +392,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa } //need to check existing soft credit contribution, CRM-3968 - if (CRM_Utils_Array::value('soft_credit_to', $formatted)) { + if (!empty($formatted['soft_credit_to'])) { $dupeSoftCredit = array( 'contact_id' => $formatted['soft_credit_to'], 'contribution_id' => $ids['contribution'], @@ -400,7 +400,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa //FIX ME: Need to fix this logic $existingSoftCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($dupeSoftCredit['contribution_id']); - if (CRM_Utils_Array::value('soft_credit_id', $existingSoftCredit)) { + if (!empty($existingSoftCredit['soft_credit_id'])) { $formatted['softID'] = $existingSoftCredit['soft_credit_id']; } } @@ -409,7 +409,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa $this->_newContributions[] = $newContribution->id; //return soft valid since we need to show how soft credits were added - if (CRM_Utils_Array::value('soft_credit_to', $formatted)) { + if (!empty($formatted['soft_credit_to'])) { return CRM_Contribute_Import_Parser::SOFT_CREDIT; } @@ -475,7 +475,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa $formatted['contribution_id'] = $newContribution['id']; //return soft valid since we need to show how soft credits were added - if (CRM_Utils_Array::value('soft_credit_to', $formatted)) { + if (!empty($formatted['soft_credit_to'])) { return CRM_Contribute_Import_Parser::SOFT_CREDIT; } @@ -505,7 +505,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa } } - if (CRM_Utils_Array::value('external_identifier', $params)) { + if (!empty($params['external_identifier'])) { if ($disp) { $disp .= "AND {$params['external_identifier']}"; } @@ -519,7 +519,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa } } else { - if (CRM_Utils_Array::value('external_identifier', $paramValues)) { + if (!empty($paramValues['external_identifier'])) { $checkCid = new CRM_Contact_DAO_Contact(); $checkCid->external_identifier = $paramValues['external_identifier']; $checkCid->find(TRUE); @@ -546,7 +546,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa $formatted['contribution_id'] = $newContribution['id']; //return soft valid since we need to show how soft credits were added - if (CRM_Utils_Array::value('soft_credit_to', $formatted)) { + if (!empty($formatted['soft_credit_to'])) { return CRM_Contribute_Import_Parser::SOFT_CREDIT; } @@ -561,7 +561,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa * Function to process pledge payments */ function processPledgePayments(&$formatted) { - if (CRM_Utils_Array::value('pledge_payment_id', $formatted) && + if (!empty($formatted['pledge_payment_id']) && CRM_Utils_Array::value('pledge_id', $formatted) ) { //get completed status diff --git a/CRM/Contribute/Page/ContributionPage.php b/CRM/Contribute/Page/ContributionPage.php index 54a2902593..ad21d501bf 100644 --- a/CRM/Contribute/Page/ContributionPage.php +++ b/CRM/Contribute/Page/ContributionPage.php @@ -663,7 +663,7 @@ SELECT count(id) $classes = $link['class']; } - if (!CRM_Utils_Array::value($sectionName, $sectionsInfo)) { + if (empty($sectionsInfo[$sectionName])) { $classes = array(); if (isset($link['class'])) { $classes = $link['class']; diff --git a/CRM/Contribute/Page/ContributionRecur.php b/CRM/Contribute/Page/ContributionRecur.php index abe2f3a232..91f674fe2e 100644 --- a/CRM/Contribute/Page/ContributionRecur.php +++ b/CRM/Contribute/Page/ContributionRecur.php @@ -55,7 +55,7 @@ class CRM_Contribute_Page_ContributionRecur extends CRM_Core_Page { $values = array(); CRM_Core_DAO::storeValues($recur, $values); // if there is a payment processor ID, get the name of the payment processor - if (CRM_Utils_Array::value('payment_processor_id', $values)) { + if (!empty($values['payment_processor_id'])) { $values['payment_processor'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_PaymentProcessor', $values['payment_processor_id'], @@ -63,7 +63,7 @@ class CRM_Contribute_Page_ContributionRecur extends CRM_Core_Page { ); } // get contribution status label - if (CRM_Utils_Array::value('contribution_status_id', $values)) { + if (!empty($values['contribution_status_id'])) { $values['contribution_status'] = CRM_Core_OptionGroup::getLabel('contribution_status', $values['contribution_status_id']); } diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index fefbbc78b8..5836363533 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -391,7 +391,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id ); - if (CRM_Utils_Array::value('amount_level', $row)) { + if (!empty($row['amount_level'])) { CRM_Event_BAO_Participant::fixEventLevel($row['amount_level']); } diff --git a/CRM/Contribute/StateMachine/Search.php b/CRM/Contribute/StateMachine/Search.php index 9c36577ddc..7801d0bfa5 100644 --- a/CRM/Contribute/StateMachine/Search.php +++ b/CRM/Contribute/StateMachine/Search.php @@ -80,7 +80,7 @@ class CRM_Contribute_StateMachine_Search extends CRM_Core_StateMachine { function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff // fix value if print button is pressed - if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) { + if (!empty($_POST['_qf_' . $formName . '_next_print'])) { $value = CRM_Contribute_Task::PRINT_CONTRIBUTIONS; } else { diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index b9fa1d6ac1..ea000abf11 100755 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -1244,7 +1244,7 @@ WHERE m.owner_membership_id IS NOT NULL AND switch ($mapping['entity']) { case 'civicrm_participant': $eventContacts = CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'name'); - if (!CRM_Utils_Array::value($recipientType, $eventContacts)) { + if (empty($eventContacts[$recipientType])) { return $options; } if ($eventContacts[$recipientType] == 'participant_role') { diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 40785fcb78..2c3d4c9836 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -80,7 +80,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { } $addressExists = self::dataExists($value); - if ( !CRM_Utils_Array::value('id', $value) ) { + if (empty($value['id'])) { if ($updateBlankLocInfo) { if ((!empty($addresses) || !$addressExists) && array_key_exists($key, $addresses)) { $value['id'] = $addresses[$key]; @@ -119,7 +119,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { $value['is_billing'] = 0; } - if (!CRM_Utils_Array::value('manual_geo_code', $value)) { + if (empty($value['manual_geo_code'])) { $value['manual_geo_code'] = 0; } $value['contact_id'] = $contactId; @@ -203,7 +203,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { * @static */ static function fixAddress(&$params) { - if (CRM_Utils_Array::value('billing_street_address', $params)) { + if (!empty($params['billing_street_address'])) { //Check address is comming from online contribution / registration page //Fixed :CRM-5076 $billing = array( @@ -218,7 +218,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { foreach ($billing as $key => $val) { if ($value = CRM_Utils_Array::value($val, $params)) { - if (CRM_Utils_Array::value($key, $params)) { + if (!empty($params[$key])) { unset($params[$val]); } else { @@ -231,7 +231,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { } /* Split the zip and +4, if it's in US format */ - if (CRM_Utils_Array::value('postal_code', $params) && + if (!empty($params['postal_code']) && preg_match('/^(\d{4,5})[+-](\d{4})$/', $params['postal_code'], $match @@ -468,7 +468,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { $addresses = array(); $address = new CRM_Core_BAO_Address(); - if (!CRM_Utils_Array::value('entity_table', $entityBlock)) { + if (empty($entityBlock['entity_table'])) { $address->$fieldName = CRM_Utils_Array::value($fieldName, $entityBlock); } else { @@ -967,7 +967,7 @@ SELECT is_primary, $nameVal = explode('-', $values['name']); $fldName = CRM_Utils_Array::value(0, $nameVal); $locType = CRM_Utils_Array::value(1, $nameVal); - if (CRM_Utils_Array::value('location_type_id', $values)) { + if (!empty($values['location_type_id'])) { $locType = $values['location_type_id']; } @@ -1198,4 +1198,4 @@ SELECT is_primary, } return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context); } -} \ No newline at end of file +} diff --git a/CRM/Core/BAO/Block.php b/CRM/Core/BAO/Block.php index bd1b3a2e79..846f63a3c3 100644 --- a/CRM/Core/BAO/Block.php +++ b/CRM/Core/BAO/Block.php @@ -157,7 +157,7 @@ class CRM_Core_BAO_Block { */ static function blockExists($blockName, &$params) { // return if no data present - if (!CRM_Utils_Array::value($blockName, $params) || !is_array($params[$blockName])) { + if (empty($params[$blockName]) || !is_array($params[$blockName])) { return FALSE; } @@ -262,7 +262,7 @@ class CRM_Core_BAO_Block { $primaryId = TRUE; if (is_array($blockIds)) { foreach ($blockIds as $blockId => $blockValue) { - if (CRM_Utils_Array::value('is_primary', $blockValue)) { + if (!empty($blockValue['is_primary'])) { $resetPrimaryId = $blockId; break; } @@ -294,12 +294,12 @@ class CRM_Core_BAO_Block { ); //check for update - if (!CRM_Utils_Array::value('id', $value) && + if (empty($value['id']) && is_array($blockIds) && !empty($blockIds) ) { foreach ($blockIds as $blockId => $blockValue) { if ($updateBlankLocInfo) { - if (CRM_Utils_Array::value($count, $blockIds)) { + if (!empty($blockIds[$count])) { $value['id'] = $blockIds[$count]['id']; unset($blockIds[$count]); } @@ -343,7 +343,7 @@ class CRM_Core_BAO_Block { // Note there could be cases when block info already exist ($value[id] is set) for a contact/entity // BUT info is not present at this time, and therefore we should be really careful when deleting the block. // $updateBlankLocInfo will help take appropriate decision. CRM-5969 - if (CRM_Utils_Array::value('id', $value) && !$dataExits && $updateBlankLocInfo) { + if (!empty($value['id']) && !$dataExits && $updateBlankLocInfo) { //delete the existing record self::blockDelete($blockName, array('id' => $value['id'])); continue; @@ -376,7 +376,7 @@ class CRM_Core_BAO_Block { // we need to delete blocks that were deleted during update if ($updateBlankLocInfo && !empty($blockIds)) { foreach ($blockIds as $deleteBlock) { - if (!CRM_Utils_Array::value('id', $deleteBlock)) { + if (empty($deleteBlock['id'])) { continue; } self::blockDelete($blockName, array('id' => $deleteBlock['id'])); @@ -454,7 +454,7 @@ class CRM_Core_BAO_Block { } // if params is_primary then set all others to not be primary & exit out - if (CRM_Utils_Array::value('is_primary', $params)) { + if (!empty($params['is_primary'])) { $sql = "UPDATE $table SET is_primary = 0 WHERE contact_id = %1"; $sqlParams = array(1 => array($contactId, 'Integer')); // we don't want to create unecessary entries in the log_ tables so exclude the one we are working on diff --git a/CRM/Core/BAO/CMSUser.php b/CRM/Core/BAO/CMSUser.php index af59a3a0a8..0b6f8dc758 100644 --- a/CRM/Core/BAO/CMSUser.php +++ b/CRM/Core/BAO/CMSUser.php @@ -343,7 +343,7 @@ class CRM_Core_BAO_CMSUser { * */ static function formRule($fields, $files, $self) { - if (!CRM_Utils_Array::value('cms_create_account', $fields)) { + if (empty($fields['cms_create_account'])) { return TRUE; } diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 106055ad8d..f7a61a01df 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -304,7 +304,7 @@ class CRM_Core_BAO_ConfigSetting { global $dbLocale; // try to inherit the language from the hosting CMS - if (CRM_Utils_Array::value('inheritLocale', $defaults)) { + if (!empty($defaults['inheritLocale'])) { // FIXME: On multilanguage installs, CRM_Utils_System::getUFLocale() in many cases returns nothing if $dbLocale is not set $dbLocale = $multiLang ? "_{$defaults['lcMessages']}" : ''; $lcMessages = CRM_Utils_System::getUFLocale(); diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 3f3bf2e80f..a197f04569 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -151,7 +151,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $indexExist = FALSE; //as during create if field is_searchable we had created index. - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $indexExist = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $params['id'], 'is_searchable'); } @@ -180,8 +180,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } } else { - if (CRM_Utils_Array::value('default_option', $params) - && isset($params['option_value'][$params['default_option']]) + if (!empty($params['default_option']) && isset($params['option_value'][$params['default_option']]) ) { $params['default_value'] = $params['option_value'][$params['default_option']]; } @@ -244,14 +243,14 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } // check for orphan option groups - if (CRM_Utils_Array::value('option_group_id', $params)) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['option_group_id'])) { + if (!empty($params['id'])) { self::fixOptionGroups($params['id'], $params['option_group_id']); } // if we dont have a default value // retrive it from one of the other custom fields which use this option group - if (!CRM_Utils_Array::value('default_value', $params)) { + if (empty($params['default_value'])) { //don't insert only value separator as default value, CRM-4579 $defaultValue = self::getOptionGroupDefault($params['option_group_id'], $params['html_type'] @@ -283,7 +282,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $customField->find(TRUE); //create/drop the index when we toggle the is_searchable flag - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { self::createField($customField, 'modify', $indexExist); } else { @@ -1584,7 +1583,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } // return if field is a 'code' field - if (CRM_Utils_Array::value('is_view', $customFields[$customFieldId])) { + if (!empty($customFields[$customFieldId]['is_view'])) { return; } @@ -2056,7 +2055,7 @@ AND cf.id = %1"; $customOptionGroup[$cacheKey] = NULL; } - if (!CRM_Utils_Array::value($cacheKey, $customOptionGroup)) { + if (empty($customOptionGroup[$cacheKey])) { $whereClause = '( g.is_active = 1 AND f.is_active = 1 )'; //support for single as well as array format. diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 0b4aa7ae41..24f2917fe9 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -88,7 +88,7 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup { //this is format when form get submit. $extendsChildType = CRM_Utils_Array::value(1, $params['extends']); //lets allow user to pass direct child type value, CRM-6893 - if (CRM_Utils_Array::value('extends_entity_column_value', $params)) { + if (!empty($params['extends_entity_column_value'])) { $extendsChildType = $params['extends_entity_column_value']; } if (!CRM_Utils_System::isNull($extendsChildType)) { @@ -1574,11 +1574,11 @@ ORDER BY civicrm_custom_group.weight, elseif ($field['data_type'] == 'Date') { if (!empty($value)) { $time = NULL; - if (CRM_Utils_Array::value('time_format', $field)) { + if (!empty($field['time_format'])) { $time = CRM_Utils_Request::retrieve($fieldName . '_time', 'String', $form, FALSE, NULL, 'GET'); } list($value, $time) = CRM_Utils_Date::setDateDefaults($value . ' ' . $time); - if (CRM_Utils_Array::value('time_format', $field)) { + if (!empty($field['time_format'])) { $customValue[$fieldName . '_time'] = $time; } } @@ -1923,7 +1923,7 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1, break; case 'ContactReference': - if (CRM_Utils_Array::value('data', $values)) { + if (!empty($values['data'])) { $retValue = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $values['data'], 'display_name'); } break; diff --git a/CRM/Core/BAO/CustomValueTable.php b/CRM/Core/BAO/CustomValueTable.php index 011116f98e..4afdbdebf0 100644 --- a/CRM/Core/BAO/CustomValueTable.php +++ b/CRM/Core/BAO/CustomValueTable.php @@ -91,7 +91,7 @@ class CRM_Core_BAO_CustomValueTable { CRM_Utils_Array::lookupValue($states, 'state_province', CRM_Core_PseudoConstant::stateProvince(), TRUE ); - if (!CRM_Utils_Array::value('state_province_id', $states)) { + if (empty($states['state_province_id'])) { CRM_Utils_Array::lookupValue($states, 'state_province', CRM_Core_PseudoConstant::stateProvinceAbbreviation(), TRUE ); @@ -128,7 +128,7 @@ class CRM_Core_BAO_CustomValueTable { CRM_Utils_Array::lookupValue($countries, 'country', CRM_Core_PseudoConstant::country(), TRUE ); - if (!CRM_Utils_Array::value('country_id', $countries)) { + if (empty($countries['country_id'])) { CRM_Utils_Array::lookupValue($countries, 'country', CRM_Core_PseudoConstant::countryIsoCode(), TRUE ); @@ -320,7 +320,7 @@ class CRM_Core_BAO_CustomValueTable { $cvParam['type'] = 'Timestamp'; } - if (CRM_Utils_Array::value('id', $customValue)) { + if (!empty($customValue['id'])) { $cvParam['id'] = $customValue['id']; } if (!array_key_exists($customValue['table_name'], $cvParams)) { diff --git a/CRM/Core/BAO/Dashboard.php b/CRM/Core/BAO/Dashboard.php index 0f5dcca112..710ba42dcd 100644 --- a/CRM/Core/BAO/Dashboard.php +++ b/CRM/Core/BAO/Dashboard.php @@ -373,7 +373,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { // special case to handle duplicate entires for report instances $dashboardID = CRM_Utils_Array::value('id', $params); - if (CRM_Utils_Array::value('instanceURL', $params)) { + if (!empty($params['instanceURL'])) { $query = "SELECT id FROM `civicrm_dashboard` WHERE url LIKE '" . CRM_Utils_Array::value('instanceURL', $params) . "&%'"; @@ -384,7 +384,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { if (!$dashboardID) { // check url is same as exiting entries, if yes just update existing - if (CRM_Utils_Array::value('name', $params)) { + if (!empty($params['name'])) { $dashlet->name = CRM_Utils_Array::value('name', $params); $dashlet->find(TRUE); } diff --git a/CRM/Core/BAO/Email.php b/CRM/Core/BAO/Email.php index d2e5c859d8..d3e5be77b3 100644 --- a/CRM/Core/BAO/Email.php +++ b/CRM/Core/BAO/Email.php @@ -305,7 +305,7 @@ AND reset_date IS NULL $fromEmail = "$fromDisplayName <$email>"; $fromEmailHtml = htmlspecialchars($fromEmail) . ' ' . $emailVal['locationType']; - if (CRM_Utils_Array::value('is_primary', $emailVal)) { + if (!empty($emailVal['is_primary'])) { $fromEmailHtml .= ' ' . ts('(preferred)'); } $fromEmailValues[$fromEmail] = $fromEmailHtml; diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index 898ded8c7b..5da796b618 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -307,7 +307,7 @@ WHERE ceft.entity_id = %1"; return; } - if (CRM_Utils_Array::value('cost', $params)) { + if (!empty($params['cost'])) { $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); $financialAccountType = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id']); $accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND label IN ('Premiums Inventory Account is', 'Cost of Sales Account is')"); @@ -327,7 +327,7 @@ WHERE ceft.entity_id = %1"; CRM_Core_BAO_FinancialTrxn::create($financialtrxn, $trxnEntityTable); } - if (CRM_Utils_Array::value('oldPremium', $params)) { + if (!empty($params['oldPremium'])) { $premiumParams = array( 'id' => $params['oldPremium']['product_id'] ); @@ -356,7 +356,7 @@ WHERE ceft.entity_id = %1"; $expenseTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' ")); $domainId = CRM_Core_Config::domainID(); $amount = 0; - if (CRM_Utils_Array::value('prevContribution', $params)) { + if (!empty($params['prevContribution'])) { $amount = $params['prevContribution']->fee_amount; } $amount = $params['fee_amount'] - $amount; @@ -372,7 +372,7 @@ WHERE ceft.entity_id = %1"; $params['trxnParams']['status_id'] = CRM_Core_OptionGroup::getValue('contribution_status','Completed','name'); $params['trxnParams']['contribution_id'] = isset($params['contribution']->id) ? $params['contribution']->id : $params['contribution_id']; $trxn = self::create($params['trxnParams']); - if (!CRM_Utils_Array::value('entity_id', $params)) { + if (empty($params['entity_id'])) { $financialTrxnID = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['trxnParams']['contribution_id'], 'DESC'); $params['entity_id'] = $financialTrxnID['financialTrxnId']; } diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index dc2be43823..a626dff2f8 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -376,7 +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 (CRM_Utils_Array::value($key, $fields['Household']) && + if (!empty($fields['Household'][$key]) && CRM_Utils_Array::value($key, $fields['Organization']) ) { $fields['Contact'][$key] = $value; @@ -1005,7 +1005,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { } $contactType = $v[0]; } - if (CRM_Utils_Array::value('1', $v)) { + if (!empty($v['1'])) { $fldName = $v[1]; $v2 = CRM_Utils_Array::value('2', $v); if ($v2 && trim($v2)) { @@ -1162,7 +1162,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $colCnt = 0; foreach ($value as $k => $v) { - if (CRM_Utils_Array::value('1', $v)) { + if (!empty($v['1'])) { $saveMappingFields = new CRM_Core_DAO_MappingField(); $saveMappingFields->mapping_id = $mappingId; @@ -1178,10 +1178,10 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $saveMappingFields->im_provider_id = CRM_Utils_Array::value('3', $v); } - if (CRM_Utils_Array::value('operator', $params)) { + if (!empty($params['operator'])) { $saveMappingFields->operator = CRM_Utils_Array::value($k, $params['operator'][$key]); } - if (CRM_Utils_Array::value('value', $params)) { + if (!empty($params['value'])) { $saveMappingFields->value = CRM_Utils_Array::value($k, $params['value'][$key]); } // Handle mapping for 'related contact' fields @@ -1189,10 +1189,10 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { list($id, $first, $second) = explode('_', CRM_Utils_Array::value('1', $v)); if (($first == 'a' && $second == 'b') || ($first == 'b' && $second == 'a')) { - if (CRM_Utils_Array::value('2', $v)) { + if (!empty($v['2'])) { $saveMappingFields->name = CRM_Utils_Array::value('2', $v); } - elseif (CRM_Utils_Array::value('4', $v)) { + elseif (!empty($v['4'])) { $saveMappingFields->name = CRM_Utils_Array::value('4', $v); } diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php index 7044ad24db..903f369068 100644 --- a/CRM/Core/BAO/Note.php +++ b/CRM/Core/BAO/Note.php @@ -155,7 +155,7 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note { } $note->copyValues($params); - if (!CRM_Utils_Array::value('contact_id', $params)) { + if (empty($params['contact_id'])) { if ($params['entity_table'] == 'civicrm_contact') { $note->contact_id = $params['entity_id']; } diff --git a/CRM/Core/BAO/OptionValue.php b/CRM/Core/BAO/OptionValue.php index e7eee27e02..833e502ba0 100644 --- a/CRM/Core/BAO/OptionValue.php +++ b/CRM/Core/BAO/OptionValue.php @@ -51,7 +51,7 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue { self::setDefaults($params); } $ids = array(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $ids = array('optionValue' => $params['id']); } return CRM_Core_BAO_OptionValue::add($params, $ids); @@ -169,7 +169,7 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue { // these would be usefully set @ the api layer so they are visible to api users // complex defaults like the domain id below would make sense in the setDefauls function // but unclear what other ways this function is being used - if (!CRM_Utils_Array::value('optionValue', $ids)) { + if (empty($ids['optionValue'])) { $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE); $params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE); $params['is_optgroup'] = CRM_Utils_Array::value('is_optgroup', $params, FALSE); @@ -180,7 +180,7 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue { $optionValue = new CRM_Core_DAO_OptionValue(); $optionValue->copyValues($params); - if (CRM_Utils_Array::value('is_default', $params)) { + if (!empty($params['is_default'])) { $query = 'UPDATE civicrm_option_value SET is_default = 0 WHERE option_group_id = %1'; // tweak default reset, and allow multiple default within group. diff --git a/CRM/Core/BAO/SchemaHandler.php b/CRM/Core/BAO/SchemaHandler.php index 79a148220b..752337a454 100644 --- a/CRM/Core/BAO/SchemaHandler.php +++ b/CRM/Core/BAO/SchemaHandler.php @@ -128,21 +128,21 @@ class CRM_Core_BAO_SchemaHandler { $sql .= $prefix; $sql .= "`{$params['name']}` {$params['type']}"; - if (CRM_Utils_Array::value('required', $params)) { + if (!empty($params['required'])) { $sql .= " NOT NULL"; } - if (CRM_Utils_Array::value('attributes', $params)) { + if (!empty($params['attributes'])) { $sql .= " {$params['attributes']}"; } - if (CRM_Utils_Array::value('default', $params) && + if (!empty($params['default']) && $params['type'] != 'text' ) { $sql .= " DEFAULT {$params['default']}"; } - if (CRM_Utils_Array::value('comment', $params)) { + if (!empty($params['comment'])) { $sql .= " COMMENT '{$params['comment']}'"; } @@ -151,7 +151,7 @@ class CRM_Core_BAO_SchemaHandler { static function buildPrimaryKeySQL(&$params, $separator, $prefix) { $sql = NULL; - if (CRM_Utils_Array::value('primary', $params)) { + if (!empty($params['primary'])) { $sql .= $separator; $sql .= str_repeat(' ', 8); $sql .= $prefix; @@ -171,13 +171,13 @@ class CRM_Core_BAO_SchemaHandler { //create index only for searchable fields during ADD, //create index only if field is become searchable during MODIFY, //drop index only if field is no more searchable and index was exist. - if (CRM_Utils_Array::value('searchable', $params) && !$indexExist) { + if (!empty($params['searchable']) && !$indexExist) { $sql .= $separator; $sql .= str_repeat(' ', 8); $sql .= $prefix; $sql .= "INDEX_{$params['name']} ( {$params['name']} )"; } - elseif (!CRM_Utils_Array::value('searchable', $params) && $indexExist) { + elseif (empty($params['searchable']) && $indexExist) { $sql .= $separator; $sql .= str_repeat(' ', 8); $sql .= "DROP INDEX INDEX_{$params['name']}"; @@ -235,7 +235,7 @@ ALTER TABLE {$tableName} static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) { $sql = NULL; - if (CRM_Utils_Array::value('fk_table_name', $params) && + if (!empty($params['fk_table_name']) && CRM_Utils_Array::value('fk_field_name', $params) ) { $sql .= $separator; @@ -280,10 +280,10 @@ ALTER TABLE {$tableName} case 'delete': $sql .= " DROP COLUMN `{$params['name']}`"; - if (CRM_Utils_Array::value('primary', $params)) { + if (!empty($params['primary'])) { $sql .= ", DROP PRIMARY KEY"; } - if (CRM_Utils_Array::value('fk_table_name', $params)) { + if (!empty($params['fk_table_name'])) { $sql .= ", DROP FOREIGN KEY FK_{$params['fkName']}"; } break; diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index 87a5fdd379..d9a17313ed 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -839,7 +839,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { $cbValues = array(); foreach ($groupValues as $key => $val) { - if (CRM_Utils_Array::value($val, $value)) { + if (!empty($value[$val])) { $cbValues[$key] = 1; } } diff --git a/CRM/Core/BAO/Tag.php b/CRM/Core/BAO/Tag.php index 2ba2c9a1dd..c88213a872 100644 --- a/CRM/Core/BAO/Tag.php +++ b/CRM/Core/BAO/Tag.php @@ -314,7 +314,7 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag { $tag = new CRM_Core_DAO_Tag(); // if parent id is set then inherit used for and is hidden properties - if (CRM_Utils_Array::value('parent_id', $params)) { + if (!empty($params['parent_id'])) { // get parent details $params['used_for'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $params['parent_id'], 'used_for'); } diff --git a/CRM/Core/BAO/UFField.php b/CRM/Core/BAO/UFField.php index e4baabe332..b03ea87918 100644 --- a/CRM/Core/BAO/UFField.php +++ b/CRM/Core/BAO/UFField.php @@ -143,7 +143,7 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField { $ufField->location_type_id = (CRM_Utils_Array::value(2, $params['field_name'])) ? $params['field_name'][2] : 'NULL'; $ufField->phone_type_id = CRM_Utils_Array::value(3, $params['field_name']); - if (CRM_Utils_Array::value('uf_field', $ids)) { + if (!empty($ids['uf_field'])) { $ufField->whereAdd("id <> " . CRM_Utils_Array::value('uf_field', $ids)); } @@ -252,7 +252,7 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; // fix for CRM-316 $oldWeight = NULL; - if (CRM_Utils_Array::value('field_id', $params)) { + if (!empty($params['field_id'])) { $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $params['field_id'], 'weight', 'id'); } $fieldValues = array('uf_group_id' => $params['group_id']); diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index e0d8fbd9d6..bac03c95c0 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -169,7 +169,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { // we do not allow duplicates. the first field is the winner foreach ($subset as $name => $field) { - if (!CRM_Utils_Array::value($name, $fields)) { + if (empty($fields[$name])) { $fields[$name] = $field; } } @@ -928,7 +928,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { } // skip fields that should not be displayed separately - if (CRM_Utils_Array::value('skipDisplay', $field)) { + if (!empty($field['skipDisplay'])) { continue; } @@ -940,7 +940,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { } //handle the case to avoid re-write where the profile field labels are the same - if (CRM_Utils_Array::value($index, $values)) { + if (!empty($values[$index])) { $index .= $nullValueIndex; $nullValueIndex .= $nullValueIndex; } @@ -2119,7 +2119,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) ); } elseif ($fieldName == 'participant_role') { - if (CRM_Utils_Array::value('is_multiple', $field)) { + if (!empty($field['is_multiple'])) { $form->addCheckBox($name, $title, CRM_Event_PseudoConstant::participantRole(), NULL, NULL, NULL, NULL, ' ', TRUE); } else { @@ -2253,7 +2253,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) CRM_Contact_Form_Edit_TagsAndGroups::setDefaults($contactId, $defaults, CRM_Contact_Form_Edit_TagsAndGroups::TAG, $fldName); } - if (CRM_Utils_Array::value($name, $details) || isset($details[$name])) { + if (!empty($details[$name]) || isset($details[$name])) { //to handle custom data (checkbox) to be written // to handle birth/deceased date, greeting_type and few other fields if (($name == 'birth_date') || ($name == 'deceased_date')) { @@ -2328,11 +2328,11 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) case 'Select Date': // CRM-6681, set defult values according to date and time format (if any). $dateFormat = NULL; - if (CRM_Utils_Array::value('date_format', $customFields[$customFieldId])) { + if (!empty($customFields[$customFieldId]['date_format'])) { $dateFormat = $customFields[$customFieldId]['date_format']; } - if (!CRM_Utils_Array::value('time_format', $customFields[$customFieldId])) { + if (empty($customFields[$customFieldId]['time_format'])) { list($defaults[$fldName]) = CRM_Utils_Date::setDateDefaults($details[$name], NULL, $dateFormat ); @@ -2380,7 +2380,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) // fixed for CRM-665 if (is_numeric($locTypeId)) { if ($primaryLocationType || $locTypeId == CRM_Utils_Array::value('location_type_id', $value)) { - if (CRM_Utils_Array::value($fieldName, $value)) { + if (!empty($value[$fieldName])) { //to handle stateprovince and country if ($fieldName == 'state_province') { $defaults[$fldName] = $value['state_province_id']; @@ -2811,7 +2811,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) // if we are getting in a new primary email, dont overwrite the new one if ($locTypeId == $primaryLocationType) { - if (CRM_Utils_Array::value('email-' . $primaryLocationType, $params)) { + if (!empty($params['email-' . $primaryLocationType])) { $data['location'][$loc]['email'][$loc]['email'] = $fields['email-' . $primaryLocationType]; } elseif (isset($primaryEmail)) { @@ -3130,7 +3130,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) $fldName = $isStandalone ? $name : "field[$componentId][$name]"; if (in_array($name, $dateTimeFields)) { $timefldName = $isStandalone ? "{$name}_time" : "field[$componentId][{$name}_time]"; - if (CRM_Utils_Array::value($name, $values)) { + if (!empty($values[$name])) { list($defaults[$fldName], $defaults[$timefldName]) = CRM_Utils_Date::setDateDefaults($values[$name]); } } @@ -3189,7 +3189,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) // CRM-6681, $default contains formatted date, time values. $defaults[$fldName] = $customValue; - if (CRM_Utils_Array::value($customKey . '_time', $defaults)) { + if (!empty($defaults[$customKey . '_time'])) { $defaults['field'][$componentId][$name . '_time'] = $defaults[$customKey . '_time']; } } @@ -3436,7 +3436,7 @@ SELECT group_id $groupTypes = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileId, 'group_type'); $groupTypeParts = explode(CRM_Core_DAO::VALUE_SEPARATOR, $groupTypes); - if (!CRM_Utils_Array::value(1, $groupTypeParts)) { + if (empty($groupTypeParts[1])) { return $groupTypeValue; } $participantExtends = array('ParticipantRole', 'ParticipantEventName', 'ParticipantEventType'); diff --git a/CRM/Core/BAO/UFJoin.php b/CRM/Core/BAO/UFJoin.php index 0910110543..a1b26446b1 100644 --- a/CRM/Core/BAO/UFJoin.php +++ b/CRM/Core/BAO/UFJoin.php @@ -96,7 +96,7 @@ class CRM_Core_BAO_UFJoin extends CRM_Core_DAO_UFJoin { * @static */ public static function findJoinEntryId(&$params) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { return $params['id']; } diff --git a/CRM/Core/BAO/Website.php b/CRM/Core/BAO/Website.php index 15d58ed5a2..7479464f54 100644 --- a/CRM/Core/BAO/Website.php +++ b/CRM/Core/BAO/Website.php @@ -86,7 +86,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website { } } - if (!CRM_Utils_Array::value('id', $values) && + if (empty($values['id']) && is_array($ids) && !empty($ids) ) { foreach ($ids as $id => $value) { @@ -99,7 +99,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website { } } $values['contact_id'] = $contactID; - if ( CRM_Utils_Array::value('url', $values) ) { + if (!empty($values['url'])) { self::add($values); } } diff --git a/CRM/Core/Component.php b/CRM/Core/Component.php index 7dbab550e3..1bb5569b0f 100644 --- a/CRM/Core/Component.php +++ b/CRM/Core/Component.php @@ -134,10 +134,10 @@ class CRM_Core_Component { // also set the smarty variables to the current component $template = CRM_Core_Smarty::singleton(); $template->assign('activeComponent', $name); - if (CRM_Utils_Array::value('formTpl', $comp->info[$name])) { + if (!empty($comp->info[$name]['formTpl'])) { $template->assign('formTpl', $comp->info[$name]['formTpl']); } - if (CRM_Utils_Array::value('css', $comp->info[$name])) { + if (!empty($comp->info[$name]['css'])) { $styleSheets = '"; CRM_Utils_System::addHTMLHead($styleSheet); } @@ -313,7 +313,7 @@ class CRM_Core_Component { $tasks = array(); foreach ($info as $name => $value) { - if (CRM_Utils_Array::value('task', $info[$name])) { + if (!empty($info[$name]['task'])) { $tasks += $info[$name]['task']; } } diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index 1c9b09ddd2..75230c1a9b 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -251,7 +251,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { } // if the request has a reset value, initialize the controller session - if (CRM_Utils_Array::value('reset', $_GET)) { + if (!empty($_GET['reset'])) { $this->reset(); // in this case we'll also cache the url as a hidden form variable, this allows us to @@ -440,7 +440,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { $title = CRM_Utils_Array::value('title', $value); $options = CRM_Utils_Array::value('options', $value); $stateName = CRM_Utils_String::getClassName($className); - if (CRM_Utils_Array::value('className', $value)) { + if (!empty($value['className'])) { $formName = $name; } else { diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index f2436aa10a..86f29ce359 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -261,7 +261,7 @@ class CRM_Core_DAO extends DB_DataObject { if ($fields) { foreach ($fields as $name => $value) { $table[$value['name']] = $value['type']; - if (CRM_Utils_Array::value('required', $value)) { + if (!empty($value['required'])) { $table[$value['name']] += self::DB_DAO_NOTNULL; } } @@ -1086,13 +1086,13 @@ FROM civicrm_domain $fieldsToSuffix = array(); $fieldsToReplace = array(); } - if (CRM_Utils_Array::value('prefix', $fieldsFix)) { + if (!empty($fieldsFix['prefix'])) { $fieldsToPrefix = $fieldsFix['prefix']; } - if (CRM_Utils_Array::value('suffix', $fieldsFix)) { + if (!empty($fieldsFix['suffix'])) { $fieldsToSuffix = $fieldsFix['suffix']; } - if (CRM_Utils_Array::value('replace', $fieldsFix)) { + if (!empty($fieldsFix['replace'])) { $fieldsToReplace = $fieldsFix['replace']; } diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index e4e44e86d2..663ff694e1 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -436,7 +436,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $prevnext[] = $this->createElement($button['type'], 'reset', $button['name'], $attrs); } else { - if (CRM_Utils_Array::value('subName', $button)) { + if (!empty($button['subName'])) { $buttonName = $this->getButtonName($button['type'], $button['subName']); } else { @@ -449,7 +449,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { } $prevnext[] = $this->createElement('submit', $buttonName, $button['name'], $attrs); } - if (CRM_Utils_Array::value('isDefault', $button)) { + if (!empty($button['isDefault'])) { $this->setDefaultAction($button['type']); } @@ -1057,7 +1057,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * */ function addDate($name, $label, $required = FALSE, $attributes = NULL) { - if (CRM_Utils_Array::value('formatType', $attributes)) { + if (!empty($attributes['formatType'])) { // get actual format $params = array('name' => $attributes['formatType']); $values = array(); @@ -1065,7 +1065,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { // cache date information static $dateFormat; $key = "dateFormat_" . str_replace(' ', '_', $attributes['formatType']); - if (!CRM_Utils_Array::value($key, $dateFormat)) { + if (empty($dateFormat[$key])) { CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_PreferencesDate', $params, $values); $dateFormat[$key] = $values; } @@ -1077,7 +1077,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $attributes['format'] = $values['date_format']; } - if (CRM_Utils_Array::value('time_format', $values)) { + if (!empty($values['time_format'])) { $attributes['timeFormat'] = $values['time_format']; } $attributes['startOffset'] = $values['start']; @@ -1085,7 +1085,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { } $config = CRM_Core_Config::singleton(); - if (!CRM_Utils_Array::value('format', $attributes)) { + if (empty($attributes['format'])) { $attributes['format'] = $config->dateInputFormat; } @@ -1099,7 +1099,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $this->add('text', $name, $label, $attributes); - if (CRM_Utils_Array::value('addTime', $attributes) || + if (!empty($attributes['addTime']) || CRM_Utils_Array::value('timeFormat', $attributes) ) { @@ -1130,7 +1130,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { if ($required) { $this->addRule($name, ts('Please select %1', array(1 => $label)), 'required'); - if (CRM_Utils_Array::value('addTime', $attributes) && CRM_Utils_Array::value('addTimeRequired', $attributes)) { + if (!empty($attributes['addTime']) && CRM_Utils_Array::value('addTimeRequired', $attributes)) { $this->addRule($elementName, ts('Please enter a time.'), 'required'); } } diff --git a/CRM/Core/Form/Tag.php b/CRM/Core/Form/Tag.php index cd45fd074b..4219e3a603 100644 --- a/CRM/Core/Form/Tag.php +++ b/CRM/Core/Form/Tag.php @@ -193,7 +193,7 @@ class CRM_Core_Form_Tag { $contactTags = CRM_Core_BAO_Tag::getTagsUsedFor('civicrm_contact', TRUE, FALSE, $parentId); foreach (array_keys($form->_formValues['contact_tags']) as $tagId) { - if (CRM_Utils_Array::value($tagId, $contactTags)) { + if (!empty($contactTags[$tagId])) { $tagName = $tagId; if (is_numeric($tagId)) { $tagName = $contactTags[$tagId]; diff --git a/CRM/Core/Invoke.php b/CRM/Core/Invoke.php index f6c8294ad1..837dda2ef2 100644 --- a/CRM/Core/Invoke.php +++ b/CRM/Core/Invoke.php @@ -246,7 +246,7 @@ class CRM_Core_Invoke { } // check if ssl is set - if (CRM_Utils_Array::value('is_ssl', $item)) { + if (!empty($item['is_ssl'])) { CRM_Utils_System::redirectToSSL(); } @@ -259,7 +259,7 @@ class CRM_Core_Invoke { } $pageArgs = NULL; - if (CRM_Utils_Array::value('page_arguments', $item)) { + if (!empty($item['page_arguments'])) { $pageArgs = CRM_Core_Menu::getArrayForPathArgs($item['page_arguments']); } diff --git a/CRM/Core/Menu.php b/CRM/Core/Menu.php index 355b976a50..54df7411b7 100644 --- a/CRM/Core/Menu.php +++ b/CRM/Core/Menu.php @@ -271,7 +271,7 @@ class CRM_Core_Menu { $values = array(); foreach ($menu as $path => $item) { - if (!CRM_Utils_Array::value('adminGroup', $item)) { + if (empty($item['adminGroup'])) { continue; } diff --git a/CRM/Core/OptionValue.php b/CRM/Core/OptionValue.php index a7092655b6..c0264c5df3 100644 --- a/CRM/Core/OptionValue.php +++ b/CRM/Core/OptionValue.php @@ -154,14 +154,14 @@ class CRM_Core_OptionValue { $dao->id ); - if (CRM_Utils_Array::value('component_id', $optionValue[$dao->id])) { + if (!empty($optionValue[$dao->id]['component_id'])) { $optionValue[$dao->id]['component_name'] = $componentNames[$optionValue[$dao->id]['component_id']]; } else { $optionValue[$dao->id]['component_name'] = 'Contact'; } - if (CRM_Utils_Array::value('visibility_id', $optionValue[$dao->id])) { + if (!empty($optionValue[$dao->id]['visibility_id'])) { $optionValue[$dao->id]['visibility_label'] = $visibilityLabels[$optionValue[$dao->id]['visibility_id']]; } } @@ -349,11 +349,11 @@ class CRM_Core_OptionValue { if (!empty($query->_params) || !empty($query->_returnProperties)) { $field = self::getFields(); foreach ($field as $name => $values) { - if (CRM_Utils_Array::value('pseudoconstant', $values)) { + if (!empty($values['pseudoconstant'])) { continue; } list($tableName, $fieldName) = explode('.', $values['where']); - if (CRM_Utils_Array::value($name, $query->_returnProperties)) { + if (!empty($query->_returnProperties[$name])) { $query->_select["{$name}_id"] = "{$name}.value as {$name}_id"; $query->_element["{$name}_id"] = 1; $query->_select[$name] = "{$name}.{$fieldName} as $name"; diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index 83b6dc3b09..d1ddc98a5a 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -156,7 +156,7 @@ class CRM_Core_Page { } // if the request has a reset value, initialize the controller session - if (CRM_Utils_Array::value('reset', $_REQUEST)) { + if (!empty($_REQUEST['reset'])) { $this->reset(); } } diff --git a/CRM/Core/Page/AJAX.php b/CRM/Core/Page/AJAX.php index e39ac960eb..8acb653ab8 100644 --- a/CRM/Core/Page/AJAX.php +++ b/CRM/Core/Page/AJAX.php @@ -97,11 +97,11 @@ class CRM_Core_Page_AJAX { */ static function setIsQuickConfig() { $id = $context = NULL; - if (CRM_Utils_Array::value('id', $_REQUEST)) { + if (!empty($_REQUEST['id'])) { $id = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer'); } - if (CRM_Utils_Array::value('context', $_REQUEST)) { + if (!empty($_REQUEST['context'])) { $context = CRM_Utils_Type::escape($_REQUEST['context'], 'String'); } // return false if $id is null and diff --git a/CRM/Core/Page/Basic.php b/CRM/Core/Page/Basic.php index e779d30378..65c7684623 100644 --- a/CRM/Core/Page/Basic.php +++ b/CRM/Core/Page/Basic.php @@ -224,13 +224,13 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page { $fields = &$object->fields(); $key = ''; - if (CRM_Utils_Array::value('title', $fields)) { + if (!empty($fields['title'])) { $key = 'title'; } - elseif (CRM_Utils_Array::value('label', $fields)) { + elseif (!empty($fields['label'])) { $key = 'label'; } - elseif (CRM_Utils_Array::value('name', $fields)) { + elseif (!empty($fields['name'])) { $key = 'name'; } @@ -291,7 +291,7 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page { $newAction = $action; $hasDelete = $hasDisable = TRUE; - if (CRM_Utils_Array::value('name', $values) && in_array($values['name'], array( + if (!empty($values['name']) && in_array($values['name'], array( 'encounter_medium', 'case_type', 'case_status'))) { static $caseCount = NULL; if (!isset($caseCount)) { diff --git a/CRM/Core/Payment/AuthorizeNet.php b/CRM/Core/Payment/AuthorizeNet.php index a30e6ca7a8..21c2e5e270 100644 --- a/CRM/Core/Payment/AuthorizeNet.php +++ b/CRM/Core/Payment/AuthorizeNet.php @@ -100,7 +100,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { * & giving it a change to act on the params array */ $newParams = $params; - if (CRM_Utils_Array::value('is_recur', $params) && + if (!empty($params['is_recur']) && $params['contributionRecurID'] ) { CRM_Utils_Hook::alterPaymentProcessorParams($this, @@ -112,7 +112,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { $this->_setParam($field, $value); } - if (CRM_Utils_Array::value('is_recur', $params) && + if (!empty($params['is_recur']) && $params['contributionRecurID'] ) { $result = $this->doRecurPayment(); @@ -334,7 +334,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { ); //only impact of assigning this here is is can be used to cancel the subscription in an automated test // if it isn't cancelled a duplicate transaction error occurs - if (CRM_Utils_Array::value('subscriptionId', $responseFields)) { + if (!empty($responseFields['subscriptionId'])) { $this->_setParam('subscriptionId', $responseFields['subscriptionId']); } } diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index eeff13606e..0c80670ad6 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -143,13 +143,13 @@ class CRM_Core_Payment_BaseIPN { } catch(Exception $e) { $success = FALSE; - if (CRM_Utils_Array::value('log_error', $error_handling)) { + if (!empty($error_handling['log_error'])) { CRM_Core_Error::debug_log_message($e->getMessage()); } - if (CRM_Utils_Array::value('echo_error', $error_handling)) { + if (!empty($error_handling['echo_error'])) { echo ($e->getMessage()); } - if (CRM_Utils_Array::value('return_error', $error_handling)) { + if (!empty($error_handling['return_error'])) { return array( 'is_error' => 1, 'error_message' => ($e->getMessage()), @@ -170,7 +170,7 @@ class CRM_Core_Payment_BaseIPN { function failed(&$objects, &$transaction, $input = array()) { $contribution = &$objects['contribution']; $memberships = array(); - if (CRM_Utils_Array::value('membership', $objects)) { + if (!empty($objects['membership'])) { $memberships = &$objects['membership']; if (is_numeric($memberships)) { $memberships = array($objects['membership']); @@ -191,16 +191,16 @@ class CRM_Core_Payment_BaseIPN { $contribution->save(); //add lineitems for recurring payments - if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id && $addLineItems) { + if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) { $this->addrecurLineItems($objects['contributionRecur']->id, $contribution->id, CRM_Core_DAO::$_nullArray); } //copy initial contribution custom fields for recurring contributions - if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) { + if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) { $this->copyCustomValues($objects['contributionRecur']->id, $contribution->id); } - if (!CRM_Utils_Array::value('skipComponentSync', $input)) { + if (empty($input['skipComponentSync'])) { if (!empty($memberships)) { // if transaction is failed then set "Cancelled" as membership status $cancelStatusId = array_search('Cancelled', CRM_Member_PseudoConstant::membershipStatus()); @@ -262,16 +262,16 @@ class CRM_Core_Payment_BaseIPN { $contribution->save(); //add lineitems for recurring payments - if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id && $addLineItems) { + if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) { $this->addrecurLineItems($objects['contributionRecur']->id, $contribution->id, CRM_Core_DAO::$_nullArray); } //copy initial contribution custom fields for recurring contributions - if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) { + if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) { $this->copyCustomValues($objects['contributionRecur']->id, $contribution->id); } - if (!CRM_Utils_Array::value('skipComponentSync', $input)) { + if (empty($input['skipComponentSync'])) { if (!empty($memberships)) { foreach ($memberships as $membership) { if ($membership) { @@ -337,7 +337,7 @@ class CRM_Core_Payment_BaseIPN { } $contribution->source = $source; - if (CRM_Utils_Array::value('is_email_receipt', $values)) { + if (!empty($values['is_email_receipt'])) { $contribution->receipt_date = self::$_now; } @@ -413,7 +413,7 @@ LIMIT 1;"; $membershipLog = $formatedParams; $logStartDate = $formatedParams['start_date']; - if (CRM_Utils_Array::value('log_start_date', $dates)) { + if (!empty($dates['log_start_date'])) { $logStartDate = CRM_Utils_Date::customFormat($dates['log_start_date'], $format); $logStartDate = CRM_Utils_Date::isoToMysql($logStartDate); } @@ -479,7 +479,7 @@ LIMIT 1;"; $contribution->receipt_date = self::$_now; $values['is_email_receipt'] = 1; } - if (!CRM_Utils_Array::value('skipComponentSync', $input)) { + if (empty($input['skipComponentSync'])) { $participant->status_id = 1; } $participant->save(); @@ -504,11 +504,11 @@ LIMIT 1;"; $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date); $contribution->cancel_date = 'null'; - if (CRM_Utils_Array::value('check_number', $input)) { + if (!empty($input['check_number'])) { $contribution->check_number = $input['check_number']; } - if (CRM_Utils_Array::value('payment_instrument_id', $input)) { + if (!empty($input['payment_instrument_id'])) { $contribution->payment_instrument_id = $input['payment_instrument_id']; } @@ -519,7 +519,7 @@ LIMIT 1;"; $contribution->save(); //add lineitems for recurring payments - if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id && $addLineItems) { + if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) { $this->addrecurLineItems($objects['contributionRecur']->id, $contribution->id, $input); } @@ -555,7 +555,7 @@ LIMIT 1;"; $input['contribution'] = $contribution; $input['financial_type_id'] = $contribution->financial_type_id; - if (CRM_Utils_Array::value('participant', $contribution->_relatedObjects)) { + if (!empty($contribution->_relatedObjects['participant'])) { $input['contribution_mode'] = 'participant'; $input['participant_id'] = $contribution->_relatedObjects['participant']->id; $input['skipLineItem'] = 1; @@ -578,7 +578,7 @@ LIMIT 1;"; if ($input['component'] == 'contribute') { //CRM-4027 $targetContactID = NULL; - if (CRM_Utils_Array::value('related_contact', $ids)) { + if (!empty($ids['related_contact'])) { $targetContactID = $contribution->contact_id; $contribution->contact_id = $ids['related_contact']; } @@ -742,7 +742,7 @@ LIMIT 1;"; } $input['is_test'] = $contribution->is_test; $input['net_amount'] = $contribution->net_amount; - if (CRM_Utils_Array::value('fee_amount', $input) && CRM_Utils_Array::value('amount', $input)) { + if (!empty($input['fee_amount']) && CRM_Utils_Array::value('amount', $input)) { $input['net_amount'] = $input['amount'] - $input['fee_amount']; } diff --git a/CRM/Core/Payment/Google.php b/CRM/Core/Payment/Google.php index 9bc8f6f016..4b369363f3 100644 --- a/CRM/Core/Payment/Google.php +++ b/CRM/Core/Payment/Google.php @@ -128,7 +128,7 @@ class CRM_Core_Payment_Google extends CRM_Core_Payment { function doTransferCheckout(&$params, $component) { $component = strtolower($component); - if (CRM_Utils_Array::value('is_recur', $params) && + if (!empty($params['is_recur']) && $params['contributionRecurID'] ) { return $this->doRecurCheckout($params, $component); diff --git a/CRM/Core/Payment/GoogleIPN.php b/CRM/Core/Payment/GoogleIPN.php index 6266324388..0c31625736 100644 --- a/CRM/Core/Payment/GoogleIPN.php +++ b/CRM/Core/Payment/GoogleIPN.php @@ -213,10 +213,10 @@ class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN { * lets make use of it by passing the eventID/membershipTypeID to next level. * And change trxn_id to google-order-number before finishing db update */ - if (CRM_Utils_Array::value('event', $ids)) { + if (!empty($ids['event'])) { $contribution->trxn_id = $ids['event'] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['participant']; } - elseif (CRM_Utils_Array::value('membership', $ids)) { + elseif (!empty($ids['membership'])) { $contribution->trxn_id = $ids['membership'][0] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['related_contact'] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['onbehalf_dupe_alert']; } } diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index a5ee6ca0eb..e3e5ac98b0 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -111,7 +111,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { $args['version'] = '56.0'; //LCD if recurring, collect additional data and set some values - if (CRM_Utils_Array::value('is_recur',$params)) { + if (!empty($params['is_recur'])) { $args['L_BILLINGTYPE0'] = 'RecurringPayments'; //$args['L_BILLINGAGREEMENTDESCRIPTION0'] = 'Recurring Contribution'; $args['L_BILLINGAGREEMENTDESCRIPTION0'] = $params['amount'] . " Per " . $params['frequency_interval'] . " " . $params['frequency_unit']; @@ -524,7 +524,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { ); $cancelUrlString = "$cancel=1&cancel=1&qfKey={$params['qfKey']}"; - if (CRM_Utils_Array::value('is_recur', $params)) { + if (!empty($params['is_recur'])) { $cancelUrlString .= "&isRecur=1&recurId={$params['contributionRecurID']}&contribId={$params['contributionID']}"; } diff --git a/CRM/Core/Payment/ProcessorForm.php b/CRM/Core/Payment/ProcessorForm.php index 46e7ff96ee..8ce6e23089 100644 --- a/CRM/Core/Payment/ProcessorForm.php +++ b/CRM/Core/Payment/ProcessorForm.php @@ -53,7 +53,7 @@ class CRM_Core_Payment_ProcessorForm { $form->set('paymentProcessor', $form->_paymentProcessor); // also set cancel subscription url - if (CRM_Utils_Array::value('is_recur', $form->_paymentProcessor) && + if (!empty($form->_paymentProcessor['is_recur']) && CRM_Utils_Array::value('is_recur', $form->_values) ) { $form->_paymentObject = &CRM_Core_Payment::singleton($mode, $form->_paymentProcessor, $form); @@ -86,7 +86,7 @@ class CRM_Core_Payment_ProcessorForm { } // make sure we have a valid payment class, else abort - if (CRM_Utils_Array::value('is_monetary', $form->_values) && + if (!empty($form->_values['is_monetary']) && !$form->_paymentProcessor['class_name'] && !CRM_Utils_Array::value('is_pay_later', $form->_values) ) { diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 877f00982a..c7b96f54d6 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -363,7 +363,7 @@ class CRM_Core_SelectValues { $date['emptyOptionValue'] = ''; } - if (!CRM_Utils_Array::value('format', $date)) { + if (empty($date['format'])) { $date['format'] = 'M d'; } } diff --git a/CRM/Core/Session.php b/CRM/Core/Session.php index c9b047c0da..20ba2ebf09 100644 --- a/CRM/Core/Session.php +++ b/CRM/Core/Session.php @@ -179,7 +179,7 @@ class CRM_Core_Session { return; } - if (!CRM_Utils_Array::value($prefix, $this->_session[$this->_key])) { + if (empty($this->_session[$this->_key][$prefix])) { $this->_session[$this->_key][$prefix] = array(); } } diff --git a/CRM/Core/StateMachine.php b/CRM/Core/StateMachine.php index 486b95b2eb..f6419a8ce2 100644 --- a/CRM/Core/StateMachine.php +++ b/CRM/Core/StateMachine.php @@ -267,7 +267,7 @@ class CRM_Core_StateMachine { $this->_pageNames = array(); foreach ($pages as $tempName => $value) { - if (CRM_Utils_Array::value('className', $value)) { + if (!empty($value['className'])) { $this->_pageNames[] = $tempName; } else { diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index b573587d9f..04a1ae661b 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -215,7 +215,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { $defaults['filter_selected'] = $contactRefFilter; } - if (CRM_Utils_Array::value('data_type', $defaults)) { + if (!empty($defaults['data_type'])) { $defaultDataType = array_search($defaults['data_type'], self::$_dataTypeKeys ); @@ -254,7 +254,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { $defaults['is_view'] = 0; } - if (CRM_Utils_Array::value('html_type', $defaults)) { + if (!empty($defaults['html_type'])) { $dontShowLink = substr($defaults['html_type'], -14) == 'State/Province' || substr($defaults['html_type'], -7) == 'Country' ? 1 : 0; } @@ -876,7 +876,7 @@ AND option_group_id = %2"; } // we can not set require and view at the same time. - if (CRM_Utils_Array::value('is_required', $fields) && + if (!empty($fields['is_required']) && CRM_Utils_Array::value('is_view', $fields) ) { $errors['is_view'] = ts('Can not set this field Required and View Only at the same time.'); @@ -910,7 +910,7 @@ AND option_group_id = %2"; //fix for 'is_search_range' field. if (in_array($dataTypeKey, array( 1, 2, 3, 5))) { - if (!CRM_Utils_Array::value('is_searchable', $params)) { + if (empty($params['is_searchable'])) { $params['is_search_range'] = 0; } } diff --git a/CRM/Custom/Form/Group.php b/CRM/Custom/Form/Group.php index 30274ba2cf..697148dc3b 100644 --- a/CRM/Custom/Form/Group.php +++ b/CRM/Custom/Form/Group.php @@ -135,7 +135,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form { $errors['title'] = ts('Custom group \'%1\' already exists in Database.', array(1 => $title)); } - if (CRM_Utils_Array::value(1, $fields['extends'])) { + if (!empty($fields['extends'][1])) { if (in_array('', $fields['extends'][1]) && count($fields['extends'][1]) > 1) { $errors['extends'] = ts("Cannot combine other option with 'Any'."); } @@ -151,7 +151,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form { $self->assign('showStyle', TRUE); } - if (CRM_Utils_Array::value('is_multiple', $fields)) { + if (!empty($fields['is_multiple'])) { $self->assign('showMultiple', TRUE); } @@ -417,7 +417,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form { $defaults['is_active'] = $defaults['collapse_display'] = 1; $defaults['style'] = 'Inline'; } - elseif (!CRM_Utils_Array::value('max_multiple', $defaults) && !$this->_isGroupEmpty) { + elseif (empty($defaults['max_multiple']) && !$this->_isGroupEmpty) { $this->assign('showMaxMultiple', FALSE); } diff --git a/CRM/Custom/Form/Option.php b/CRM/Custom/Form/Option.php index 15760f5aae..b084dbda35 100644 --- a/CRM/Custom/Form/Option.php +++ b/CRM/Custom/Form/Option.php @@ -125,7 +125,7 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { || $fieldDefaults['html_type'] == 'Multi-Select' || $fieldDefaults['html_type'] == 'AdvMulti-Select' ) { - if (CRM_Utils_Array::value('default_value', $fieldDefaults)) { + if (!empty($fieldDefaults['default_value'])) { $defaultCheckValues = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($fieldDefaults['default_value'], 1, -1) ); @@ -452,7 +452,7 @@ SELECT count(*) CRM_Core_DAO::VALUE_SEPARATOR, substr($customField->default_value, 1, -1) ); - if (CRM_Utils_Array::value('default_value', $params)) { + if (!empty($params['default_value'])) { if (!in_array($customOption->value, $defVal)) { if (empty($defVal[0])) { $defVal = array($customOption->value); @@ -497,7 +497,7 @@ SELECT count(*) break; } - if (CRM_Utils_Array::value('default_value', $params)) { + if (!empty($params['default_value'])) { $customField->default_value = $customOption->value; $customField->save(); } diff --git a/CRM/Custom/Form/Preview.php b/CRM/Custom/Form/Preview.php index 4b634b1c06..e3aee59592 100644 --- a/CRM/Custom/Form/Preview.php +++ b/CRM/Custom/Form/Preview.php @@ -71,7 +71,7 @@ class CRM_Custom_Form_Preview extends CRM_Core_Form { $fieldDAO = new CRM_Core_DAO_CustomField(); CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults); - if (CRM_Utils_Array::value('is_view', $defaults)) { + if (!empty($defaults['is_view'])) { CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.')); } elseif (CRM_Utils_Array::value('is_active', $defaults) == 0) { diff --git a/CRM/Custom/Import/Form/MapField.php b/CRM/Custom/Import/Form/MapField.php index 86c8c9dab1..10d8a0c9d1 100644 --- a/CRM/Custom/Import/Form/MapField.php +++ b/CRM/Custom/Import/Form/MapField.php @@ -80,7 +80,7 @@ class CRM_Custom_Import_Form_MapField extends CRM_Contact_Import_Form_MapField { } } - if (CRM_Utils_Array::value('saveMapping', $fields)) { + if (!empty($fields['saveMapping'])) { $nameField = CRM_Utils_Array::value('saveMappingName', $fields); if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); @@ -154,7 +154,7 @@ class CRM_Custom_Import_Form_MapField extends CRM_Contact_Import_Form_MapField { $this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params)); //Updating Mapping Records - if (CRM_Utils_Array::value('updateMapping', $params)) { + if (!empty($params['updateMapping'])) { $mappingFields = new CRM_Core_DAO_MappingField(); $mappingFields->mapping_id = $params['mappingId']; @@ -184,7 +184,7 @@ class CRM_Custom_Import_Form_MapField extends CRM_Contact_Import_Form_MapField { } //Saving Mapping Details and Records - if (CRM_Utils_Array::value('saveMapping', $params)) { + if (!empty($params['saveMapping'])) { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], @@ -220,4 +220,4 @@ class CRM_Custom_Import_Form_MapField extends CRM_Contact_Import_Form_MapField { // add all the necessary variables to the form $parser->set($this); } -} \ No newline at end of file +} diff --git a/CRM/Dedupe/Finder.php b/CRM/Dedupe/Finder.php index 62af0e5e0d..a71343b5a8 100644 --- a/CRM/Dedupe/Finder.php +++ b/CRM/Dedupe/Finder.php @@ -208,7 +208,7 @@ class CRM_Dedupe_Finder { 'gender' => 'gender_id', ); foreach (array('individual_suffix', 'individual_prefix', 'gender') as $name) { - if (CRM_Utils_Array::value($name, $fields)) { + if (!empty($fields[$name])) { $flat[$replace_these[$name]] = $flat[$name]; unset($flat[$name]); } @@ -217,7 +217,7 @@ class CRM_Dedupe_Finder { // handle {birth,deceased}_date foreach (array( 'birth_date', 'deceased_date') as $date) { - if (CRM_Utils_Array::value($date, $fields)) { + if (!empty($fields[$date])) { $flat[$date] = $fields[$date]; if (is_array($flat[$date])) { $flat[$date] = CRM_Utils_Date::format($flat[$date]); @@ -226,7 +226,7 @@ class CRM_Dedupe_Finder { } } - if (CRM_Utils_Array::value('contact_source', $flat)) { + if (!empty($flat['contact_source'])) { $flat['source'] = $flat['contact_source']; unset($flat['contact_source']); } @@ -290,13 +290,13 @@ class CRM_Dedupe_Finder { 'state_province' => 'state_province_id', 'county' => 'county_id', ); foreach ($fixes as $orig => $target) { - if (CRM_Utils_Array::value($orig, $flat)) { + if (!empty($flat[$orig])) { $params[$table][$target] = $flat[$orig]; } } } foreach ($fields as $field => $title) { - if (CRM_Utils_Array::value($field, $flat)) { + if (!empty($flat[$field])) { $params[$table][$field] = $flat[$field]; } } diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 0240ec2960..c7ac62103f 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -730,7 +730,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m // Rule: resolve address conflict if any - if ($fieldName == 'address') { $mainNewLocTypeId = $migrationInfo['location'][$fieldName][$fieldCount]['locTypeId']; - if (CRM_Utils_Array::value('main_loc_address', $migrationInfo) && + if (!empty($migrationInfo['main_loc_address']) && array_key_exists("main_{$mainNewLocTypeId}", $migrationInfo['main_loc_address'])) { // main loc already has some address for the loc-type. Its a overwrite situation. @@ -826,7 +826,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m 'preferred_communication_method' => $value, ); - if (CRM_Utils_array::value('preferred_communication_method', $contact)){ + if (!empty($contact['preferred_communication_method'])){ // api 3 returns pref_comm_method as an array, which breaks the lookup; so we reconstruct $prefCommList = is_array($specialValues[$moniker]['preferred_communication_method']) ? implode(CRM_Core_DAO::VALUE_SEPARATOR, $specialValues[$moniker]['preferred_communication_method']) : @@ -863,7 +863,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $value = CRM_Core_DAO::VALUE_SEPARATOR . trim($specialValues[$moniker][$field], CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR; } $label = isset($specialValues[$moniker]["{$field}_display"]) ? $specialValues[$moniker]["{$field}_display"] : $value; - if (CRM_Utils_Array::value('type', $fields[$field]) && $fields[$field]['type'] == CRM_Utils_Type::T_DATE) { + if (!empty($fields[$field]['type']) && $fields[$field]['type'] == CRM_Utils_Type::T_DATE) { if ($value) { $value = str_replace('-', '', $value); $label = CRM_Utils_Date::customFormat($label); @@ -872,7 +872,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $value = "null"; } } - elseif (CRM_Utils_Array::value('type', $fields[$field]) && $fields[$field]['type'] == CRM_Utils_Type::T_BOOLEAN) { + elseif (!empty($fields[$field]['type']) && $fields[$field]['type'] == CRM_Utils_Type::T_BOOLEAN) { if ($label === '0') { $label = ts('[ ]'); } @@ -1119,7 +1119,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $rows["custom_group_$gid"]['title'] = $group['title']; $foundField = TRUE; } - if (CRM_Utils_Array::value('customValue', $mainTree[$gid]['fields'][$fid])) { + if (!empty($mainTree[$gid]['fields'][$fid]['customValue'])) { foreach ($mainTree[$gid]['fields'][$fid]['customValue'] as $valueId => $values) { $rows["move_custom_$fid"]['main'] = CRM_Core_BAO_CustomGroup::formatCustomValues($values, $field, TRUE @@ -1127,7 +1127,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m } } $value = "null"; - if (CRM_Utils_Array::value('customValue', $otherTree[$gid]['fields'][$fid])) { + if (!empty($otherTree[$gid]['fields'][$fid]['customValue'])) { foreach ($otherTree[$gid]['fields'][$fid]['customValue'] as $valueId => $values) { $rows["move_custom_$fid"]['other'] = CRM_Core_BAO_CustomGroup::formatCustomValues($values, $field, TRUE @@ -1362,7 +1362,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m // get the existing custom values from db. $customParams = array('entityID' => $mainId, $key => TRUE); $customfieldValues = CRM_Core_BAO_CustomValueTable::getValues($customParams); - if (CRM_Utils_array::value($key, $customfieldValues)) { + if (!empty($customfieldValues[$key])) { $existingValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customfieldValues[$key]); if (is_array($existingValue) && !empty($existingValue)) { $mergeValue = $submmtedCustomValue = array(); @@ -1492,7 +1492,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m CRM_Core_Permission::check('delete contacts') ) { // if ext id is submitted then set it null for contact to be deleted - if (CRM_Utils_Array::value('external_identifier', $submitted)) { + if (!empty($submitted['external_identifier'])) { $query = "UPDATE civicrm_contact SET external_identifier = null WHERE id = {$otherId}"; CRM_Core_DAO::executeQuery($query); } diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 946279debd..607205377c 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -91,9 +91,9 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { static function add(&$params) { CRM_Utils_System::flushCache(); $financialTypeId = NULL; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Event', $params['id'], $params); - if (!CRM_Utils_Array::value('skipFinancialType', $params)) { + if (empty($params['skipFinancialType'])) { $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['id'], 'financial_type_id'); } } @@ -106,7 +106,7 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { $event->copyValues($params); $result = $event->save(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'Event', $event->id, $event); } else { @@ -166,7 +166,7 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { CRM_Core_BAO_Log::add($logParams); - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_event', $event->id); @@ -796,7 +796,7 @@ WHERE civicrm_event.is_active = 1 $baseURL = parse_url($config->userFrameworkBaseURL); $url = "@" . $baseURL['host']; - if (CRM_Utils_Array::value('path', $baseURL)) { + if (!empty($baseURL['path'])) { $url .= substr($baseURL['path'], 0, -1); } @@ -885,7 +885,7 @@ WHERE civicrm_event.is_active = 1 $locBlockId = CRM_Utils_Array::value('loc_block_id', $eventValues); $fieldsFix = ($afterCreate) ? array( ) : array('prefix' => array('title' => ts('Copy of') . ' ')); - if (!CRM_Utils_Array::value('is_show_location', $eventValues)) { + if (empty($eventValues['is_show_location'])) { $fieldsFix['prefix']['is_show_location'] = 0; } @@ -1068,7 +1068,7 @@ WHERE civicrm_event.is_active = 1 $preProfileID = CRM_Utils_Array::value('custom_pre_id', $values); $postProfileID = CRM_Utils_Array::value('custom_post_id', $values); - if (CRM_Utils_Array::value('additionalParticipant', $values['params'])) { + if (!empty($values['params']['additionalParticipant'])) { $preProfileID = CRM_Utils_Array::value('additional_custom_pre_id', $values, $preProfileID ); $postProfileID = CRM_Utils_Array::value('additional_custom_post_id', $values, $postProfileID ); } @@ -1130,7 +1130,7 @@ WHERE civicrm_event.is_active = 1 if ($lineItem = CRM_Utils_Array::value('lineItem', $values)) { // check if additional prticipant, if so filter only to relevant ones // CRM-9902 - if (CRM_Utils_Array::value('additionalParticipant', $values['params'])) { + if (!empty($values['params']['additionalParticipant'])) { $ownLineItems = array( ); foreach ( $lineItem as $liKey => $liValue ) { $firstElement = array_pop( $liValue ); @@ -1377,7 +1377,7 @@ WHERE civicrm_event.is_active = 1 } foreach ($fields as $v) { - if (CRM_Utils_Array::value('groupTitle', $v)) { + if (!empty($v['groupTitle'])) { $groupTitle['groupTitle'] = $v['groupTitle']; break; } @@ -1823,7 +1823,7 @@ WHERE ce.loc_block_id = $locBlockId"; $alreadyRegistered = self::checkRegistration($params); } - if (CRM_Utils_Array::value('allow_same_participant_emails', $values['event']) || + if (!empty($values['event']['allow_same_participant_emails']) || !$alreadyRegistered ) { return TRUE; @@ -1839,7 +1839,7 @@ WHERE ce.loc_block_id = $locBlockId"; */ static function checkRegistration($params) { $alreadyRegistered = FALSE; - if (!CRM_Utils_Array::value('contact_id', $params)) { + if (empty($params['contact_id'])) { return $alreadyRegistered; } @@ -1942,8 +1942,7 @@ WHERE ce.loc_block_id = $locBlockId"; $eventEmail = array(); CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $params, $eventEmail, $returnProperties); - if (CRM_Utils_Array::value('confirm_from_name', $eventEmail) - && CRM_Utils_Array::value('confirm_from_email', $eventEmail) + if (!empty($eventEmail['confirm_from_name']) && CRM_Utils_Array::value('confirm_from_email', $eventEmail) ) { $eventEmailId = "{$eventEmail['confirm_from_name']} <{$eventEmail['confirm_from_email']}>"; diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 407c15c30c..ec55eecc20 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -86,7 +86,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { */ static function &add(&$params) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Participant', $params['id'], $params); } else { @@ -94,15 +94,15 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { } // converting dates to mysql format - if (CRM_Utils_Array::value('register_date', $params)) { + if (!empty($params['register_date'])) { $params['register_date'] = CRM_Utils_Date::isoToMysql($params['register_date']); } - if (CRM_Utils_Array::value('participant_fee_amount', $params)) { + if (!empty($params['participant_fee_amount'])) { $params['participant_fee_amount'] = CRM_Utils_Rule::cleanMoney($params['participant_fee_amount']); } - if (CRM_Utils_Array::value('fee_amount', $params)) { + if (!empty($params['fee_amount'])) { $params['fee_amount'] = CRM_Utils_Rule::cleanMoney($params['fee_amount']); } @@ -112,7 +112,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { } $participantBAO = new CRM_Event_BAO_Participant; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $participantBAO->id = CRM_Utils_Array::value('id', $params); $participantBAO->find(TRUE); $participantBAO->register_date = CRM_Utils_Date::isoToMysql($participantBAO->register_date); @@ -141,7 +141,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { // reset the group contact cache for this group CRM_Contact_BAO_GroupContactCache::remove(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'Participant', $participantBAO->id, $participantBAO); } else { @@ -193,7 +193,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { $transaction = new CRM_Core_Transaction(); $status = NULL; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $status = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $params['id'], 'status_id'); } @@ -223,7 +223,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { } // add custom field values - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_participant', $participant->id); @@ -231,7 +231,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { //process note, CRM-7634 $noteId = NULL; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $note = CRM_Core_BAO_Note::getNote($params['id'], 'civicrm_participant'); $noteId = key($note); } @@ -281,7 +281,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { $transaction->commit(); // do not add to recent items for import, CRM-4399 - if (!CRM_Utils_Array::value('skipRecentView', $params)) { + if (empty($params['skipRecentView'])) { $url = CRM_Utils_System::url('civicrm/contact/view/participant', "action=view&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home" @@ -1424,7 +1424,7 @@ UPDATE civicrm_participant //don't send confirmation mail to additional //since only primary able to confirm registration. - if (CRM_Utils_Array::value('registered_by_id', $participantValues) && + if (!empty($participantValues['registered_by_id']) && $mailType == 'Confirm' ) { return $mailSent; @@ -1447,7 +1447,7 @@ UPDATE civicrm_participant //take a receipt from as event else domain. $receiptFrom = $domainValues['name'] . ' <' . $domainValues['email'] . '>'; - if (CRM_Utils_Array::value('confirm_from_name', $eventDetails) && + if (!empty($eventDetails['confirm_from_name']) && CRM_Utils_Array::value('confirm_from_email', $eventDetails) ) { $receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>'; @@ -1743,7 +1743,7 @@ WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2"; $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Discounts Account is' ")); $contributionParams['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType( $contributionParams['contribution']->financial_type_id, $relationTypeId); - if (CRM_Utils_Array::value('from_financial_account_id', $contributionParams['trxnParams'])) { + if (!empty($contributionParams['trxnParams']['from_financial_account_id'])) { $contributionParams['trxnParams']['total_amount'] = $mainAmount - $contributionParams['total_amount']; $contributionParams['trxnParams']['payment_processor_id'] = $contributionParams['trxnParams']['payment_instrument_id'] = $contributionParams['trxnParams']['check_number'] = $contributionParams['trxnParams']['trxn_id'] = diff --git a/CRM/Event/BAO/ParticipantStatusType.php b/CRM/Event/BAO/ParticipantStatusType.php index 0bcdf47af5..2eac0299cb 100644 --- a/CRM/Event/BAO/ParticipantStatusType.php +++ b/CRM/Event/BAO/ParticipantStatusType.php @@ -148,7 +148,7 @@ LEFT JOIN civicrm_event event ON ( event.id = participant.event_id ) foreach ($participantDetails as $participantId => $values) { //process the additional participant at the time of //primary participant, don't process separately. - if (CRM_Utils_Array::value('registered_by_id', $values)) { + if (!empty($values['registered_by_id'])) { continue; } @@ -195,7 +195,7 @@ LEFT JOIN civicrm_event event ON ( event.id = participant.event_id ) foreach ($participantDetails as $participantId => $values) { //process the additional participant at the time of //primary participant, don't process separately. - if (CRM_Utils_Array::value('registered_by_id', $values)) { + if (!empty($values['registered_by_id'])) { continue; } diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index 49669c3f3b..c2429467c9 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -64,25 +64,25 @@ class CRM_Event_BAO_Query { $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1; //add fee level - if (CRM_Utils_Array::value('participant_fee_level', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_fee_level'])) { $query->_select['participant_fee_level'] = "civicrm_participant.fee_level as participant_fee_level"; $query->_element['participant_fee_level'] = 1; } //add fee amount - if (CRM_Utils_Array::value('participant_fee_amount', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_fee_amount'])) { $query->_select['participant_fee_amount'] = "civicrm_participant.fee_amount as participant_fee_amount"; $query->_element['participant_fee_amount'] = 1; } //add fee currency - if (CRM_Utils_Array::value('participant_fee_currency', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_fee_currency'])) { $query->_select['participant_fee_currency'] = "civicrm_participant.fee_currency as participant_fee_currency"; $query->_element['participant_fee_currency'] = 1; } //add event title also if event id is select - if (CRM_Utils_Array::value('event_id', $query->_returnProperties) || + if (!empty($query->_returnProperties['event_id']) || CRM_Utils_Array::value('event_title', $query->_returnProperties) ) { $query->_select['event_id'] = "civicrm_event.id as event_id"; @@ -94,25 +94,25 @@ class CRM_Event_BAO_Query { } //add start date / end date - if (CRM_Utils_Array::value('event_start_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['event_start_date'])) { $query->_select['event_start_date'] = "civicrm_event.start_date as event_start_date"; $query->_element['event_start_date'] = 1; } - if (CRM_Utils_Array::value('event_end_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['event_end_date'])) { $query->_select['event_end_date'] = "civicrm_event.end_date as event_end_date"; $query->_element['event_end_date'] = 1; } //event type - if (CRM_Utils_Array::value('event_type', $query->_returnProperties)) { + if (!empty($query->_returnProperties['event_type'])) { $query->_select['event_type'] = "event_type.label as event_type"; $query->_element['event_type'] = 1; $query->_tables['event_type'] = 1; $query->_whereTables['event_type'] = 1; } - if (CRM_Utils_Array::value('event_type_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['event_type_id'])) { $query->_select['event_type_id'] = "event_type.id as event_type_id"; $query->_element['event_type_id'] = 1; $query->_tables['event_type'] = 1; @@ -120,7 +120,7 @@ class CRM_Event_BAO_Query { } //add status and status_id - if (CRM_Utils_Array::value('participant_status', $query->_returnProperties) || + if (!empty($query->_returnProperties['participant_status']) || CRM_Utils_Array::value('participant_status_id', $query->_returnProperties) ) { $query->_select['participant_status'] = "participant_status.label as participant_status"; @@ -134,7 +134,7 @@ class CRM_Event_BAO_Query { } //add role - if (CRM_Utils_Array::value('participant_role', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_role'])) { $query->_select['participant_role'] = "participant_role.label as participant_role"; $query->_element['participant_role'] = 1; $query->_tables['civicrm_participant'] = 1; @@ -143,7 +143,7 @@ class CRM_Event_BAO_Query { $query->_whereTables['participant_role'] = 1; } - if (CRM_Utils_Array::value('participant_role_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_role_id'])) { $query->_select['participant_role_id'] = "civicrm_participant.role_id as participant_role_id"; $query->_element['participant_role_id'] = 1; $query->_tables['civicrm_participant'] = 1; @@ -153,43 +153,43 @@ class CRM_Event_BAO_Query { } //add register date - if (CRM_Utils_Array::value('participant_register_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_register_date'])) { $query->_select['participant_register_date'] = "civicrm_participant.register_date as participant_register_date"; $query->_element['participant_register_date'] = 1; } //add source - if (CRM_Utils_Array::value('participant_source', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_source'])) { $query->_select['participant_source'] = "civicrm_participant.source as participant_source"; $query->_element['participant_source'] = 1; $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1; } //participant note - if (CRM_Utils_Array::value('participant_note', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_note'])) { $query->_select['participant_note'] = "civicrm_note.note as participant_note"; $query->_element['participant_note'] = 1; $query->_tables['participant_note'] = 1; $query->_whereTables['civicrm_note'] = 1; } - if (CRM_Utils_Array::value('participant_is_pay_later', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_is_pay_later'])) { $query->_select['participant_is_pay_later'] = "civicrm_participant.is_pay_later as participant_is_pay_later"; $query->_element['participant_is_pay_later'] = 1; } - if (CRM_Utils_Array::value('participant_is_test', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_is_test'])) { $query->_select['participant_is_test'] = "civicrm_participant.is_test as participant_is_test"; $query->_element['participant_is_test'] = 1; } - if (CRM_Utils_Array::value('participant_registered_by_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_registered_by_id'])) { $query->_select['participant_registered_by_id'] = "civicrm_participant.registered_by_id as participant_registered_by_id"; $query->_element['participant_registered_by_id'] = 1; } // get discount name - if (CRM_Utils_Array::value('participant_discount_name', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_discount_name'])) { $query->_select['participant_discount_name'] = "discount_name.title as participant_discount_name"; $query->_element['participant_discount_name'] = 1; $query->_tables['civicrm_discount'] = 1; @@ -199,7 +199,7 @@ class CRM_Event_BAO_Query { } //carry campaign id to selectors. - if (CRM_Utils_Array::value('participant_campaign_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['participant_campaign_id'])) { $query->_select['participant_campaign_id'] = 'civicrm_participant.campaign_id as participant_campaign_id'; $query->_element['participant_campaign_id'] = 1; } @@ -209,7 +209,7 @@ class CRM_Event_BAO_Query { static function where(&$query) { $grouping = NULL; foreach (array_keys($query->_params) as $id) { - if (!CRM_Utils_Array::value(0, $query->_params[$id])) { + if (empty($query->_params[$id][0])) { continue; } if (substr($query->_params[$id][0], 0, 6) == 'event_' || @@ -617,7 +617,7 @@ class CRM_Event_BAO_Query { static function tableNames(&$tables) { //add participant table - if (CRM_Utils_Array::value('civicrm_event', $tables)) { + if (!empty($tables['civicrm_event'])) { $tables = array_merge(array('civicrm_participant' => 1), $tables); } } diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index 3bba4af06f..3d69472aae 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -55,7 +55,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { } if (self::is_administrator()) { - if (CRM_Utils_Array::value('note', $params)) { + if (!empty($params['note'])) { $note_params = array( 'participant_id' => $participant->id, 'contact_id' => self::getContactID(), @@ -68,7 +68,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $participant->copyValues($participantParams); $participant->save(); - if (CRM_Utils_Array::value('contributionID', $params)) { + if (!empty($params['contributionID'])) { $payment_params = array( 'participant_id' => $participant->id, 'contribution_id' => $params['contributionID'], @@ -461,7 +461,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $contribution_statuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); $params['payment_instrument_id'] = NULL; - if (CRM_Utils_Array::value('is_pay_later', $params)) { + if (!empty($params['is_pay_later'])) { $params['payment_instrument_id'] = CRM_Core_OptionGroup::getValue('payment_instrument', 'Check', 'name'); $trxn_prefix = 'CK'; } @@ -610,7 +610,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $mer_participant->contribution_id = $contribution->id; $params['contributionID'] = $contribution->id; $params['receive_date'] = $contribution->receive_date; - if (CRM_Utils_Array::value('financial_trxn_id', $params)) { + if (!empty($params['financial_trxn_id'])) { $entity_financial_trxn_params = array( 'entity_table' => "civicrm_contribution", 'entity_id' => $contribution->id, @@ -661,7 +661,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $defaults["billing_contact_email"] = $email['email']; } } - if (!CRM_Utils_Array::value('billing_contact_email', $defaults)) { + if (empty($defaults['billing_contact_email'])) { foreach ($contact->email as $email) { if ($email['is_primary']) { $defaults["billing_contact_email"] = $email['email']; diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index 34aec68548..1f35cb46a4 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -81,7 +81,7 @@ class CRM_Event_Form_EventFees { $returnProperities = array( 'confirm_email_text', 'financial_type_id', 'campaign_id', 'start_date' ); $details = array(); CRM_Core_DAO::commonRetrieveAll('CRM_Event_DAO_Event', 'id', $form->_eventId, $details, $returnProperities); - if ( CRM_Utils_Array::value( 'financial_type_id', $details[$form->_eventId] ) ) { + if (!empty($details[$form->_eventId]['financial_type_id'])) { $defaults[$form->_pId]['financial_type_id'] = $details[$form->_eventId]['financial_type_id']; } } @@ -126,17 +126,17 @@ class CRM_Event_Form_EventFees { } //CRM-13420 - if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) { + if (empty($defaults['payment_instrument_id'])) { $defaults[$form->_pId]['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')); } if ($form->_mode) { $config = CRM_Core_Config::singleton(); // set default country from config if no country set - if (!CRM_Utils_Array::value("billing_country_id-{$form->_bltID}", $defaults[$form->_pId])) { + if (empty($defaults[$form->_pId]["billing_country_id-{$form->_bltID}"])) { $defaults[$form->_pId]["billing_country_id-{$form->_bltID}"] = $config->defaultContactCountry; } - if (!CRM_Utils_Array::value("billing_state_province_id-{$form->_bltID}", $defaults)) { + if (empty($defaults["billing_state_province_id-{$form->_bltID}"])) { $defaults[$form->_pId]["billing_state_province_id-{$form->_bltID}"] = $config->defaultContactStateProvince; } @@ -230,7 +230,7 @@ class CRM_Event_Form_EventFees { } //CRM-4453 - if (CRM_Utils_Array::value('participant_fee_currency', $defaults[$form->_pId])) { + if (!empty($defaults[$form->_pId]['participant_fee_currency'])) { $form->assign('fee_currency', $defaults[$form->_pId]['participant_fee_currency']); } diff --git a/CRM/Event/Form/ManageEvent/EventInfo.php b/CRM/Event/Form/ManageEvent/EventInfo.php index 2539671f40..f48295cb19 100644 --- a/CRM/Event/Form/ManageEvent/EventInfo.php +++ b/CRM/Event/Form/ManageEvent/EventInfo.php @@ -74,7 +74,7 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { $showLocation = FALSE; // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { $this->set('type', 'Event'); $this->set('subType', CRM_Utils_Array::value('event_type_id', $_POST)); $this->set('entityId', $this->_id); @@ -109,15 +109,15 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { $defaults = parent::setDefaultValues(); // in update mode, we need to set custom data subtype to tpl - if (CRM_Utils_Array::value('event_type_id', $defaults)) { + if (!empty($defaults['event_type_id'])) { $this->assign('customDataSubType', $defaults['event_type_id']); } $this->_showHide = new CRM_Core_ShowHideBlocks(); // Show waitlist features or event_full_text if max participants set - if (CRM_Utils_Array::value('max_participants', $defaults)) { + if (!empty($defaults['max_participants'])) { $this->_showHide->addShow('id-waitlist'); - if (CRM_Utils_Array::value('has_waitlist', $defaults)) { + if (!empty($defaults['has_waitlist'])) { $this->_showHide->addShow('id-waitlist-text'); $this->_showHide->addHide('id-event_full'); } @@ -143,7 +143,7 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { $defaults['waitlist_text'] = CRM_Utils_Array::value('waitlist_text', $defaults, ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.')); list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value('start_date', $defaults), 'activityDateTime'); - if (CRM_Utils_Array::value('end_date', $defaults)) { + if (!empty($defaults['end_date'])) { list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['end_date'], 'activityDateTime'); } return $defaults; @@ -322,14 +322,14 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { ); //merge params with defaults from templates - if (CRM_Utils_Array::value('template_id', $params)) { + if (!empty($params['template_id'])) { $params = array_merge(CRM_Event_BAO_Event::getTemplateDefaultValues($params['template_id']), $params); } $event = CRM_Event_BAO_Event::create($params); // now that we have the event’s id, do some more template-based stuff - if (CRM_Utils_Array::value('template_id', $params)) { + if (!empty($params['template_id'])) { CRM_Event_BAO_Event::copy($params['template_id'], $event, TRUE); } diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index 61ec49e7e9..60cc6a20dd 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -152,7 +152,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $defaults['discounted_value'][$discountFieldsval['weight']][$rowCount] = CRM_Utils_Money::format($discountFieldsval['amount'], NULL, '%a'); $defaults['discount_option_id'][$rowCount][$discountFieldsval['weight']]= $discountFieldsval['id']; - if (CRM_Utils_Array::value('is_default', $discountFieldsval)) { + if (!empty($discountFieldsval['is_default'])) { $defaults['discounted_default'] = $discountFieldsval['weight']; } } @@ -185,7 +185,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { //if Regular Fees are present in DB and event fee page is in update mode $defaults['discounted_label'] = $defaults['label']; } - elseif (CRM_Utils_Array::value('label', $this->_submitValues)) { + elseif (!empty($this->_submitValues['label'])) { //if event is newly created, use submitted values for //discount labels if (is_array($this->_submitValues['label'])) { @@ -242,7 +242,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $this->_showHide->addToTemplate(); $this->assign('inDate', $this->_inDate); - if (CRM_Utils_Array::value('payment_processor', $defaults)) { + if (!empty($defaults['payment_processor'])) { $defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR, $defaults['payment_processor'] ), '1'); @@ -420,17 +420,17 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { */ static function formRule($values) { $errors = array(); - if (CRM_Utils_Array::value('is_discount', $values)) { + if (!empty($values['is_discount'])) { $occurDiscount = array_count_values($values['discount_name']); $countemptyrows = 0; $countemptyvalue = 0; for ($i = 1; $i <= self::NUM_DISCOUNT; $i++) { $start_date = $end_date = NULL; - if (CRM_Utils_Array::value($i, $values['discount_name'])) { - if (CRM_Utils_Array::value($i, $values['discount_start_date'])) { + if (!empty($values['discount_name'][$i])) { + if (!empty($values['discount_start_date'][$i])) { $start_date = ($values['discount_start_date'][$i]) ? CRM_Utils_Date::processDate($values['discount_start_date'][$i]) : 0; } - if (CRM_Utils_Array::value($i, $values['discount_end_date'])) { + if (!empty($values['discount_end_date'][$i])) { $end_date = ($values['discount_end_date'][$i]) ? CRM_Utils_Date::processDate($values['discount_end_date'][$i]) : 0; } @@ -482,7 +482,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $countemptyvalue++; } } - if (CRM_Utils_Array::value('_qf_Fee_next', $values) && ($countemptyrows == 11 || $countemptyvalue == 11)) { + if (!empty($values['_qf_Fee_next']) && ($countemptyrows == 11 || $countemptyvalue == 11)) { $errors["discounted_label[1]"] = $errors["discounted_value[1][$i]"] = ts('At least one fee should be entered for your Discount Set. If you do not see the table to enter discount fees, click the "Add Discount Set to Fee Table" button.'); } } @@ -499,7 +499,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $errors['fee_label'] = ts('Please enter the fee label for the paid event.'); } - if (!CRM_Utils_Array::value('price_set_id', $values)) { + if (empty($values['price_set_id'])) { //check fee label and amount $check = 0; $optionKeys = array(); @@ -566,7 +566,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $this->set('discountSection', 0); - if (CRM_Utils_Array::value('_qf_Fee_submit', $_POST)) { + if (!empty($_POST['_qf_Fee_submit'])) { $this->buildAmountLabel(); $this->set('discountSection', 2); return; @@ -593,9 +593,9 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } if ($params['is_monetary']) { - if (CRM_Utils_Array::value('price_set_id', $params)) { + if (!empty($params['price_set_id'])) { CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $params['price_set_id']); - if (CRM_Utils_Array::value('price_field_id', $params)) { + if (!empty($params['price_field_id'])) { $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id'); CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0); } @@ -619,8 +619,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } if (!empty($options)) { $params['default_fee_id'] = NULL; - if (!CRM_Utils_Array::value('price_set_id', $params)) { - if (!CRM_Utils_Array::value('price_field_id', $params)) { + if (empty($params['price_set_id'])) { + if (empty($params['price_field_id'])) { $setParams['title'] = $eventTitle = ($this->_isTemplate) ? $this->_defaultValues['template_title'] : $this->_defaultValues['title']; $eventTitle = strtolower(CRM_Utils_String::munge($eventTitle, '_', 245)); if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle, 'id', 'name')) { @@ -702,7 +702,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $params['default_discount_fee_id'] = NULL; $keyCheck = $j-1; $setParams = array(); - if (!CRM_Utils_Array::value($keyCheck, $discountPriceSets)) { + if (empty($discountPriceSets[$keyCheck])) { if (!$eventTitle) { $eventTitle = strtolower(CRM_Utils_String::munge($this->_defaultValues['title'], '_', 200)); } @@ -746,10 +746,10 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $fieldParams['option_label'][$value['weight']] = $value['label']; $fieldParams['option_amount'][$value['weight']] = $value['value']; $fieldParams['option_weight'][$value['weight']] = $value['weight']; - if (CRM_Utils_Array::value('is_default', $value)) { + if (!empty($value['is_default'])) { $fieldParams['default_option'] = $value['weight']; } - if (CRM_Utils_Array::value($j, $discountFieldIDs) && CRM_Utils_Array::value($value['weight'], $discountFieldIDs[$j])) { + if (!empty($discountFieldIDs[$j]) && CRM_Utils_Array::value($value['weight'], $discountFieldIDs[$j])) { $fieldParams['option_id'][$value['weight']] = $discountFieldIDs[$j][$value['weight']]; unset($discountFieldIDs[$j][$value['weight']]); } @@ -782,7 +782,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } } else { - if (CRM_Utils_Array::value('price_field_id', $params)) { + if (!empty($params['price_field_id'])) { $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id'); CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0); } diff --git a/CRM/Event/Form/ManageEvent/Location.php b/CRM/Event/Form/ManageEvent/Location.php index c671ce0459..844f67aa5a 100644 --- a/CRM/Event/Form/ManageEvent/Location.php +++ b/CRM/Event/Form/ManageEvent/Location.php @@ -202,10 +202,10 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent { $locationEvents = CRM_Event_BAO_Event::getLocationEvents(); // remove duplicates and make sure that the duplicate entry with key as // loc_block_id of this event (this->_id) is preserved - if (CRM_Utils_Array::value($this->_oldLocBlockId, $locationEvents)) { + if (!empty($locationEvents[$this->_oldLocBlockId])) { $possibleDuplicate = $locationEvents[$this->_oldLocBlockId]; $locationEvents = array_flip(array_unique($locationEvents)); - if (CRM_Utils_Array::value($possibleDuplicate, $locationEvents)) { + if (!empty($locationEvents[$possibleDuplicate])) { $locationEvents[$possibleDuplicate] = $this->_oldLocBlockId; } $locationEvents = array_flip($locationEvents); @@ -283,7 +283,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent { $defaultLocationType = CRM_Core_BAO_LocationType::getDefault(); foreach (array( 'address', 'phone', 'email') as $block) { - if (!CRM_Utils_Array::value($block, $params) || !is_array($params[$block])) { + if (empty($params[$block]) || !is_array($params[$block])) { continue; } foreach ($params[$block] as $count => & $values) { diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index 65d2f86809..f43f9c26f6 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -145,7 +145,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $this->assign('profilePostMultiple', CRM_Utils_Array::value('custom_post', $defaults)); - if (CRM_Utils_Array::value('is_multiple_registrations', $defaults)) { + if (!empty($defaults['is_multiple_registrations'])) { // CRM-4377: set additional participants’ profiles – set to ‘none’ if explicitly unset (non-active) $ufJoinAddParams = array( @@ -184,7 +184,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $defaults['thankyou_title'] = CRM_Utils_Array::value('thankyou_title', $defaults, ts('Thank You for Registering')); $defaults['approval_req_text'] = CRM_Utils_Array::value('approval_req_text', $defaults, ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.')); - if (CRM_Utils_Array::value('registration_start_date', $defaults)) { + if (!empty($defaults['registration_start_date'])) { list($defaults['registration_start_date'], $defaults['registration_start_date_time'] ) = CRM_Utils_Date::setDateDefaults($defaults['registration_start_date'], @@ -192,7 +192,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent ); } - if (CRM_Utils_Array::value('registration_end_date', $defaults)) { + if (!empty($defaults['registration_end_date'])) { list($defaults['registration_end_date'], $defaults['registration_end_date_time'] ) = CRM_Utils_Date::setDateDefaults($defaults['registration_end_date'], @@ -222,11 +222,11 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $this->_showHide->addHide('id-approval-text'); } else { - if (!CRM_Utils_Array::value('is_multiple_registrations', $defaults)) { + if (empty($defaults['is_multiple_registrations'])) { $this->_showHide->addHide('additional_profile_pre'); $this->_showHide->addHide('additional_profile_post'); } - if (!CRM_Utils_Array::value('requires_approval', $defaults)) { + if (empty($defaults['requires_approval'])) { $this->_showHide->addHide('id-approval-text'); } } @@ -442,7 +442,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent * @access public */ static function formRule($values, $files, $form) { - if (CRM_Utils_Array::value('is_online_registration', $values)) { + if (!empty($values['is_online_registration'])) { if (!$values['confirm_title']) { $errorMsg['confirm_title'] = ts('Please enter a Title for the registration Confirmation Page'); @@ -501,7 +501,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent } $additionalCustomPreId = $additionalCustomPostId = NULL; $isPreError = $isPostError = TRUE; - if (CRM_Utils_Array::value('allow_same_participant_emails', $values) && + if (!empty($values['allow_same_participant_emails']) && CRM_Utils_Array::value('is_multiple_registrations', $values) ) { $types = array_merge(array('Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual')); @@ -580,7 +580,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent // // CRM-8485 // $config = CRM_Core_Config::singleton(); // if ( $config->doNotAttachPDFReceipt ) { - // if ( CRM_Utils_Array::value('custom_post_id_multiple', $values) ) { + // if (!empty($values['custom_post_id_multiple'])) { // foreach( $values['custom_post_id_multiple'] as $count => $customPostMultiple ) { // if ( $customPostMultiple ) { // $errorMsg["custom_post_id_multiple[{$count}]"] = ts('Please disable PDF receipt as an attachment in Miscellaneous Settings if you want to add additional profiles.', array( 1 => CRM_Utils_System::url( 'civicrm/admin/setting/misc', 'reset=1' ) ) ); @@ -589,7 +589,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent // } // } // - // if ( CRM_Utils_Array::value('is_multiple_registrations', $values) && + // if (!empty($values['is_multiple_registrations']) && // CRM_Utils_Array::value('additional_custom_post_id_multiple', $values) ) { // foreach( $values['additional_custom_post_id_multiple'] as $count => $customPostMultiple ) { // if ( $customPostMultiple ) { @@ -601,13 +601,13 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent // } if (!empty($errorMsg)) { - if (CRM_Utils_Array::value('custom_post_id_multiple', $values)) { + if (!empty($values['custom_post_id_multiple'])) { foreach ($values['custom_post_id_multiple'] as $count => $customPostMultiple) { self::buildMultipleProfileBottom($form, $count); } $form->assign('profilePostMultiple', $values['custom_post_id_multiple']); } - if (CRM_Utils_Array::value('additional_custom_post_id_multiple', $values)) { + if (!empty($values['additional_custom_post_id_multiple'])) { foreach ($values['additional_custom_post_id_multiple'] as $count => $customPostMultiple) { self::buildMultipleProfileBottom($form, $count, 'additional_', ts('Profile for Additional Participants')); } @@ -747,7 +747,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $uf[2] = $params['custom_post_id']; } - if (CRM_Utils_Array::value('custom_post_id_multiple', $params)) { + if (!empty($params['custom_post_id_multiple'])) { $uf = array_merge($uf, $params['custom_post_id_multiple']); } $uf = array_values($uf); @@ -769,12 +769,12 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent // first delete all past entries CRM_Core_BAO_UFJoin::deleteAll($ufJoinParamsAdd); - if (CRM_Utils_Array::value('is_multiple_registrations', $params)) { + if (!empty($params['is_multiple_registrations'])) { $ufAdd = array(); $wtAdd = 2; if (array_key_exists('additional_custom_pre_id', $params)) { - if (!CRM_Utils_Array::value('additional_custom_pre_id', $params)) { + if (empty($params['additional_custom_pre_id'])) { $ufAdd[1] = $params['custom_pre_id']; $wtAdd = 1; } @@ -786,7 +786,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent } if (array_key_exists('additional_custom_post_id', $params)) { - if (!CRM_Utils_Array::value('additional_custom_post_id', $params)) { + if (empty($params['additional_custom_post_id'])) { $ufAdd[2] = $params['custom_post_id']; } elseif (CRM_Utils_Array::value('additional_custom_post_id', $params) == 'none') {} @@ -795,7 +795,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent } } - if (CRM_Utils_Array::value('additional_custom_post_id_multiple', $params)) { + 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)) { diff --git a/CRM/Event/Form/ManageEvent/ScheduleReminders.php b/CRM/Event/Form/ManageEvent/ScheduleReminders.php index acbc2dcefa..e9f26ae8d7 100755 --- a/CRM/Event/Form/ManageEvent/ScheduleReminders.php +++ b/CRM/Event/Form/ManageEvent/ScheduleReminders.php @@ -233,7 +233,7 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage */ static function formRule($fields) { $errors = array(); - if (CRM_Utils_Array::value('is_active', $fields) && + if (!empty($fields['is_active']) && CRM_Utils_System::isNull($fields['subject']) ) { $errors['subject'] = ts('Subject is a required field.'); @@ -354,12 +354,12 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage //mail template is composed $composeParams = array(); foreach ($composeFields as $key) { - if (CRM_Utils_Array::value($key, $values)) { + if (!empty($values[$key])) { $composeParams[$key] = $values[$key]; } } - if (CRM_Utils_Array::value('updateTemplate', $composeParams)) { + if (!empty($composeParams['updateTemplate'])) { $templateParams = array( 'msg_text' => $params['body_text'], 'msg_html' => $params['body_html'], @@ -372,7 +372,7 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } - if (CRM_Utils_Array::value('saveTemplate', $composeParams)) { + if (!empty($composeParams['saveTemplate'])) { $templateParams = array( 'msg_text' => $params['body_text'], 'msg_html' => $params['body_html'], diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 4620daf142..5406562b70 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 (CRM_Utils_Array::value('hidden_feeblock', $_POST) - || CRM_Utils_Array::value('send_receipt', $_POST) + if (!empty($_POST['hidden_feeblock']) || CRM_Utils_Array::value('send_receipt', $_POST) ) { CRM_Event_Form_EventFees::preProcess($this); CRM_Event_Form_EventFees::buildQuickForm($this); @@ -416,9 +415,9 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task { } // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { //custom data of type participant role - if (CRM_Utils_Array::value('role_id', $_POST)) { + if (!empty($_POST['role_id'])) { foreach ($_POST['role_id'] as $k => $val) { $roleID = $val; CRM_Custom_Form_CustomData::preProcess($this, $this->_roleCustomDataTypeID, $k, 1, 'Participant', $this->_id); @@ -554,7 +553,7 @@ SELECT civicrm_custom_group.name as name, } // Get registered_by contact ID and display_name if participant was registered by someone else (CRM-4859) - if (CRM_Utils_Array::value('participant_registered_by_id', $defaults[$this->_id])) { + if (!empty($defaults[$this->_id]['participant_registered_by_id'])) { $registered_by_contact_id = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $defaults[$this->_id]['participant_registered_by_id'], 'contact_id', 'id' @@ -578,7 +577,7 @@ SELECT civicrm_custom_group.name as name, if ($this->_action == CRM_Core_Action::ADD) { $statuses = array_flip($this->_participantStatuses); $defaults[$this->_id]['status_id'] = CRM_Utils_Array::value(ts('Registered'), $statuses); - if (CRM_Utils_Array::value('event_id', $defaults[$this->_id])) { + if (!empty($defaults[$this->_id]['event_id'])) { $contributionTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $defaults[$this->_id]['event_id'], 'financial_type_id' @@ -604,7 +603,7 @@ SELECT civicrm_custom_group.name as name, } $submittedRole = $this->getElementValue('role_id'); - if (CRM_Utils_Array::value(0, $submittedRole)) { + if (!empty($submittedRole[0])) { $roleID = $submittedRole[0]; } $submittedEvent = $this->getElementValue('event_id'); @@ -639,7 +638,7 @@ SELECT civicrm_custom_group.name as name, //assign event and role id, this is needed for Custom data building $sep = CRM_Core_DAO::VALUE_SEPARATOR; - if (CRM_Utils_Array::value('participant_role_id', $defaults[$this->_id])) { + if (!empty($defaults[$this->_id]['participant_role_id'])) { $roleIDs = explode($sep, $defaults[$this->_id]['participant_role_id']); } if (isset($roleIDs)) { @@ -821,7 +820,7 @@ WHERE civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0"; // but we do the same for the onChange element and this form is complex // and i did not want to break it late in the 3.2 cycle $preloadJSSnippet = NULL; - if (CRM_Utils_Array::value('reset', $_GET) && $this->_eID) { + if (!empty($_GET['reset']) && $this->_eID) { $preloadJSSnippet = " cj(function() { cj('#event_id').val( '{$this->_eID}' ); @@ -994,16 +993,16 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $errorMsg['contact[1]'] = ts('Please select a contact or create new contact'); } - if (CRM_Utils_Array::value('payment_processor_id', $values)) { + if (!empty($values['payment_processor_id'])) { // make sure that credit card number and cvv are valid CRM_Core_Payment_Form::validateCreditCard($values, $errorMsg); } - if (CRM_Utils_Array::value('record_contribution', $values)) { - if (!CRM_Utils_Array::value('financial_type_id', $values)) { + if (!empty($values['record_contribution'])) { + if (empty($values['financial_type_id'])) { $errorMsg['financial_type_id'] = ts('Please enter the associated Financial Type'); } - if (!CRM_Utils_Array::value('payment_instrument_id', $values)) { + if (empty($values['payment_instrument_id'])) { $errorMsg['payment_instrument_id'] = ts('Paid By is a required field.'); } } @@ -1064,7 +1063,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $participantStatus = CRM_Event_PseudoConstant::participantStatus(); // set the contact, when contact is selected - if (CRM_Utils_Array::value('contact_select_id', $params)) { + if (!empty($params['contact_select_id'])) { $this->_contactId = $params['contact_select_id'][1]; } if ($this->_priceSetId && $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { @@ -1106,7 +1105,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); else { //check if discount is selected - if (CRM_Utils_Array::value('discount_id', $params)) { + if (!empty($params['discount_id'])) { $discountId = $params['discount_id']; } else { @@ -1177,7 +1176,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $params['contact_id'] = $this->_contactId; // overwrite actual payment amount if entered - if (CRM_Utils_Array::value('total_amount', $params)) { + if (!empty($params['total_amount'])) { $contributionParams['total_amount'] = CRM_Utils_Array::value('total_amount', $params); } @@ -1311,7 +1310,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); // all the payment processors expect the name and address to be in the // so we copy stuff over to first_name etc. $paymentParams = $this->_params; - if (CRM_Utils_Array::value('send_receipt', $this->_params)) { + if (!empty($this->_params['send_receipt'])) { $paymentParams['email'] = $this->_contributorEmail; } CRM_Core_Payment_Form::mapParams($this->_bltID, $this->_params, $paymentParams, TRUE); @@ -1333,7 +1332,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $this->_params['receive_date'] = $now; - if (CRM_Utils_Array::value('send_receipt', $this->_params)) { + if (!empty($this->_params['send_receipt'])) { $this->_params['receipt_date'] = $now; } else { @@ -1356,7 +1355,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); // add participant record $participants = array(); - if (CRM_Utils_Array::value('participant_role_id', $this->_params) && is_array($this->_params['participant_role_id'])) { + if (!empty($this->_params['participant_role_id']) && is_array($this->_params['participant_role_id'])) { $this->_params['participant_role_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($this->_params['participant_role_id']) ); @@ -1427,8 +1426,8 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); } $contributions = array(); - if (CRM_Utils_Array::value('record_contribution', $params)) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['record_contribution'])) { + if (!empty($params['id'])) { if ($this->_onlinePendingContributionId) { $ids['contribution'] = $this->_onlinePendingContributionId; } @@ -1513,7 +1512,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); // CRM-11124 if ($this->_quickConfig) { - if (CRM_Utils_Array::value('amount_priceset_level_radio', $this->_params)) { + if (!empty($this->_params['amount_priceset_level_radio'])) { $feeLevel = $this->_params['amount_priceset_level_radio']; } else { @@ -1562,7 +1561,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $sent = array(); $notSent = array(); - if (CRM_Utils_Array::value('send_receipt', $params)) { + if (!empty($params['send_receipt'])) { if (array_key_exists($params['from_email_address'], $this->_fromEmails['from_email_id'])) { $receiptFrom = $params['from_email_address']; } @@ -1628,15 +1627,15 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params)); } if ($this->_mode) { - if (CRM_Utils_Array::value('billing_first_name', $params)) { + if (!empty($params['billing_first_name'])) { $name = $params['billing_first_name']; } - if (CRM_Utils_Array::value('billing_middle_name', $params)) { + if (!empty($params['billing_middle_name'])) { $name .= " {$params['billing_middle_name']}"; } - if (CRM_Utils_Array::value('billing_last_name', $params)) { + if (!empty($params['billing_last_name'])) { $name .= " {$params['billing_last_name']}"; } $this->assign('billingName', $name); @@ -1678,7 +1677,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $participant = array(array('participant_id', '=', $participants[0]->id, 0, 0)); // check whether its a test drive ref CRM-3075 - if (CRM_Utils_Array::value('is_test', $this->_defaultValues)) { + if (!empty($this->_defaultValues['is_test'])) { $participant[] = array('participant_test', '=', 1, 0, 0); } @@ -1769,7 +1768,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); if (($this->_action & CRM_Core_Action::UPDATE)) { $statusMsg = ts('Event registration information for %1 has been updated.', array(1 => $this->_contributorDisplayName)); - if (CRM_Utils_Array::value('send_receipt', $params) && count($sent)) { + if (!empty($params['send_receipt']) && count($sent)) { $statusMsg .= ' ' . ts('A confirmation email has been sent to %1', array(1 => $this->_contributorEmail)); } @@ -1780,7 +1779,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); elseif ($this->_action & CRM_Core_Action::ADD) { if ($this->_single) { $statusMsg = ts('Event registration for %1 has been added.', array(1 => $this->_contributorDisplayName)); - if (CRM_Utils_Array::value('send_receipt', $params) && count($sent)) { + if (!empty($params['send_receipt']) && count($sent)) { $statusMsg .= ' ' . ts('A confirmation email has been sent to %1.', array(1 => $this->_contributorEmail)); } } diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index b8da44ab59..fd69ba2945 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -62,7 +62,7 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { CRM_Event_BAO_Participant::resolveDefaults($values[$participantID]); - if (CRM_Utils_Array::value('fee_level', $values[$participantID])) { + if (!empty($values[$participantID]['fee_level'])) { CRM_Event_BAO_Participant::fixEventLevel($values[$participantID]['fee_level']); } @@ -91,7 +91,7 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $values[$participantID]['totalAmount'] = CRM_Utils_Array::value('fee_amount', $values[$participantID]); // Get registered_by contact ID and display_name if participant was registered by someone else (CRM-4859) - if (CRM_Utils_Array::value('participant_registered_by_id', $values[$participantID])) { + if (!empty($values[$participantID]['participant_registered_by_id'])) { $values[$participantID]['registered_by_contact_id'] = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $values[$participantID]['participant_registered_by_id'], 'contact_id', 'id' @@ -129,7 +129,7 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $finalTree); $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $values[$participantID]['event_id'], 'title'); //CRM-7150, show event name on participant view even if the event is disabled - if (!CRM_Utils_Array::value('event', $values[$participantID])) { + if (empty($values[$participantID]['event'])) { $values[$participantID]['event'] = $eventTitle; } diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 0846b472d4..82bfebc447 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -290,7 +290,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { //check for require requires approval. $this->_requireApproval = FALSE; - if (CRM_Utils_Array::value('requires_approval', $this->_values['event']) && !$this->_allowConfirmation) { + if (!empty($this->_values['event']['requires_approval']) && !$this->_allowConfirmation) { $this->_requireApproval = TRUE; } $this->set('requireApproval', $this->_requireApproval); @@ -481,15 +481,15 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $params = $this->_params[0]; } $name = ''; - if (CRM_Utils_Array::value('billing_first_name', $params)) { + if (!empty($params['billing_first_name'])) { $name = $params['billing_first_name']; } - if (CRM_Utils_Array::value('billing_middle_name', $params)) { + if (!empty($params['billing_middle_name'])) { $name .= " {$params['billing_middle_name']}"; } - if (CRM_Utils_Array::value('billing_last_name', $params)) { + if (!empty($params['billing_last_name'])) { $name .= " {$params['billing_last_name']}"; } $this->assign('billingName', $name); @@ -501,7 +501,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { ); foreach ($vars as $v) { - if (CRM_Utils_Array::value($v, $params)) { + if (!empty($params[$v])) { if ($v == 'receive_date') { $this->assign($v, CRM_Utils_Date::mysqlToIso($params[$v])); } @@ -628,7 +628,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $fields = @array_diff_assoc($fields, $this->_fields); } - if (!CRM_Utils_Array::value('additional_participants', $this->_params[0]) && + if (empty($this->_params[0]['additional_participants']) && is_null($cid) ) { CRM_Core_BAO_Address::checkContactSharedAddressFields($fields, $contactID); @@ -743,7 +743,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->_params = $this->get('value'); //get the amount of primary participant - if (CRM_Utils_Array::value('is_primary', $this->_params)) { + if (!empty($this->_params['is_primary'])) { $this->_params['fee_amount'] = $this->get('primaryParticipantAmount'); } @@ -752,7 +752,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->_participantIDS[] = $participant->id; //setting register_by_id field and primaryContactId - if (CRM_Utils_Array::value('is_primary', $this->_params)) { + if (!empty($this->_params['is_primary'])) { $this->set('registerByID', $participant->id); $this->set('primaryContactId', $contactID); @@ -801,7 +801,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->assign('action', $this->_action); // create CMS user - if (CRM_Utils_Array::value('cms_create_account', $this->_params)) { + if (!empty($this->_params['cms_create_account'])) { $this->_params['contactID'] = $contactID; if (array_key_exists('email-5', $this->_params)) { @@ -820,7 +820,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { // 2. pay later participant. // 3. waiting list participant. // 4. require approval participant. - if (CRM_Utils_Array::value('is_pay_later', $this->_params) || + if (!empty($this->_params['is_pay_later']) || $this->_allowWaitlist || $this->_requireApproval || !CRM_Utils_Array::value('is_monetary', $this->_values['event']) ) { @@ -865,7 +865,7 @@ WHERE v.option_group_id = g.id if ($this->_allowConfirmation && $this->_participantId) { $registerDate = $params['participant_register_date']; } - elseif (CRM_Utils_Array::value('participant_register_date', $params) && + elseif (!empty($params['participant_register_date']) && is_array($params['participant_register_date']) && !empty($params['participant_register_date']) ) { @@ -900,10 +900,10 @@ WHERE v.option_group_id = g.id $participantParams['is_test'] = 0; } - if (CRM_Utils_Array::value('note', $this->_params)) { + if (!empty($this->_params['note'])) { $participantParams['note'] = $this->_params['note']; } - elseif (CRM_Utils_Array::value('participant_note', $this->_params)) { + elseif (!empty($this->_params['participant_note'])) { $participantParams['note'] = $this->_params['participant_note']; } @@ -1091,11 +1091,11 @@ WHERE v.option_group_id = g.id } $priceSetFields = $priceMaxFieldDetails = array(); - if (CRM_Utils_Array::value('optionsCountTotal', $priceSet)) { + if (!empty($priceSet['optionsCountTotal'])) { $priceSetFields = $priceSet['optionsCountDetails']['fields']; } - if (CRM_Utils_Array::value('optionsMaxValueTotal', $priceSet)) { + if (!empty($priceSet['optionsMaxValueTotal'])) { $priceMaxFieldDetails = $priceSet['optionsMaxValueDetails']['fields']; } @@ -1297,7 +1297,7 @@ WHERE v.option_group_id = g.id if (!is_array($values) || $values == 'skip') { continue; } - if (!CRM_Utils_Array::value($pNum, $fieldSelected)) { + if (empty($fieldSelected[$pNum])) { $errors[$pNum]['_qf_default'] = ts('Select at least one option from Event Fee(s).'); } } @@ -1339,7 +1339,7 @@ WHERE v.option_group_id = g.id } // is this an event template ? - if (CRM_Utils_Array::value('is_template', $this->_values['event'])) { + if (!empty($this->_values['event']['is_template'])) { CRM_Core_Error::statusBounce(ts('Event templates are not meant to be registered.'), $redirect); } diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index 54c381c9eb..ac72739690 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -111,7 +111,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } if ($this->_priceSetId) { foreach ($this->_feeBlock as $key => $val) { - if (!CRM_Utils_Array::value('options', $val)) { + if (empty($val['options'])) { continue; } @@ -191,7 +191,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } foreach (array( 'first_name', 'last_name') as $name) { - if (CRM_Utils_Array::value($name, $$keys) && + if (!empty($$keys[$name]) && CRM_Utils_Array::value('is_required', CRM_Utils_Array::value($name, $$keys)) ) { $$name = 1; @@ -240,7 +240,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } //we might did reset allow waiting in case of dynamic calculation - if (CRM_Utils_Array::value('bypass_payment', $this->_params[0]) && + if (!empty($this->_params[0]['bypass_payment']) && is_numeric($spaces) && $processedCnt > $spaces ) { @@ -250,7 +250,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 (CRM_Utils_Array::value('is_monetary', $this->_values['event']) && + if (!empty($this->_values['event']['is_monetary']) && CRM_Utils_Array::value('is_pay_later', $this->_values['event']) ) { $realPayLater = CRM_Utils_Array::value('is_pay_later', $this->_params[0]); @@ -322,7 +322,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $this->assign('allowGroupOnWaitlist', TRUE); $paymentBypassed = NULL; - if (CRM_Utils_Array::value('bypass_payment', $this->_params[0]) && + if (!empty($this->_params[0]['bypass_payment']) && !$this->_allowWaitlist && !$realPayLater && !$this->_requireApproval && @@ -385,7 +385,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $button = substr($self->controller->getButtonName(), -4); $realPayLater = FALSE; - if (CRM_Utils_Array::value('is_monetary', $self->_values['event']) && + if (!empty($self->_values['event']['is_monetary']) && CRM_Utils_Array::value('is_pay_later', $self->_values['event']) ) { $realPayLater = CRM_Utils_Array::value('is_pay_later', $self->_params[0]); @@ -452,7 +452,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } //check for atleast one pricefields should be selected - if (CRM_Utils_Array::value('priceSetId', $fields)) { + if (!empty($fields['priceSetId'])) { $allParticipantParams = $params; //format current participant params. @@ -466,7 +466,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R if (!$self->_allowConfirmation && is_numeric($self->_availableRegistrations) ) { - if (CRM_Utils_Array::value('bypass_payment', $self->_params[0]) && + if (!empty($self->_params[0]['bypass_payment']) && !$self->_allowWaitlist && !$realPayLater && !$self->_requireApproval && @@ -492,7 +492,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R return $errors; } - if (CRM_Utils_Array::value('has_waitlist', $self->_values['event']) && + if (!empty($self->_values['event']['has_waitlist']) && CRM_Utils_Array::value('bypass_payment', $self->_params[0]) && !$self->_allowWaitlist && !$realPayLater && @@ -521,7 +521,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R function validatePaymentValues($self, $fields) { - if (CRM_Utils_Array::value('bypass_payment', $self->_params[0]) || + if (!empty($self->_params[0]['bypass_payment']) || $self->_allowWaitlist || empty($self->_fields) || CRM_Utils_Array::value('amount', $self->_params[0]) > 0 @@ -530,7 +530,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } $validatePayement = FALSE; - if (CRM_Utils_Array::value('priceSetId', $fields)) { + if (!empty($fields['priceSetId'])) { $lineItem = array(); CRM_Price_BAO_PriceSet::processAmount($self->_values['fee'], $fields, $lineItem); if ($fields['amount'] > 0) { @@ -539,7 +539,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R // return false; } } - elseif (CRM_Utils_Array::value('amount', $fields) && + elseif (!empty($fields['amount']) && (CRM_Utils_Array::value('value', $self->_values['fee'][$fields['amount']]) > 0) ) { $validatePayement = TRUE; @@ -617,7 +617,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R if (is_numeric($currentCount)) { $totalParticipants += $currentCount; } - if (CRM_Utils_Array::value('has_waitlist', $this->_values['event']) && + if (!empty($this->_values['event']['has_waitlist']) && $totalParticipants > $this->_availableRegistrations ) { $this->_allowWaitlist = TRUE; @@ -683,11 +683,11 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $params['participant_role_id'] = $params['participant_role']; } - if (!CRM_Utils_Array::value('participant_role_id', $params) && $this->_values['event']['default_role_id']) { + if (empty($params['participant_role_id']) && $this->_values['event']['default_role_id']) { $params['participant_role_id'] = $this->_values['event']['default_role_id']; } - if (CRM_Utils_Array::value('is_pay_later', $this->_params[0])) { + if (!empty($this->_params[0]['is_pay_later'])) { $params['is_pay_later'] = 1; } diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 01f969f600..2c4d5aef92 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -78,7 +78,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { CRM_Utils_Hook::eventDiscount($this, $this->_params); - if (CRM_Utils_Array::value('discount', $this->_params[0]) && + if (!empty($this->_params[0]['discount']) && CRM_Utils_Array::value('applied', $this->_params[0]['discount']) ) { $this->set('hookDiscount', $this->_params[0]['discount']); @@ -118,7 +118,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { // set a few other parameters for PayPal $params['token'] = $this->get('token'); $params['amount'] = $this->_params[0]['amount']; - if (CRM_Utils_Array::value('discount', $this->_params[0])) { + if (!empty($this->_params[0]['discount'])) { $params['discount'] = $this->_params[0]['discount']; $params['discountAmount'] = $this->_params[0]['discountAmount']; $params['discountMessage'] = $this->_params[0]['discountMessage']; @@ -185,7 +185,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $this->assign('defaultRole', TRUE); } - if (!CRM_Utils_Array::value('participant_role_id', $this->_params[0]) && + if (empty($this->_params[0]['participant_role_id']) && $this->_values['event']['default_role_id'] ) { $this->_params[0]['participant_role_id'] = $this->_values['event']['default_role_id']; @@ -241,7 +241,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } } - if (CRM_Utils_Array::value('first_name', $v) && CRM_Utils_Array::value('last_name', $v)) { + if (!empty($v['first_name']) && CRM_Utils_Array::value('last_name', $v)) { $append = $v['first_name'] . ' ' . $v['last_name']; } else { @@ -254,17 +254,17 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } $this->_amount[$k]['amount'] = $v['amount']; - if (CRM_Utils_Array::value('discountAmount', $v)) { + if (!empty($v['discountAmount'])) { $this->_amount[$k]['amount'] -= $v['discountAmount']; } $this->_amount[$k]['label'] = preg_replace('//', '', $v['amount_level']) . ' - ' . $append; $this->_part[$k]['info'] = CRM_Utils_Array::value('first_name', $v) . ' ' . CRM_Utils_Array::value('last_name', $v); - if (!CRM_Utils_Array::value('first_name', $v)) { + if (empty($v['first_name'])) { $this->_part[$k]['info'] = $append; } $this->_totalAmount = $this->_totalAmount + $this->_amount[$k]['amount']; - if (CRM_Utils_Array::value('is_primary', $v)) { + if (!empty($v['is_primary'])) { $this->set('primaryParticipantAmount', $this->_amount[$k]['amount']); } } @@ -303,7 +303,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } if ($participantValue != 'skip') { //get the customPre profile info - if (CRM_Utils_Array::value( $prefix2 . 'custom_pre_id', $this->_values)) { + if (!empty($this->_values[$prefix2 . 'custom_pre_id'])) { $values = $groupName = array(); CRM_Event_BAO_Event::displayProfile($participantValue, $this->_values[ $prefix2 . 'custom_pre_id'], @@ -318,7 +318,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $formattedValues[$count][$prefix1 . 'CustomPreGroupTitle'] = CRM_Utils_Array::value('groupTitle', $groupName); } //get the customPost profile info - if (CRM_Utils_Array::value( $prefix2 . 'custom_post_id', $this->_values)) { + if (!empty($this->_values[$prefix2 . 'custom_post_id'])) { $values = $groupName = array(); foreach ($this->_values[$prefix2 . 'custom_post_id'] as $gids) { $val = array(); @@ -451,7 +451,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $now = date('YmdHis'); $this->_params = $this->get('params'); - if (CRM_Utils_Array::value('contact_id', $this->_params[0])) { + if (!empty($this->_params[0]['contact_id'])) { // unclear when this would be set & whether it could be checked in getContactID. // perhaps it relates to when cid is in the url //@todo someone who knows add comments on the various contactIDs in this form @@ -463,7 +463,7 @@ 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 (CRM_Utils_Array::value('discount', $this->_params[0]) && + if (!empty($this->_params[0]['discount']) && CRM_Utils_Array::value('applied', $this->_params[0]['discount']) ) { foreach ($this->_params as $k => $v) { @@ -536,13 +536,13 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { foreach ($billingFields as $field) { unset($value[$field]); } - if (CRM_Utils_Array::value('is_pay_later', $value)) { + if (!empty($value['is_pay_later'])) { $this->_values['params']['is_pay_later'] = TRUE; } } //Unset ContactID for additional participants and set RegisterBy Id. - if (!CRM_Utils_Array::value('is_primary', $value)) { + if (empty($value['is_primary'])) { $contactID = CRM_Utils_Array::value('contact_id', $value); $registerByID = $this->get('registerByID'); if ($registerByID) { @@ -591,7 +591,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { //now becomes part of run time waiting list. $value['is_pay_later'] = FALSE; } - elseif (CRM_Utils_Array::value('is_pay_later', $value) || + elseif (!empty($value['is_pay_later']) || $value['amount'] == 0 || $this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify' @@ -610,7 +610,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { else CRM_Core_Error::fatal($paymentObjError); } - elseif (CRM_Utils_Array::value('is_primary', $value)) { + elseif (!empty($value['is_primary'])) { CRM_Core_Payment_Form::mapParams($this->_bltID, $value, $value, TRUE); // payment email param can be empty for _bltID mapping // thus provide mapping for it with a different email value @@ -675,10 +675,10 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } //CRM-4453. - if (CRM_Utils_Array::value('is_primary', $value)) { + if (!empty($value['is_primary'])) { $primaryCurrencyID = CRM_Utils_Array::value('currencyID', $value); } - if (!CRM_Utils_Array::value('currencyID', $value)) { + if (empty($value['currencyID'])) { $value['currencyID'] = $primaryCurrencyID; } @@ -699,7 +699,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { if ($this->_allowConfirmation) { $registerDate = CRM_Utils_Array::value( 'participant_register_date', $params ); } - elseif (CRM_Utils_Array::value('participant_register_date', $params) && + elseif (!empty($params['participant_register_date']) && is_array($params['participant_register_date']) && !empty($params['participant_register_date']) ) { @@ -774,7 +774,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $primaryParticipant = $this->get('primaryParticipant'); - if (!CRM_Utils_Array::value('participantID', $primaryParticipant)) { + if (empty($primaryParticipant['participantID'])) { $primaryParticipant['participantID'] = $registerByID; } @@ -922,7 +922,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params), ); - if (!CRM_Utils_Array::value('is_pay_later', $params)) { + if (empty($params['is_pay_later'])) { $contribParams['payment_instrument_id'] = 1; } @@ -947,7 +947,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } $contribID = NULL; - if (CRM_Utils_Array::value('invoice_id', $contribParams)) { + if (!empty($contribParams['invoice_id'])) { $contribID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contribParams['invoice_id'], 'id', @@ -967,12 +967,12 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } // Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin. - if (CRM_Utils_Array::value('pcp_made_through_id', $params) || + if (!empty($params['pcp_made_through_id']) || CRM_Utils_Array::value('soft_credit_to', $params) ) { // if its due to pcp - if (CRM_Utils_Array::value('pcp_made_through_id', $params)) { + if (!empty($params['pcp_made_through_id'])) { $contribSoftContactId = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $params['pcp_made_through_id'], 'contact_id' @@ -1063,7 +1063,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { if (!empty($this->_fields)) { foreach ($this->_fields as $key => $value) { - if (CRM_Utils_Array::value('add_to_group_id', $value)) { + if (!empty($value['add_to_group_id'])) { $addToGroups[$value['add_to_group_id']] = $value['add_to_group_id']; } } diff --git a/CRM/Event/Form/Registration/ParticipantConfirm.php b/CRM/Event/Form/Registration/ParticipantConfirm.php index 848323f10a..6a39b4a03e 100644 --- a/CRM/Event/Form/Registration/ParticipantConfirm.php +++ b/CRM/Event/Form/Registration/ParticipantConfirm.php @@ -204,7 +204,7 @@ class CRM_Event_Form_Registration_ParticipantConfirm extends CRM_Event_Form_Regi $statusMessage = ts("Your event registration has been cancelled."); } - if (CRM_Utils_Array::value('mailedParticipants', $results)) { + if (!empty($results['mailedParticipants'])) { foreach ($results['mailedParticipants'] as $key => $displayName) { $statusMessage .= "
" . ts("Email has been sent to : %1", array(1 => $displayName)); } diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 4da015f785..645c56c49b 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -151,12 +151,12 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { // country if the person has an address but no country (for anonymous country is set above) // this could have implications if the billing profile is filled but hidden. // this behaviour has been in place for a while but the use of js to hide things has increased - if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $this->_defaults)) { + if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) { $this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry; } // set default state/province from config if no state/province set - if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $this->_defaults)) { + if (empty($this->_defaults["billing_state_province_id-{$this->_bltID}"])) { $this->_defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince; } @@ -200,7 +200,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { // Set default payment processor as default payment_processor radio button value if (!empty($this->_paymentProcessors)) { foreach ($this->_paymentProcessors as $pid => $value) { - if (CRM_Utils_Array::value('is_default', $value)) { + if (!empty($value['is_default'])) { $this->_defaults['payment_processor'] = $pid; } } @@ -209,7 +209,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { //if event is monetary and pay later is enabled and payment //processor is not available then freeze the pay later checkbox with //default check - if (CRM_Utils_Array::value('is_pay_later', $this->_values['event']) && + if (!empty($this->_values['event']['is_pay_later']) && !is_array($this->_paymentProcessor) ) { $this->_defaults['is_pay_later'] = 1; @@ -423,7 +423,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { //@todo we are blocking for multiple registrations because we haven't tested $this->addCidZeroOptions($onlinePaymentProcessorEnabled); } - if (CRM_Utils_Array::value('is_pay_later', $this->_values['event']) && + if (!empty($this->_values['event']['is_pay_later']) && ($this->_allowConfirmation || (!$this->_requireApproval && !$this->_allowWaitlist)) ) { $pps[0] = $this->_values['event']['pay_later_text']; @@ -507,7 +507,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { //freeze button to avoid multiple calls. $js = NULL; - if (!CRM_Utils_Array::value('is_monetary', $this->_values['event'])) { + if (empty($this->_values['event']['is_monetary'])) { $js = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"); } $this->addButtons(array( @@ -586,7 +586,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { //format price set fields across option full. self::formatFieldsForOptionFull($form); - if (CRM_Utils_Array::value('is_quick_config', $form->_priceSet)) { + if (!empty($form->_priceSet['is_quick_config'])) { $form->_quickConfig = $form->_priceSet['is_quick_config']; } $form->add('hidden', 'priceSetId', $form->_priceSetId); @@ -734,7 +734,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $form->_allowConfirmation && !empty($formattedPriceSetDefaults) ) { - if (!CRM_Utils_Array::value("price_{$field}", $formattedPriceSetDefaults) || + if (empty($formattedPriceSetDefaults["price_{$field}"]) || !CRM_Utils_Array::value($opId, $formattedPriceSetDefaults["price_{$fieldId}"]) ) { $optionFullIds[$optId] = $optId; @@ -794,7 +794,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } //don't allow to register w/ waiting if enough spaces available. - if (CRM_Utils_Array::value('bypass_payment', $fields)) { + 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) ) { @@ -802,14 +802,14 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } } - if (CRM_Utils_Array::value('additional_participants', $fields) && + if (!empty($fields['additional_participants']) && !CRM_Utils_Rule::positiveInteger($fields['additional_participants']) ) { $errors['additional_participants'] = ts('Please enter a whole number for Number of additional people.'); } // priceset validations - if (CRM_Utils_Array::value('priceSetId', $fields)) { + if (!empty($fields['priceSetId'])) { //format params. $formatted = self::formatPriceSetParams($self, $fields); $ppParams = array($formatted); @@ -820,11 +820,11 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $errors = array_merge($errors, CRM_Utils_Array::value(0, $priceSetErrors, array())); $totalParticipants = $primaryParticipantCount; - if (CRM_Utils_Array::value('additional_participants', $fields)) { + if (!empty($fields['additional_participants'])) { $totalParticipants += $fields['additional_participants']; } - if (!CRM_Utils_Array::value('bypass_payment', $fields) && + if (empty($fields['bypass_payment']) && !$self->_allowConfirmation && is_numeric($self->_availableRegistrations) && $self->_availableRegistrations < $totalParticipants @@ -854,7 +854,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 (CRM_Utils_Array::value($self->_expressButtonName . '_x', $fields) || + if (!empty($fields[$self->_expressButtonName . '_x']) || CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) || CRM_Utils_Array::value($self->_expressButtonName, $fields) ) { @@ -863,19 +863,19 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } $isZeroAmount = $skipPaymentValidation = FALSE; - if (CRM_Utils_Array::value('priceSetId', $fields)) { + if (!empty($fields['priceSetId'])) { if (CRM_Utils_Array::value('amount', $fields) == 0) { $isZeroAmount = TRUE; } } - elseif (CRM_Utils_Array::value('amount', $fields) && + elseif (!empty($fields['amount']) && (isset($self->_values['discount'][$fields['amount']]) && CRM_Utils_Array::value('value', $self->_values['discount'][$fields['amount']]) == 0 ) ) { $isZeroAmount = TRUE; } - elseif (CRM_Utils_Array::value('amount', $fields) && + elseif (!empty($fields['amount']) && (isset($self->_values['fee'][$fields['amount']]) && CRM_Utils_Array::value('value', $self->_values['fee'][$fields['amount']]) == 0 ) @@ -888,7 +888,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } // also return if paylater mode or zero fees for valid members - if (CRM_Utils_Array::value('is_pay_later', $fields) || + if (!empty($fields['is_pay_later']) || CRM_Utils_Array::value('bypass_payment', $fields) || $skipPaymentValidation || (!$self->_allowConfirmation && ($self->_requireApproval || $self->_allowWaitlist)) @@ -974,7 +974,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } } - if (CRM_Utils_Array::value('image_URL', $params)) { + if (!empty($params['image_URL'])) { CRM_Contact_BAO_Contact::processImageParams($params); } @@ -990,7 +990,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $primaryParticipantCount = self::getParticipantCount($this, $params); $totalParticipants = $primaryParticipantCount; - if (CRM_Utils_Array::value('additional_participants', $params)) { + if (!empty($params['additional_participants'])) { $totalParticipants += $params['additional_participants']; } if (!$this->_allowConfirmation && @@ -1015,7 +1015,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { if (array_key_exists('participant_role_id', $params)) { $params['defaultRole'] = 0; } - if (!CRM_Utils_Array::value('participant_role_id', $params) && + if (empty($params['participant_role_id']) && $this->_values['event']['default_role_id'] ) { $params['participant_role_id'] = $this->_values['event']['default_role_id']; @@ -1155,7 +1155,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $this->_params[] = $params; $this->set('params', $this->_params); - if (!CRM_Utils_Array::value('additional_participants', $params)) { + if (empty($params['additional_participants'])) { self::processRegistration($this->_params); } } @@ -1203,7 +1203,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $fields = NULL; // setting register by Id and unset contactId. - if (!CRM_Utils_Array::value('is_primary', $value)) { + if (empty($value['is_primary'])) { $contactID = NULL; $registerByID = $this->get('registerByID'); if ($registerByID) { @@ -1223,7 +1223,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $this->_participantInfo[] = $value['first_name'] . ' ' . $value['last_name']; } } - elseif (CRM_Utils_Array::value('contact_id', $value)) { + elseif (!empty($value['contact_id'])) { $contactID = $value['contact_id']; } else { @@ -1232,7 +1232,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { CRM_Event_Form_Registration_Confirm::fixLocationFields($value, $fields); //for free event or additional participant, dont create billing email address. - if (!CRM_Utils_Array::value('is_primary', $value) || !$this->_values['event']['is_monetary']) { + if (empty($value['is_primary']) || !$this->_values['event']['is_monetary']) { unset($value["email-{$this->_bltID}"]); } diff --git a/CRM/Event/Form/Registration/ThankYou.php b/CRM/Event/Form/Registration/ThankYou.php index c06f34ab9b..1d97a891ce 100644 --- a/CRM/Event/Form/Registration/ThankYou.php +++ b/CRM/Event/Form/Registration/ThankYou.php @@ -161,7 +161,7 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { $params['entity_table'] = 'civicrm_event'; $data = array(); CRM_Friend_BAO_Friend::retrieve($params, $data); - if (CRM_Utils_Array::value('is_active', $data)) { + if (!empty($data['is_active'])) { $friendText = $data['title']; $this->assign('friendText', $friendText); if ($this->_action & CRM_Core_Action::PREVIEW) { diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index 75c41f9dbb..b1c213f9b6 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -276,11 +276,11 @@ class CRM_Event_Form_Search extends CRM_Core_Form { if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0' ) { $seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )"; } - if (CRM_Utils_Array::value('participant_status_id', $this->_formValues)) { + if (!empty($this->_formValues['participant_status_id'])) { $statuses = array_keys($this->_formValues['participant_status_id']); $seatClause[] = '( participant.status_id IN ( ' . implode(' , ', $statuses) . ' ) )'; } - if (CRM_Utils_Array::value('participant_role_id', $this->_formValues)) { + if (!empty($this->_formValues['participant_role_id'])) { $roles = array_keys($this->_formValues['participant_role_id']); $seatClause[] = '( participant.role_id IN ( ' . implode(' , ', $roles) . ' ) )'; } diff --git a/CRM/Event/Form/SearchEvent.php b/CRM/Event/Form/SearchEvent.php index 524b2d8d85..1728b091f4 100644 --- a/CRM/Event/Form/SearchEvent.php +++ b/CRM/Event/Form/SearchEvent.php @@ -39,7 +39,7 @@ class CRM_Event_Form_SearchEvent extends CRM_Core_Form { $defaults['eventsByDates'] = 0; $this->_showHide = new CRM_Core_ShowHideBlocks(); - if (!CRM_Utils_Array::value('eventsByDates', $defaults)) { + if (empty($defaults['eventsByDates'])) { $this->_showHide->addHide('id_fromToDates'); } diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index 33dae3abd3..a6cb48d95c 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -180,7 +180,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) { $customValue = CRM_Utils_Array::value($customFieldID, $this->_customFields); $entityColumnValue = array(); - if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) { + if (!empty($customValue['extends_entity_column_value'])) { $entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue['extends_entity_column_value'] ); @@ -281,11 +281,11 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { ); $value['id'] = $key; - if (CRM_Utils_Array::value('participant_register_date', $value)) { + if (!empty($value['participant_register_date'])) { $value['register_date'] = CRM_Utils_Date::processDate($value['participant_register_date'], $value['participant_register_date_time']); } - if (CRM_Utils_Array::value('participant_role', $value)) { + if (!empty($value['participant_role'])) { $participantRoles = CRM_Event_PseudoConstant::participantRole(); if (is_array($value['participant_role'])) { $value['role_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($value['participant_role'])); @@ -298,7 +298,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { //need to send mail when status change $statusChange = FALSE; $relatedStatusChange = FALSE; - if (CRM_Utils_Array::value('participant_status', $value)) { + if (!empty($value['participant_status'])) { $value['status_id'] = $value['participant_status']; $fromStatusId = CRM_Utils_Array::value($key, $this->_fromStatusIds); if (!$fromStatusId) { @@ -313,7 +313,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { } } - if (CRM_Utils_Array::value('participant_source', $value)) { + if (!empty($value['participant_source'])) { $value['source'] = $value['participant_source']; } unset($value['participant_register_date']); diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php index 5946e8cbac..ce54af06b2 100644 --- a/CRM/Event/Import/Form/MapField.php +++ b/CRM/Event/Import/Form/MapField.php @@ -348,7 +348,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { } } - if (CRM_Utils_Array::value('saveMapping', $fields)) { + if (!empty($fields['saveMapping'])) { $nameField = CRM_Utils_Array::value('saveMappingName', $fields); if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); @@ -419,7 +419,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params)); //Updating Mapping Records - if (CRM_Utils_Array::value('updateMapping', $params)) { + if (!empty($params['updateMapping'])) { $mappingFields = new CRM_Core_DAO_MappingField(); $mappingFields->mapping_id = $params['mappingId']; @@ -449,7 +449,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { } //Saving Mapping Details and Records - if (CRM_Utils_Array::value('saveMapping', $params)) { + if (!empty($params['saveMapping'])) { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php index 8b026129bc..59c8647235 100644 --- a/CRM/Event/Import/Parser/Participant.php +++ b/CRM/Event/Import/Parser/Participant.php @@ -176,10 +176,10 @@ 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 (!CRM_Utils_Array::value('event_id', $params) && !CRM_Utils_Array::value('event_title', $params)) { + if (empty($params['event_id']) && !CRM_Utils_Array::value('event_title', $params)) { CRM_Contact_Import_Parser_Contact::addToErrorMsg('Event', $missingField); } - if (!CRM_Utils_Array::value('participant_status_id', $params)) { + if (empty($params['participant_status_id'])) { CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Status', $missingField); } } @@ -303,7 +303,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 (CRM_Utils_Array::value('event_id', $params)) { + if (!empty($params['event_id'])) { $params['participant_role_id'] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'default_role_id'); } else { @@ -373,7 +373,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { return CRM_Import_Parser::ERROR; } $newParticipant = CRM_Event_BAO_Participant::create($formatted, $ids); - if( CRM_Utils_Array::value('fee_level', $formatted)) { + if (!empty($formatted['fee_level'])) { $otherParams = array( 'fee_label' => $formatted['fee_level'], 'event_id' => $newParticipant->event_id @@ -429,7 +429,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { } } - if (CRM_Utils_Array::value('external_identifier', $params)) { + if (!empty($params['external_identifier'])) { if ($disp) { $disp .= "AND {$params['external_identifier']}"; } @@ -443,7 +443,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { } } else { - if (CRM_Utils_Array::value('external_identifier', $formatValues)) { + if (!empty($formatValues['external_identifier'])) { $checkCid = new CRM_Contact_DAO_Contact(); $checkCid->external_identifier = $formatValues['external_identifier']; $checkCid->find(TRUE); diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index 051aa75805..d0416b3cb3 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -242,7 +242,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { ); $allowRegistration = FALSE; - if (CRM_Utils_Array::value('is_online_registration', $values['event'])) { + if (!empty($values['event']['is_online_registration'])) { if (CRM_Event_BAO_Event::validRegistrationRequest($values['event'], $this->_id)) { // we always generate urls for the front end in joomla $action_query = $action === CRM_Core_Action::PREVIEW ? "&action=$action" : ''; @@ -253,7 +253,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { ); if (!$eventFullMessage || $hasWaitingList) { $registerText = ts('Register Now'); - if (CRM_Utils_Array::value('registration_link_text', $values['event'])) { + if (!empty($values['event']['registration_link_text'])) { $registerText = $values['event']['registration_link_text']; } diff --git a/CRM/Event/Selector/Search.php b/CRM/Event/Selector/Search.php index 30f036211d..2dd9a069b7 100644 --- a/CRM/Event/Selector/Search.php +++ b/CRM/Event/Selector/Search.php @@ -355,7 +355,7 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co $row['showConfirmUrl'] = ($statusClass == 'Pending') ? TRUE : FALSE; - if (CRM_Utils_Array::value('participant_is_test', $row)) { + if (!empty($row['participant_is_test'])) { $row['participant_status'] .= ' (' . ts('test') . ')'; } @@ -392,7 +392,7 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co $row['paid'] = CRM_Event_BAO_Event::isMonetary($row['event_id']); - if (CRM_Utils_Array::value('participant_fee_level', $row)) { + if (!empty($row['participant_fee_level'])) { CRM_Event_BAO_Participant::fixEventLevel($row['participant_fee_level']); } diff --git a/CRM/Event/StateMachine/Search.php b/CRM/Event/StateMachine/Search.php index 582c3dbda4..66f2fb3efa 100644 --- a/CRM/Event/StateMachine/Search.php +++ b/CRM/Event/StateMachine/Search.php @@ -83,7 +83,7 @@ class CRM_Event_StateMachine_Search extends CRM_Core_StateMachine { function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff // fix value if print button is pressed - if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) { + if (!empty($_POST['_qf_' . $formName . '_next_print'])) { $value = CRM_Event_Task::PRINT_EVENTS; } else { diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 4f3bc5a84a..7796a8cbc6 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -158,7 +158,7 @@ class CRM_Export_BAO_Export { } if (array_key_exists($relationshipTypes, $contactRelationshipTypes)) { - if (CRM_Utils_Array::value(2, $value)) { + if (!empty($value[2])) { $relationField = CRM_Utils_Array::value(2, $value); if (trim(CRM_Utils_Array::value(3, $value))) { $relLocTypeId = CRM_Utils_Array::value(3, $value); @@ -174,7 +174,7 @@ class CRM_Export_BAO_Export { $relIMProviderId = CRM_Utils_Array::value(4, $value); } } - elseif (CRM_Utils_Array::value(4, $value)) { + elseif (!empty($value[4])) { $relationField = CRM_Utils_Array::value(4, $value); $relLocTypeId = CRM_Utils_Array::value(5, $value); if ($relationField == 'phone') { @@ -242,7 +242,7 @@ class CRM_Export_BAO_Export { } elseif ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) { $returnProperties['participant_id'] = 1; - if (CRM_Utils_Array::value('participant_role', $returnProperties)) { + if (!empty($returnProperties['participant_role'])) { unset($returnProperties['participant_role']); $returnProperties['participant_role_id'] = 1; } @@ -359,7 +359,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c if ($moreReturnProperties) { // fix for CRM-7066 - if (CRM_Utils_Array::value('group', $moreReturnProperties)) { + if (!empty($moreReturnProperties['group'])) { unset($moreReturnProperties['group']); $moreReturnProperties['groups'] = 1; } @@ -506,7 +506,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c // make sure the groups stuff is included only if specifically specified // by the fields param (CRM-1969), else we limit the contacts outputted to only // ones that are part of a group - if (CRM_Utils_Array::value('groups', $returnProperties)) { + if (!empty($returnProperties['groups'])) { $oldClause = "( contact_a.id = civicrm_group_contact.contact_id )"; $newClause = " ( $oldClause AND ( civicrm_group_contact.status = 'Added' OR civicrm_group_contact.status IS NULL ) )"; // total hack for export, CRM-3618 @@ -545,7 +545,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $queryString = "$select $from $where $having"; $groupBy = ""; - if (CRM_Utils_Array::value('tags', $returnProperties) || + if (!empty($returnProperties['tags']) || CRM_Utils_Array::value('groups', $returnProperties) || CRM_Utils_Array::value('notes', $returnProperties) || // CRM-9552 @@ -575,7 +575,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c if ($order) { list($field, $dir) = explode(' ', $order, 2); $field = trim($field); - if (CRM_Utils_Array::value($field, $returnProperties)) { + if (!empty($returnProperties[$field])) { // $queryString .= " ORDER BY $order"; } } @@ -678,7 +678,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $type = explode('-', $fld); $hdr = "{$ltype}-" . $query->_fields[$type[0]]['title']; - if (CRM_Utils_Array::value(1, $type)) { + if (!empty($type[1])) { if (CRM_Utils_Array::value(0, $type) == 'phone') { $hdr .= "-" . CRM_Utils_Array::value($type[1], $phoneTypes); } @@ -744,7 +744,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $hdr = "{$ltype}-" . $relationQuery[$field]->_fields[$type[0]]['title']; - if (CRM_Utils_Array::value(1, $type)) { + if (!empty($type[1])) { if (CRM_Utils_Array::value(0, $type) == 'phone') { $hdr .= "-" . CRM_Utils_Array::value($type[1], $phoneTypes); } @@ -834,7 +834,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c // FIXME: We should not be using labels as keys! $daoField = CRM_Utils_String::munge($ltype) . '-' . $type[0]; - if (CRM_Utils_Array::value(1, $type)) { + if (!empty($type[1])) { $fldValue .= "-" . $type[1]; } @@ -899,7 +899,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c foreach (array_keys($val) as $fld) { $type = explode('-', $fld); $fldValue = "{$ltype}-" . $type[0]; - if (CRM_Utils_Array::value(1, $type)) { + if (!empty($type[1])) { $fldValue .= "-" . $type[1]; } // CRM-3157: localise country, region (both have ‘country’ context) @@ -1069,7 +1069,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c } } //remove organization name for individuals if it is set for current employer - if (CRM_Utils_Array::value('contact_type', $row) && + if (!empty($row['contact_type']) && $row['contact_type'] == 'Individual' && array_key_exists('organization_name', $row) ) { $row['organization_name'] = ''; @@ -1558,7 +1558,7 @@ WHERE id IN ( $deleteIDString ) 'addressee', ); foreach ($greetingFields as $greeting) { - if (CRM_Utils_Array::value($greeting, $exportParams)) { + if (!empty($exportParams[$greeting])) { $greetingLabel = $exportParams[$greeting]; if (empty($contact)) { $values = array( @@ -1567,7 +1567,7 @@ WHERE id IN ( $deleteIDString ) ); $contact = civicrm_api('contact', 'get', $values); - if (CRM_Utils_Array::value('is_error', $contact)) { + if (!empty($contact['is_error'])) { return $greetings; } $contact = $contact['values'][$contact['id']]; @@ -1589,7 +1589,7 @@ WHERE id IN ( $deleteIDString ) static function _trimNonTokens(&$parsedString, $defaultGreeting, $addressMergeGreetings, $greetingType = 'postal_greeting' ) { - if (CRM_Utils_Array::value($greetingType, $addressMergeGreetings)) { + if (!empty($addressMergeGreetings[$greetingType])) { $greetingLabel = $addressMergeGreetings[$greetingType]; } $greetingLabel = empty($greetingLabel) ? $defaultGreeting : $greetingLabel; @@ -1665,7 +1665,7 @@ WHERE id IN ( $deleteIDString ) if (!$sharedAddress && !array_key_exists($copyID, $merge[$masterID]['copy'])) { - if (CRM_Utils_Array::value('postal_greeting_other', $exportParams) && + if (!empty($exportParams['postal_greeting_other']) && count($merge[$masterID]['copy']) >= 1 ) { // use static greetings specified if no of contacts > 2 @@ -1681,7 +1681,7 @@ WHERE id IN ( $deleteIDString ) $merge[$masterID]['postalGreeting'] = str_replace(" {$copyPostalGreeting},", "", $merge[$masterID]['postalGreeting']); } - if (CRM_Utils_Array::value('addressee_other', $exportParams) && + if (!empty($exportParams['addressee_other']) && count($merge[$masterID]['copy']) >= 1 ) { // use static greetings specified if no of contacts > 2 @@ -1735,7 +1735,7 @@ WHERE id IN ( $deleteIDString ) else { $householdColName = CRM_Utils_String::munge($prefixColumn . $columnNames, '_', 64); - if (CRM_Utils_Array::value($householdColName, $sqlColumns)) { + if (!empty($sqlColumns[$householdColName])) { $replaced[$columnNames] = $householdColName; } } @@ -1869,7 +1869,7 @@ LIMIT $offset, $limit $addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_options', TRUE, NULL, TRUE ); - if (CRM_Utils_Array::value('supplemental_address_1', $addressOptions)) { + if (!empty($addressOptions['supplemental_address_1'])) { $addressWhereClause .= " AND ( (supplemental_address_1 IS NULL) OR (supplemental_address_1 = '') ) "; // enclose it again, since we are doing an AND in between a set of ORs $addressWhereClause = "( $addressWhereClause )"; diff --git a/CRM/Export/Form/Map.php b/CRM/Export/Form/Map.php index 8fe847578f..e8b2da1707 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 (CRM_Utils_Array::value('saveMapping', $fields) && CRM_Utils_Array::value('_qf_Map_next', $fields)) { + if (!empty($fields['saveMapping']) && CRM_Utils_Array::value('_qf_Map_next', $fields)) { $nameField = CRM_Utils_Array::value('saveMappingName', $fields); if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Export Mapping'); @@ -208,12 +208,12 @@ class CRM_Export_Form_Map extends CRM_Core_Form { } if ($buttonName1 == '_qf_Map_next') { - if (CRM_Utils_Array::value('updateMapping', $params)) { + if (!empty($params['updateMapping'])) { //save mapping fields CRM_Core_BAO_Mapping::saveMappingFields($params, $params['mappingId']); } - if (CRM_Utils_Array::value('saveMapping', $params)) { + if (!empty($params['saveMapping'])) { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], diff --git a/CRM/Financial/BAO/ExportFormat.php b/CRM/Financial/BAO/ExportFormat.php index dd47c4f483..2c6e6d41c7 100644 --- a/CRM/Financial/BAO/ExportFormat.php +++ b/CRM/Financial/BAO/ExportFormat.php @@ -160,10 +160,10 @@ class CRM_Financial_BAO_ExportFormat { } $details = '

' . ts('Record: ') . $values['title'] . '

' . ts('Description: ') . '

' . ts('Created By: ') . $createdBy . '

' . ts('Created Date: ') . $values['created_date'] . '

' . ts('Last Modified By: ') . $modifiedBy . '

' . ts('Payment Instrument: ') . $values['payment_instrument_id'] . '

'; $subject = ''; - if (CRM_Utils_Array::value('total', $values)) { + if (!empty($values['total'])) { $subject .= ts('Total') . '['. CRM_Utils_Money::format($values['total']) .'],'; } - if (CRM_Utils_Array::value('item_count', $values)) { + if (!empty($values['item_count'])) { $subject .= ' ' . ts('Count') . '['. $values['item_count'] .'],'; } diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php index f2528f70bb..0be4ddef5d 100644 --- a/CRM/Financial/BAO/FinancialAccount.php +++ b/CRM/Financial/BAO/FinancialAccount.php @@ -101,7 +101,7 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco $params['is_tax'] = CRM_Utils_Array::value('is_tax', $params, FALSE); $params['is_header_account'] = CRM_Utils_Array::value('is_header_account', $params, FALSE); $params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE); - if (CRM_Utils_Array::value('is_default', $params)) { + if (!empty($params['is_default'])) { $query = 'UPDATE civicrm_financial_account SET is_default = 0 WHERE financial_account_type_id = %1'; $queryParams = array(1 => array($params['financial_account_type_id'], 'Integer')); CRM_Core_DAO::executeQuery($query, $queryParams); diff --git a/CRM/Financial/BAO/FinancialItem.php b/CRM/Financial/BAO/FinancialItem.php index 84a5d33064..7136d49de8 100644 --- a/CRM/Financial/BAO/FinancialItem.php +++ b/CRM/Financial/BAO/FinancialItem.php @@ -131,12 +131,12 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem { static function create(&$params, $ids = NULL, $trxnIds = NULL) { $financialItem = new CRM_Financial_DAO_FinancialItem(); $financialItem->copyValues($params); - if (CRM_Utils_Array::value('id', $ids)) { + if (!empty($ids['id'])) { $financialItem->id = $ids['id']; } $financialItem->save(); - if (CRM_Utils_Array::value('id', $trxnIds)) { + if (!empty($trxnIds['id'])) { $entity_financial_trxn_params = array( 'entity_table' => "civicrm_financial_item", 'entity_id' => $financialItem->id, @@ -146,7 +146,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem { $entity_trxn = new CRM_Financial_DAO_EntityFinancialTrxn(); $entity_trxn->copyValues($entity_financial_trxn_params); - if (CRM_Utils_Array::value('entityFinancialTrxnId', $ids)) { + if (!empty($ids['entityFinancialTrxnId'])) { $entity_trxn->id = $ids['entityFinancialTrxnId']; } $entity_trxn->save(); diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index 1c40b7359b..1bdaafc4e6 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -103,12 +103,12 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { // action is taken depending upon the mode $financialType = new CRM_Financial_DAO_FinancialType(); $financialType->copyValues($params); - if (CRM_Utils_Array::value('financialType', $ids)) { + if (!empty($ids['financialType'])) { $financialType->id = CRM_Utils_Array::value('financialType', $ids); } $financialType->save(); // CRM-12470 - if (!CRM_Utils_Array::value('financialType', $ids)) { + if (empty($ids['financialType'])) { $titles = CRM_Financial_BAO_FinancialTypeAccount::createDefaultFinancialAccounts($financialType); $financialType->titles = $titles; } diff --git a/CRM/Financial/BAO/FinancialTypeAccount.php b/CRM/Financial/BAO/FinancialTypeAccount.php index b90bdf3fe0..5fa8846168 100644 --- a/CRM/Financial/BAO/FinancialTypeAccount.php +++ b/CRM/Financial/BAO/FinancialTypeAccount.php @@ -95,7 +95,7 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin else { $financialTypeAccount->id = CRM_Utils_Array::value('entityFinancialAccount', $ids); } - if (CRM_Utils_Array::value('entityFinancialAccount', $ids)) { + if (!empty($ids['entityFinancialAccount'])) { $financialTypeAccount->id = $ids['entityFinancialAccount']; } $financialTypeAccount->copyValues($params); diff --git a/CRM/Financial/BAO/PaymentProcessor.php b/CRM/Financial/BAO/PaymentProcessor.php index 0531fb98a5..110dc94044 100644 --- a/CRM/Financial/BAO/PaymentProcessor.php +++ b/CRM/Financial/BAO/PaymentProcessor.php @@ -68,7 +68,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces $processor->save(); // CRM-11826, add entry in civicrm_entity_financial_account // if financial_account_id is not NULL - if (CRM_Utils_Array::value('financial_account_id', $params)) { + if (!empty($params['financial_account_id'])) { $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' ")); $values = array( 'entity_table' => 'civicrm_payment_processor', diff --git a/CRM/Financial/Form/FinancialBatch.php b/CRM/Financial/Form/FinancialBatch.php index a03a92312d..efcb53837e 100644 --- a/CRM/Financial/Form/FinancialBatch.php +++ b/CRM/Financial/Form/FinancialBatch.php @@ -76,7 +76,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form { ); $createdID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'created_id'); - if (CRM_Utils_Array::value($this->_action, $permissions)) { + if (!empty($permissions[$this->_action])) { $this->checkPermissions($this->_action, $permissions[$this->_action]['permission'], $createdID, $session->get('userID'), $permissions[$this->_action]['actionName'] ); } } @@ -181,7 +181,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form { */ static function formRule($values, $files, $self) { $errors = array(); - if (CRM_Utils_Array::value('contact_name', $values) && !is_numeric($values['created_id'])) { + if (!empty($values['contact_name']) && !is_numeric($values['created_id'])) { $errors['contact_name'] = ts('Please select a valid contact.'); } if ($values['item_count'] && (!is_numeric($values['item_count']) || $values['item_count'] < 1)) { @@ -190,7 +190,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form { if ($values['total'] && (!is_numeric($values['total']) || $values['total'] <= 0)) { $errors['total'] = ts('Total Amount should be a positive number'); } - if (CRM_Utils_Array::value('created_date', $values) && date('Y-m-d') < date('Y-m-d', strtotime($values['created_date']))) { + if (!empty($values['created_date']) && date('Y-m-d') < date('Y-m-d', strtotime($values['created_date']))) { $errors['created_date'] = ts('Created date cannot be greater than current date'); } $batchName = $values['title']; @@ -219,7 +219,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form { // store the submitted values in an array $params['modified_date'] = date('YmdHis'); $params['modified_id'] = $session->get('userID'); - if (CRM_Utils_Array::value('created_date', $params)) { + if (!empty($params['created_date'])) { $params['created_date'] = CRM_Utils_Date::processDate($params['created_date']); } diff --git a/CRM/Financial/Form/FinancialTypeAccount.php b/CRM/Financial/Form/FinancialTypeAccount.php index e811fbffce..35503e9809 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 (CRM_Utils_Array::value('account_relationship', $this->_submitValues) || CRM_Utils_Array::value('financial_account_id', $this->_submitValues)) { + if (!empty($this->_submitValues['account_relationship']) || CRM_Utils_Array::value('financial_account_id', $this->_submitValues)) { $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 (CRM_Utils_Array::value('account_relationship', $values) && CRM_Utils_Array::value('financial_account_id', $values)) { + if (!empty($values['account_relationship']) && CRM_Utils_Array::value('financial_account_id', $values)) { $params = array( 'account_relationship' => $values['account_relationship'], 'entity_id' => $self->_aid diff --git a/CRM/Financial/Form/Search.php b/CRM/Financial/Form/Search.php index bc52e1079b..e7f34190f9 100644 --- a/CRM/Financial/Form/Search.php +++ b/CRM/Financial/Form/Search.php @@ -123,7 +123,7 @@ class CRM_Financial_Form_Search extends CRM_Core_Form { $batchIds[] = $batch[1]; } } - if (CRM_Utils_Array::value('batch_update', $_POST)) { + if (!empty($_POST['batch_update'])) { CRM_Batch_BAO_Batch::closeReOpen($batchIds, $_POST['batch_update']); } } diff --git a/CRM/Financial/Page/FinancialType.php b/CRM/Financial/Page/FinancialType.php index 08628f7ff0..f8fd2ffdfc 100644 --- a/CRM/Financial/Page/FinancialType.php +++ b/CRM/Financial/Page/FinancialType.php @@ -151,7 +151,7 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic { CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, CRM_Core_DAO::$_nullArray, $financialAccountIds); foreach( $financialAccountIds as $key => $values){ - if (CRM_Utils_Array::value($values['financial_account_id'], $financialAccounts)) { + if (!empty($financialAccounts[$values['financial_account_id']])) { $financialAccountId[$values['financial_account_id']] = CRM_Utils_Array::value( $values['financial_account_id'], $financialAccounts ); } diff --git a/CRM/Friend/BAO/Friend.php b/CRM/Friend/BAO/Friend.php index db5101a261..e14822eac6 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 (CRM_Utils_Array::value('is_email_receipt', $default) && CRM_Utils_Array::value('receipt_from_email', $default)) { + if (!empty($default['is_email_receipt']) && CRM_Utils_Array::value('receipt_from_email', $default)) { $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 (CRM_Utils_Array::value('is_email_confirm', $default) && CRM_Utils_Array::value('confirm_from_email', $default)) { + if (!empty($default['is_email_confirm']) && CRM_Utils_Array::value('confirm_from_email', $default)) { $mailParams['email_from'] = $default['confirm_from_email']; } @@ -294,7 +294,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { } // use contact email, CRM-4963 - if (!CRM_Utils_Array::value('email_from', $values)) { + if (empty($values['email_from'])) { $values['email_from'] = $email; } diff --git a/CRM/Friend/Form.php b/CRM/Friend/Form.php index dc0ee797ee..b19b213fea 100644 --- a/CRM/Friend/Form.php +++ b/CRM/Friend/Form.php @@ -104,7 +104,7 @@ class CRM_Friend_Form extends CRM_Core_Form { $params, $values, array('is_tellfriend_enabled', 'tellfriend_limit') ); - if (!CRM_Utils_Array::value('is_tellfriend_enabled', $values)) { + if (empty($values['is_tellfriend_enabled'])) { CRM_Core_Error::fatal(ts('Tell Friend is disable for this Personal Campaign Page')); } diff --git a/CRM/Friend/Form/Event.php b/CRM/Friend/Form/Event.php index 4a1c03296d..9971cfb9e9 100644 --- a/CRM/Friend/Form/Event.php +++ b/CRM/Friend/Form/Event.php @@ -64,7 +64,7 @@ class CRM_Friend_Form_Event extends CRM_Event_Form_ManageEvent { $defaults['entity_table'] = 'civicrm_event'; $defaults['entity_id'] = $this->_id; CRM_Friend_BAO_Friend::getValues($defaults); - if (CRM_Utils_Array::value('id', $defaults)) { + if (!empty($defaults['id'])) { $defaults['tf_id'] = CRM_Utils_Array::value('id', $defaults); $this->_friendId = $defaults['tf_id']; // lets unset the 'id' since it conflicts with eventID (or contribID) diff --git a/CRM/Grant/BAO/Grant.php b/CRM/Grant/BAO/Grant.php index f0a91cfbb4..52f998b3c2 100644 --- a/CRM/Grant/BAO/Grant.php +++ b/CRM/Grant/BAO/Grant.php @@ -156,7 +156,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { */ static function add(&$params, &$ids) { - if (CRM_Utils_Array::value('grant_id', $ids)) { + if (!empty($ids['grant_id'])) { CRM_Utils_Hook::pre('edit', 'Grant', $ids['grant_id'], $params); } else { @@ -205,7 +205,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { ); $grantTypes = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'); - if (!CRM_Utils_Array::value('skipRecentView', $params)) { + if (empty($params['skipRecentView'])) { if(!isset($grant->contact_id) || !isset($grant->grant_type_id)){ $grant->find(TRUE); } @@ -234,7 +234,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { ); } - if (CRM_Utils_Array::value('grant', $ids)) { + if (!empty($ids['grant'])) { CRM_Utils_Hook::post('edit', 'Grant', $grant->id, $grant); } else { @@ -269,7 +269,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { if (!$id) { $id = CRM_Utils_Array::value('contact_id', $params); } - if (CRM_Utils_Array::value('note', $params) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note',$ids))) { + if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note',$ids))) { $noteParams = array( 'entity_table' => 'civicrm_grant', 'note' => $params['note'] = $params['note'] ? $params['note'] : "null", @@ -291,7 +291,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { CRM_Core_BAO_Log::add($logParams); // add custom field values - if (CRM_Utils_Array::value('custom', $params) && is_array($params['custom'])) { + if (!empty($params['custom']) && is_array($params['custom'])) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_grant', $grant->id); } diff --git a/CRM/Grant/BAO/Query.php b/CRM/Grant/BAO/Query.php index 9011b49693..b3d14f7cdb 100644 --- a/CRM/Grant/BAO/Query.php +++ b/CRM/Grant/BAO/Query.php @@ -48,35 +48,35 @@ class CRM_Grant_BAO_Query { */ static function select(&$query) { if ($query->_mode & CRM_Contact_BAO_Query::MODE_GRANT) { - if (CRM_Utils_Array::value('grant_status_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['grant_status_id'])) { $query->_select['grant_status_id'] = 'grant_status.id as grant_status_id'; $query->_element['grant_status'] = 1; $query->_tables['grant_status'] = $query->_whereTables['grant_status'] = 1; $query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1; } - if (CRM_Utils_Array::value('grant_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['grant_status'])) { $query->_select['grant_status'] = 'grant_status.label as grant_status'; $query->_element['grant_status'] = 1; $query->_tables['grant_status'] = $query->_whereTables['grant_status'] = 1; $query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1; } - if (CRM_Utils_Array::value('grant_type_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['grant_type_id'])) { $query->_select['grant_type_id'] = 'grant_type.id as grant_type_id'; $query->_element['grant_type'] = 1; $query->_tables['grant_type'] = $query->_whereTables['grant_type'] = 1; $query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1; } - if (CRM_Utils_Array::value('grant_type', $query->_returnProperties)) { + if (!empty($query->_returnProperties['grant_type'])) { $query->_select['grant_type'] = 'grant_type.label as grant_type'; $query->_element['grant_type'] = 1; $query->_tables['grant_type'] = $query->_whereTables['grant_type'] = 1; $query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1; } - if (CRM_Utils_Array::value('grant_note', $query->_returnProperties)) { + if (!empty($query->_returnProperties['grant_note'])) { $query->_select['grant_note'] = "civicrm_note.note as grant_note"; $query->_element['grant_note'] = 1; $query->_tables['grant_note'] = 1; diff --git a/CRM/Grant/Form/Grant.php b/CRM/Grant/Form/Grant.php index bc7dbab2f4..9898a23e45 100644 --- a/CRM/Grant/Form/Grant.php +++ b/CRM/Grant/Form/Grant.php @@ -105,7 +105,7 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { } // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { $this->set('type', 'Grant'); $this->set('subType', CRM_Utils_Array::value('grant_type_id', $_POST)); $this->set('entityId', $this->_id); @@ -153,7 +153,7 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { ); foreach ($dates as $key) { - if (CRM_Utils_Array::value($key, $defaults)) { + if (!empty($defaults[$key])) { list($defaults[$key]) = CRM_Utils_Date::setDateDefaults($defaults[$key]); } } @@ -306,12 +306,12 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { // get the submitted form values. $params = $this->controller->exportValues($this->_name); - if (!CRM_Utils_Array::value('grant_report_received', $params)) { + if (empty($params['grant_report_received'])) { $params['grant_report_received'] = "null"; } // set the contact, when contact is selected - if (CRM_Utils_Array::value('contact_select_id', $params)) { + if (!empty($params['contact_select_id'])) { $this->_contactID = $params['contact_select_id'][1]; } diff --git a/CRM/Grant/StateMachine/Search.php b/CRM/Grant/StateMachine/Search.php index 654d4c3d41..a2df38f200 100644 --- a/CRM/Grant/StateMachine/Search.php +++ b/CRM/Grant/StateMachine/Search.php @@ -82,7 +82,7 @@ class CRM_Grant_StateMachine_Search extends CRM_Core_StateMachine { function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff // fix value if print button is pressed - if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) { + if (!empty($_POST['_qf_' . $formName . '_next_print'])) { $value = CRM_Grant_Task::PRINT_GRANTS; } else { diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index e3e9f0847d..f36a7be006 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -131,11 +131,11 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { 'search_custom_id' ); } - if (CRM_Utils_Array::value('created_id', $this->_groupValues)) + if (!empty($this->_groupValues['created_id'])) $groupValues['created_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['created_id'] , 'sort_name', 'id'); - if (CRM_Utils_Array::value('modified_id', $this->_groupValues)) { + if (!empty($this->_groupValues['modified_id'])) { $groupValues['modified_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['modified_id'] , 'sort_name', 'id'); } @@ -164,7 +164,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { if (isset($this->_id)) { $defaults = $this->_groupValues; - if (CRM_Utils_Array::value('group_type', $defaults)) { + if (!empty($defaults['group_type'])) { $types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($defaults['group_type'], 1, -1) ); @@ -179,7 +179,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { ) { CRM_Contact_BAO_GroupOrganization::retrieve($this->_id, $defaults); - if (CRM_Utils_Array::value('group_organization', $defaults)) { + if (!empty($defaults['group_organization'])) { //used in edit mode $this->_groupOrganizationID = $defaults['group_organization']; } @@ -202,7 +202,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { } } - if (!CRM_Utils_Array::value('parents', $defaults)) { + if (empty($defaults['parents'])) { $defaults['parents'] = CRM_Core_BAO_Domain::getGroupId(); } @@ -384,7 +384,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { } $grpAdd = 0; - if (CRM_Utils_Array::value('parents', $fields)) { + if (!empty($fields['parents'])) { $grpAdd++; } @@ -394,7 +394,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { } // do check for both name and title uniqueness - if (CRM_Utils_Array::value('title', $fields)) { + if (!empty($fields['title'])) { $title = trim($fields['title']); $query = " SELECT count(*) @@ -461,7 +461,7 @@ WHERE title = %1 * Remove any parent groups requested to be removed */ - if (CRM_Utils_Array::value('parents', $this->_groupValues)) { + if (!empty($this->_groupValues['parents'])) { $parentGroupIds = explode(',', $this->_groupValues['parents']); foreach ($parentGroupIds as $parentGroupId) { if (isset($params["remove_parent_group_$parentGroupId"])) { diff --git a/CRM/Group/Page/AJAX.php b/CRM/Group/Page/AJAX.php index 98b5a69f7a..1a37a63dd2 100644 --- a/CRM/Group/Page/AJAX.php +++ b/CRM/Group/Page/AJAX.php @@ -88,7 +88,7 @@ class CRM_Group_Page_AJAX { 'group_type', 'visibility', 'org_info', 'links', 'class', ); - if (!CRM_Utils_Array::value('showOrgInfo', $params)) { + if (empty($params['showOrgInfo'])) { unset($selectorElements[6]); } diff --git a/CRM/Logging/Differ.php b/CRM/Logging/Differ.php index 9c27255dc2..0cf1c18ab4 100644 --- a/CRM/Logging/Differ.php +++ b/CRM/Logging/Differ.php @@ -196,7 +196,7 @@ WHERE lt.log_conn_id = %1 AND // we need to make sure separators are trimmed if ($diff == 'case_type_id') { foreach (array('original', 'changed') as $var) { - if (CRM_Utils_Array::value($diff, $$var)) { + if (!empty($$var[$diff])) { $holder =& $$var; $val = explode(CRM_Case_BAO_Case::VALUE_SEPARATOR, $holder[$diff]); $holder[$diff] = CRM_Utils_Array::value(1, $val); diff --git a/CRM/Logging/ReportSummary.php b/CRM/Logging/ReportSummary.php index cc4deb5e6c..f72ee2ef1f 100644 --- a/CRM/Logging/ReportSummary.php +++ b/CRM/Logging/ReportSummary.php @@ -230,15 +230,15 @@ class CRM_Logging_ReportSummary extends CRM_Report_Form { $rows = array(); $tempColumns = "id int(10)"; - if (CRM_Utils_Array::value('log_action', $this->_params['fields'])) { + if (!empty($this->_params['fields']['log_action'])) { $tempColumns .= ", log_action varchar(64)"; } $tempColumns .= ", log_type varchar(64), log_user_id int(10), log_date timestamp"; - if (CRM_Utils_Array::value('altered_contact', $this->_params['fields'])) { + if (!empty($this->_params['fields']['altered_contact'])) { $tempColumns .= ", altered_contact varchar(128)"; } $tempColumns .= ", altered_contact_id int(10), log_conn_id int(11), is_deleted tinyint(4)"; - if (CRM_Utils_Array::value('display_name', $this->_params['fields'])) { + if (!empty($this->_params['fields']['display_name'])) { $tempColumns .= ", display_name varchar(128)"; } @@ -336,7 +336,7 @@ ORDER BY log_civicrm_entity_log_date DESC {$this->_limit}"; } function getLogType($entity) { - if (CRM_Utils_Array::value('log_type', $this->_logTables[$entity])) { + if (!empty($this->_logTables[$entity]['log_type'])) { return $this->_logTables[$entity]['log_type']; } $logType = ucfirst(substr($entity, strrpos($entity, '_') + 1)); @@ -344,8 +344,8 @@ ORDER BY log_civicrm_entity_log_date DESC {$this->_limit}"; } function getEntityValue($id, $entity, $logDate) { - if (CRM_Utils_Array::value('bracket_info', $this->_logTables[$entity])) { - if (CRM_Utils_Array::value('entity_column', $this->_logTables[$entity]['bracket_info'])) { + if (!empty($this->_logTables[$entity]['bracket_info'])) { + if (!empty($this->_logTables[$entity]['bracket_info']['entity_column'])) { $logTable = !empty($this->_logTables[$entity]['table_name']) ? $this->_logTables[$entity]['table_name'] : $entity; $sql = " SELECT {$this->_logTables[$entity]['bracket_info']['entity_column']} @@ -389,7 +389,7 @@ WHERE log_date <= %1 AND id = %2 ORDER BY log_date DESC LIMIT 1"; } function getEntityAction($id, $connId, $entity, $oldAction) { - if (CRM_Utils_Array::value('action_column', $this->_logTables[$entity])) { + if (!empty($this->_logTables[$entity]['action_column'])) { $sql = "select {$this->_logTables[$entity]['action_column']} from `{$this->loggingDB}`.{$entity} where id = %1 AND log_conn_id = %2"; $newAction = CRM_Core_DAO::singleValueQuery($sql, array( 1 => array($id, 'Integer'), diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index bdee729f93..0f1124b49e 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -1231,7 +1231,7 @@ ORDER BY civicrm_email.is_bulkmail DESC CRM_Utils_Hook::alterMailParams($mailParams, 'civimail'); // CRM-10699 support custom email headers - if (CRM_Utils_Array::value('headers', $mailParams)) { + if (!empty($mailParams['headers'])) { $headers = array_merge($headers, $mailParams['headers']); } //cycle through mailParams and set headers array @@ -1457,7 +1457,7 @@ ORDER BY civicrm_email.is_bulkmail DESC $result = $mailing->save(); - if (CRM_Utils_Array::value('mailing', $ids)) { + if (!empty($ids['mailing'])) { CRM_Utils_Hook::post('edit', 'Mailing', $mailing->id, $mailing); } else { @@ -1920,7 +1920,7 @@ ORDER BY civicrm_email.is_bulkmail DESC $report['event_totals']['queue'] = self::getRecipientsCount($mailing_id, $mailing_id); } - if (CRM_Utils_Array::value('queue', $report['event_totals'])) { + if (!empty($report['event_totals']['queue'])) { $report['event_totals']['delivered_rate'] = (100.0 * $report['event_totals']['delivered']) / $report['event_totals']['queue']; $report['event_totals']['bounce_rate'] = (100.0 * $report['event_totals']['bounce']) / $report['event_totals']['queue']; $report['event_totals']['unsubscribe_rate'] = (100.0 * $report['event_totals']['unsubscribe']) / $report['event_totals']['queue']; diff --git a/CRM/Mailing/BAO/Query.php b/CRM/Mailing/BAO/Query.php index f80b61d4fe..ea18d25891 100644 --- a/CRM/Mailing/BAO/Query.php +++ b/CRM/Mailing/BAO/Query.php @@ -66,19 +66,19 @@ class CRM_Mailing_BAO_Query { $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1; // get mailing name - if (CRM_Utils_Array::value('mailing_name', $query->_returnProperties)) { + if (!empty($query->_returnProperties['mailing_name'])) { $query->_select['mailing_name'] = "civicrm_mailing.name as mailing_name"; $query->_element['mailing_name'] = 1; } // get mailing subject - if (CRM_Utils_Array::value('mailing_subject', $query->_returnProperties)) { + if (!empty($query->_returnProperties['mailing_subject'])) { $query->_select['mailing_subject'] = "civicrm_mailing.subject as mailing_subject"; $query->_element['mailing_subject'] = 1; } // get mailing status - if (CRM_Utils_Array::value('mailing_job_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['mailing_job_status'])) { $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] = " LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 "; $query->_select['mailing_job_status'] = "civicrm_mailing_job.status as mailing_job_status"; @@ -86,34 +86,34 @@ class CRM_Mailing_BAO_Query { } // get email on hold - if (CRM_Utils_Array::value('email_on_hold', $query->_returnProperties)) { + if (!empty($query->_returnProperties['email_on_hold'])) { $query->_select['email_on_hold'] = "recipient_email.on_hold as email_on_hold"; $query->_element['email_on_hold'] = 1; $query->_tables['recipient_email'] = $query->_whereTables['recipient_email'] = 1; } // get recipient email - if (CRM_Utils_Array::value('email', $query->_returnProperties)) { + if (!empty($query->_returnProperties['email'])) { $query->_select['email'] = "recipient_email.email as email"; $query->_element['email'] = 1; $query->_tables['recipient_email'] = $query->_whereTables['recipient_email'] = 1; } // get user opt out - if (CRM_Utils_Array::value('contact_opt_out', $query->_returnProperties)) { + if (!empty($query->_returnProperties['contact_opt_out'])) { $query->_select['contact_opt_out'] = "contact_a.is_opt_out as contact_opt_out"; $query->_element['contact_opt_out'] = 1; } // mailing job end date / completed date - if (CRM_Utils_Array::value('mailing_job_end_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['mailing_job_end_date'])) { $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] = " LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 "; $query->_select['mailing_job_end_date'] = "civicrm_mailing_job.end_date as mailing_job_end_date"; $query->_element['mailing_job_end_date'] = 1; } - if (CRM_Utils_Array::value('mailing_recipients_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['mailing_recipients_id'])) { $query->_select['mailing_recipients_id'] = " civicrm_mailing_recipients.id as mailing_recipients_id"; $query->_element['mailing_recipients_id'] = 1; } @@ -123,7 +123,7 @@ class CRM_Mailing_BAO_Query { static function where(&$query) { $grouping = NULL; foreach (array_keys($query->_params) as $id) { - if (!CRM_Utils_Array::value(0, $query->_params[$id])) { + if (empty($query->_params[$id][0])) { continue; } if (substr($query->_params[$id][0], 0, 8) == 'mailing_') { diff --git a/CRM/Mailing/Event/BAO/Forward.php b/CRM/Mailing/Event/BAO/Forward.php index e2de313e50..83357332e7 100644 --- a/CRM/Mailing/Event/BAO/Forward.php +++ b/CRM/Mailing/Event/BAO/Forward.php @@ -173,7 +173,7 @@ class CRM_Mailing_Event_BAO_Forward extends CRM_Mailing_Event_DAO_Forward { //append comment if added while forwarding. if (count($comment)) { $message->_txtbody = CRM_Utils_Array::value('body_text', $comment) . $message->_txtbody; - if (CRM_Utils_Array::value('body_html', $comment)) { + if (!empty($comment['body_html'])) { $message->_htmlbody = $comment['body_html'] . '
---------------Original message---------------------
' . $message->_htmlbody; } } diff --git a/CRM/Mailing/Form/Group.php b/CRM/Mailing/Form/Group.php index 51ba1c2a9e..7169819dc9 100644 --- a/CRM/Mailing/Form/Group.php +++ b/CRM/Mailing/Form/Group.php @@ -393,7 +393,7 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task { foreach ( array('name', 'group_id', 'search_id', 'search_args', 'campaign_id', 'dedupe_email') as $n ) { - if (CRM_Utils_Array::value($n, $values)) { + if (!empty($values[$n])) { $params[$n] = $values[$n]; } } diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php index 88cdf99626..88c13c0d88 100644 --- a/CRM/Mailing/Form/Test.php +++ b/CRM/Mailing/Form/Test.php @@ -202,7 +202,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form { $urlString = 'civicrm/contact/' . $fragment; } $emails = NULL; - if (CRM_Utils_Array::value('sendtest', $testParams)) { + if (!empty($testParams['sendtest'])) { if (!($testParams['test_group'] || $testParams['test_email'])) { CRM_Core_Session::setStatus(ts('You did not provide an email address or select a group.'), ts('Test not sent.'), 'error'); $error = TRUE; @@ -228,7 +228,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('_qf_Test_submit', $testParams)) { + if (!empty($testParams['_qf_Test_submit'])) { //when user perform mailing from search context //redirect it to search result CRM-3711. if ($ssID && $self->_searchBasedMailing) { @@ -260,7 +260,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('_qf_Test_next', $testParams) && + if (!empty($testParams['_qf_Test_next']) && $self->get('count') <= 0) { return array( '_qf_default' => @@ -268,7 +268,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form { ); } - if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST) || + if (!empty($_POST['_qf_Import_refresh']) || CRM_Utils_Array::value('_qf_Test_next', $testParams) || !CRM_Utils_Array::value('sendtest', $testParams) ) { @@ -345,7 +345,7 @@ ORDER BY e.is_bulkmail DESC, e.is_primary DESC $isComplete = CRM_Mailing_BAO_MailingJob::runJobs($testParams); } - if (CRM_Utils_Array::value('sendtest', $testParams)) { + if (!empty($testParams['sendtest'])) { $status = NULL; if (CRM_Mailing_Info::workflowEnabled()) { if (( diff --git a/CRM/Mailing/Form/Upload.php b/CRM/Mailing/Form/Upload.php index 0147e8f38f..0698ccdf72 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 (CRM_Utils_Array::value('from_name', $defaults) && CRM_Utils_Array::value('from_email', $defaults)) { + if (!empty($defaults['from_name']) && CRM_Utils_Array::value('from_email', $defaults)) { $defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>', CRM_Core_OptionGroup::values('from_email_address') ); @@ -132,7 +132,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('replyto_email', $defaults)) { + if (!empty($defaults['replyto_email'])) { $replyToEmail = CRM_Core_OptionGroup::values('from_email_address'); foreach ($replyToEmail as $value) { if (strstr($value, $defaults['replyto_email'])) { @@ -241,7 +241,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { array('' => '- select -') + $fromEmailAddress ); } - elseif (CRM_Utils_Array::value('override_verp', $options)) { + elseif (!empty($options['override_verp'])) { $trackReplies = TRUE; $this->assign('trackReplies', $trackReplies); } @@ -327,7 +327,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { $formValues = $this->controller->exportValues($this->_name); foreach ($uploadParams as $key) { - if (CRM_Utils_Array::value($key, $formValues) || + if (!empty($formValues[$key]) || in_array($key, array('header_id', 'footer_id')) ) { $params[$key] = $formValues[$key]; @@ -384,13 +384,13 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { $composeParams = array(); foreach ($composeFields as $key) { - if (CRM_Utils_Array::value($key, $formValues)) { + if (!empty($formValues[$key])) { $composeParams[$key] = $formValues[$key]; $this->set($key, $formValues[$key]); } } - if (CRM_Utils_Array::value('updateTemplate', $composeParams)) { + if (!empty($composeParams['updateTemplate'])) { $templateParams = array( 'msg_text' => $text_message, 'msg_html' => $html_message, @@ -403,7 +403,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } - if (CRM_Utils_Array::value('saveTemplate', $composeParams)) { + if (!empty($composeParams['saveTemplate'])) { $templateParams = array( 'msg_text' => $text_message, 'msg_html' => $html_message, @@ -444,7 +444,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { $params['from_name'] = CRM_Utils_Array::value(1, explode('"', $fromEmailAddress)); //Add Reply-To to headers - if (CRM_Utils_Array::value('reply_to_address', $formValues)) { + if (!empty($formValues['reply_to_address'])) { $replyToEmail = CRM_Core_OptionGroup::values('from_email_address'); $params['replyto_email'] = CRM_Utils_Array::value($formValues['reply_to_address'], $replyToEmail); } @@ -510,7 +510,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { * @static */ static function formRule($params, $files, $self) { - if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST)) { + if (!empty($_POST['_qf_Import_refresh'])) { return TRUE; } $errors = array(); @@ -582,10 +582,10 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { } } else { - if (!CRM_Utils_Array::value('text_message', $params) && !CRM_Utils_Array::value('html_message', $params)) { + if (empty($params['text_message']) && !CRM_Utils_Array::value('html_message', $params)) { $errors['html_message'] = ts('Please provide either a Text or HTML formatted message - or both.'); } - if (CRM_Utils_Array::value('saveTemplate', $params) && !CRM_Utils_Array::value('saveTemplateName', $params)) { + if (!empty($params['saveTemplate']) && !CRM_Utils_Array::value('saveTemplateName', $params)) { $errors['saveTemplateName'] = ts('Please provide a Template Name.'); } } @@ -665,8 +665,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { } $templateName = CRM_Core_BAO_MessageTemplate::getMessageTemplates(); - if (CRM_Utils_Array::value('saveTemplate', $params) - && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName) + if (!empty($params['saveTemplate']) && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName) ) { $errors['saveTemplate'] = ts('Duplicate Template Name.'); } diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 3aed00e50d..2609b3906a 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -66,7 +66,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { */ static function &add(&$params, &$ids) { - if (CRM_Utils_Array::value('membership', $ids)) { + if (!empty($ids['membership'])) { CRM_Utils_Hook::pre('edit', 'Membership', $ids['membership'], $params); $oldStatus = NULL; $oldType = NULL; @@ -136,7 +136,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { // reset the group contact cache since smart groups might be affected due to this CRM_Contact_BAO_GroupContactCache::remove(); - if (CRM_Utils_Array::value('membership', $ids)) { + if (!empty($ids['membership'])) { if ($membership->status_id != $oldStatus) { $allStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'get'); $activityParam = array( @@ -231,7 +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 (!CRM_Utils_Array::value('is_override', $params) && + if (empty($params['is_override']) && !CRM_Utils_Array::value('skipStatusCal', $params) ) { $dates = array('start_date', 'end_date', 'join_date'); @@ -294,8 +294,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { } // add custom field values - if (CRM_Utils_Array::value('custom', $params) - && is_array($params['custom']) + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_membership', $membership->id); } @@ -310,13 +309,13 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { } //record contribution for this membership - if (CRM_Utils_Array::value('contribution_status_id', $params) && !CRM_Utils_Array::value('relate_contribution_id', $params)) { + if (!empty($params['contribution_status_id']) && !CRM_Utils_Array::value('relate_contribution_id', $params)) { $memInfo = array_merge($params, array('membership_id' => $membership->id)); $params['contribution'] = self::recordMembershipContribution($memInfo, $ids); } //insert payment record for this membership - if (CRM_Utils_Array::value('relate_contribution_id', $params)) { + if (!empty($params['relate_contribution_id'])) { $mpDAO = new CRM_Member_DAO_MembershipPayment(); $mpDAO->membership_id = $membership->id; $mpDAO->contribution_id = $params['relate_contribution_id']; @@ -329,11 +328,11 @@ 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 (!CRM_Utils_Array::value('membership', $ids) || + if (empty($ids['membership']) || $activityType == 'Membership Renewal' || CRM_Utils_Array::value('createActivity', $params) ) { - if (CRM_Utils_Array::value('membership', $ids)) { + if (!empty($ids['membership'])) { $data = array(); CRM_Core_DAO::commonRetrieveAll('CRM_Member_DAO_Membership', 'id', @@ -354,7 +353,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { // create activity source = individual, target = org CRM-4027 $targetContactID = NULL; - if (CRM_Utils_Array::value('is_for_organization', $params)) { + if (!empty($params['is_for_organization'])) { $targetContactID = $membership->contact_id; $membership->contact_id = CRM_Utils_Array::value('userId', $ids); } @@ -363,9 +362,9 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { $membership->contact_id = $realMembershipContactId; } - if (CRM_Utils_Array::value('membership', $ids) && $activityType != 'Membership Signup') { + if (!empty($ids['membership']) && $activityType != 'Membership Signup') { CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $targetContactID); - } elseif (!CRM_Utils_Array::value('membership', $ids)) { + } elseif (empty($ids['membership'])) { CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $targetContactID); } @@ -380,7 +379,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { self::createRelatedMemberships($params, $membership); // do not add to recent items for import, CRM-4399 - if (!CRM_Utils_Array::value('skipRecentView', $params)) { + if (empty($params['skipRecentView'])) { $url = CRM_Utils_System::url('civicrm/contact/view/membership', "action=view&reset=1&id={$membership->id}&cid={$membership->contact_id}&context=home" ); @@ -507,7 +506,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { 'status', 'membership_type') as $fld) { $defaults[$fld] = CRM_Utils_Array::value($fld, $statusANDType[$membership->id]); } - if (CRM_Utils_Array::value('is_current_member', $statusANDType[$membership->id])) { + if (!empty($statusANDType[$membership->id]['is_current_member'])) { $defaults['active'] = TRUE; } @@ -680,7 +679,7 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty $actives = array(); if ($status == 'active') { foreach ($memberships as $f => $v) { - if (CRM_Utils_Array::value('active', $v)) { + if (!empty($v['active'])) { $actives[$f] = $v; } } @@ -688,7 +687,7 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty } elseif ($status == 'inactive') { foreach ($memberships as $f => $v) { - if (!CRM_Utils_Array::value('active', $v)) { + if (empty($v['active'])) { $actives[$f] = $v; } } @@ -740,14 +739,14 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty continue; } foreach ($pField['options'] as $opId => $opValues) { - if (!CRM_Utils_Array::value('membership_type_id', $opValues)) { + if (empty($opValues['membership_type_id'])) { continue; } $membershipTypeIds[$opValues['membership_type_id']] = $opValues['membership_type_id']; } } } - elseif (CRM_Utils_Array::value('membership_types', $membershipBlock)) { + elseif (!empty($membershipBlock['membership_types'])) { $membershipTypeIds = explode(',', $membershipBlock['membership_types']); } @@ -910,7 +909,7 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty $dao->is_active = 1; if ($dao->find(TRUE)) { CRM_Core_DAO::storeValues($dao, $membershipBlock); - if (CRM_Utils_Array::value('membership_types', $membershipBlock)) { + if (!empty($membershipBlock['membership_types'])) { $membershipTypes = unserialize($membershipBlock['membership_types']); if (!is_array($membershipTypes)) { return $membershipBlock; @@ -1278,7 +1277,7 @@ AND civicrm_membership.is_test = %2"; if (is_a($result[1], 'CRM_Core_Error')) { $errors[1] = CRM_Core_Error::getMessages($result[1]); } - elseif (CRM_Utils_Array::value(1, $result)) { + elseif (!empty($result[1])) { // Save the contribution ID so that I can be used in email receipts // For example, if you need to generate a tax receipt for the donation only. $form->_values['contribution_other_id'] = $result[1]->id; @@ -1287,7 +1286,7 @@ AND civicrm_membership.is_test = %2"; $memBlockDetails = CRM_Member_BAO_Membership::getMembershipBlock($form->_id); - if (CRM_Utils_Array::value('is_separate_payment', $memBlockDetails) && !$paymentDone) { + if (!empty($memBlockDetails['is_separate_payment']) && !$paymentDone) { $form->_lineItem = $form->_memLineItem; $contributionType = new CRM_Financial_DAO_FinancialType( ); $contributionType->id = CRM_Utils_Array::value('financial_type_id', $membershipDetails); @@ -1299,7 +1298,7 @@ AND civicrm_membership.is_test = %2"; $tempParams['invoiceID'] = $invoiceID; //we don't allow recurring membership.CRM-3781. - if (CRM_Utils_Array::value('is_recur', $tempParams)) { + if (!empty($tempParams['is_recur'])) { $tempParams['is_recur'] = 0; } $result = NULL; @@ -1358,7 +1357,7 @@ AND civicrm_membership.is_test = %2"; $index = !empty($memBlockDetails['is_separate_payment']) ? 2 : 1; - if (!CRM_Utils_Array::value($index, $errors)) { + if (empty($errors[$index])) { if (isset($membershipParams['onbehalf']) && CRM_Utils_Array::value('member_campaign_id', $membershipParams['onbehalf'])) { $form->_params['campaign_id'] = $membershipParams['onbehalf']['member_campaign_id']; @@ -1392,7 +1391,7 @@ AND civicrm_membership.is_test = %2"; } if ($form->_priceSetId && !empty($form->_useForMember) && !empty($form->_lineItem)) { foreach ($form->_lineItem[$form->_priceSetId] as & $priceFieldOp) { - if (CRM_Utils_Array::value('membership_type_id', $priceFieldOp) && + if (!empty($priceFieldOp['membership_type_id']) && isset($createdMemberships[$priceFieldOp['membership_type_id']]) ) { $membershipOb = $createdMemberships[$priceFieldOp['membership_type_id']]; @@ -1472,7 +1471,7 @@ AND civicrm_membership.is_test = %2"; // Do not send an email if Recurring transaction is done via Direct Mode // Email will we sent when the IPN is received. - if (CRM_Utils_Array::value('is_recur', $form->_params) && $form->_contributeMode == 'direct') { + if (!empty($form->_params['is_recur']) && $form->_contributeMode == 'direct') { return TRUE; } @@ -1604,7 +1603,7 @@ AND civicrm_membership.is_test = %2"; } CRM_Member_BAO_MembershipLog::add($logParams, CRM_Core_DAO::$_nullArray); - if (CRM_Utils_Array::value('contributionRecurID', $form->_params)) { + if (!empty($form->_params['contributionRecurID'])) { CRM_Core_DAO::setFieldValue('CRM_Member_DAO_Membership', $membership->id, 'contribution_recur_id', $form->_params['contributionRecurID'] ); @@ -1642,7 +1641,7 @@ AND civicrm_membership.is_test = %2"; $currentMembership['end_date'] = CRM_Utils_Array::value('end_date', $dates); $currentMembership['is_test'] = $is_test; - if (CRM_Utils_Array::value('membership_source', $form->_params)) { + if (!empty($form->_params['membership_source'])) { $currentMembership['source'] = $form->_params['membership_source']; } elseif (isset($form->_values['title']) && !empty($form->_values['title'])) { @@ -1655,7 +1654,7 @@ AND civicrm_membership.is_test = %2"; ); } - if (CRM_Utils_Array::value('id', $currentMembership)) { + if (!empty($currentMembership['id'])) { $ids['membership'] = $currentMembership['id']; } $memParams = $currentMembership; @@ -1687,7 +1686,7 @@ AND civicrm_membership.is_test = %2"; //set the log start date. $memParams['log_start_date'] = CRM_Utils_Date::customFormat($dates['log_start_date'], $format); if (empty($membership->source)) { - if (CRM_Utils_Array::value('membership_source', $form->_params)) { + if (!empty($form->_params['membership_source'])) { $memParams['source'] = $form->_params['membership_source']; } elseif (property_exists($form, '_values') && CRM_Utils_Array::value('title', $form->_values)) { @@ -1701,7 +1700,7 @@ AND civicrm_membership.is_test = %2"; } } - if (CRM_Utils_Array::value('id', $currentMembership)) { + if (!empty($currentMembership['id'])) { $ids['membership'] = $currentMembership['id']; } } @@ -1744,10 +1743,10 @@ AND civicrm_membership.is_test = %2"; $updateStatusId = array_search('Pending', $allStatus); } - if (CRM_Utils_Array::value('membership_source', $form->_params)) { + if (!empty($form->_params['membership_source'])) { $memParams['source'] = $form->_params['membership_source']; } - elseif (CRM_Utils_Array::value('title', $form->_values)) { + elseif (!empty($form->_values['title'])) { $memParams['source'] = ts('Online Contribution:') . ' ' . $form->_values['title']; } $memParams['contribution_recur_id'] = CRM_Utils_Array::value('contributionRecurID', $form->_params); @@ -2039,7 +2038,7 @@ WHERE civicrm_membership.contact_id = civicrm_contact.id // remove repeated related contacts, which already inherited membership. $relatedContactIds[$membership->contact_id] = TRUE; foreach ($allRelatedContacts as $cid => $status) { - if (!CRM_Utils_Array::value($cid, $relatedContactIds)) { + if (empty($relatedContactIds[$cid])) { $relatedContactIds[$cid] = TRUE; //don't create membership again for owner contact. @@ -2669,16 +2668,16 @@ WHERE civicrm_membership.is_test = 0"; } // make entry in batch entity batch table - if (CRM_Utils_Array::value('batch_id', $params)) { + if (!empty($params['batch_id'])) { $contributionParams['batch_id'] = $params['batch_id']; } - if ( CRM_Utils_Array::value('contribution_contact_id', $params) ) { + if (!empty($params['contribution_contact_id'])) { // deal with possibility of a different person paying for contribution $contributionParams['contact_id'] = $params['contribution_contact_id']; } - if (CRM_Utils_Array::value('processPriceSet', $params) && + if (!empty($params['processPriceSet']) && !empty($params['lineItems']) ) { $contributionParams['line_item'] = CRM_Utils_Array::value('lineItems', $params, NULL); @@ -2691,13 +2690,13 @@ WHERE civicrm_membership.is_test = 0"; //insert payment record for this membership - if (!CRM_Utils_Array::value('contribution', $ids) || + if (empty($ids['contribution']) || CRM_Utils_Array::value('is_recur', $params) ) { $mpDAO = new CRM_Member_DAO_MembershipPayment(); $mpDAO->membership_id = $membershipId; $mpDAO->contribution_id = $contribution->id; - if (CRM_Utils_Array::value('is_recur', $params)) { + if (!empty($params['is_recur'])) { $mpDAO->find(); } @@ -2743,7 +2742,7 @@ WHERE civicrm_membership.is_test = 0"; $editedResults = array(); CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults); $qf->_priceSet['fields'][$fid]['options'][$editedResults['id']] = $priceSets['fields'][$fid]['options'][$editedResults['id']]; - if (CRM_Utils_Array::value('total_amount', $qf->_params)) { + if (!empty($qf->_params['total_amount'])) { $qf->_priceSet['fields'][$fid]['options'][$editedResults['id']]['amount'] = $qf->_params['total_amount']; } } diff --git a/CRM/Member/BAO/MembershipStatus.php b/CRM/Member/BAO/MembershipStatus.php index 6ade1ca1de..58deb11703 100644 --- a/CRM/Member/BAO/MembershipStatus.php +++ b/CRM/Member/BAO/MembershipStatus.php @@ -134,7 +134,7 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus { } //copy name to label when not passed. - if (!CRM_Utils_Array::value('label', $params) && + if (empty($params['label']) && CRM_Utils_Array::value('name', $params) ) { $params['label'] = $params['name']; diff --git a/CRM/Member/BAO/MembershipType.php b/CRM/Member/BAO/MembershipType.php index 05fb74ed21..80956abca7 100644 --- a/CRM/Member/BAO/MembershipType.php +++ b/CRM/Member/BAO/MembershipType.php @@ -118,7 +118,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { self::createMembershipPriceField($params, $ids, $previousID, $membershipType->id); // update all price field value for quick config when membership type is set CRM-11718 - if (CRM_Utils_Array::value('membershipType', $ids)) { + if (!empty($ids['membershipType'])) { self::updateAllPriceFieldValue($ids['membershipType'], $params); } @@ -192,7 +192,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { ); foreach ($membershipType as $id => $details) { foreach ($periodDays as $pDay) { - if (CRM_Utils_Array::value($pDay, $details)) { + if (!empty($details[$pDay])) { if ($details[$pDay] > 31) { $month = substr($details[$pDay], 0, strlen($details[$pDay]) - 2); $day = substr($details[$pDay], -2); @@ -644,7 +644,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name'); - if (CRM_Utils_Array::value('member_of_contact_id', $params)) { + if (!empty($params['member_of_contact_id'])) { $fieldName = $params['member_of_contact_id']; } else { @@ -705,7 +705,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { if ($previousID) { CRM_Member_Form_MembershipType::checkPreviousPriceField($previousID, $priceSetId, $membershipTypeId, $optionsIds); - if (CRM_Utils_Array::value('option_id', $optionsIds)) { + if (!empty($optionsIds['option_id'])) { $optionsIds['id'] = current(CRM_Utils_Array::value('option_id', $optionsIds)); } } @@ -723,7 +723,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { * @param integer financial type id */ static function updateAllPriceFieldValue($membershipTypeId, $params) { - if (CRM_Utils_Array::value('minimum_fee', $params)){ + if (!empty($params['minimum_fee'])){ $amount = $params['minimum_fee']; } else { diff --git a/CRM/Member/BAO/Query.php b/CRM/Member/BAO/Query.php index 4636068d38..10f36ff01f 100644 --- a/CRM/Member/BAO/Query.php +++ b/CRM/Member/BAO/Query.php @@ -57,7 +57,7 @@ class CRM_Member_BAO_Query { $query->_whereTables['civicrm_membership'] = 1; //add membership type - if (CRM_Utils_Array::value('membership_type', $query->_returnProperties)) { + if (!empty($query->_returnProperties['membership_type'])) { $query->_select['membership_type'] = "civicrm_membership_type.name as membership_type"; $query->_element['membership_type'] = 1; $query->_tables['civicrm_membership_type'] = 1; @@ -65,26 +65,26 @@ class CRM_Member_BAO_Query { } //add join date - if (CRM_Utils_Array::value('join_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['join_date'])) { $query->_select['join_date'] = "civicrm_membership.join_date as join_date"; $query->_element['join_date'] = 1; } //add source - if (CRM_Utils_Array::value('membership_source', $query->_returnProperties)) { + if (!empty($query->_returnProperties['membership_source'])) { $query->_select['membership_source'] = "civicrm_membership.source as membership_source"; $query->_element['membership_source'] = 1; } //add status - if (CRM_Utils_Array::value('membership_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['membership_status'])) { $query->_select['membership_status'] = "civicrm_membership_status.label as membership_status"; $query->_element['membership_status'] = 1; $query->_tables['civicrm_membership_status'] = 1; $query->_whereTables['civicrm_membership_status'] = 1; } - if (CRM_Utils_Array::value('status_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['status_id'])) { $query->_select['status_id'] = "civicrm_membership_status.id as status_id"; $query->_element['status_id'] = 1; $query->_tables['civicrm_membership_status'] = 1; @@ -92,34 +92,34 @@ class CRM_Member_BAO_Query { } //add start date / end date - if (CRM_Utils_Array::value('membership_start_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['membership_start_date'])) { $query->_select['membership_start_date'] = "civicrm_membership.start_date as membership_start_date"; $query->_element['membership_start_date'] = 1; } - if (CRM_Utils_Array::value('membership_end_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['membership_end_date'])) { $query->_select['membership_end_date'] = "civicrm_membership.end_date as membership_end_date"; $query->_element['membership_end_date'] = 1; } //add owner_membership_id - if (CRM_Utils_Array::value('owner_membership_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['owner_membership_id'])) { $query->_select['owner_membership_id'] = "civicrm_membership.owner_membership_id as owner_membership_id"; $query->_element['owner_membership_id'] = 1; } //add max_related - if (CRM_Utils_Array::value('max_related', $query->_returnProperties)) { + if (!empty($query->_returnProperties['max_related'])) { $query->_select['max_related'] = "civicrm_membership.max_related as max_related"; $query->_element['max_related'] = 1; } //add recur id w/o taking contribution table in join. - if (CRM_Utils_Array::value('membership_recur_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['membership_recur_id'])) { $query->_select['membership_recur_id'] = "civicrm_membership.contribution_recur_id as membership_recur_id"; $query->_element['membership_recur_id'] = 1; } //add campaign id. - if (CRM_Utils_Array::value('member_campaign_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['member_campaign_id'])) { $query->_select['member_campaign_id'] = 'civicrm_membership.campaign_id as member_campaign_id'; $query->_element['member_campaign_id'] = 1; } @@ -129,7 +129,7 @@ class CRM_Member_BAO_Query { static function where(&$query) { $grouping = NULL; foreach (array_keys($query->_params) as $id) { - if (!CRM_Utils_Array::value(0, $query->_params[$id])) { + if (empty($query->_params[$id][0])) { continue; } if (substr($query->_params[$id][0], 0, 7) == 'member_' || substr($query->_params[$id][0], 0, 11) == 'membership_') { @@ -457,7 +457,7 @@ class CRM_Member_BAO_Query { static function tableNames(&$tables) { //add membership table - if (CRM_Utils_Array::value('civicrm_membership_log', $tables) || CRM_Utils_Array::value('civicrm_membership_status', $tables) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) { + if (!empty($tables['civicrm_membership_log']) || CRM_Utils_Array::value('civicrm_membership_status', $tables) || 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 8a7030de96..51bebebc0b 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -173,7 +173,7 @@ class CRM_Member_Form extends CRM_Core_Form { */ function storeContactFields($formValues){ // in a 'standalone form' (contact id not in the url) the contact will be in the form values - if (CRM_Utils_Array::value('contact_select_id', $formValues)) { + if (!empty($formValues['contact_select_id'])) { $this->_contactID = $formValues['contact_select_id'][1]; } @@ -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 (CRM_Utils_Array::value('contribution_contact_select_id', $formValues) && CRM_Utils_Array::value('1', $formValues['contribution_contact_select_id'])) { + if (!empty($formValues['contribution_contact_select_id']) && CRM_Utils_Array::value('1', $formValues['contribution_contact_select_id'])) { $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 7cba16ba13..ce8a346e7b 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -216,7 +216,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $mems_by_org = array(); foreach ($contactMemberships as $memid => $mem) { $mem['member_of_contact_id'] = CRM_Utils_Array::value($mem['membership_type_id'], $memberorgs); - if (CRM_Utils_Array::value('membership_end_date', $mem)) { + if (!empty($mem['membership_end_date'])) { $mem['membership_end_date'] = CRM_Utils_Date::customformat($mem['membership_end_date']); } $mem['membership_type'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', @@ -270,7 +270,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { CRM_Custom_Form_CustomData::preProcess($this); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); @@ -342,7 +342,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $defaults['num_terms'] = 1; - if (CRM_Utils_Array::value('id', $defaults)) { + if (!empty($defaults['id'])) { if ($this->_onlinePendingContributionId) { $defaults['record_contribution'] = $this->_onlinePendingContributionId; } @@ -360,7 +360,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } } - if (CRM_Utils_Array::value('record_contribution', $defaults) && !$this->_mode) { + if (!empty($defaults['record_contribution']) && !$this->_mode) { $contributionParams = array('id' => $defaults['record_contribution']); $contributionIds = array(); @@ -372,17 +372,17 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { //get back original object campaign id. $defaults['campaign_id'] = $memberCampaignId; - if (CRM_Utils_Array::value('receive_date', $defaults)) { + if (!empty($defaults['receive_date'])) { list($defaults['receive_date']) = CRM_Utils_Date::setDateDefaults($defaults['receive_date']); } // Contribution::getValues() over-writes the membership record's source field value - so we need to restore it. - if (CRM_Utils_Array::value('membership_source', $defaults)) { + if (!empty($defaults['membership_source'])) { $defaults['source'] = $defaults['membership_source']; } } //CRM-13420 - if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) { + if (empty($defaults['payment_instrument_id'])) { $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')); } @@ -394,12 +394,12 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { unset($defaults['record_contribution']); } - if (CRM_Utils_Array::value('id', $defaults)) { + if (!empty($defaults['id'])) { $subscriptionCancelled = CRM_Member_BAO_Membership::isSubscriptionCancelled($this->_id); } $alreadyAutoRenew = FALSE; - if (CRM_Utils_Array::value('contribution_recur_id', $defaults) && !$subscriptionCancelled) { + if (!empty($defaults['contribution_recur_id']) && !$subscriptionCancelled) { $defaults['auto_renew'] = 1; $alreadyAutoRenew = TRUE; } @@ -409,17 +409,17 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $this->assign('membership_status_id', CRM_Utils_Array::value('status_id', $defaults)); - if (CRM_Utils_Array::value('is_pay_later', $defaults)) { + if (!empty($defaults['is_pay_later'])) { $this->assign('is_pay_later', TRUE); } if ($this->_mode) { // set default country from config if no country set $config = CRM_Core_Config::singleton(); - if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $defaults)) { + if (empty($defaults["billing_country_id-{$this->_bltID}"])) { $defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry; } - if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $defaults)) { + if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) { $defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince; } @@ -438,17 +438,17 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $dates = array('join_date', 'start_date', 'end_date'); foreach ($dates as $key) { - if (CRM_Utils_Array::value($key, $defaults)) { + if (!empty($defaults[$key])) { list($defaults[$key]) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value($key, $defaults)); } } //setting default join date if there is no join date - if (!CRM_Utils_Array::value('join_date', $defaults)) { + if (empty($defaults['join_date'])) { $defaults['join_date'] = $now; } - if (CRM_Utils_Array::value('membership_end_date', $defaults)) { + if (!empty($defaults['membership_end_date'])) { $this->assign('endDate', $defaults['membership_end_date']); } @@ -469,7 +469,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 (CRM_Utils_Array::value('price_set_id', $_POST)) { + if (!empty($_POST['price_set_id'])) { $buildPriceSet = TRUE; } $getOnlyPriceSetElements = TRUE; @@ -560,14 +560,14 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $allMembershipInfo = $membershipType = array(); foreach ($allMemberships as $key => $values) { - if (CRM_Utils_Array::value('is_active', $values)) { + if (!empty($values['is_active'])) { $membershipType[$key] = CRM_Utils_Array::value('name', $values); if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) { continue; } else { $memberOfContactId = CRM_Utils_Array::value('member_of_contact_id', $values); - if (!CRM_Utils_Array::value($memberOfContactId, $selMemTypeOrg)) { + if (empty($selMemTypeOrg[$memberOfContactId])) { $selMemTypeOrg[$memberOfContactId] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $memberOfContactId, 'display_name', @@ -576,7 +576,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $selOrgMemType[$memberOfContactId][0] = ts('- select -'); } - if (!CRM_Utils_Array::value($key, $selOrgMemType[$memberOfContactId])) { + if (empty($selOrgMemType[$memberOfContactId][$key])) { $selOrgMemType[$memberOfContactId][$key] = CRM_Utils_Array::value('name', $values); } } @@ -885,7 +885,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } } } - elseif (!CRM_Utils_Array::value(1, $params['membership_type_id'])) { + elseif (empty($params['membership_type_id'][1])) { $errors['membership_type_id'] = ts('Please select a membership type.'); } else { @@ -931,32 +931,32 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $errors['financial_type_id'] = ts('Please enter the financial Type.'); } - if (CRM_Utils_Array::value('record_contribution', $params) && !CRM_Utils_Array::value('payment_instrument_id', $params)) { + if (!empty($params['record_contribution']) && !CRM_Utils_Array::value('payment_instrument_id', $params)) { $errors['payment_instrument_id'] = ts('Paid By is a required field.'); } - if (CRM_Utils_Array::value('is_different_contribution_contact', $params)) { - if (!CRM_Utils_Array::value('soft_credit_type_id', $params)) { + if (!empty($params['is_different_contribution_contact'])) { + if (empty($params['soft_credit_type_id'])) { $errors['soft_credit_type_id'] = ts('Please Select a Soft Credit Type'); } - if (!CRM_Utils_Array::value(1, $params['contribution_contact'])) { + if (empty($params['contribution_contact'][1])) { $errors['contribution_contact[1]'] = ts('Please select a contact'); } } - if (CRM_Utils_Array::value('payment_processor_id', $params)) { + if (!empty($params['payment_processor_id'])) { // make sure that credit card number and cvv are valid CRM_Core_Payment_Form::validateCreditCard($params, $errors); } $joinDate = NULL; - if (CRM_Utils_Array::value('join_date', $params)) { + if (!empty($params['join_date'])) { $joinDate = CRM_Utils_Date::processDate($params['join_date']); foreach ($self->_memTypeSelected as $memType) { $startDate = NULL; - if (CRM_Utils_Array::value('start_date', $params)) { + if (!empty($params['start_date'])) { $startDate = CRM_Utils_Date::processDate($params['start_date']); } @@ -965,7 +965,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; // If selected membership type has duration unit as 'lifetime' // and end date is set, then give error $endDate = NULL; - if (CRM_Utils_Array::value('end_date', $params)) { + if (!empty($params['end_date'])) { $endDate = CRM_Utils_Date::processDate($params['end_date']); } @@ -1011,7 +1011,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } //CRM-3724, check for availability of valid membership status. - if (!CRM_Utils_Array::value('is_override', $params) && !isset($errors['_qf_default'])) { + if (empty($params['is_override']) && !isset($errors['_qf_default'])) { $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate, $endDate, $joinDate, @@ -1139,8 +1139,8 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $submittedFinancialType = CRM_Utils_Array::value('financial_type_id', $formValues); if (!empty($lineItem[$priceSetId])) { foreach ($lineItem[$priceSetId] as &$li) { - if (CRM_Utils_Array::value('membership_type_id', $li)) { - if (CRM_Utils_Array::value('membership_num_terms', $li)) { + if (!empty($li['membership_type_id'])) { + if (!empty($li['membership_num_terms'])) { $termsByType[$li['membership_type_id']] = $li['membership_num_terms']; } } @@ -1173,7 +1173,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; // fix for CRM-3724 // when is_override false ignore is_admin statuses during membership // status calculation. similarly we did fix for import in CRM-3570. - if (!CRM_Utils_Array::value('is_override', $params)) { + if (empty($params['is_override'])) { $params['exclude_is_admin'] = TRUE; } @@ -1258,12 +1258,12 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; //CRM-10223 - allow contribution to be recorded against different contact if ($this->_contributorContactID != $this->_contactID) { $params['contribution_contact_id'] = $this->_contributorContactID; - if (CRM_Utils_Array::value('soft_credit_type_id', $this->_params)) { + if (!empty($this->_params['soft_credit_type_id'])) { $softParams['soft_credit_type_id'] = $this->_params['soft_credit_type_id']; $softParams['contact_id'] = $params['contact_id']; } } - if (CRM_Utils_Array::value('record_contribution', $formValues)) { + if (!empty($formValues['record_contribution'])) { $recordContribution = array( 'total_amount', 'financial_type_id', @@ -1285,7 +1285,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; ); } - if (!CRM_Utils_Array::value('is_override', $params) && + if (empty($params['is_override']) && CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')) ) { $allStatus = CRM_Member_PseudoConstant::membershipStatus(); @@ -1295,7 +1295,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $this->assign('is_pay_later', 1); } - if (CRM_Utils_Array::value('send_receipt', $formValues)) { + if (!empty($formValues['send_receipt'])) { $params['receipt_date'] = CRM_Utils_Array::value('receive_date', $formValues); } @@ -1403,12 +1403,12 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; //CRM-10377 if payment is by an alternate contact then we need to set that person // as the contact in the payment params if ($this->_contributorContactID != $this->_contactID) { - if (CRM_Utils_Array::value('soft_credit_type_id', $this->_params)) { + if (!empty($this->_params['soft_credit_type_id'])) { $softParams['contact_id'] = $params['contact_id']; $softParams['soft_credit_type_id'] = $this->_params['soft_credit_type_id']; } } - if (CRM_Utils_Array::value('send_receipt', $this->_params)) { + if (!empty($this->_params['send_receipt'])) { $paymentParams['email'] = $this->_contributorEmail; } @@ -1417,7 +1417,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; // CRM-7137 -for recurring membership, // we do need contribution and recuring records. $result = NULL; - if (CRM_Utils_Array::value('is_recur', $paymentParams)) { + if (!empty($paymentParams['is_recur'])) { $allStatus = CRM_Member_PseudoConstant::membershipStatus(); $contributionType = new CRM_Financial_DAO_FinancialType(); @@ -1474,10 +1474,10 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; if (is_a($result, 'CRM_Core_Error')) { //make sure to cleanup db for recurring case. - if (CRM_Utils_Array::value('contributionID', $paymentParams)) { + if (!empty($paymentParams['contributionID'])) { CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']); } - if (CRM_Utils_Array::value('contributionRecurID', $paymentParams)) { + if (!empty($paymentParams['contributionRecurID'])) { CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']); } @@ -1503,7 +1503,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result); $params['payment_instrument_id'] = 1; $params['is_test'] = ($this->_mode == 'live') ? 0 : 1; - if (CRM_Utils_Array::value('send_receipt', $this->_params)) { + if (!empty($this->_params['send_receipt'])) { $params['receipt_date'] = $now; } else { @@ -1618,7 +1618,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } $membershipParams = array_merge($params, $membershipTypeValues[$memType]); - if (CRM_Utils_Array::value('int_amount', $formValues)) { + if (!empty($formValues['int_amount'])) { $init_amount = array(); foreach ($formValues as $key => $value) { if (strstr($key, 'txt-price')) { @@ -1638,7 +1638,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; if (!empty($lineItem[$priceSetId])) { foreach ($lineItem[$priceSetId] as & $priceFieldOp) { - if (CRM_Utils_Array::value('membership_type_id', $priceFieldOp)) { + if (!empty($priceFieldOp['membership_type_id'])) { $priceFieldOp['start_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'], '%d%f %b, %Y') : '-'; $priceFieldOp['end_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'], '%d%f %b, %Y') : '-'; @@ -1651,7 +1651,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE); $receiptSend = FALSE; - if (CRM_Utils_Array::value('send_receipt', $formValues)) { + if (!empty($formValues['send_receipt'])) { $receiptSend = TRUE; $formValues['contact_id'] = $this->_contactID; @@ -1743,7 +1743,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; // retrieve 'from email id' for acknowledgement $receiptFrom = $formValues['from_email_address']; - if (CRM_Utils_Array::value('payment_instrument_id', $formValues)) { + if (!empty($formValues['payment_instrument_id'])) { $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); $formValues['paidBy'] = $paymentInstrument[$formValues['payment_instrument_id']]; } @@ -1773,15 +1773,15 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; CRM_Core_BAO_UFGroup::getValues($formValues['contact_id'], $customFields, $customValues, FALSE, $members); if ($form->_mode) { - if (CRM_Utils_Array::value('billing_first_name', $form->_params)) { + if (!empty($form->_params['billing_first_name'])) { $name = $form->_params['billing_first_name']; } - if (CRM_Utils_Array::value('billing_middle_name', $form->_params)) { + if (!empty($form->_params['billing_middle_name'])) { $name .= " {$form->_params['billing_middle_name']}"; } - if (CRM_Utils_Array::value('billing_last_name', $form->_params)) { + if (!empty($form->_params['billing_last_name'])) { $name .= " {$form->_params['billing_last_name']}"; } @@ -1822,19 +1822,19 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $form->assign('membershipID', CRM_Utils_Array::value('membership_id', $form->_params, CRM_Utils_Array::value('membership_id', $form->_defaultValues))); - if (CRM_Utils_Array::value('contribution_id', $formValues)) { + if (!empty($formValues['contribution_id'])) { $form->assign('contributionID', $formValues['contribution_id']); } elseif (isset($form->_onlinePendingContributionId)) { $form->assign('contributionID', $form->_onlinePendingContributionId); } - if (CRM_Utils_Array::value('contribution_status_id', $formValues)) { + if (!empty($formValues['contribution_status_id'])) { $form->assign('contributionStatusID', $formValues['contribution_status_id']); $form->assign('contributionStatus', CRM_Contribute_PseudoConstant::contributionStatus($formValues['contribution_status_id'], 'name')); } - if (CRM_Utils_Array::value('is_renew', $formValues)) { + if (!empty($formValues['is_renew'])) { $form->assign('receiptType', 'membership renewal'); } else { diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index 895982f61f..d8dc8b8388 100644 --- a/CRM/Member/Form/MembershipBlock.php +++ b/CRM/Member/Form/MembershipBlock.php @@ -87,7 +87,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa } } - if (CRM_Utils_Array::value('mem_price_field_id', $defaults)) { + if (!empty($defaults['mem_price_field_id'])) { $options = array(); $priceFieldOptions = CRM_Price_BAO_PriceFieldValue::getValues($defaults['mem_price_field_id'], $options, 'id', 1); foreach ($options as $k => $v) { @@ -209,7 +209,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa static function formRule($params, $files, $contributionPageId = NULL) { $errors = array(); - if (CRM_Utils_Array::value('member_price_set_id', $params)) { + if (!empty($params['member_price_set_id'])) { //check if this price set has membership type both auto-renew and non-auto-renew memberships. $bothTypes = CRM_Price_BAO_PriceSet::checkMembershipPriceSet($params['member_price_set_id']); @@ -239,7 +239,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa } } } - if (CRM_Utils_Array::value('member_is_active', $params)) { + if (!empty($params['member_is_active'])) { // don't allow price set w/ membership signup, CRM-5095 if ($contributionPageId && ($setID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $contributionPageId, NULL, 1))) { @@ -256,7 +256,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa $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.'); } - if (CRM_Utils_Array::value('member_price_set_id', $params)) { + if (!empty($params['member_price_set_id'])) { return $errors; } @@ -333,9 +333,9 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa // check for price set. $priceSetID = CRM_Utils_Array::value('member_price_set_id', $params); - if (CRM_Utils_Array::value('member_is_active', $params) && is_array($membershipTypes) && !$priceSetID) { + if (!empty($params['member_is_active']) && is_array($membershipTypes) && !$priceSetID) { $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 2); - if (!CRM_Utils_Array::value('mem_price_field_id', $params) && !$usedPriceSetId) { + if (empty($params['mem_price_field_id']) && !$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')) { @@ -373,10 +373,10 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa ); $editedResults = array(); CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults); - if (!CRM_Utils_Array::value('id', $editedResults)) { + if (empty($editedResults['id'])) { $fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245)); $fieldParams['label'] = !empty($params['new_title']) ? $params['new_title'] : ts('Membership'); - if (!CRM_Utils_Array::value('mem_price_field_id', $params)) { + if (empty($params['mem_price_field_id'])) { CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', 0, 1, array('price_set_id' => $priceSetID)); } $fieldParams['weight'] = 1; @@ -391,7 +391,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa $fieldParams['is_display_amounts'] = !empty($params['display_min_fee']) ? 1 : 0; $rowCount = 1; $options = array(); - if (CRM_Utils_Array::value('id', $fieldParams)) { + if (!empty($fieldParams['id'])) { CRM_Core_PseudoConstant::populate($options, 'CRM_Price_DAO_PriceFieldValue', TRUE, 'membership_type_id', NULL, " price_field_id = {$fieldParams['id']} "); } @@ -453,7 +453,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa ); CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceField', $conditionParams, $pFIDs); - if (!CRM_Utils_Array::value('id', $pFIDs)) { + if (empty($pFIDs['id'])) { CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $this->_id); CRM_Price_BAO_PriceSet::setIsQuickConfig($this->_memPriceSetId, '0'); } diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 02ccc85eaa..a6aafefaf9 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -190,7 +190,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { } // when custom data is included in this page - if (CRM_Utils_Array::value('hidden_custom', $_POST)) { + if (!empty($_POST['hidden_custom'])) { CRM_Custom_Form_CustomData::preProcess($this); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); @@ -246,7 +246,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { $defaults['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'financial_type_id'); //CRM-13420 - if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) { + if (empty($defaults['payment_instrument_id'])) { $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')); } @@ -335,14 +335,14 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { $options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required ')); foreach( $allMemberships as $key => $values ) { - if (CRM_Utils_Array::value('is_active', $values) ) { + if (!empty($values['is_active'])) { $membershipType[$key] = CRM_Utils_Array::value('name', $values); if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) { continue; } else { $memberOfContactId = CRM_Utils_Array::value('member_of_contact_id', $values); - if (!CRM_Utils_Array::value($memberOfContactId, $selMemTypeOrg)) { + if (empty($selMemTypeOrg[$memberOfContactId])) { $selMemTypeOrg[$memberOfContactId] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $memberOfContactId, 'display_name', @@ -351,7 +351,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { $selOrgMemType[$memberOfContactId][0] = ts('- select -'); } - if (!CRM_Utils_Array::value($key, $selOrgMemType[$memberOfContactId])) { + if (empty($selOrgMemType[$memberOfContactId][$key])) { $selOrgMemType[$memberOfContactId][$key] = CRM_Utils_Array::value('name', $values); } } @@ -364,7 +364,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { 'total_amount_numeric' => CRM_Utils_Array::value('minimum_fee', $values) ); - if (CRM_Utils_Array::value('auto_renew', $values)) { + if (!empty($values['auto_renew'])) { $allMembershipInfo[$key]['auto_renew'] = $options[$values['auto_renew']]; } } @@ -549,7 +549,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; if (!$params['total_amount']) { $errors['total_amount'] = ts('Please enter a Contribution Amount.'); } - if (!CRM_Utils_Array::value('payment_instrument_id', $params)) { + if (empty($params['payment_instrument_id'])) { $errors['payment_instrument_id'] = ts('Paid By is a required field.'); } } @@ -585,7 +585,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $this->convertDateFieldsToMySQL($formValues); $this->assign('receive_date', $formValues['receive_date']); - if (CRM_Utils_Array::value('send_receipt', $this->_params)) { + if (!empty($this->_params['send_receipt'])) { $formValues['receipt_date'] = $now; $this->assign('receipt_date', CRM_Utils_Date::mysqlToIso($formValues['receipt_date'])); } @@ -597,7 +597,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $formValues['total_amount'] = CRM_Utils_Array::value('total_amount', $this->_params, CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'minimum_fee' )); - if (!CRM_Utils_Array::value('financial_type_id', $formValues)) { + if (empty($formValues['financial_type_id'])) { $formValues['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType,'financial_type_id'); } @@ -660,7 +660,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; // all the payment processors expect the name and address to be in the passed params // so we copy stuff over to first_name etc. $paymentParams = $this->_params; - if (CRM_Utils_Array::value('send_receipt', $this->_params)) { + if (!empty($this->_params['send_receipt'])) { $paymentParams['email'] = $this->_contributorEmail; } @@ -668,7 +668,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; //CRM-10377 if payment is by an alternate contact then we need to set that person // as the contact in the payment params if ($this->_contributorContactID != $this->_contactID) { - if (CRM_Utils_Array::value('honor_type_id', $this->_params)) { + if (!empty($this->_params['honor_type_id'])) { $paymentParams['honor_contact_id'] = $this->_contactID; $paymentParams['honor_type_id'] = $this->_params['honor_type_id']; } @@ -753,7 +753,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $renewMembership->membership_type_id, 'name'); - if (CRM_Utils_Array::value('record_contribution', $formValues) || $this->_mode) { + if (!empty($formValues['record_contribution']) || $this->_mode) { // set the source $formValues['contribution_source'] = "{$memType} Membership: Offline membership renewal (by {$userName})"; @@ -781,7 +781,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; //assign contribution contact id to the field expected by recordMembershipContribution if($this->_contributorContactID != $this->_contactID){ $formValues['contribution_contact_id'] = $this->_contributorContactID; - if(CRM_Utils_Array::value('soft_credit_type_id', $this->_params)){ + if (!empty($this->_params['soft_credit_type_id'])){ $formValues['soft_credit'][] = array( 'soft_credit_type_id' => $this->_params['soft_credit_type_id'], 'contact_id' => $this->_contactID, @@ -794,7 +794,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; CRM_Member_BAO_Membership::recordMembershipContribution(array_merge($formValues, array('membership_id' => $renewMembership->id))); } - if (CRM_Utils_Array::value('send_receipt', $formValues)) { + if (!empty($formValues['send_receipt'])) { CRM_Core_DAO::setFieldValue('CRM_Member_DAO_MembershipType', $formValues['membership_type_id'][1], 'receipt_text_renewal', @@ -803,12 +803,12 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } $receiptSend = FALSE; - if (CRM_Utils_Array::value('send_receipt', $formValues)) { + if (!empty($formValues['send_receipt'])) { $receiptSend = TRUE; $receiptFrom = $formValues['from_email_address']; - if (CRM_Utils_Array::value('payment_instrument_id', $formValues)) { + if (!empty($formValues['payment_instrument_id'])) { $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); $formValues['paidBy'] = $paymentInstrument[$formValues['payment_instrument_id']]; } @@ -834,7 +834,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; CRM_Core_BAO_UFGroup::getValues($this->_contactID, $customFields, $customValues, FALSE, $members); $this->assign_by_ref('formValues', $formValues); - if ( CRM_Utils_Array::value( 'contribution_id', $formValues ) ) { + if (!empty($formValues['contribution_id'])) { $this->assign('contributionID', $formValues['contribution_id']); } $this->assign('membershipID', $this->_id); @@ -848,15 +848,15 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; )); $this->assign('customValues', $customValues); if ($this->_mode) { - if (CRM_Utils_Array::value('billing_first_name', $this->_params)) { + if (!empty($this->_params['billing_first_name'])) { $name = $this->_params['billing_first_name']; } - if (CRM_Utils_Array::value('billing_middle_name', $this->_params)) { + if (!empty($this->_params['billing_middle_name'])) { $name .= " {$this->_params['billing_middle_name']}"; } - if (CRM_Utils_Array::value('billing_last_name', $this->_params)) { + if (!empty($this->_params['billing_last_name'])) { $name .= " {$this->_params['billing_last_name']}"; } $this->assign('billingName', $name); diff --git a/CRM/Member/Form/MembershipStatus.php b/CRM/Member/Form/MembershipStatus.php index 1146ead0dc..2cdfc1cd08 100644 --- a/CRM/Member/Form/MembershipStatus.php +++ b/CRM/Member/Form/MembershipStatus.php @@ -52,7 +52,7 @@ class CRM_Member_Form_MembershipStatus extends CRM_Member_Form { $defaults = parent::setDefaultValues(); //finding default weight to be put - if (!CRM_Utils_Array::value('weight', $defaults)) { + if (empty($defaults['weight'])) { $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Member_DAO_MembershipStatus'); } return $defaults; diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index 25d203a30a..c3189c9bd0 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -398,7 +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 (CRM_Utils_Array::value('M', $params[$per]) && + if (!empty($params[$per]['M']) && CRM_Utils_Array::value('d', $params[$per]) ) { $mon = $params[$per]['M']; diff --git a/CRM/Member/Form/MembershipView.php b/CRM/Member/Form/MembershipView.php index cdaa0b7c80..7b87250e4a 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 (CRM_Utils_Array::value('relationship_type_id', $membershipType) - && !CRM_Utils_Array::value('owner_membership_id', $values) + if (!empty($membershipType['relationship_type_id']) && !CRM_Utils_Array::value('owner_membership_id', $values) ) { // display related contacts/membership block $this->assign('has_related', TRUE); @@ -375,7 +374,7 @@ SELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment, $autoRenew = $isRecur ? TRUE : FALSE; } - if (CRM_Utils_Array::value('is_test', $values)) { + if (!empty($values['is_test'])) { $values['membership_type'] .= ' (test) '; } diff --git a/CRM/Member/Form/Task/Batch.php b/CRM/Member/Form/Task/Batch.php index 89a00ea41c..56e530ec69 100644 --- a/CRM/Member/Form/Task/Batch.php +++ b/CRM/Member/Form/Task/Batch.php @@ -159,7 +159,7 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task { foreach ($this->_fields as $name => $field) { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) { $customValue = CRM_Utils_Array::value($customFieldID, $customFields); - if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) { + if (!empty($customValue['extends_entity_column_value'])) { $entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue['extends_entity_column_value'] ); @@ -228,11 +228,11 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task { $customFields = array(); foreach ($params['field'] as $key => $value) { $ids['membership'] = $key; - if (CRM_Utils_Array::value('membership_source', $value)) { + if (!empty($value['membership_source'])) { $value['source'] = $value['membership_source']; } - if (CRM_Utils_Array::value('membership_type', $value)) { + if (!empty($value['membership_type'])) { $membershipTypeId = $value['membership_type_id'] = $value['membership_type'][1]; } @@ -248,7 +248,7 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task { } } if (empty($customFields)) { - if (!CRM_Utils_Array::value('membership_type_id', $value)) { + if (empty($value['membership_type_id'])) { $membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $key, 'membership_type_id'); } @@ -272,7 +272,7 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task { $membership = CRM_Member_BAO_Membership::add($value, $ids); // add custom field values - if (CRM_Utils_Array::value('custom', $value) && + if (!empty($value['custom']) && is_array($value['custom']) ) { CRM_Core_BAO_CustomValueTable::store($value['custom'], 'civicrm_membership', $membership->id); diff --git a/CRM/Member/Import/Form/MapField.php b/CRM/Member/Import/Form/MapField.php index 51123c3dc8..4217e6b574 100644 --- a/CRM/Member/Import/Form/MapField.php +++ b/CRM/Member/Import/Form/MapField.php @@ -373,7 +373,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { } - if (CRM_Utils_Array::value('saveMapping', $fields)) { + if (!empty($fields['saveMapping'])) { $nameField = CRM_Utils_Array::value('saveMappingName', $fields); if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); @@ -432,14 +432,14 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $mapper[$i] = $this->_mapperFields[$mapperKeys[$i][0]]; $mapperKeysMain[$i] = $mapperKeys[$i][0]; - if (CRM_Utils_Array::value(1, $mapperKeys[$i]) && is_numeric($mapperKeys[$i][1])) { + if (!empty($mapperKeys[$i][1]) && is_numeric($mapperKeys[$i][1])) { $mapperLocType[$i] = $mapperKeys[$i][1]; } else { $mapperLocType[$i] = NULL; } - if (CRM_Utils_Array::value(2, $mapperKeys[$i]) && (!is_numeric($mapperKeys[$i][2]))) { + if (!empty($mapperKeys[$i][2]) && (!is_numeric($mapperKeys[$i][2]))) { $mapperPhoneType[$i] = $mapperKeys[$i][2]; } else { @@ -450,11 +450,11 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $this->set('mapper', $mapper); // store mapping Id to display it in the preview page - if (CRM_Utils_Array::value('mappingId', $params)) { + if (!empty($params['mappingId'])) { $this->set('loadMappingId', $params['mappingId']); } //Updating Mapping Records - if (CRM_Utils_Array::value('updateMapping', $params)) { + if (!empty($params['updateMapping'])) { $mappingFields = new CRM_Core_DAO_MappingField(); $mappingFields->mapping_id = $params['mappingId']; $mappingFields->find(); @@ -482,7 +482,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { } //Saving Mapping Details and Records - if (CRM_Utils_Array::value('saveMapping', $params)) { + if (!empty($params['saveMapping'])) { $mappingParams = array( 'name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], diff --git a/CRM/Member/Import/Form/Preview.php b/CRM/Member/Import/Form/Preview.php index 6626a75601..2f5ec657ae 100644 --- a/CRM/Member/Import/Form/Preview.php +++ b/CRM/Member/Import/Form/Preview.php @@ -131,14 +131,14 @@ class CRM_Member_Import_Form_Preview extends CRM_Import_Form_Preview { foreach ($mapper as $key => $value) { $mapperKeys[$key] = $mapper[$key][0]; - if (CRM_Utils_Array::value(1, $mapper[$key]) && is_numeric($mapper[$key][1])) { + if (!empty($mapper[$key][1]) && is_numeric($mapper[$key][1])) { $mapperLocType[$key] = $mapper[$key][1]; } else { $mapperLocType[$key] = NULL; } - if (CRM_Utils_Array::value(2, $mapper[$key]) && (!is_numeric($mapper[$key][2]))) { + if (!empty($mapper[$key][2]) && (!is_numeric($mapper[$key][2]))) { $mapperPhoneType[$key] = $mapper[$key][2]; } else { diff --git a/CRM/Member/Import/Parser/Membership.php b/CRM/Member/Import/Parser/Membership.php index 5e83fca4bd..e23a1b3265 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 (!CRM_Utils_Array::value('membership_start_date', $params) && !CRM_Utils_Array::value('join_date', $params)) { + if (empty($params['membership_start_date']) && !CRM_Utils_Array::value('join_date', $params)) { $errorMessage = 'Membership Start Date is required to create a memberships.'; CRM_Contact_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); } @@ -266,7 +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 (!CRM_Utils_Array::value('join_date', $params) && + if (empty($params['join_date']) && CRM_Utils_Array::value('membership_start_date', $params) ) { $params['join_date'] = $params['membership_start_date']; @@ -359,7 +359,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 (CRM_Utils_Array::value('is_override', $formatted) && + if (!empty($formatted['is_override']) && !CRM_Utils_Array::value('status_id', $formatted) ) { array_unshift($values, 'Required parameter missing: Status'); @@ -371,7 +371,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $dao->id = $formatValues['membership_id']; $dates = array('join_date', 'start_date', 'end_date'); foreach ($dates as $v) { - if (!CRM_Utils_Array::value( $v, $formatted )) { + if (empty($formatted[$v])) { $formatted[$v] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $formatValues['membership_id'], $v); } } @@ -438,7 +438,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { //fix for CRM-3570, exclude the statuses those having is_admin = 1 //now user can import is_admin if is override is true. $excludeIsAdmin = FALSE; - if (!CRM_Utils_Array::value('is_override', $formatted)) { + if (empty($formatted['is_override'])) { $formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE; } $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate, @@ -448,10 +448,10 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $excludeIsAdmin ); - if (!CRM_Utils_Array::value('status_id', $formatted)) { + if (empty($formatted['status_id'])) { $formatted['status_id'] = $calcStatus['id']; } - elseif (!CRM_Utils_Array::value('is_override', $formatted)) { + elseif (empty($formatted['is_override'])) { if (empty($calcStatus)) { array_unshift($values, 'Status in import row (' . $formatValues['status_id'] . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.'); return CRM_Import_Parser::ERROR; @@ -490,7 +490,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { } } - if (CRM_Utils_Array::value('external_identifier', $params)) { + if (!empty($params['external_identifier'])) { if ($disp) { $disp .= "AND {$params['external_identifier']}"; } @@ -504,7 +504,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { } } else { - if (CRM_Utils_Array::value('external_identifier', $formatValues)) { + if (!empty($formatValues['external_identifier'])) { $checkCid = new CRM_Contact_DAO_Contact(); $checkCid->external_identifier = $formatValues['external_identifier']; $checkCid->find(TRUE); @@ -526,7 +526,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { //fix for CRM-3570, exclude the statuses those having is_admin = 1 //now user can import is_admin if is override is true. $excludeIsAdmin = FALSE; - if (!CRM_Utils_Array::value('is_override', $formatted)) { + if (empty($formatted['is_override'])) { $formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE; } $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate, @@ -535,10 +535,10 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { 'today', $excludeIsAdmin ); - if (!CRM_Utils_Array::value('status_id', $formatted)) { + if (empty($formatted['status_id'])) { $formatted['status_id'] = CRM_Utils_Array::value('id', $calcStatus); } - elseif (!CRM_Utils_Array::value('is_override', $formatted)) { + elseif (empty($formatted['is_override'])) { if (empty($calcStatus)) { array_unshift($values, 'Status in import row (' . CRM_Utils_Array::value('status_id', $formatValues) . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.'); return CRM_Import_Parser::ERROR; @@ -689,7 +689,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { CRM_Member_PseudoConstant::membershipType() ); if ($membershipTypeId) { - if (CRM_Utils_Array::value('membership_type_id', $values) && + if (!empty($values['membership_type_id']) && $membershipTypeId != $values['membership_type_id'] ) { throw new Exception('Mismatched membership Type and Membership Type Id'); @@ -713,7 +713,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { CRM_Member_PseudoConstant::membershipStatus() ); if ($membershipStatusId) { - if (CRM_Utils_Array::value('status_id', $values) && + if (!empty($values['status_id']) && $membershipStatusId != $values['status_id'] ) { throw new Exception('Mismatched membership Status and Membership Status Id'); diff --git a/CRM/Member/Page/Tab.php b/CRM/Member/Page/Tab.php index 629aa6d3ad..c844868419 100644 --- a/CRM/Member/Page/Tab.php +++ b/CRM/Member/Page/Tab.php @@ -92,7 +92,7 @@ class CRM_Member_Page_Tab extends CRM_Core_Page { foreach (array('status', 'membership_type') as $fld) { $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]); } - if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id])) { + if (!empty($statusANDType[$dao->id]['is_current_member'])) { $membership[$dao->id]['active'] = TRUE; } if (empty($dao->owner_membership_id)) { @@ -146,7 +146,7 @@ class CRM_Member_Page_Tab extends CRM_Core_Page { } //does membership have auto renew CRM-7137. - if (CRM_Utils_Array::value('contribution_recur_id', $membership[$dao->id]) && + if (!empty($membership[$dao->id]['contribution_recur_id']) && !CRM_Member_BAO_Membership::isSubscriptionCancelled($membership[$dao->id]['membership_id']) ) { $membership[$dao->id]['auto_renew'] = 1; diff --git a/CRM/Member/Page/UserDashboard.php b/CRM/Member/Page/UserDashboard.php index 78e8d3d402..23df3a1053 100644 --- a/CRM/Member/Page/UserDashboard.php +++ b/CRM/Member/Page/UserDashboard.php @@ -61,7 +61,7 @@ class CRM_Member_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard 'status', 'membership_type') as $fld) { $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]); } - if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id])) { + if (!empty($statusANDType[$dao->id]['is_current_member'])) { $membership[$dao->id]['active'] = TRUE; } diff --git a/CRM/Member/Selector/Search.php b/CRM/Member/Selector/Search.php index e0924de732..4a55b31239 100644 --- a/CRM/Member/Selector/Search.php +++ b/CRM/Member/Selector/Search.php @@ -371,7 +371,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C $row['campaign'] = CRM_Utils_Array::value($result->member_campaign_id, $allCampaigns); $row['campaign_id'] = $result->member_campaign_id; - if (CRM_Utils_Array::value('member_is_test', $row)) { + if (!empty($row['member_is_test'])) { $row['membership_type'] = $row['membership_type'] . " (test)"; } diff --git a/CRM/Member/StateMachine/Search.php b/CRM/Member/StateMachine/Search.php index 0fe26be351..6d7a132d7a 100644 --- a/CRM/Member/StateMachine/Search.php +++ b/CRM/Member/StateMachine/Search.php @@ -80,7 +80,7 @@ class CRM_Member_StateMachine_Search extends CRM_Core_StateMachine { function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff // fix value if print button is pressed - if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) { + if (!empty($_POST['_qf_' . $formName . '_next_print'])) { $value = CRM_Member_Task::PRINT_MEMBERS; } else { diff --git a/CRM/PCP/BAO/PCP.php b/CRM/PCP/BAO/PCP.php index a1300170da..0f6cfc89dc 100644 --- a/CRM/PCP/BAO/PCP.php +++ b/CRM/PCP/BAO/PCP.php @@ -511,11 +511,11 @@ WHERE pcp.id = %1 AND cc.contribution_status_id =1 AND cc.is_test = 0"; $statusMessage = ts('The Personal Campaign Page you have just visited is currently %1. However you can still support the campaign here.', array(1 => $pcpStatus[$pcpInfo['status_id']])); CRM_Core_Error::statusBounce($statusMessage, $url); } - elseif (!CRM_Utils_Array::value('is_active', $pcpBlock)) { + elseif (empty($pcpBlock['is_active'])) { $statusMessage = ts('Personal Campaign Pages are currently not enabled for this contribution page. However you can still support the campaign here.'); CRM_Core_Error::statusBounce($statusMessage, $url); } - elseif (!CRM_Utils_Array::value('is_active', $pcpInfo)) { + elseif (empty($pcpInfo['is_active'])) { $statusMessage = ts('The Personal Campaign Page you have just visited is currently inactive. However you can still support the campaign here.'); CRM_Core_Error::statusBounce($statusMessage, $url); } diff --git a/CRM/PCP/Form/Contribute.php b/CRM/PCP/Form/Contribute.php index 5d573ef14a..94601cba78 100644 --- a/CRM/PCP/Form/Contribute.php +++ b/CRM/PCP/Form/Contribute.php @@ -73,7 +73,7 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage { $this->assign('pageId', $this->_id); } - if (!CRM_Utils_Array::value('id', $defaults)) { + if (empty($defaults['id'])) { $defaults['target_entity_type'] = 'contribute'; $defaults['is_approval_needed'] = 1; $defaults['is_tellfriend_enabled'] = 1; @@ -113,14 +113,14 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage { */ public static function formRule($params, $files, $self) { $errors = array(); - if (CRM_Utils_Array::value('is_active', $params)) { + if (!empty($params['is_active'])) { - if (CRM_Utils_Array::value('is_tellfriend_enabled', $params) && + if (!empty($params['is_tellfriend_enabled']) && (CRM_Utils_Array::value('tellfriend_limit', $params) <= 0) ) { $errors['tellfriend_limit'] = ts('if Tell Friend is enabled, Maximum recipients limit should be greater than zero.'); } - if (!CRM_Utils_Array::value('supporter_profile_id', $params)) { + if (empty($params['supporter_profile_id'])) { $errors['supporter_profile_id'] = ts('Supporter profile is a required field.'); } else { diff --git a/CRM/PCP/Form/Event.php b/CRM/PCP/Form/Event.php index 23ffdde5d8..03d6dcb4c8 100644 --- a/CRM/PCP/Form/Event.php +++ b/CRM/PCP/Form/Event.php @@ -74,7 +74,7 @@ class CRM_PCP_Form_Event extends CRM_Event_Form_ManageEvent { $this->assign('pageId', $this->_id); } - if (!CRM_Utils_Array::value('id', $defaults)) { + if (empty($defaults['id'])) { $defaults['target_entity_type'] = 'event'; $defaults['is_approval_needed'] = 1; $defaults['is_tellfriend_enabled'] = 1; @@ -141,14 +141,14 @@ class CRM_PCP_Form_Event extends CRM_Event_Form_ManageEvent { */ public static function formRule($params, $files, $self) { $errors = array(); - if (CRM_Utils_Array::value('is_active', $params)) { + if (!empty($params['is_active'])) { - if (CRM_Utils_Array::value('is_tellfriend_enabled', $params) && + if (!empty($params['is_tellfriend_enabled']) && (CRM_Utils_Array::value('tellfriend_limit', $params) <= 0) ) { $errors['tellfriend_limit'] = ts('if Tell Friend is enable, Maximum recipients limit should be greater than zero.'); } - if (!CRM_Utils_Array::value('supporter_profile_id', $params)) { + if (empty($params['supporter_profile_id'])) { $errors['supporter_profile_id'] = ts('Supporter profile is a required field.'); } else { diff --git a/CRM/PCP/Page/PCP.php b/CRM/PCP/Page/PCP.php index 841efad02c..1fa64ebf91 100644 --- a/CRM/PCP/Page/PCP.php +++ b/CRM/PCP/Page/PCP.php @@ -183,26 +183,26 @@ class CRM_PCP_Page_PCP extends CRM_Core_Page_Basic { $whereClause = NULL; if (!empty($_POST) || !empty($_GET['page_type'])) { - if (CRM_Utils_Array::value('status_id', $_POST)) { + if (!empty($_POST['status_id'])) { $whereClause = ' AND cp.status_id = %1'; $params['1'] = array($_POST['status_id'], 'Integer'); } - if (CRM_Utils_Array::value('page_type', $_POST)) { + if (!empty($_POST['page_type'])) { $whereClause .= ' AND cp.page_type = %2'; $params['2'] = array($_POST['page_type'], 'String'); } - elseif (CRM_Utils_Array::value('page_type', $_GET)) { + elseif (!empty($_GET['page_type'])) { $whereClause .= ' AND cp.page_type = %2'; $params['2'] = array($_GET['page_type'], 'String'); } - if (CRM_Utils_Array::value('page_id', $_POST)) { + if (!empty($_POST['page_id'])) { $whereClause .= ' AND cp.page_id = %4 AND cp.page_type = "contribute"'; $params['4'] = array($_POST['page_id'], 'Integer'); } - if (CRM_Utils_Array::value('event_id', $_POST)) { + if (!empty($_POST['event_id'])) { $whereClause .= ' AND cp.page_id = %5 AND cp.page_type = "event"'; $params['5'] = array($_POST['event_id'], 'Integer'); } diff --git a/CRM/PCP/Page/PCPInfo.php b/CRM/PCP/Page/PCPInfo.php index f26571ec56..813916d09b 100644 --- a/CRM/PCP/Page/PCPInfo.php +++ b/CRM/PCP/Page/PCPInfo.php @@ -267,7 +267,7 @@ class CRM_PCP_Page_PCPInfo extends CRM_Core_Page { if ($validDate) { $contributionText = ts('Contribute Now'); - if (CRM_Utils_Array::value('donate_link_text', $pcpInfo)) { + if (!empty($pcpInfo['donate_link_text'])) { $contributionText = $pcpInfo['donate_link_text']; } diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index 3e7040aa10..0964327bae 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -84,7 +84,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { * @return object */ static function add(&$params) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Pledge', $params['id'], $params); } else { @@ -108,7 +108,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { $result = $pledge->save(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'Pledge', $pledge->id, $pledge); } else { @@ -160,7 +160,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { $paymentParams = array(); $paymentParams['status_id'] = CRM_Utils_Array::value('status_id', $params); - if (CRM_Utils_Array::value('installment_amount', $params)) { + if (!empty($params['installment_amount'])) { $params['amount'] = $params['installment_amount'] * $params['installments']; } @@ -191,7 +191,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { } //handle custom data. - if (CRM_Utils_Array::value('custom', $params) && + if (!empty($params['custom']) && is_array($params['custom']) ) { CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_pledge', $pledge->id); @@ -204,7 +204,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { //if pledge is pending delete all payments and recreate. - if (CRM_Utils_Array::value('is_pledge_pending', $params)) { + if (!empty($params['is_pledge_pending'])) { CRM_Pledge_BAO_PledgePayment::deletePayments($pledge->id); } @@ -527,7 +527,7 @@ GROUP BY currency 'installments', 'frequency_day', 'scheduled_amount', 'currency', ); foreach ($pledgeFields as $field) { - if (CRM_Utils_Array::value($field, $params)) { + if (!empty($params[$field])) { $form->assign($field, $params[$field]); } } @@ -540,7 +540,7 @@ GROUP BY currency //assign honor fields. $honor_block_is_active = FALSE; //make sure we have values for it - if (CRM_Utils_Array::value('honor_type_id', $params) && + if (!empty($params['honor_type_id']) && ((!empty($params['honor_first_name']) && !empty($params['honor_last_name'])) || (!empty($params['honor_email'])) ) @@ -584,7 +584,7 @@ GROUP BY currency $form->assign('contact', $details[0][$params['contact_id']]); //handle custom data. - if (CRM_Utils_Array::value('hidden_custom', $params)) { + if (!empty($params['hidden_custom'])) { $groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', CRM_Core_DAO::$_nullObject, $params['id']); $pledgeParams = array(array('pledge_id', '=', $params['id'], 0, 0)); $customGroup = array(); @@ -614,11 +614,11 @@ GROUP BY currency //check for online pledge. $session = CRM_Core_Session::singleton(); - if (CRM_Utils_Array::value('receipt_from_email', $params)) { + if (!empty($params['receipt_from_email'])) { $userName = CRM_Utils_Array::value('receipt_from_name', $params); $userEmail = CRM_Utils_Array::value('receipt_from_email', $params); } - elseif (CRM_Utils_Array::value('from_email_id', $params)) { + elseif (!empty($params['from_email_id'])) { $receiptFrom = $params['from_email_id']; } elseif ($userID = $session->get('userID')) { @@ -676,7 +676,7 @@ GROUP BY currency ); //lets insert assignee record. - if (CRM_Utils_Array::value('contact_id', $params)) { + if (!empty($params['contact_id'])) { $activityParams['assignee_contact_id'] = $params['contact_id']; } diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php index 907b42837a..2dd6e278f5 100644 --- a/CRM/Pledge/BAO/PledgeBlock.php +++ b/CRM/Pledge/BAO/PledgeBlock.php @@ -102,7 +102,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { */ static function add(&$params) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'PledgeBlock', $params['id'], $params); } else { @@ -136,7 +136,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $pledgeBlock->copyValues($params); $result = $pledgeBlock->save(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'PledgeBlock', $pledgeBlock->id, $pledgeBlock); } else { @@ -200,7 +200,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { */ static function buildPledgeBlock($form) { //build pledge payment fields. - if (CRM_Utils_Array::value('pledge_id', $form->_values)) { + if (!empty($form->_values['pledge_id'])) { //get all payments required details. $allPayments = array(); $returnProperties = array('status_id', 'scheduled_date', 'scheduled_amount'); @@ -278,7 +278,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { ); $form->addElement('text', 'pledge_installments', ts('Installments'), array('size' => 3)); - if (CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock)) { + if (!empty($pledgeBlock['is_pledge_interval'])) { $form->assign('is_pledge_interval', CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock)); $form->addElement('text', 'pledge_frequency_interval', NULL, array('size' => 3)); } diff --git a/CRM/Pledge/BAO/PledgePayment.php b/CRM/Pledge/BAO/PledgePayment.php index f1690ff2e5..de9941e96c 100644 --- a/CRM/Pledge/BAO/PledgePayment.php +++ b/CRM/Pledge/BAO/PledgePayment.php @@ -164,7 +164,7 @@ WHERE pledge_id = %1 * @static */ static function add($params) { - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'PledgePayment', $params['id'], $params); } else { @@ -182,7 +182,7 @@ WHERE pledge_id = %1 $result = $payment->save(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'PledgePayment', $payment->id, $payment); } else { diff --git a/CRM/Pledge/BAO/Query.php b/CRM/Pledge/BAO/Query.php index 4b8721afda..26b70453d0 100644 --- a/CRM/Pledge/BAO/Query.php +++ b/CRM/Pledge/BAO/Query.php @@ -55,43 +55,43 @@ class CRM_Pledge_BAO_Query { } //add pledge select - if (CRM_Utils_Array::value('pledge_amount', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_amount'])) { $query->_select['pledge_amount'] = 'civicrm_pledge.amount as pledge_amount'; $query->_element['pledge_amount'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_create_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_create_date'])) { $query->_select['pledge_create_date'] = 'civicrm_pledge.create_date as pledge_create_date'; $query->_element['pledge_create_date'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_status_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_status_id'])) { $query->_select['pledge_status_id'] = 'pledge_status.value as pledge_status_id'; $query->_element['pledge_status'] = 1; $query->_tables['pledge_status'] = $query->_whereTables['pledge_status'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_status'])) { $query->_select['pledge_status'] = 'pledge_status.label as pledge_status'; $query->_element['pledge_status'] = 1; $query->_tables['pledge_status'] = $query->_whereTables['pledge_status'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_total_paid', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_total_paid'])) { $query->_select['pledge_total_paid'] = ' (SELECT sum(civicrm_pledge_payment.actual_amount) FROM civicrm_pledge_payment WHERE civicrm_pledge_payment.pledge_id = civicrm_pledge.id AND civicrm_pledge_payment.status_id = 1 ) as pledge_total_paid'; $query->_element['pledge_total_paid'] = 1; } - if (CRM_Utils_Array::value('pledge_next_pay_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_next_pay_date'])) { $query->_select['pledge_next_pay_date'] = " (SELECT civicrm_pledge_payment.scheduled_date FROM civicrm_pledge_payment WHERE civicrm_pledge_payment.pledge_id = civicrm_pledge.id AND civicrm_pledge_payment.status_id IN ( 2, 6 ) ORDER BY civicrm_pledge_payment.scheduled_date ASC LIMIT 0, 1) as pledge_next_pay_date"; $query->_element['pledge_next_pay_date'] = 1; } - if (CRM_Utils_Array::value('pledge_next_pay_amount', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_next_pay_amount'])) { $query->_select['pledge_next_pay_amount'] = " (SELECT civicrm_pledge_payment.scheduled_amount FROM civicrm_pledge_payment WHERE civicrm_pledge_payment.pledge_id = civicrm_pledge.id AND civicrm_pledge_payment.status_id = 2 ORDER BY civicrm_pledge_payment.scheduled_date ASC LIMIT 0, 1) as pledge_next_pay_amount"; $query->_element['pledge_next_pay_amount'] = 1; @@ -99,99 +99,99 @@ class CRM_Pledge_BAO_Query { $query->_element['pledge_outstanding_amount'] = 1; } - if (CRM_Utils_Array::value('pledge_financial_type', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_financial_type'])) { $query->_select['pledge_financial_type'] = "(SELECT civicrm_financial_type.name FROM civicrm_financial_type WHERE civicrm_financial_type.id = civicrm_pledge.financial_type_id) as pledge_financial_type"; $query->_element['pledge_financial_type'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_contribution_page_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_contribution_page_id'])) { $query->_select['pledge_contribution_page_id'] = 'civicrm_pledge.contribution_page_id as pledge_contribution_page_id'; $query->_element['pledge_contribution_page_id'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_id'])) { $query->_select['pledge_payment_id'] = 'civicrm_pledge_payment.id as pledge_payment_id'; $query->_element['pledge_payment_id'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_scheduled_amount', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_scheduled_amount'])) { $query->_select['pledge_payment_scheduled_amount'] = 'civicrm_pledge_payment.scheduled_amount as pledge_payment_scheduled_amount'; $query->_element['pledge_payment_scheduled_amount'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_scheduled_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_scheduled_date'])) { $query->_select['pledge_payment_scheduled_date'] = 'civicrm_pledge_payment.scheduled_date as pledge_payment_scheduled_date'; $query->_element['pledge_payment_scheduled_date'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_paid_amount', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_paid_amount'])) { $query->_select['pledge_payment_paid_amount'] = 'civicrm_pledge_payment.actual_amount as pledge_payment_paid_amount'; $query->_element['pledge_payment_paid_amount'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_paid_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_paid_date'])) { $query->_select['pledge_payment_paid_date'] = 'payment_contribution.receive_date as pledge_payment_paid_date'; $query->_element['pledge_payment_paid_date'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; $query->_tables['payment_contribution'] = $query->_whereTables['payment_contribution'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_reminder_date', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_reminder_date'])) { $query->_select['pledge_payment_reminder_date'] = 'civicrm_pledge_payment.reminder_date as pledge_payment_reminder_date'; $query->_element['pledge_payment_reminder_date'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_reminder_count', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_reminder_count'])) { $query->_select['pledge_payment_reminder_count'] = 'civicrm_pledge_payment.reminder_count as pledge_payment_reminder_count'; $query->_element['pledge_payment_reminder_count'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_status_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_status_id'])) { $query->_select['pledge_payment_status_id'] = 'payment_status.name as pledge_payment_status_id'; $query->_element['pledge_payment_status_id'] = 1; $query->_tables['payment_status'] = $query->_whereTables['payment_status'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; } - if (CRM_Utils_Array::value('pledge_payment_status', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_payment_status'])) { $query->_select['pledge_payment_status'] = 'payment_status.label as pledge_payment_status'; $query->_element['pledge_payment_status'] = 1; $query->_tables['payment_status'] = $query->_whereTables['payment_status'] = 1; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; } - if (CRM_Utils_Array::value('pledge_frequency_interval', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_frequency_interval'])) { $query->_select['pledge_frequency_interval'] = 'civicrm_pledge.frequency_interval as pledge_frequency_interval'; $query->_element['pledge_frequency_interval'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_frequency_unit', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_frequency_unit'])) { $query->_select['pledge_frequency_unit'] = 'civicrm_pledge.frequency_unit as pledge_frequency_unit'; $query->_element['pledge_frequency_unit'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_is_test', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_is_test'])) { $query->_select['pledge_is_test'] = 'civicrm_pledge.is_test as pledge_is_test'; $query->_element['pledge_is_test'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_campaign_id', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_campaign_id'])) { $query->_select['pledge_campaign_id'] = 'civicrm_pledge.campaign_id as pledge_campaign_id'; $query->_element['pledge_campaign_id'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } - if (CRM_Utils_Array::value('pledge_currency', $query->_returnProperties)) { + if (!empty($query->_returnProperties['pledge_currency'])) { $query->_select['pledge_currency'] = 'civicrm_pledge.currency as pledge_currency'; $query->_element['pledge_currency'] = 1; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; @@ -201,7 +201,7 @@ class CRM_Pledge_BAO_Query { static function where(&$query) { $grouping = NULL; foreach (array_keys($query->_params) as $id) { - if (!CRM_Utils_Array::value(0, $query->_params[$id])) { + if (empty($query->_params[$id][0])) { continue; } if (substr($query->_params[$id][0], 0, 7) == 'pledge_') { @@ -629,7 +629,7 @@ class CRM_Pledge_BAO_Query { static function tableNames(&$tables) { //add status table - if (CRM_Utils_Array::value('pledge_status', $tables) || + if (!empty($tables['pledge_status']) || CRM_Utils_Array::value('civicrm_pledge_payment', $tables) ) { $tables = array_merge(array('civicrm_pledge' => 1), $tables); diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index def9c51291..ab11019031 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -180,7 +180,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { return $defaults; } - if (CRM_Utils_Array::value('is_test', $defaults)) { + if (!empty($defaults['is_test'])) { $this->assign('is_test', TRUE); } @@ -535,7 +535,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $formValues = $this->controller->exportValues($this->_name); // set the contact, when contact is selected - if (CRM_Utils_Array::value('contact_select_id', $formValues)) { + if (!empty($formValues['contact_select_id'])) { $this->_contactID = $formValues['contact_select_id'][1]; } @@ -582,7 +582,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { } $params[$d] = CRM_Utils_Date::processDate($this->_values[$d]); } - elseif (CRM_Utils_Array::value($d, $formValues) && !CRM_Utils_System::isNull($formValues[$d])) { + elseif (!empty($formValues[$d]) && !CRM_Utils_System::isNull($formValues[$d])) { if ($d == 'start_date') { $params['scheduled_date'] = CRM_Utils_Date::processDate($formValues[$d]); } @@ -593,7 +593,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('is_acknowledge', $formValues)) { + if (!empty($formValues['is_acknowledge'])) { $params['acknowledge_date'] = date('Y-m-d'); } @@ -605,7 +605,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $params['contact_id'] = $this->_contactID; //format custom data - if (CRM_Utils_Array::value('hidden_custom', $formValues)) { + if (!empty($formValues['hidden_custom'])) { $params['hidden_custom'] = 1; $customFields = CRM_Core_BAO_CustomField::getFields('Pledge'); @@ -635,7 +635,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { } //handle Acknowledgment. - if (CRM_Utils_Array::value('is_acknowledge', $formValues) && $pledge->id) { + if (!empty($formValues['is_acknowledge']) && $pledge->id) { //calculate scheduled amount. $params['scheduled_amount'] = round($params['amount'] / $params['installments']); diff --git a/CRM/Pledge/Form/PledgeView.php b/CRM/Pledge/Form/PledgeView.php index 0fed9c4812..61f5358c8b 100644 --- a/CRM/Pledge/Form/PledgeView.php +++ b/CRM/Pledge/Form/PledgeView.php @@ -72,7 +72,7 @@ class CRM_Pledge_Form_PledgeView extends CRM_Core_Form { $groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']); CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree); - if (CRM_Utils_Array::value('contribution_page_id', $values)) { + if (!empty($values['contribution_page_id'])) { $values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title'); } diff --git a/CRM/Pledge/Selector/Search.php b/CRM/Pledge/Selector/Search.php index fb8c50201c..71e0ca60d2 100644 --- a/CRM/Pledge/Selector/Search.php +++ b/CRM/Pledge/Selector/Search.php @@ -329,7 +329,7 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base { $pledgeStatuses ); // append (test) to status label - if (CRM_Utils_Array::value('pledge_is_test', $row)) { + if (!empty($row['pledge_is_test'])) { $row['pledge_status'] .= ' (test)'; } diff --git a/CRM/Pledge/StateMachine/Search.php b/CRM/Pledge/StateMachine/Search.php index b21d414320..1d4fc16ba4 100644 --- a/CRM/Pledge/StateMachine/Search.php +++ b/CRM/Pledge/StateMachine/Search.php @@ -82,7 +82,7 @@ class CRM_Pledge_StateMachine_Search extends CRM_Core_StateMachine { function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff // fix value if print button is pressed - if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) { + if (!empty($_POST['_qf_' . $formName . '_next_print'])) { $value = CRM_Pledge_Task::PRINT_PLEDGES; } else { diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 741a10c74d..0bf6ee817c 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 (CRM_Utils_Array::value('price_field_value_id', $line) && !CRM_Utils_Array::value('financial_type_id', $line)) { + if (!empty($line['price_field_value_id']) && !CRM_Utils_Array::value('financial_type_id', $line)) { $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); @@ -395,7 +395,7 @@ AND li.entity_id = {$entityId})"; $setID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $values['price_field_id'], 'price_set_id'); $params['is_quick_config'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'is_quick_config'); } - if (CRM_Utils_Array::value('is_quick_config', $params) && array_key_exists('total_amount', $params) + if (!empty($params['is_quick_config']) && array_key_exists('total_amount', $params) && $totalEntityId == 1) { $values['line_total'] = $values['unit_price'] = $params['total_amount']; } diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index a9938882d6..1e2bebc6fe 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -113,7 +113,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { } } else { - if (CRM_Utils_Array::value('default_option', $params)) { + if (!empty($params['default_option'])) { $defaultArray[$params['default_option']] = 1; } } @@ -146,7 +146,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { if (CRM_Utils_Array::value( $index, CRM_Utils_Array::value('option_financial_type_id', $params))) { $options['financial_type_id'] = $params['option_financial_type_id'][$index]; - } elseif (CRM_Utils_Array::value( 'financial_type_id', $params )) { + } elseif (!empty($params['financial_type_id'])) { $options['financial_type_id'] = $params['financial_type_id']; } @@ -301,7 +301,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { $label = ts('Additional Contribution'); $useRequired = 0; } - elseif (CRM_Utils_Array::value('label', $fieldOptions[$optionKey])) { //check for label. + elseif (!empty($fieldOptions[$optionKey]['label'])) { //check for label. $label = $fieldOptions[$optionKey]['label']; } @@ -386,7 +386,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { if (!$field->is_required) { // add "none" option - if (CRM_Utils_Array::value('is_allow_other_amount', $otherAmount) && $field->name == 'contribution_amount') { + 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') { @@ -613,7 +613,7 @@ WHERE } } - if (CRM_Utils_Array::value($key, $fields)) { + if (!empty($fields[$key])) { $priceFields[$priceField->id] = $fields[$key]; } } diff --git a/CRM/Price/BAO/PriceFieldValue.php b/CRM/Price/BAO/PriceFieldValue.php index fee5a90bb1..e125c474fa 100644 --- a/CRM/Price/BAO/PriceFieldValue.php +++ b/CRM/Price/BAO/PriceFieldValue.php @@ -56,7 +56,7 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue { if ($id = CRM_Utils_Array::value('id', $ids)) { $fieldValueBAO->id = $id; } - if (CRM_Utils_Array::value('is_default', $params)) { + if (!empty($params['is_default'])) { $query = 'UPDATE civicrm_price_field_value SET is_default = 0 WHERE price_field_id = %1'; $p = array(1 => array($params['price_field_id'], 'Integer')); CRM_Core_DAO::executeQuery($query, $p); @@ -93,10 +93,10 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue { $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceFieldValue', $oldWeight, $params['weight'], $fieldValues); } else { - if (!CRM_Utils_Array::value('name', $params)) { + if (empty($params['name'])) { $params['name'] = CRM_Utils_String::munge(CRM_Utils_Array::value('label', $params), '_', 64); } - if (!CRM_Utils_Array::value('weight', $params)) { + if (empty($params['weight'])) { $params['weight'] = 1; } } diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 455eff3966..eaff867fab 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -649,7 +649,7 @@ WHERE id = %1"; $autoRenew[0] = $autoRenew[1] = $autoRenew[2] = 0; } foreach ($fields as $id => $field) { - if (!CRM_Utils_Array::value("price_{$id}", $params) || + if (empty($params["price_{$id}"]) || (empty($params["price_{$id}"]) && $params["price_{$id}"] == NULL) ) { // skip if nothing was submitted for this field @@ -869,7 +869,7 @@ WHERE id = %1"; static $_contact_memberships = array(); $checklifetime = FALSE; foreach ($options as $key => $value) { - if (CRM_Utils_Array::value('membership_type_id', $value)) { + if (!empty($value['membership_type_id'])) { 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); } diff --git a/CRM/Price/Form/Field.php b/CRM/Price/Form/Field.php index 508304b88a..002b25dd6e 100644 --- a/CRM/Price/Form/Field.php +++ b/CRM/Price/Form/Field.php @@ -127,13 +127,13 @@ class CRM_Price_Form_Field extends CRM_Core_Form { $defaults['price'] = CRM_Utils_Money::format($defaults['amount'], NULL, '%a'); } - if (CRM_Utils_Array::value('active_on', $defaults)) { + if (!empty($defaults['active_on'])) { list($defaults['active_on'], $defaults['active_on_time'] ) = CRM_Utils_Date::setDateDefaults($defaults['active_on'], 'activityDateTime'); } - if (CRM_Utils_Array::value('expire_on', $defaults)) { + if (!empty($defaults['expire_on'])) { list($defaults['expire_on'], $defaults['expire_on_time'] ) = CRM_Utils_Date::setDateDefaults($defaults['expire_on'], 'activityDateTime'); @@ -558,7 +558,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { foreach ($memTypesIDS as $key => $val) { // see if any price field option values in this price field are for memberships with autorenew $memTypeDetails = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($val); - if (CRM_Utils_Array::value('auto_renew', $memTypeDetails)) { + if (!empty($memTypeDetails['auto_renew'])) { $foundAutorenew = TRUE; break; } diff --git a/CRM/Price/Form/Option.php b/CRM/Price/Form/Option.php index f730ad972b..3faaf8f62b 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 (CRM_Utils_Array::value('count', $fields) && CRM_Utils_Array::value('max_value', $fields) && + if (!empty($fields['count']) && CRM_Utils_Array::value('max_value', $fields) && $fields['count'] > $fields['max_value'] ) { $errors['count'] = ts('Participant count can not be greater than max participants.'); diff --git a/CRM/Price/Form/Preview.php b/CRM/Price/Form/Preview.php index 5039389e35..0115d63262 100644 --- a/CRM/Price/Form/Preview.php +++ b/CRM/Price/Form/Preview.php @@ -98,7 +98,7 @@ class CRM_Price_Form_Preview extends CRM_Core_Form { $defaults = array(); $groupId = $this->get('groupId'); $fieldId = $this->get('fieldId'); - if (CRM_Utils_Array::value('fields', $this->_groupTree[$groupId])) { + if (!empty($this->_groupTree[$groupId]['fields'])) { foreach ($this->_groupTree[$groupId]['fields'] as $key => $val) { foreach ($val['options'] as $keys => $values) { if ($values['is_default']) { diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index 8f7220e393..5455594770 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -134,7 +134,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $financialType = CRM_Contribute_PseudoConstant::financialType(); foreach ($customOption as $id => $values) { $action = array_sum(array_keys($this->actionLinks())); - if( CRM_Utils_Array::value('financial_type_id', $values)){ + if (!empty($values['financial_type_id'])){ $customOption[$id]['financial_type_id'] = $financialType[$values['financial_type_id']]; } // update enable/disable links depending on price_field properties. @@ -149,7 +149,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $action -= CRM_Core_Action::DISABLE; } } - if (CRM_Utils_Array::value('is_default', $customOption[$id])) { + if (!empty($customOption[$id]['is_default'])) { $customOption[$id]['is_default'] = ''; } else { diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index e9ae4787ec..b243bd1b46 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -373,7 +373,7 @@ class CRM_Profile_Form extends CRM_Core_Form { $this->assign('multiRecordFieldListing', $multiRecordFieldListing); // is profile double-opt in? - if (CRM_Utils_Array::value('group', $this->_fields) && + if (!empty($this->_fields['group']) && CRM_Core_BAO_UFGroup::isProfileDoubleOptin() ) { $emailField = FALSE; @@ -556,7 +556,7 @@ class CRM_Profile_Form extends CRM_Core_Form { return; } - if (CRM_Utils_Array::value('image_URL', $this->_defaults)) { + if (!empty($this->_defaults['image_URL'])) { list($imageWidth, $imageHeight) = getimagesize($this->_defaults['image_URL']); list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight); $this->assign("imageWidth", $imageWidth); @@ -929,12 +929,12 @@ 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)) { // fix for CRM-3240 - if (CRM_Utils_Array::value('email-Primary', $fields)) { + if (!empty($fields['email-Primary'])) { $fields['email'] = CRM_Utils_Array::value('email-Primary', $fields); } // fix for CRM-6141 - if (CRM_Utils_Array::value('phone-Primary-1', $fields) && + if (!empty($fields['phone-Primary-1']) && !CRM_Utils_Array::value('phone-Primary', $fields) ) { $fields['phone-Primary'] = $fields['phone-Primary-1']; @@ -1089,11 +1089,11 @@ class CRM_Profile_Form extends CRM_Core_Form { //if the delete record button is clicked if ($this->_deleteButtonName) { - if (CRM_Utils_Array::value($this->_deleteButtonName, $_POST) && $this->_recordId) { + if (!empty($_POST[$this->_deleteButtonName]) && $this->_recordId) { $filterParams['id'] = $this->_customGroupId; $returnProperities = array('is_multiple', 'table_name'); CRM_Core_DAO::commonRetrieve("CRM_Core_DAO_CustomGroup", $filterParams, $returnValues, $returnProperities); - if (CRM_Utils_Array::value('is_multiple', $returnValues)) { + if (!empty($returnValues['is_multiple'])) { if ($tableName = CRM_Utils_Array::value('table_name', $returnValues)) { $sql = "DELETE FROM {$tableName} WHERE id = %1 AND entity_id = %2"; $sqlParams = array( @@ -1108,7 +1108,7 @@ class CRM_Profile_Form extends CRM_Core_Form { } } CRM_Utils_Hook::processProfile($this->_ufGroupName); - if (CRM_Utils_Array::value('image_URL', $params)) { + if (!empty($params['image_URL'])) { CRM_Contact_BAO_Contact::processImageParams($params); } @@ -1167,11 +1167,11 @@ class CRM_Profile_Form extends CRM_Core_Form { //array of group id, subscribed by contact $contactGroup = array(); - if (CRM_Utils_Array::value('group', $params) && + if (!empty($params['group']) && CRM_Core_BAO_UFGroup::isProfileDoubleOptin() ) { $groupSubscribed = array(); - if (CRM_Utils_Array::value('email', $result)) { + if (!empty($result['email'])) { if ($this->_id) { $contactGroups = new CRM_Contact_DAO_GroupContact(); $contactGroups->contact_id = $this->_id; @@ -1208,7 +1208,7 @@ class CRM_Profile_Form extends CRM_Core_Form { } $addToGroupId = NULL; - if (CRM_Utils_Array::value('add_to_group', $params)) { + if (!empty($params['add_to_group'])) { $addToGroupId = $params['add_to_group']; //run same check whether group is a mailing list @@ -1273,7 +1273,7 @@ class CRM_Profile_Form extends CRM_Core_Form { if (isset($params['activity_date_time'])) { $activityParams['activity_date_time'] = CRM_Utils_Date::processDate($params['activity_date_time'], $params['activity_date_time_time']); } - if (CRM_Utils_Array::value($fieldName, $params) && isset($params["{$fieldName}_id"])) { + if (!empty($params[$fieldName]) && isset($params["{$fieldName}_id"])) { $activityParams[$fieldName] = $params["{$fieldName}_id"]; } } @@ -1327,7 +1327,7 @@ class CRM_Profile_Form extends CRM_Core_Form { } //create CMS user (if CMS user option is selected in profile) - if (CRM_Utils_Array::value('cms_create_account', $params) && + if (!empty($params['cms_create_account']) && $this->_mode == self::MODE_CREATE ) { $params['contactID'] = $this->_id; diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index b9fba0122b..cbaa13ed48 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -326,7 +326,7 @@ SELECT module } //for delete record handling - if (!CRM_Utils_Array::value($this->_deleteButtonName, $_POST)) { + if (empty($_POST[$this->_deleteButtonName])) { CRM_Core_Session::setStatus(ts('Your information has been saved.'), ts('Thank you.'), 'success'); } diff --git a/CRM/Profile/Page/Listings.php b/CRM/Profile/Page/Listings.php index f25f6bbdf8..ffa8023de1 100644 --- a/CRM/Profile/Page/Listings.php +++ b/CRM/Profile/Page/Listings.php @@ -359,7 +359,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page { ) ); } - if (CRM_Utils_Array::value('group', $this->_params)) { + if (!empty($this->_params['group'])) { foreach ($this->_params['group'] as $key => $val) { if (!$val) { unset($this->_params['group'][$key]); @@ -423,7 +423,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page { // add group id to params if a uf group belong to a any group if ($groupId) { - if (CRM_Utils_Array::value('group', $params)) { + if (!empty($params['group'])) { $params['group'][$groupId] = 1; } else { diff --git a/CRM/Profile/Selector/Listings.php b/CRM/Profile/Selector/Listings.php index 724169a54f..9b23e60455 100644 --- a/CRM/Profile/Selector/Listings.php +++ b/CRM/Profile/Selector/Listings.php @@ -172,7 +172,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR // add group id to params if a uf group belong to a any group if ($groupId) { - if (CRM_Utils_Array::value('group', $this->_params)) { + if (!empty($this->_params['group'])) { $this->_params['group'][$groupId] = 1; } else { @@ -318,7 +318,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR continue; } - if (CRM_Utils_Array::value('in_selector', $field) && + if (!empty($field['in_selector']) && !in_array($name, $skipFields) ) { @@ -509,7 +509,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR continue; } - if (CRM_Utils_Array::value('in_selector', $field) && + if (!empty($field['in_selector']) && !in_array($key, $skipFields) ) { if (strpos($key, '-') !== FALSE) { @@ -757,7 +757,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR } } - if (CRM_Utils_Array::value('in_selector', $properties)) { + if (!empty($properties['in_selector'])) { $selectorSet = TRUE; } } diff --git a/CRM/Report/BAO/ReportInstance.php b/CRM/Report/BAO/ReportInstance.php index f04b4a7e83..322e2e2ed7 100644 --- a/CRM/Report/BAO/ReportInstance.php +++ b/CRM/Report/BAO/ReportInstance.php @@ -73,7 +73,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance { } $instanceID = CRM_Utils_Array::value('id', $params); - if (CRM_Utils_Array::value('instance_id', $params)) { + if (!empty($params['instance_id'])) { $instanceID = CRM_Utils_Array::value('instance_id', $params); } @@ -143,7 +143,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance { } // build navigation parameters - if (CRM_Utils_Array::value('is_navigation', $params)) { + if (!empty($params['is_navigation'])) { if (!array_key_exists('navigation', $params)) { $params['navigation'] = array(); } @@ -168,7 +168,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance { // add to dashboard $dashletParams = array(); - if (CRM_Utils_Array::value('addToDashboard', $params)) { + if (!empty($params['addToDashboard'])) { $dashletParams = array( 'label' => $params['title'], 'is_active' => 1, @@ -188,7 +188,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance { // add / update navigation as required if (!empty($navigationParams)) { - if (!CRM_Utils_Array::value('id',$params) && + if (empty($params['id']) && !CRM_Utils_Array::value('instance_id',$params) && CRM_Utils_Array::value('id', $navigationParams)) { unset($navigationParams['id']); @@ -196,7 +196,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance { $navigationParams['url'] = "civicrm/report/instance/{$instance->id}&reset=1"; $navigation = CRM_Core_BAO_Navigation::add($navigationParams); - if (CRM_Utils_Array::value('is_active', $navigationParams)) { + if (!empty($navigationParams['is_active'])) { //set the navigation id in report instance table CRM_Core_DAO::setFieldValue('CRM_Report_DAO_ReportInstance', $instance->id, 'navigation_id', $navigation->id); } @@ -212,7 +212,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance { if (!empty($dashletParams)) { $section = 2; $chart = ''; - if (CRM_Utils_Array::value('charts', $params)) { + if (!empty($params['charts'])) { $section = 1; $chart = "&charts=" . $params['charts']; } diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 9c2b954dcb..adf4c666ac 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -397,7 +397,7 @@ class CRM_Report_Form extends CRM_Core_Form { } // lets always do a force if reset is found in the url. - if (CRM_Utils_Array::value('reset', $_REQUEST)) { + if (!empty($_REQUEST['reset'])) { $this->_force = 1; } @@ -498,7 +498,7 @@ class CRM_Report_Form extends CRM_Core_Form { $fieldGroups = array('fields', 'filters', 'group_bys', 'order_bys'); foreach ($fieldGroups as $fieldGrp) { - if (CRM_Utils_Array::value($fieldGrp, $table) && is_array($table[$fieldGrp])) { + if (!empty($table[$fieldGrp]) && is_array($table[$fieldGrp])) { foreach ($table[$fieldGrp] as $fieldName => $field) { // $name is the field name used to reference the BAO/DAO export fields array $name = isset($field['name']) ? $field['name'] : $fieldName; @@ -527,10 +527,10 @@ class CRM_Report_Form extends CRM_Core_Form { } // fill other vars - if (CRM_Utils_Array::value('no_repeat', $field)) { + if (!empty($field['no_repeat'])) { $this->_noRepeats[] = "{$tableName}_{$fieldName}"; } - if (CRM_Utils_Array::value('no_display', $field)) { + if (!empty($field['no_display'])) { $this->_noDisplay[] = "{$tableName}_{$fieldName}"; } @@ -629,7 +629,7 @@ class CRM_Report_Form extends CRM_Core_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!CRM_Utils_Array::value('no_display', $field)) { + if (empty($field['no_display'])) { if (isset($field['required'])) { // set default $this->_defaults['fields'][$fieldName] = 1; @@ -653,7 +653,7 @@ class CRM_Report_Form extends CRM_Core_Form { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { if (isset($field['default'])) { - if (CRM_Utils_Array::value('frequency', $field)) { + if (!empty($field['frequency'])) { $this->_defaults['group_bys_freq'][$fieldName] = 'MONTH'; } $this->_defaults['group_bys'][$fieldName] = $field['default']; @@ -699,8 +699,7 @@ class CRM_Report_Form extends CRM_Core_Form { $this->_defaults['order_bys'] = array(); } foreach ($table['order_bys'] as $fieldName => $field) { - if ( - CRM_Utils_Array::value('default', $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) @@ -711,7 +710,7 @@ class CRM_Report_Form extends CRM_Core_Form { 'section' => CRM_Utils_Array::value('default_is_section', $field, 0), ); - if (CRM_Utils_Array::value('default_weight', $field)) { + if (!empty($field['default_weight'])) { $this->_defaults['order_bys'][(int) $field['default_weight']] = $order_by; } else { @@ -820,7 +819,7 @@ class CRM_Report_Form extends CRM_Core_Form { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { $groupTitle = ''; - if (!CRM_Utils_Array::value('no_display', $field)) { + if (empty($field['no_display'])) { foreach ( array('table', 'field') as $var) { if (!empty(${$var}['grouping'])) { if (!is_array(${$var}['grouping'])) { @@ -986,7 +985,7 @@ class CRM_Report_Form extends CRM_Core_Form { foreach ($table['group_bys'] as $fieldName => $field) { if (!empty($field)) { $options[$field['title']] = $fieldName; - if (CRM_Utils_Array::value('frequency', $field)) { + if (!empty($field['frequency'])) { $freqElements[$field['title']] = $fieldName; } } @@ -1025,7 +1024,7 @@ class CRM_Report_Form extends CRM_Core_Form { if ($this->_autoIncludeIndexedFieldsAsOrderBys && array_key_exists('extends', $table) && !empty($table['extends'])) { foreach ($table['fields'] as $fieldName => $field) { - if (!CRM_Utils_Array::value('no_display', $field)) { + if (empty($field['no_display'])) { $options[$fieldName] = $field['title']; } } @@ -1429,10 +1428,10 @@ class CRM_Report_Form extends CRM_Core_Form { break; } - if (CRM_Utils_Array::value('group', $field) && $clause) { + if (!empty($field['group']) && $clause) { $clause = $this->whereGroupClause($field, $value, $op); } - elseif (CRM_Utils_Array::value('tag', $field) && $clause) { + elseif (!empty($field['tag']) && $clause) { // not using left join in query because if any contact // belongs to more than one tag, results duplicate // entries. @@ -1777,7 +1776,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND // unset columns not to be displayed. foreach ($this->_columnHeaders as $key => $value) { - if (CRM_Utils_Array::value('no_display', $value)) { + if (!empty($value['no_display'])) { unset($this->_columnHeaders[$key]); } } @@ -1828,7 +1827,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND $this->_phoneField = TRUE; } - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -1843,7 +1842,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND } // include statistics columns only if set - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { $alias = "{$tableName}_{$fieldName}_{$stat}"; switch (strtolower($stat)) { @@ -1948,7 +1947,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND break; } // for graphs and charts - - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) { + if (!empty($this->_params['group_bys_freq'][$fieldName])) { $this->_interval = $field['title']; $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning'; $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type']; @@ -2040,7 +2039,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND } if (!empty($clause)) { - if (CRM_Utils_Array::value('having', $field)) { + if (!empty($field['having'])) { $this->_havingClauses[] = $clause; } else { @@ -2128,7 +2127,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND // fields array is missing because form building etc is skipped // in dashboard mode for report //@todo - this could be done in the dashboard no we have a setter - if (!CRM_Utils_Array::value('fields', $this->_params) && !$this->_noFields) { + if (empty($this->_params['fields']) && !$this->_noFields) { $this->setParams($this->_formValues); } @@ -2177,14 +2176,14 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND function groupBy() { $groupBys = array(); - if (CRM_Utils_Array::value('group_bys', $this->_params) && + if (!empty($this->_params['group_bys']) && is_array($this->_params['group_bys']) && !empty($this->_params['group_bys']) ) { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { $groupBys[] = $field['dbAlias']; } } @@ -2215,7 +2214,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND function storeOrderByArray() { $orderBys = array(); - if (CRM_Utils_Array::value('order_bys', $this->_params) && + if (!empty($this->_params['order_bys']) && is_array($this->_params['order_bys']) && !empty($this->_params['order_bys']) ) { @@ -2248,7 +2247,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND $orderBys[] = "{$orderByField['dbAlias']} {$orderBy['order']}"; // Record any section headers for assignment to the template - if (CRM_Utils_Array::value('section', $orderBy)) { + if (!empty($orderBy['section'])) { $orderByField['pageBreak'] = CRM_Utils_Array::value('pageBreak', $orderBy); $this->_sections[$orderByField['tplField']] = $orderByField; } @@ -2266,7 +2265,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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -2420,14 +2419,14 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND } function groupByStat(&$statistics) { - if (CRM_Utils_Array::value('group_bys', $this->_params) && + if (!empty($this->_params['group_bys']) && is_array($this->_params['group_bys']) && !empty($this->_params['group_bys']) ) { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { $combinations[] = $field['title']; } } @@ -3015,7 +3014,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a } //might be survey response field. - if (CRM_Utils_Array::value('survey_response', $this->_params['fields']) && + if (!empty($this->_params['fields']['survey_response']) && CRM_Utils_Array::value('isSurveyResponseField', $prop['fields'][$fieldAlias]) ) { return TRUE; @@ -3054,7 +3053,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a return TRUE; } } - if (CRM_Utils_Array::value($fieldAlias . '_op', $this->_params) && + if (!empty($this->_params[$fieldAlias . '_op']) && in_array($this->_params[$fieldAlias . '_op'], array('nll', 'nnll')) ) { return TRUE; @@ -3134,7 +3133,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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { $this->_selectedTables[] = $tableName; @@ -3152,7 +3151,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a } if (array_key_exists('filters', $table)) { foreach ($table['filters'] as $filterName => $filter) { - if (CRM_Utils_Array::value("{$filterName}_value", $this->_params) || + if (!empty($this->_params["{$filterName}_value"]) || CRM_Utils_Array::value("{$filterName}_op", $this->_params) == 'nll' || CRM_Utils_Array::value("{$filterName}_op", $this->_params) == 'nnll' ) { diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php index 8f89c05521..96062ec0da 100644 --- a/CRM/Report/Form/ActivitySummary.php +++ b/CRM/Report/Form/ActivitySummary.php @@ -186,7 +186,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) { case 'YEARWEEK': @@ -218,7 +218,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { $field['title'] = 'Quarter'; break; } - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) { + if (!empty($this->_params['group_bys_freq'][$fieldName])) { $this->_interval = $field['title']; $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning'; $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type']; @@ -235,7 +235,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { } if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_email') { @@ -244,7 +244,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { if ($tableName == 'civicrm_phone') { $this->_phoneField = TRUE; } - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { case 'count': @@ -264,7 +264,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { } } elseif ($fieldName == 'activity_type_id') { - if (!CRM_Utils_Array::value('activity_type_id', $this->_params['group_bys'])) { + if (empty($this->_params['group_bys']['activity_type_id'])) { $select[] = "GROUP_CONCAT(DISTINCT {$field['dbAlias']} ORDER BY {$field['dbAlias']} ) as {$tableName}_{$fieldName}"; } else { @@ -397,11 +397,11 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { - if (CRM_Utils_Array::value('chart', $field)) { + if (!empty($this->_params['group_bys'][$fieldName])) { + if (!empty($field['chart'])) { $this->assign('chartSupported', TRUE); } - if (CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) && + if (!empty($table['group_bys'][$fieldName]['frequency']) && CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) ) { @@ -432,9 +432,9 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { function formRule($fields, $files, $self) { $errors = array(); $contactFields = array('sort_name', 'email', 'phone'); - if (CRM_Utils_Array::value('group_bys', $fields)) { + if (!empty($fields['group_bys'])) { - if (CRM_Utils_Array::value('activity_type_id', $fields['group_bys']) && + if (!empty($fields['group_bys']['activity_type_id']) && !CRM_Utils_Array::value('sort_name', $fields['group_bys']) ) { foreach ($fields['fields'] as $fieldName => $val) { @@ -445,8 +445,8 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { } } - if (CRM_Utils_Array::value('activity_date_time', $fields['group_bys'])) { - if (CRM_Utils_Array::value('sort_name', $fields['group_bys'])) { + if (!empty($fields['group_bys']['activity_date_time'])) { + if (!empty($fields['group_bys']['sort_name'])) { $errors['fields'] = ts("Please do not select GroupBy 'Activity Date' with GroupBy 'Contact'"); } else { diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index 7f6928d7b9..ef9ae9ff20 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -286,7 +286,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { continue; } foreach ($table['fields'] as $fieldName => $field) { - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) || CRM_Utils_Array::value('is_required', $field) ) { @@ -513,7 +513,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { continue; } foreach ($values['fields'] as $name => $field) { - if (CRM_Utils_Array::value('isSurveyResponseField', $field)) { + if (!empty($field['isSurveyResponseField'])) { $fldId = substr($name, 7); $fieldIds[$fldId] = $fldId; $title = CRM_Utils_Array::value('label', $field, $field['title']); @@ -666,7 +666,7 @@ INNER JOIN civicrm_survey survey ON ( survey.result_id = grp.id ) $surveyId = CRM_Utils_Array::value(0, $surveyIds); foreach ($rows as & $row) { - if (CRM_Utils_Array::value('civicrm_activity_survey_id', $row)) { + if (!empty($row['civicrm_activity_survey_id'])) { $surveyId = $row['civicrm_activity_survey_id']; } $result = CRM_Utils_Array::value($surveyId, $resultSet, array()); @@ -698,7 +698,7 @@ INNER JOIN civicrm_survey survey ON ( survey.result_id = grp.id ) continue; } foreach ($values['fields'] as $name => $field) { - if (CRM_Utils_Array::value('isSurveyResponseField', $field)) { + if (!empty($field['isSurveyResponseField'])) { $fldId = substr($name, 7); $surveyResponseFields[$name] = "{$tableName}_{$name}"; $surveyResponseFieldIds[$fldId] = $fldId; @@ -713,7 +713,7 @@ INNER JOIN civicrm_survey survey ON ( survey.result_id = grp.id ) $hasResponseData = FALSE; foreach ($surveyResponseFields as $fldName) { foreach ($rows as $row) { - if (CRM_Utils_Array::value($fldName, $row)) { + if (!empty($row[$fldName])) { $hasResponseData = TRUE; break; } @@ -871,7 +871,7 @@ INNER JOIN civicrm_custom_field cf ON ( cg.id = cf.custom_group_id ) $this->_columns[$resTable]['dao'] = 'CRM_Contact_DAO_Contact'; $this->_columns[$resTable]['extends'] = $response->extends; } - if (!CRM_Utils_Array::value('alias', $this->_columns[$resTable])) { + if (empty($this->_columns[$resTable]['alias'])) { $this->_columns[$resTable]['alias'] = "{$resTable}_survey_response"; } if (!is_array(CRM_Utils_Array::value('fields', $this->_columns[$resTable]))) { diff --git a/CRM/Report/Form/Case/Demographics.php b/CRM/Report/Form/Case/Demographics.php index 2f38aaed3f..12c03e0e9b 100644 --- a/CRM/Report/Form/Case/Demographics.php +++ b/CRM/Report/Form/Case/Demographics.php @@ -249,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_email') { diff --git a/CRM/Report/Form/Case/Detail.php b/CRM/Report/Form/Case/Detail.php index 31b131472a..3a68446e8a 100644 --- a/CRM/Report/Form/Case/Detail.php +++ b/CRM/Report/Form/Case/Detail.php @@ -304,7 +304,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_email') { @@ -550,7 +550,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { $this->_relField = TRUE; } - if (CRM_Utils_Array::value('activity_date_time_relative', $this->_params) || + if (!empty($this->_params['activity_date_time_relative']) || CRM_Utils_Array::value('activity_date_time_from', $this->_params) || CRM_Utils_Array::value('activity_date_time_to', $this->_params) ) { @@ -558,7 +558,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { } foreach (array_keys($this->_caseDetailExtra) as $field) { - if (CRM_Utils_Array::value($field, $this->_params['case_detail_extra'])) { + if (!empty($this->_params['case_detail_extra'][$field])) { $this->_includeCaseDetailExtra = TRUE; break; } diff --git a/CRM/Report/Form/Case/Summary.php b/CRM/Report/Form/Case/Summary.php index e0f16be6a0..e7f56531eb 100644 --- a/CRM/Report/Form/Case/Summary.php +++ b/CRM/Report/Form/Case/Summary.php @@ -179,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { diff --git a/CRM/Report/Form/Case/TimeSpent.php b/CRM/Report/Form/Case/TimeSpent.php index 1c90e989b4..9f92d61c8c 100644 --- a/CRM/Report/Form/Case/TimeSpent.php +++ b/CRM/Report/Form/Case/TimeSpent.php @@ -180,7 +180,7 @@ class CRM_Report_Form_Case_TimeSpent extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (CRM_Utils_Array::value('required', $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'))) ) diff --git a/CRM/Report/Form/Contact/CurrentEmployer.php b/CRM/Report/Form/Contact/CurrentEmployer.php index f8fa02059e..44b213486e 100644 --- a/CRM/Report/Form/Contact/CurrentEmployer.php +++ b/CRM/Report/Form/Contact/CurrentEmployer.php @@ -206,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -325,7 +325,7 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} // in previous row foreach ($row as $colName => $colVal) { - if (CRM_Utils_Array::value($colName, $checkList) && is_array($checkList[$colName]) && + if (!empty($checkList[$colName]) && is_array($checkList[$colName]) && in_array($colVal, $checkList[$colName]) ) { $rows[$rowNum][$colName] = ""; diff --git a/CRM/Report/Form/Contact/Detail.php b/CRM/Report/Form/Contact/Detail.php index 1ab75d8124..f23ea602de 100644 --- a/CRM/Report/Form/Contact/Detail.php +++ b/CRM/Report/Form/Contact/Detail.php @@ -397,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { //isolate the select clause compoenent wise @@ -436,7 +436,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { } foreach ($this->_component as $val) { - if (CRM_Utils_Array::value($val, $select)) { + if (!empty($select[$val])) { $this->_selectComponent[$val] = "SELECT " . implode(', ', $select[$val]) . " "; unset($select[$val]); } @@ -486,7 +486,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { $this->_from .= "{$group}"; foreach ($this->_component as $val) { - if (CRM_Utils_Array::value('contribution_civireport', $this->_selectComponent)) { + if (!empty($this->_selectComponent['contribution_civireport'])) { $this->_formComponent['contribution_civireport'] = " FROM civicrm_contact {$this->_aliases['civicrm_contact']} INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} @@ -494,14 +494,14 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { {$group} "; } - if (CRM_Utils_Array::value('membership_civireport', $this->_selectComponent)) { + if (!empty($this->_selectComponent['membership_civireport'])) { $this->_formComponent['membership_civireport'] = " FROM civicrm_contact {$this->_aliases['civicrm_contact']} INNER JOIN civicrm_membership {$this->_aliases['civicrm_membership']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_membership']}.contact_id {$group} "; } - if (CRM_Utils_Array::value('participant_civireport', $this->_selectComponent)) { + if (!empty($this->_selectComponent['participant_civireport'])) { $this->_formComponent['participant_civireport'] = " FROM civicrm_contact {$this->_aliases['civicrm_contact']} INNER JOIN civicrm_participant {$this->_aliases['civicrm_participant']} @@ -509,7 +509,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { {$group} "; } - if (CRM_Utils_Array::value('activity_civireport', $this->_selectComponent)) { + if (!empty($this->_selectComponent['activity_civireport'])) { $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); @@ -544,7 +544,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { civicrm_case_contact.case_id = civicrm_case.id "; } - if (CRM_Utils_Array::value('relationship_civireport', $this->_selectComponent)) { + if (!empty($this->_selectComponent['relationship_civireport'])) { $this->_formComponent['relationship_civireport'] = "FROM civicrm_relationship {$this->_aliases['civicrm_relationship']} @@ -605,7 +605,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { $contribution = $membership = $participant = NULL; $eligibleResult = $rows = $tempArray = array(); foreach ($this->_component as $val) { - if (CRM_Utils_Array::value($val, $this->_selectComponent) && ($val != 'activity_civireport' && $val != 'relationship_civireport')) { + if (!empty($this->_selectComponent[$val]) && ($val != 'activity_civireport' && $val != 'relationship_civireport')) { $sql = "{$this->_selectComponent[$val]} {$this->_formComponent[$val]} WHERE {$this->_aliases['civicrm_contact']}.id IN ( $selectedContacts ) GROUP BY {$this->_aliases['civicrm_contact']}.id,{$val}.id "; @@ -631,7 +631,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { } } - if (CRM_Utils_Array::value('relationship_civireport', $this->_selectComponent)) { + if (!empty($this->_selectComponent['relationship_civireport'])) { $relTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE); @@ -671,7 +671,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { } } - if (CRM_Utils_Array::value('activity_civireport', $this->_selectComponent)) { + if (!empty($this->_selectComponent['activity_civireport'])) { $componentClause = "civicrm_option_value.component_id IS NULL"; $componentsIn = NULL; diff --git a/CRM/Report/Form/Contact/Log.php b/CRM/Report/Form/Contact/Log.php index b714015e12..f05615f11b 100644 --- a/CRM/Report/Form/Contact/Log.php +++ b/CRM/Report/Form/Contact/Log.php @@ -158,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { diff --git a/CRM/Report/Form/Contact/LoggingSummary.php b/CRM/Report/Form/Contact/LoggingSummary.php index fef8530c26..7f1dcebe6b 100644 --- a/CRM/Report/Form/Contact/LoggingSummary.php +++ b/CRM/Report/Form/Contact/LoggingSummary.php @@ -165,7 +165,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['log_civicrm_entity_altered_contact_id'], 'is_deleted') !== '0'; } - if (CRM_Utils_Array::value('log_civicrm_entity_altered_contact', $row) && + if (!empty($row['log_civicrm_entity_altered_contact']) && !$isDeleted[$row['log_civicrm_entity_altered_contact_id']]) { $row['log_civicrm_entity_altered_contact_link'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_entity_altered_contact_id']); @@ -243,7 +243,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { INNER JOIN civicrm_contact modified_contact_civireport ON (entity_log_civireport.{$detail['fk']} = modified_contact_civireport.id {$clause})"; - if (CRM_Utils_Array::value('joins', $detail)) { + if (!empty($detail['joins'])) { $clause = CRM_Utils_Array::value('entity_table', $detail); $clause = $clause ? "AND fk_table.entity_table = 'civicrm_contact'" : null; $joinClause = " diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php index 07ef819c99..d92004cc3a 100644 --- a/CRM/Report/Form/Contact/Relationship.php +++ b/CRM/Report/Form/Contact/Relationship.php @@ -267,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -415,7 +415,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { } if (!empty($clause)) { - if (CRM_Utils_Array::value('having', $field)) { + if (!empty($field['having'])) { $havingClauses[] = $clause; } else { @@ -455,7 +455,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { elseif (CRM_Utils_Array::value('is_active_value', $this->_params) == '0') { $relStatus = 'Is equal to Inactive'; } - if (CRM_Utils_Array::value('filters', $statistics)) { + if (!empty($statistics['filters'])) { foreach ($statistics['filters'] as $id => $value) { //for displaying relationship type filter if ($value['title'] == 'Relationship') { @@ -507,7 +507,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { $this->relationType = NULL; $relType = array(); - if (CRM_Utils_Array::value('relationship_type_id_value', $this->_params)) { + if (!empty($this->_params['relationship_type_id_value'])) { $relType = explode('_', $this->_params['relationship_type_id_value']); $this->relationType = $relType[1] . '_' . $relType[2]; diff --git a/CRM/Report/Form/Contact/Summary.php b/CRM/Report/Form/Contact/Summary.php index 3fa5e0cac1..a20a351526 100644 --- a/CRM/Report/Form/Contact/Summary.php +++ b/CRM/Report/Form/Contact/Summary.php @@ -222,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_email') { diff --git a/CRM/Report/Form/Contribute/Bookkeeping.php b/CRM/Report/Form/Contribute/Bookkeeping.php index def252161c..f3e34cbd7d 100644 --- a/CRM/Report/Form/Contribute/Bookkeeping.php +++ b/CRM/Report/Form/Contribute/Bookkeeping.php @@ -305,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { switch ($fieldName) { diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index e5c38a3ee1..d5a8c264ee 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -430,7 +430,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { {$this->_aliases['civicrm_email']}.is_primary = 1\n"; } // include contribution note - if (CRM_Utils_Array::value('contribution_note', $this->_params['fields']) || + if (!empty($this->_params['fields']['contribution_note']) || CRM_Utils_Array::value('note_value', $this->_params)) { $this->_from.= " LEFT JOIN civicrm_note {$this->_aliases['civicrm_note']} diff --git a/CRM/Report/Form/Contribute/History.php b/CRM/Report/Form/Contribute/History.php index 413588a7fb..da10eef143 100644 --- a/CRM/Report/Form/Contribute/History.php +++ b/CRM/Report/Form/Contribute/History.php @@ -281,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_address') { @@ -300,7 +300,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { continue; } - if (CRM_Utils_Array::value('is_statistics', $field)) { + if (!empty($field['is_statistics'])) { $this->_columnHeaders[$fieldName]['type'] = $field['type']; $this->_columnHeaders[$fieldName]['title'] = $field['title']; continue; @@ -324,7 +324,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title']; } - if (CRM_Utils_Array::value('no_display', $field)) { + if (!empty($field['no_display'])) { $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = TRUE; } } @@ -407,7 +407,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { $this->_statusClause = " AND " . $clause; } - if (CRM_Utils_Array::value('having', $field)) { + if (!empty($field['having'])) { $havingClauses[] = $clause; } else { @@ -477,7 +477,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { static function formRule($fields, $files, $self) { $errors = array(); - if (CRM_Utils_Array::value('this_year_value', $fields) && + if (!empty($fields['this_year_value']) && CRM_Utils_Array::value('other_year_value', $fields) && ($fields['this_year_value'] == $fields['other_year_value']) ) { @@ -514,10 +514,10 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { } function fixReportParams() { - if (CRM_Utils_Array::value('this_year_value', $this->_params)) { + if (!empty($this->_params['this_year_value'])) { $this->_referenceYear['this_year'] = $this->_params['this_year_value']; } - if (CRM_Utils_Array::value('other_year_value', $this->_params)) { + if (!empty($this->_params['other_year_value'])) { $this->_referenceYear['other_year'] = $this->_params['other_year_value']; } } @@ -527,11 +527,11 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { $addWhere = ''; - if (CRM_Utils_Array::value('other_year', $this->_referenceYear)) { + if (!empty($this->_referenceYear['other_year'])) { (CRM_Utils_Array::value('other_year_op', $this->_params) == 'calendar') ? $other_receive_date = 'YEAR (contri.receive_date)' : $other_receive_date = self::fiscalYearOffset('contri.receive_date'); $addWhere .= " AND {$this->_aliases['civicrm_contact']}.id NOT IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$other_receive_date} = {$this->_referenceYear['other_year']} AND contri.is_test = 0 ) "; } - if (CRM_Utils_Array::value('this_year', $this->_referenceYear)) { + if (!empty($this->_referenceYear['this_year'])) { (CRM_Utils_Array::value('this_year_op', $this->_params) == 'calendar') ? $receive_date = 'YEAR (contri.receive_date)' : $receive_date = self::fiscalYearOffset('contri.receive_date'); $addWhere .= " AND {$this->_aliases['civicrm_contact']}.id IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$receive_date} = {$this->_referenceYear['this_year']} AND contri.is_test = 0 ) "; } @@ -597,7 +597,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { } foreach (array_keys($this->_relationshipColumns) as $col) { - if (CRM_Utils_Array::value($col, $relRow)) { + if (!empty($relRow[$col])) { $relatedRow[$col] = $relRow[$col]; } } @@ -731,7 +731,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { } // Convert Display name into link - if (CRM_Utils_Array::value('civicrm_contact_sort_name', $row) && + if (!empty($row['civicrm_contact_sort_name']) && CRM_Utils_Array::value('civicrm_contact_id', $row) ) { $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail', diff --git a/CRM/Report/Form/Contribute/HouseholdSummary.php b/CRM/Report/Form/Contribute/HouseholdSummary.php index da307f2856..d403172742 100644 --- a/CRM/Report/Form/Contribute/HouseholdSummary.php +++ b/CRM/Report/Form/Contribute/HouseholdSummary.php @@ -220,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_address') { @@ -230,7 +230,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { $this->_emailField = TRUE; } - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}_{$stat}"; $this->_columnHeaders["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label; @@ -380,14 +380,14 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { $params = array('contact_type_b' => 'Household', 'version' => 3); $typesA = civicrm_api('relationship_type', 'get', $params); - if (!CRM_Utils_Array::value('is_error', $typesA)) { + if (empty($typesA['is_error'])) { foreach ($typesA['values'] as $rel) { $relationTypes[$rel['id']][$rel['id'] . '_b_a'] = $rel['label_b_a']; } } $params = array('contact_type_a' => 'Household', 'version' => 3); $typesB = civicrm_api('relationship_type', 'get', $params); - if (!CRM_Utils_Array::value('is_error', $typesB)) { + if (empty($typesB['is_error'])) { foreach ($typesB['values'] as $rel) { $relationTypes[$rel['id']][$rel['id'] . '_a_b'] = $rel['label_a_b']; //$this->relationTypes[$rel['id'].'_a_b'] = $rel['label_a_b']; @@ -513,7 +513,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { $entryFound = TRUE; } - if (CRM_Utils_Array::value('civicrm_contribution_total_amount', $row)) { + if (!empty($row['civicrm_contribution_total_amount'])) { $row['civicrm_contribution_total_amount'] = CRM_Utils_Money::format($row['civicrm_contribution_total_amount'], $row['civicrm_contribution_currency']); } diff --git a/CRM/Report/Form/Contribute/Lybunt.php b/CRM/Report/Form/Contribute/Lybunt.php index cfeef63098..990c4f411f 100644 --- a/CRM/Report/Form/Contribute/Lybunt.php +++ b/CRM/Report/Form/Contribute/Lybunt.php @@ -224,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($fieldName == 'total_amount') { @@ -245,7 +245,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field); } - if (CRM_Utils_Array::value('no_display', $field)) { + if (!empty($field['no_display'])) { $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = TRUE; } } @@ -372,7 +372,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { $this->groupBy(); $rows = $contactIds = array(); - if (!CRM_Utils_Array::value('charts', $this->_params)) { + if (empty($this->_params['charts'])) { $this->limit(); $getContacts = "SELECT SQL_CALC_FOUND_ROWS {$this->_aliases['civicrm_contact']}.id as cid {$this->_from} {$this->_where} GROUP BY {$this->_aliases['civicrm_contact']}.id {$this->_limit}"; @@ -386,7 +386,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { } if (!empty($contactIds) || CRM_Utils_Array::value('charts', $this->_params)) { - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}"; } else { diff --git a/CRM/Report/Form/Contribute/OrganizationSummary.php b/CRM/Report/Form/Contribute/OrganizationSummary.php index f99c85587a..4ede8517b0 100644 --- a/CRM/Report/Form/Contribute/OrganizationSummary.php +++ b/CRM/Report/Form/Contribute/OrganizationSummary.php @@ -221,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_address') { @@ -231,7 +231,7 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { $this->_emailField = TRUE; } - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}_{$stat}"; $this->_columnHeaders["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label; @@ -380,7 +380,7 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { $params = array('contact_type_b' => 'Organization', 'version' => 3); $typesA = &civicrm_api('relationship_type', 'get', $params); - if (!CRM_Utils_Array::value('is_error', $typesA)) { + if (empty($typesA['is_error'])) { foreach ($typesA['values'] as $rel) { $relationTypes[$rel['id']][$rel['id'] . '_b_a'] = $rel['label_b_a']; } @@ -389,7 +389,7 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { $params = array('contact_type_a' => 'Organization', 'version' => 3); $typesB = &civicrm_api('relationship_type', 'get', $params); - if (!CRM_Utils_Array::value('is_error', $typesB)) { + if (empty($typesB['is_error'])) { foreach ($typesB['values'] as $rel) { $relationTypes[$rel['id']][$rel['id'] . '_a_b'] = $rel['label_a_b']; } diff --git a/CRM/Report/Form/Contribute/PCP.php b/CRM/Report/Form/Contribute/PCP.php index a051910bd7..c7586a7388 100644 --- a/CRM/Report/Form/Contribute/PCP.php +++ b/CRM/Report/Form/Contribute/PCP.php @@ -314,7 +314,7 @@ LEFT JOIN civicrm_contribution_page {$this->_aliases['civicrm_contribution_page' $repeatFound = FALSE; foreach ($row as $colName => $colVal) { - if (CRM_Utils_Array::value($colName, $checkList) && + if (!empty($checkList[$colName]) && is_array($checkList[$colName]) && in_array($colVal, $checkList[$colName]) ) { diff --git a/CRM/Report/Form/Contribute/Repeat.php b/CRM/Report/Form/Contribute/Repeat.php index 8dca9bb29b..1e23eabf26 100644 --- a/CRM/Report/Form/Contribute/Repeat.php +++ b/CRM/Report/Form/Contribute/Repeat.php @@ -281,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if (isset($field['clause'])) { @@ -299,7 +299,7 @@ contribution_civireport2.total_amount_sum as contribution2_total_amount_sum', $select[] = "{$field['dbAlias']} as {$field['alias']}_{$field['name']}"; $this->_columnHeaders["{$field['alias']}_{$field['name']}"]['type'] = CRM_Utils_Array::value('type', $field); $this->_columnHeaders["{$field['alias']}_{$field['name']}"]['title'] = CRM_Utils_Array::value('title', $field); - if (CRM_Utils_Array::value('no_display', $field)) { + if (!empty($field['no_display'])) { $this->_columnHeaders["{$field['alias']}_{$field['name']}"]['no_display'] = TRUE; } } @@ -316,7 +316,7 @@ contribution_civireport2.total_amount_sum as contribution2_total_amount_sum', foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { if ($tableCol) { return array($tableName, $field['alias'], $field['name']); } @@ -398,11 +398,11 @@ LEFT JOIN civicrm_temp_civireport_repeat2 {$this->_aliases['civicrm_contribution if (!$this->_amountClauseWithAND) { $amountClauseWithAND = array(); - if (CRM_Utils_Array::value('total_amount1', $clauses)) { + if (!empty($clauses['total_amount1'])) { $amountClauseWithAND[] = str_replace("{$this->_aliases['civicrm_contribution']}.total_amount", "{$this->_aliases['civicrm_contribution']}1.total_amount_sum", $clauses['total_amount1']); } - if (CRM_Utils_Array::value('total_amount2', $clauses)) { + if (!empty($clauses['total_amount2'])) { $amountClauseWithAND[] = str_replace("{$this->_aliases['civicrm_contribution']}.total_amount", "{$this->_aliases['civicrm_contribution']}2.total_amount_sum", $clauses['total_amount2']); } diff --git a/CRM/Report/Form/Contribute/SoftCredit.php b/CRM/Report/Form/Contribute/SoftCredit.php index 4027871204..5565a2deec 100644 --- a/CRM/Report/Form/Contribute/SoftCredit.php +++ b/CRM/Report/Form/Contribute/SoftCredit.php @@ -281,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -304,7 +304,7 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form { } // only include statistics columns if set - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { case 'sum': diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index d15b69fae7..2ebe975693 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -312,7 +312,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { 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"; @@ -342,7 +342,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { $field['title'] = 'Quarter'; break; } - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) { + if (!empty($this->_params['group_bys_freq'][$fieldName])) { $this->_interval = $field['title']; $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning'; $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type']; @@ -363,12 +363,12 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { if ($tableName == 'civicrm_address') { $this->_addressField = TRUE; } - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { // only include statistics columns if set - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { case 'sum': @@ -414,18 +414,18 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { $ignoreFields = array('total_amount', 'sort_name'); $errors = $self->customDataFormRule($fields, $ignoreFields); - if (!CRM_Utils_Array::value('receive_date', $fields['group_bys'])) { - if (CRM_Utils_Array::value('receive_date_relative', $fields) || + if (empty($fields['group_bys']['receive_date'])) { + if (!empty($fields['receive_date_relative']) || CRM_Utils_Date::isDate($fields['receive_date_from']) || CRM_Utils_Date::isDate($fields['receive_date_to']) ) { $errors['receive_date_relative'] = ts("Do not use filter on Date if group by Receive Date is not used "); } } - if (!CRM_Utils_Array::value('total_amount', $fields['fields'])) { + if (empty($fields['fields']['total_amount'])) { foreach (array( 'total_count_value', 'total_sum_value', 'total_avg_value') as $val) { - if (CRM_Utils_Array::value($val, $fields)) { + if (!empty($fields[$val])) { $errors[$val] = ts("Please select the Amount Statistics"); } } @@ -436,7 +436,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { function from() { $softCreditJoin = "LEFT"; - if (CRM_Utils_Array::value('soft_amount', $this->_params['fields']) && + if (!empty($this->_params['fields']['soft_amount']) && !CRM_Utils_Array::value('total_amount', $this->_params['fields'])) { // if its only soft credit stats, use inner join $softCreditJoin = "INNER"; @@ -477,12 +477,12 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { - if (CRM_Utils_Array::value('chart', $field)) { + if (!empty($this->_params['group_bys'][$fieldName])) { + if (!empty($field['chart'])) { $this->assign('chartSupported', TRUE); } - if (CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) && + if (!empty($table['group_bys'][$fieldName]['frequency']) && CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) ) { @@ -517,7 +517,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { function storeWhereHavingClauseArray(){ parent::storeWhereHavingClauseArray(); - if (!CRM_Utils_Array::value('soft_amount', $this->_params['fields']) && !empty($this->_havingClauses)){ + if (empty($this->_params['fields']['soft_amount']) && !empty($this->_havingClauses)){ foreach ($this->_havingClauses as $key => $havingClause) { if (stristr($havingClause, 'soft_soft')){ unset($this->_havingClauses[$key]); @@ -606,8 +606,8 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_ function buildChart(&$rows) { $graphRows = array(); - if (CRM_Utils_Array::value('charts', $this->_params)) { - if (CRM_Utils_Array::value('receive_date', $this->_params['group_bys'])) { + if (!empty($this->_params['charts'])) { + if (!empty($this->_params['group_bys']['receive_date'])) { $contrib = !empty($this->_params['fields']['total_amount']) ? TRUE : FALSE; $softContrib = !empty($this->_params['fields']['soft_amount']) ? TRUE : FALSE; @@ -654,7 +654,7 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_ foreach ($rows as $rowNum => $row) { // make count columns point to detail report - if (CRM_Utils_Array::value('receive_date', $this->_params['group_bys']) && + 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) diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index 8abe6ccd7d..d6b3111133 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -221,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($fieldName == 'total_amount') { @@ -250,7 +250,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title']; } - if (CRM_Utils_Array::value('no_display', $field)) { + if (!empty($field['no_display'])) { $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = TRUE; } } @@ -371,7 +371,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { $this->groupBy(); $rows = $contactIds = array(); - if (!CRM_Utils_Array::value('charts', $this->_params)) { + if (empty($this->_params['charts'])) { $this->limit(); $getContacts = "SELECT SQL_CALC_FOUND_ROWS {$this->_aliases['civicrm_contact']}.id as cid {$this->_from} {$this->_where} GROUP BY {$this->_aliases['civicrm_contact']}.id {$this->_limit}"; @@ -385,7 +385,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { } if (!empty($contactIds) || CRM_Utils_Array::value('charts', $this->_params)) { - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}"; } else { diff --git a/CRM/Report/Form/Contribute/TopDonor.php b/CRM/Report/Form/Contribute/TopDonor.php index e3be823977..108d3a7509 100644 --- a/CRM/Report/Form/Contribute/TopDonor.php +++ b/CRM/Report/Form/Contribute/TopDonor.php @@ -198,11 +198,11 @@ 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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { // only include statistics columns if set - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { case 'sum': diff --git a/CRM/Report/Form/Event/IncomeCountSummary.php b/CRM/Report/Form/Event/IncomeCountSummary.php index 81e06c6e17..5ec9785871 100644 --- a/CRM/Report/Form/Event/IncomeCountSummary.php +++ b/CRM/Report/Form/Event/IncomeCountSummary.php @@ -152,10 +152,10 @@ 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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { case 'count': @@ -339,7 +339,7 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form_Event { $this->_interval = 'events'; $countEvent = NULL; - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { foreach ($rows as $key => $value) { if ($value['civicrm_event_id']) { $graphRows['totalParticipants'][] = ($rows[$key]['civicrm_line_item_participant_count_count']); diff --git a/CRM/Report/Form/Event/ParticipantListCount.php b/CRM/Report/Form/Event/ParticipantListCount.php index e0ceb65370..db21c59cc3 100644 --- a/CRM/Report/Form/Event/ParticipantListCount.php +++ b/CRM/Report/Form/Event/ParticipantListCount.php @@ -328,10 +328,10 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { case 'sum': @@ -446,14 +446,14 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event { function groupBy() { $this->_groupBy = ""; - if (CRM_Utils_Array::value('group_bys', $this->_params) && + if (!empty($this->_params['group_bys']) && is_array($this->_params['group_bys']) && !empty($this->_params['group_bys']) ) { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { $this->_groupBy[] = $field['dbAlias']; } } diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php index 1abf7cf8d2..905f991fb9 100644 --- a/CRM/Report/Form/Event/ParticipantListing.php +++ b/CRM/Report/Form/Event/ParticipantListing.php @@ -429,7 +429,7 @@ GROUP BY cv.label } if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_contribution') { diff --git a/CRM/Report/Form/Event/Summary.php b/CRM/Report/Form/Event/Summary.php index d1503f9c0b..6559b2649e 100644 --- a/CRM/Report/Form/Event/Summary.php +++ b/CRM/Report/Form/Event/Summary.php @@ -111,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; @@ -240,7 +240,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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -326,7 +326,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form_Event { function buildChart(&$rows) { $this->_interval = 'events'; $countEvent = NULL; - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { foreach ($rows as $key => $value) { $graphRows['totalAmount'][] = $graphRows['value'][] = CRM_Utils_Array::value('totalAmount', $rows[$key]); $graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" . $rows[$key]['civicrm_event_id'] . ") "; diff --git a/CRM/Report/Form/Grant/Detail.php b/CRM/Report/Form/Grant/Detail.php index b87d116584..876ffd945f 100644 --- a/CRM/Report/Form/Grant/Detail.php +++ b/CRM/Report/Form/Grant/Detail.php @@ -250,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -319,14 +319,14 @@ class CRM_Report_Form_Grant_Detail extends CRM_Report_Form { function groupBy() { $this->_groupBy = ""; - if (CRM_Utils_Array::value('group_bys', $this->_params) && + if (!empty($this->_params['group_bys']) && is_array($this->_params['group_bys']) && !empty($this->_params['group_bys']) ) { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { $this->_groupBy[] = $field['dbAlias']; } } diff --git a/CRM/Report/Form/Grant/Statistics.php b/CRM/Report/Form/Grant/Statistics.php index 6c06e00f3e..1e02807114 100644 --- a/CRM/Report/Form/Grant/Statistics.php +++ b/CRM/Report/Form/Grant/Statistics.php @@ -248,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -335,14 +335,14 @@ WHERE {$this->_aliases['civicrm_grant']}.amount_total IS NOT NULL function groupBy() { $this->_groupBy = ''; - if (CRM_Utils_Array::value('fields', $this->_params) && + if (!empty($this->_params['fields']) && is_array($this->_params['fields']) && !empty($this->_params['fields']) ) { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['fields'])) { + if (!empty($this->_params['fields'][$fieldName])) { $this->_groupBy[] = $field['dbAlias']; } } @@ -421,11 +421,11 @@ SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count , } foreach ($rows as $key => $values) { - if (CRM_Utils_Array::value('civicrm_grant_grant_report_received', $values)) { + if (!empty($values['civicrm_grant_grant_report_received'])) { $grantReportsReceived++; } - if (CRM_Utils_Array::value('civicrm_grant_grant_type_id', $values)) { + if (!empty($values['civicrm_grant_grant_type_id'])) { $grantType = CRM_Utils_Array::value($values['civicrm_grant_grant_type_id'], $grantTypes); $grantStatistics['civicrm_grant_grant_type_id']['title'] = ts('By Grant Type'); self::getStatistics($grantStatistics['civicrm_grant_grant_type_id'], $grantType, $values, diff --git a/CRM/Report/Form/Instance.php b/CRM/Report/Form/Instance.php index 48a6dd92b7..eefde6d64d 100644 --- a/CRM/Report/Form/Instance.php +++ b/CRM/Report/Form/Instance.php @@ -211,24 +211,24 @@ class CRM_Report_Form_Instance { $defaults['report_header'] = CRM_Utils_Array::value('header', $defaults); $defaults['report_footer'] = CRM_Utils_Array::value('footer', $defaults); - if (CRM_Utils_Array::value('navigation_id', $defaults)) { + if (!empty($defaults['navigation_id'])) { //get the default navigation parent id $params = array('id' => $defaults['navigation_id']); CRM_Core_BAO_Navigation::retrieve($params, $navigationDefaults); $defaults['is_navigation'] = 1; $defaults['parent_id'] = CRM_Utils_Array::value('parent_id', $navigationDefaults); - if (CRM_Utils_Array::value('is_active', $navigationDefaults)) { + if (!empty($navigationDefaults['is_active'])) { $form->assign('is_navigation', TRUE); } - if (CRM_Utils_Array::value('id', $navigationDefaults)) { + if (!empty($navigationDefaults['id'])) { $form->_navigation['id'] = $navigationDefaults['id']; $form->_navigation['parent_id'] = $navigationDefaults['parent_id']; } } - if (CRM_Utils_Array::value('grouprole', $defaults)) { + if (!empty($defaults['grouprole'])) { foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $defaults['grouprole']) as $value) { $grouproles[] = $value; } @@ -251,7 +251,7 @@ class CRM_Report_Form_Instance { $instanceID = NULL; //unset $instanceID so a new copy would be created } $params['instance_id'] = $instanceID; - if (CRM_Utils_Array::value('is_navigation', $params)) { + if (!empty($params['is_navigation'])) { $params['navigation'] = $form->_navigation; } elseif ($instanceID){ diff --git a/CRM/Report/Form/Mailing/Bounce.php b/CRM/Report/Form/Mailing/Bounce.php index 9baad43c33..4c7e2ec687 100644 --- a/CRM/Report/Form/Mailing/Bounce.php +++ b/CRM/Report/Form/Mailing/Bounce.php @@ -221,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_email') { @@ -241,7 +241,7 @@ class CRM_Report_Form_Mailing_Bounce extends CRM_Report_Form { } - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { $select[] = "COUNT({$this->_aliases['civicrm_mailing_event_bounce']}.id) as civicrm_mailing_bounce_count"; $this->_columnHeaders["civicrm_mailing_bounce_count"]['title'] = ts('Bounce Count'); } @@ -290,7 +290,7 @@ class CRM_Report_Form_Mailing_Bounce extends CRM_Report_Form { } function groupBy() { - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_mailing']}.id"; } else { diff --git a/CRM/Report/Form/Mailing/Clicks.php b/CRM/Report/Form/Mailing/Clicks.php index e944fe8dcb..7c787c286a 100644 --- a/CRM/Report/Form/Mailing/Clicks.php +++ b/CRM/Report/Form/Mailing/Clicks.php @@ -183,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_email') { @@ -202,7 +202,7 @@ class CRM_Report_Form_Mailing_Clicks extends CRM_Report_Form { } } - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { $select[] = "COUNT(civicrm_mailing_event_trackable_url_open.id) as civicrm_mailing_click_count"; $this->_columnHeaders["civicrm_mailing_click_count"]['title'] = ts('Click Count'); } @@ -250,7 +250,7 @@ class CRM_Report_Form_Mailing_Clicks extends CRM_Report_Form { function groupBy() { $this->_groupBy = ''; - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_mailing']}.id"; } else { diff --git a/CRM/Report/Form/Mailing/Detail.php b/CRM/Report/Form/Mailing/Detail.php index f922c04394..5678af385a 100644 --- a/CRM/Report/Form/Mailing/Detail.php +++ b/CRM/Report/Form/Mailing/Detail.php @@ -281,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if (in_array($fieldName, array( diff --git a/CRM/Report/Form/Mailing/Opened.php b/CRM/Report/Form/Mailing/Opened.php index 25a3471d32..2944c77c95 100644 --- a/CRM/Report/Form/Mailing/Opened.php +++ b/CRM/Report/Form/Mailing/Opened.php @@ -174,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_email') { @@ -193,7 +193,7 @@ class CRM_Report_Form_Mailing_Opened extends CRM_Report_Form { } } - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { $select[] = "COUNT(civicrm_mailing_event_opened.id) as civicrm_mailing_opened_count"; $this->_columnHeaders["civicrm_mailing_opened_count"]['title'] = ts('Opened Count'); } @@ -238,7 +238,7 @@ class CRM_Report_Form_Mailing_Opened extends CRM_Report_Form { } function groupBy() { - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_mailing']}.id"; } else { diff --git a/CRM/Report/Form/Mailing/Summary.php b/CRM/Report/Form/Mailing/Summary.php index c5fdc8f437..954bf40d04 100644 --- a/CRM/Report/Form/Mailing/Summary.php +++ b/CRM/Report/Form/Mailing/Summary.php @@ -287,12 +287,12 @@ 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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { # for statistics - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { switch ($field['statistics']['calc']) { case 'PERCENTAGE': $base_table_column = explode('.', $field['statistics']['base']); @@ -454,7 +454,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form { function formRule($fields, $files, $self) { $errors = array(); - if (!CRM_Utils_Array::value('charts', $fields)) { + if (empty($fields['charts'])) { return $errors; } diff --git a/CRM/Report/Form/Member/ContributionDetail.php b/CRM/Report/Form/Member/ContributionDetail.php index e606f35d67..4e650135fe 100644 --- a/CRM/Report/Form/Member/ContributionDetail.php +++ b/CRM/Report/Form/Member/ContributionDetail.php @@ -427,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_address') { @@ -438,7 +438,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { } // only include statistics columns if set - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { case 'sum': @@ -497,7 +497,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { "; //for premiums - if (CRM_Utils_Array::value('product_name', $this->_params['fields']) || CRM_Utils_Array::value('product_option', $this->_params['fields'])) { + if (!empty($this->_params['fields']['product_name']) || CRM_Utils_Array::value('product_option', $this->_params['fields'])) { $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) @@ -511,7 +511,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { } // include contribution note - if (CRM_Utils_Array::value('contribution_note', $this->_params['fields']) || !empty($this->_params['note_value'])) { + 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 @@ -519,7 +519,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { } - if (CRM_Utils_Array::value('phone', $this->_params['fields'])) { + if (!empty($this->_params['fields']['phone'])) { $this->_from .= " LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']} ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND @@ -607,8 +607,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 (CRM_Utils_Array::value('first_donation_date', $this->_params['fields']) - || CRM_Utils_Array::value('first_donation_amount', $this->_params['fields'])) { + if (!empty($this->_params['fields']['first_donation_date']) || CRM_Utils_Array::value('first_donation_amount', $this->_params['fields'])) { $this->_orderBy .= ", {$this->_aliases['civicrm_contribution']}.receive_date"; } } @@ -662,7 +661,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 (CRM_Utils_Array::value('csv_display', $field) && CRM_Utils_Array::value('no_display', $field)) { + if (!empty($field['csv_display']) && CRM_Utils_Array::value('no_display', $field)) { $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field); $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); } diff --git a/CRM/Report/Form/Member/Detail.php b/CRM/Report/Form/Member/Detail.php index f1adfd602b..6087588cb6 100644 --- a/CRM/Report/Form/Member/Detail.php +++ b/CRM/Report/Form/Member/Detail.php @@ -309,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_address') { @@ -433,7 +433,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { // in previous row $repeatFound = FALSE; foreach ($row as $colName => $colVal) { - if (CRM_Utils_Array::value($colName, $checkList) && + if (!empty($checkList[$colName]) && is_array($checkList[$colName]) && in_array($colVal, $checkList[$colName]) ) { diff --git a/CRM/Report/Form/Member/Lapse.php b/CRM/Report/Form/Member/Lapse.php index 695ac4dc3b..0fd672c810 100644 --- a/CRM/Report/Form/Member/Lapse.php +++ b/CRM/Report/Form/Member/Lapse.php @@ -232,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { // to include optional columns address ,email and phone only if checked @@ -395,7 +395,7 @@ class CRM_Report_Form_Member_Lapse extends CRM_Report_Form { $repeatFound = FALSE; foreach ($row as $colName => $colVal) { - if (CRM_Utils_Array::value($colName, $checkList) && + if (!empty($checkList[$colName]) && is_array($checkList[$colName]) && in_array($colVal, $checkList[$colName]) ) { diff --git a/CRM/Report/Form/Member/Summary.php b/CRM/Report/Form/Member/Summary.php index 54078b812c..871fe7d776 100644 --- a/CRM/Report/Form/Member/Summary.php +++ b/CRM/Report/Form/Member/Summary.php @@ -218,7 +218,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) { case 'YEARWEEK': @@ -250,7 +250,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { $field['title'] = 'Quarter'; break; } - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) { + if (!empty($this->_params['group_bys_freq'][$fieldName])) { $this->_interval = $field['title']; $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning'; $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type']; @@ -270,12 +270,12 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { // only include statistics columns if set - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { $this->_statFields[] = 'civicrm_membership_member_count'; foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { @@ -303,7 +303,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { } } elseif ($fieldName == 'membership_type_id') { - if (!CRM_Utils_Array::value('membership_type_id', $this->_params['group_bys']) && + if (empty($this->_params['group_bys']['membership_type_id']) && CRM_Utils_Array::value('join_date', $this->_params['group_bys']) ) { $select[] = "GROUP_CONCAT(DISTINCT {$field['dbAlias']} ORDER BY {$field['dbAlias']} ) as {$tableName}_{$fieldName}"; @@ -362,11 +362,11 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { - if (CRM_Utils_Array::value('chart', $field)) { + if (!empty($this->_params['group_bys'][$fieldName])) { + if (!empty($field['chart'])) { $this->assign('chartSupported', TRUE); } - if (CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) && + if (!empty($table['group_bys'][$fieldName]['frequency']) && CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) ) { @@ -456,7 +456,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency $membershipTypeValues = CRM_Member_PseudoConstant::membershipType(); $isMembershipType = CRM_Utils_Array::value('membership_type_id', $this->_params['group_bys']); $isJoiningDate = CRM_Utils_Array::value('join_date', $this->_params['group_bys']); - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { foreach ($rows as $key => $row) { if (!($row['civicrm_membership_join_date_subtotal'] && $row['civicrm_membership_membership_type_id'] @@ -469,7 +469,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency if ($join_date) { list($year, $month) = explode('-', $join_date); } - if (CRM_Utils_Array::value('civicrm_membership_join_date_subtotal', $row)) { + if (!empty($row['civicrm_membership_join_date_subtotal'])) { switch ($this->_interval) { case 'Month': @@ -528,7 +528,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency $entryFound = FALSE; foreach ($rows as $rowNum => $row) { // make count columns point to detail report - if (CRM_Utils_Array::value('join_date', $this->_params['group_bys']) && + if (!empty($this->_params['group_bys']['join_date']) && CRM_Utils_Array::value('civicrm_membership_join_date_start', $row) && $row['civicrm_membership_join_date_start'] && $row['civicrm_membership_join_date_subtotal'] @@ -566,7 +566,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency break; } $typeUrl = ''; - if (CRM_Utils_Array::value('membership_type_id', $this->_params['group_bys']) && + if (!empty($this->_params['group_bys']['membership_type_id']) && $typeID = $row['civicrm_membership_membership_type_id'] ) { $typeUrl = "&tid_op=in&tid_value={$typeID}"; diff --git a/CRM/Report/Form/Membership/Summary.php b/CRM/Report/Form/Membership/Summary.php index e667e98c36..c7477ca115 100644 --- a/CRM/Report/Form/Membership/Summary.php +++ b/CRM/Report/Form/Membership/Summary.php @@ -170,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { // to include optional columns address and email, only if checked @@ -280,7 +280,7 @@ LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { $this->_groupBy[] = $field['dbAlias']; } } @@ -329,7 +329,7 @@ LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} $row[$key] = $dao->$key; } - if (CRM_Utils_Array::value('charts', $this->_params) && + if (!empty($this->_params['charts']) && $row['civicrm_contribution_receive_date_subtotal'] ) { $graphRows['receive_date'][] = $row['civicrm_contribution_receive_date_start']; @@ -346,7 +346,7 @@ LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} $this->assign_by_ref('rows', $rows); $this->assign('statistics', $this->statistics($rows)); - if (CRM_Utils_Array::value('charts', $this->_params)) { + if (!empty($this->_params['charts'])) { foreach (array( 'receive_date', $this->_interval, 'value') as $ignore) { unset($graphRows[$ignore][$count - 1]); diff --git a/CRM/Report/Form/Pledge/Pbnp.php b/CRM/Report/Form/Pledge/Pbnp.php index b130a0f8aa..660bdaf490 100644 --- a/CRM/Report/Form/Pledge/Pbnp.php +++ b/CRM/Report/Form/Pledge/Pbnp.php @@ -214,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { // to include optional columns address and email, only if checked diff --git a/CRM/Report/Form/Pledge/Summary.php b/CRM/Report/Form/Pledge/Summary.php index 94c8aa4c51..e47fdd7b55 100644 --- a/CRM/Report/Form/Pledge/Summary.php +++ b/CRM/Report/Form/Pledge/Summary.php @@ -241,7 +241,7 @@ class CRM_Report_Form_Pledge_Summary extends CRM_Report_Form { {$this->_aliases['civicrm_email']}.is_primary = 1\n"; } - if(CRM_Utils_Array::value('total_paid', $this->_params['fields'])){ + if (!empty($this->_params['fields']['total_paid'])){ $this->_from .= " LEFT JOIN civicrm_pledge_payment {$this->_aliases['civicrm_pledge_payment']} ON {$this->_aliases['civicrm_pledge']}.id = {$this->_aliases['civicrm_pledge_payment']}.pledge_id @@ -260,12 +260,12 @@ class CRM_Report_Form_Pledge_Summary extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { - if (CRM_Utils_Array::value('chart', $field)) { + if (!empty($this->_params['group_bys'][$fieldName])) { + if (!empty($field['chart'])) { $this->assign('chartSupported', TRUE); } - if (CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) && + if (!empty($table['group_bys'][$fieldName]['frequency']) && CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) ) { diff --git a/CRM/Report/Form/Walklist/Walklist.php b/CRM/Report/Form/Walklist/Walklist.php index 3ab2298550..d2c9a7e0a7 100644 --- a/CRM/Report/Form/Walklist/Walklist.php +++ b/CRM/Report/Form/Walklist/Walklist.php @@ -137,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_address') { diff --git a/CRM/Report/Utils/Report.php b/CRM/Report/Utils/Report.php index b7e44b60dc..fd1163b3eb 100644 --- a/CRM/Report/Utils/Report.php +++ b/CRM/Report/Utils/Report.php @@ -163,7 +163,7 @@ WHERE inst.report_id = %1"; $params['toEmail'] = CRM_Utils_Array::value('email_to', $instanceInfo); $params['cc'] = CRM_Utils_Array::value('email_cc', $instanceInfo); $params['subject'] = CRM_Utils_Array::value('email_subject', $instanceInfo); - if (!CRM_Utils_Array::value('attachments', $instanceInfo)) { + if (empty($instanceInfo['attachments'])) { $instanceInfo['attachments'] = array(); } $params['attachments'] = array_merge(CRM_Utils_Array::value('attachments', $instanceInfo), $attachments); diff --git a/CRM/SMS/Form/Group.php b/CRM/SMS/Form/Group.php index d60e66f733..e3d6cd83e5 100644 --- a/CRM/SMS/Form/Group.php +++ b/CRM/SMS/Form/Group.php @@ -210,7 +210,7 @@ class CRM_SMS_Form_Group extends CRM_Contact_Form_Task { foreach (array( 'name', 'group_id', 'is_sms') as $n) { - if (CRM_Utils_Array::value($n, $values)) { + if (!empty($values[$n])) { $params[$n] = $values[$n]; } } diff --git a/CRM/SMS/Form/Upload.php b/CRM/SMS/Form/Upload.php index 6665cc2fc6..3a9476bde5 100644 --- a/CRM/SMS/Form/Upload.php +++ b/CRM/SMS/Form/Upload.php @@ -197,7 +197,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { $formValues = $this->controller->exportValues($this->_name); foreach ($uploadParams as $key) { - if (CRM_Utils_Array::value($key, $formValues)) { + if (!empty($formValues[$key])) { $params[$key] = $formValues[$key]; $this->set($key, $formValues[$key]); } @@ -238,13 +238,13 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { if ($formValues['upload_type']) { $composeParams = array(); foreach ($composeFields as $key) { - if (CRM_Utils_Array::value($key, $formValues)) { + if (!empty($formValues[$key])) { $composeParams[$key] = $formValues[$key]; $this->set($key, $formValues[$key]); } } - if (CRM_Utils_Array::value('updateTemplate', $composeParams)) { + if (!empty($composeParams['updateTemplate'])) { $templateParams = array( 'msg_text' => $text_message, 'is_active' => TRUE, @@ -255,7 +255,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } - if (CRM_Utils_Array::value('saveTemplate', $composeParams)) { + if (!empty($composeParams['saveTemplate'])) { $templateParams = array( 'msg_text' => $text_message, 'is_active' => TRUE, @@ -297,7 +297,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { * @static */ static function formRule($params, $files, $self) { - if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST)) { + if (!empty($_POST['_qf_Import_refresh'])) { return TRUE; } $errors = array(); @@ -341,18 +341,18 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { } } else { - if (!CRM_Utils_Array::value('text_message', $params)) { + if (empty($params['text_message'])) { $errors['text_message'] = ts('Please provide a Text'); } else { - if (CRM_Utils_Array::value('text_message', $params)) { + if (!empty($params['text_message'])) { $messageCheck = CRM_Utils_Array::value('text_message', $params); if ($messageCheck && (strlen($messageCheck) > CRM_SMS_Provider::MAX_SMS_CHAR)) { $errors['text_message'] = ts("You can configure the SMS message body up to %1 characters", array(1 => CRM_SMS_Provider::MAX_SMS_CHAR)); } } } - if (CRM_Utils_Array::value('saveTemplate', $params) && !CRM_Utils_Array::value('saveTemplateName', $params)) { + if (!empty($params['saveTemplate']) && !CRM_Utils_Array::value('saveTemplateName', $params)) { $errors['saveTemplateName'] = ts('Please provide a Template Name.'); } } @@ -413,8 +413,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { } $templateName = CRM_Core_BAO_MessageTemplate::getMessageTemplates(); - if (CRM_Utils_Array::value('saveTemplate', $params) - && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName) + if (!empty($params['saveTemplate']) && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName) ) { $errors['saveTemplate'] = ts('Duplicate Template Name.'); } diff --git a/CRM/UF/Form/AbstractPreview.php b/CRM/UF/Form/AbstractPreview.php index b605cb75e3..4473dc491f 100644 --- a/CRM/UF/Form/AbstractPreview.php +++ b/CRM/UF/Form/AbstractPreview.php @@ -118,7 +118,7 @@ class CRM_UF_Form_AbstractPreview extends CRM_Core_Form { */ public function buildQuickForm() { foreach ($this->_fields as $name => $field) { - if (!CRM_Utils_Array::value('is_view', $field)) { + if (empty($field['is_view'])) { CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE); } } diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index 44154e2ae7..120917cdf6 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -696,7 +696,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form { } $fieldTypeValues = CRM_Core_BAO_UFGroup::groupTypeValues($gid, $fieldType); - if (!CRM_Utils_Array::value($fieldType, $fieldTypeValues)) { + if (empty($fieldTypeValues[$fieldType])) { return; } diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php index a0eccfcef5..2cd5b7cf66 100644 --- a/CRM/UF/Form/Group.php +++ b/CRM/UF/Form/Group.php @@ -353,7 +353,7 @@ class CRM_UF_Form_Group extends CRM_Core_Form { // create uf group $ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids); - if (CRM_Utils_Array::value('is_active', $params)) { + if (!empty($params['is_active'])) { //make entry in uf join table CRM_Core_BAO_UFGroup::createUFJoin($params, $ufGroup->id); } diff --git a/CRM/UF/Page/Group.php b/CRM/UF/Page/Group.php index 8279ba3980..a50111d9a8 100644 --- a/CRM/UF/Page/Group.php +++ b/CRM/UF/Page/Group.php @@ -420,7 +420,7 @@ class CRM_UF_Page_Group extends CRM_Core_Page { $returnGroupTypes[$type] = $type; } - if (CRM_Utils_Array::value(1, $groupTypeParts)) { + if (!empty($groupTypeParts[1])) { foreach (explode(',', $groupTypeParts[1]) as $typeValue) { $groupTypeValues = $valueLabels = array(); $valueParts = explode(':', $typeValue); diff --git a/CRM/Upgrade/Incremental/php/FourTwo.php b/CRM/Upgrade/Incremental/php/FourTwo.php index cb088db0b9..4d13d29594 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -379,7 +379,7 @@ WHERE name LIKE '%.amount.%' "; $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { $addTo = explode('.', $dao->name); - if (CRM_Utils_Array::value(2, $addTo)) { + if (!empty($addTo[2])) { $options = array ('optionGroup' => $dao->name); self::createPriceSet($daoName, $addTo, $options); } @@ -438,12 +438,12 @@ WHERE cpse.price_set_id IS NULL"; } $optionValue = array(); - if (CRM_Utils_Array::value('optionGroup', $options)) { + if (!empty($options['optionGroup'])) { CRM_Core_OptionGroup::getAssoc($options['optionGroup'], $optionValue); if (empty($optionValue)) return; } - elseif (!CRM_Utils_Array::value('otherAmount', $options) && !CRM_Utils_Array::value('membership', $options)) { + elseif (empty($options['otherAmount']) && !CRM_Utils_Array::value('membership', $options)) { //CRM-12273 //if options group, otherAmount, membersip is empty then return, contribution should be default price set return; @@ -462,7 +462,7 @@ WHERE cpse.price_set_id IS NULL"; CRM_Upgrade_Snapshot_V4p2_Price_BAO_Set::addTo($addTo[0], $addTo[2], $priceSet->id, 1); $fieldParams['price_set_id'] = $priceSet->id; - if (CRM_Utils_Array::value('optionGroup', $options)) { + if (!empty($options['optionGroup'])) { $fieldParams['html_type'] = 'Radio'; $fieldParams['is_required'] = 1; if ($addTo[0] == 'civicrm_event') { @@ -478,7 +478,7 @@ WHERE cpse.price_set_id IS NULL"; $fieldParams['label'] = "Contribution Amount"; $defaultAmountColumn = 'default_amount_id'; $options['otherAmount'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $addTo[2], 'is_allow_other_amount'); - if (CRM_Utils_Array::value('otherAmount', $options)) { + if (!empty($options['otherAmount'])) { $fieldParams['is_required'] = 0; } } @@ -492,7 +492,7 @@ WHERE cpse.price_set_id IS NULL"; $priceField = CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field::create($fieldParams); } - if (CRM_Utils_Array::value('membership', $options)) { + if (!empty($options['membership'])) { $dao = new CRM_Member_DAO_MembershipBlock(); $dao->entity_table = 'civicrm_contribution_page'; $dao->entity_id = $addTo[2]; @@ -533,7 +533,7 @@ WHERE cpse.price_set_id IS NULL"; } } } - if (CRM_Utils_Array::value('otherAmount', $options)) { + if (!empty($options['otherAmount'])) { $fieldParams = array( 'name' => strtolower(CRM_Utils_String::munge("Other Amount", '_', 245)), diff --git a/CRM/Upgrade/Incremental/php/ThreeFour.php b/CRM/Upgrade/Incremental/php/ThreeFour.php index 5b3ad4bf6d..2476d8493c 100644 --- a/CRM/Upgrade/Incremental/php/ThreeFour.php +++ b/CRM/Upgrade/Incremental/php/ThreeFour.php @@ -46,7 +46,7 @@ class CRM_Upgrade_Incremental_php_ThreeFour { $formValues = unserialize($instances->form_values); // replace display_name fields by sort_name - if (CRM_Utils_Array::value('fields', $formValues) && isset($formValues['fields']['display_name'])) { + if (!empty($formValues['fields']) && isset($formValues['fields']['display_name'])) { $formValues['fields']['sort_name'] = $formValues['fields']['display_name']; unset($formValues['fields']['display_name']); } diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php index 764807cdda..ab11ee7f68 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php @@ -114,8 +114,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p } } else { - if (CRM_Utils_Array::value('default_option', $params) - ) { + if (!empty($params['default_option'])) { $defaultArray[$params['default_option']] = 1; } } @@ -278,7 +277,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) && $qf->_quickConfig && $field->name == 'other_amount' && !property_exists($qf,'_contributionAmount')) { $label = ts('Additional Contribution'); $useRequired = 0; - } elseif (CRM_Utils_Array::value('label', $fieldOptions[$optionKey])) { //check for label. + } elseif (!empty($fieldOptions[$optionKey]['label'])) { //check for label. $label = $fieldOptions[$optionKey]['label']; } @@ -358,7 +357,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p if (!$field->is_required) { // add "none" option - if (CRM_Utils_Array::value('is_allow_other_amount', $otherAmount) && $field->name == 'contribution_amount') { + 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') { $none = ts('No thank you'); @@ -563,7 +562,7 @@ WHERE while ($priceField->fetch()) { $key = "price_{$priceField->id}"; - if (CRM_Utils_Array::value($key, $fields)) { + if (!empty($fields[$key])) { $priceFields[$priceField->id] = $fields[$key]; } } diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/FieldValue.php b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/FieldValue.php index 5f69ebebca..38f754397f 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/FieldValue.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/FieldValue.php @@ -56,7 +56,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_FieldValue extends CRM_Upgrade_Snapsho if ($id = CRM_Utils_Array::value('id', $ids)) { $fieldValueBAO->id = $id; } - if (CRM_Utils_Array::value('is_default', $params)) { + if (!empty($params['is_default'])) { $query = 'UPDATE civicrm_price_field_value SET is_default = 0 WHERE price_field_id = %1'; $p = array(1 => array($params['price_field_id'], 'Integer')); CRM_Core_DAO::executeQuery($query, $p); @@ -93,10 +93,10 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_FieldValue extends CRM_Upgrade_Snapsho $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue', $oldWeight, $params['weight'], $fieldValues); } else { - if (!CRM_Utils_Array::value('name', $params)) { + if (empty($params['name'])) { $params['name'] = CRM_Utils_String::munge(CRM_Utils_Array::value('label', $params), '_', 64); } - if (!CRM_Utils_Array::value('weight', $params)) { + if (empty($params['weight'])) { $params['weight'] = 1; } } diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php index f015522f17..0db307c695 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php @@ -640,7 +640,7 @@ WHERE id = %1"; $radioLevel = $checkboxLevel = $selectLevel = $textLevel = array(); foreach ($fields as $id => $field) { - if (!CRM_Utils_Array::value("price_{$id}", $params) || + if (empty($params["price_{$id}"]) || (empty($params["price_{$id}"]) && $params["price_{$id}"] == NULL) ) { // skip if nothing was submitted for this field @@ -826,7 +826,7 @@ return; static $_contact_memberships = array(); $checklifetime = FALSE; foreach ($options as $key => $value) { -if (CRM_Utils_Array::value('membership_type_id', $value)) { +if (!empty($value['membership_type_id'])) { 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); } diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/Field.php b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/Field.php index 98bbaadc6d..b685fe11e2 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/Field.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/Field.php @@ -358,7 +358,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field extends CRM_Core_DAO self::$_import = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('import', $field)) { + if (!empty($field['import'])) { if ($prefix) { self::$_import['price_field'] = & $fields[$name]; } else { @@ -382,7 +382,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field extends CRM_Core_DAO self::$_export = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('export', $field)) { + if (!empty($field['export'])) { if ($prefix) { self::$_export['price_field'] = & $fields[$name]; } else { diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/FieldValue.php b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/FieldValue.php index 9fc690da19..11fe7cedcf 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/FieldValue.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/FieldValue.php @@ -301,7 +301,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue extends CRM_Core_DAO self::$_import = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('import', $field)) { + if (!empty($field['import'])) { if ($prefix) { self::$_import['price_field_value'] = & $fields[$name]; } else { @@ -325,7 +325,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue extends CRM_Core_DAO self::$_export = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('export', $field)) { + if (!empty($field['export'])) { if ($prefix) { self::$_export['price_field_value'] = & $fields[$name]; } else { diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/LineItem.php b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/LineItem.php index 7637b3d127..cc8c710b4b 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/LineItem.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/LineItem.php @@ -277,7 +277,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem extends CRM_Core_DAO self::$_import = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('import', $field)) { + if (!empty($field['import'])) { if ($prefix) { self::$_import['line_item'] = & $fields[$name]; } else { @@ -301,7 +301,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem extends CRM_Core_DAO self::$_export = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('export', $field)) { + if (!empty($field['export'])) { if ($prefix) { self::$_export['line_item'] = & $fields[$name]; } else { diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/Set.php b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/Set.php index e81bced343..ba5ada7f50 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/Set.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/Set.php @@ -301,7 +301,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set extends CRM_Core_DAO self::$_import = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('import', $field)) { + if (!empty($field['import'])) { if ($prefix) { self::$_import['price_set'] = & $fields[$name]; } else { @@ -325,7 +325,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set extends CRM_Core_DAO self::$_export = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('export', $field)) { + if (!empty($field['export'])) { if ($prefix) { self::$_export['price_set'] = & $fields[$name]; } else { diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/SetEntity.php b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/SetEntity.php index c2a7af8910..226644445b 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/DAO/SetEntity.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/DAO/SetEntity.php @@ -202,7 +202,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity extends CRM_Core_DAO self::$_import = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('import', $field)) { + if (!empty($field['import'])) { if ($prefix) { self::$_import['price_set_entity'] = & $fields[$name]; } else { @@ -226,7 +226,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity extends CRM_Core_DAO self::$_export = array(); $fields = self::fields(); foreach($fields as $name => $field) { - if (CRM_Utils_Array::value('export', $field)) { + if (!empty($field['export'])) { if ($prefix) { self::$_export['price_set_entity'] = & $fields[$name]; } else { diff --git a/CRM/Utils/Address/BatchUpdate.php b/CRM/Utils/Address/BatchUpdate.php index dcc483d19e..7d73c323cb 100644 --- a/CRM/Utils/Address/BatchUpdate.php +++ b/CRM/Utils/Address/BatchUpdate.php @@ -211,7 +211,7 @@ class CRM_Utils_Address_BatchUpdate { $success = TRUE; // consider address is automatically parseable, // when we should found street_number and street_name - if (!CRM_Utils_Array::value('street_name', $parsedFields) || + if (empty($parsedFields['street_name']) || !CRM_Utils_Array::value('street_number', $parsedFields) ) { $success = FALSE; diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index 69df6f6ec4..95c054f3be 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -75,7 +75,7 @@ class CRM_Utils_Date { $date['M'] = $date['F']; } - if (CRM_Utils_Array::value('M', $date)) { + if (!empty($date['M'])) { $date['M'] = (int ) $date['M']; if ($date['M'] < 1 || $date['M'] > 12) { return $invalidDate; @@ -85,7 +85,7 @@ class CRM_Utils_Date { $date['M'] = 1; } - if (CRM_Utils_Array::value('d', $date)) { + if (!empty($date['d'])) { $date['d'] = (int ) $date['d']; } else { @@ -106,7 +106,7 @@ class CRM_Utils_Date { CRM_Utils_Array::value('s', $date) != NULL ) { // we have time too.. - if (CRM_Utils_Array::value('h', $date)) { + if (!empty($date['h'])) { if (CRM_Utils_Array::value('A', $date) == 'PM' or CRM_Utils_Array::value('a', $date) == 'pm') { if ($date['h'] != 12) { $date['h'] = $date['h'] + 12; @@ -125,14 +125,14 @@ class CRM_Utils_Date { } // in 24-hour format the hour is under the 'H' key - if (CRM_Utils_Array::value('H', $date)) { + if (!empty($date['H'])) { $date['H'] = (int) $date['H']; } else { $date['H'] = 0; } - if (CRM_Utils_Array::value('i', $date)) { + if (!empty($date['i'])) { $date['i'] = (int ) $date['i']; } else { @@ -143,7 +143,7 @@ class CRM_Utils_Date { $date['h'] = $date['H']; } - if (CRM_Utils_Array::value('s', $date)) { + if (!empty($date['s'])) { $date['s'] = (int ) $date['s']; } else { @@ -480,7 +480,7 @@ class CRM_Utils_Date { $prevCen = $cen - 1; $value = NULL; - if (CRM_Utils_Array::value($dateParam, $params)) { + if (!empty($params[$dateParam])) { // suppress hh:mm or hh:mm:ss if it exists CRM-7957 $value = preg_replace("/(\s(([01]\d)|[2][0-3])(:([0-5]\d)){1,2})$/", "", $params[$dateParam]); } diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index f3502ae60b..17bdae1d4b 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -368,7 +368,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F break; } } - if (!CRM_Utils_Array::value('financial_type_id', $values)) { + if (empty($values['financial_type_id'])) { return civicrm_api3_create_error("Financial Type is not valid: $value"); } break; @@ -376,7 +376,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F case 'payment_instrument': require_once 'CRM/Core/OptionGroup.php'; $values['payment_instrument_id'] = CRM_Core_OptionGroup::getValue('payment_instrument', $value); - if (!CRM_Utils_Array::value('payment_instrument_id', $values)) { + if (empty($values['payment_instrument_id'])) { return civicrm_api3_create_error("Payment Instrument is not valid: $value"); } break; @@ -391,7 +391,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F case 'honor_type_id': require_once 'CRM/Core/OptionGroup.php'; $values['honor_type_id'] = CRM_Core_OptionGroup::getValue('honor_type', $value); - if (!CRM_Utils_Array::value('honor_type_id', $values)) { + if (empty($values['honor_type_id'])) { return civicrm_api3_create_error("Honor Type is not valid: $value"); } break; @@ -450,7 +450,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F case 'pledge_id': //giving respect to pledge_payment flag. - if (!CRM_Utils_Array::value('pledge_payment', $params)) { + if (empty($params['pledge_payment'])) { continue; } @@ -489,10 +489,10 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } else { // first get the contact id for given contribution record. - if (CRM_Utils_Array::value('contribution_contact_id', $params)) { + if (!empty($params['contribution_contact_id'])) { $contributionContactID = $params['contribution_contact_id']; } - elseif (CRM_Utils_Array::value('external_identifier', $params)) { + elseif (!empty($params['external_identifier'])) { require_once 'CRM/Contact/DAO/Contact.php'; $contact = new CRM_Contact_DAO_Contact(); $contact->external_identifier = $params['external_identifier']; @@ -524,7 +524,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } } - if (CRM_Utils_Array::value('pledge_id', $params)) { + if (!empty($params['pledge_id'])) { if (CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_Pledge', $params['pledge_id'], 'contact_id') != $contributionContactID) { return civicrm_api3_create_error('Invalid Pledge ID provided. Contribution row was skipped.', 'pledge_payment'); } @@ -782,7 +782,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { } if (isset($values['individual_prefix'])) { - if (CRM_Utils_Array::value('prefix_id', $params)) { + if (!empty($params['prefix_id'])) { $prefixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'); $params['prefix'] = $prefixes[$params['prefix_id']]; } @@ -793,7 +793,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { } if (isset($values['individual_suffix'])) { - if (CRM_Utils_Array::value('suffix_id', $params)) { + if (!empty($params['suffix_id'])) { $suffixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'); $params['suffix'] = $suffixes[$params['suffix_id']]; } @@ -805,7 +805,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { //CRM-4575 if (isset($values['email_greeting'])) { - if (CRM_Utils_Array::value('email_greeting_id', $params)) { + if (!empty($params['email_greeting_id'])) { $emailGreetingFilter = array( 'contact_type' => CRM_Utils_Array::value('contact_type', $params), 'greeting_type' => 'email_greeting', @@ -821,7 +821,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { } if (isset($values['postal_greeting'])) { - if (CRM_Utils_Array::value('postal_greeting_id', $params)) { + if (!empty($params['postal_greeting_id'])) { $postalGreetingFilter = array( 'contact_type' => CRM_Utils_Array::value('contact_type', $params), 'greeting_type' => 'postal_greeting', @@ -836,7 +836,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { } if (isset($values['addressee'])) { - if (CRM_Utils_Array::value('addressee_id', $params)) { + if (!empty($params['addressee_id'])) { $addresseeFilter = array( 'contact_type' => CRM_Utils_Array::value('contact_type', $params), 'greeting_type' => 'addressee', @@ -851,7 +851,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { } if (isset($values['gender'])) { - if (CRM_Utils_Array::value('gender_id', $params)) { + if (!empty($params['gender_id'])) { $genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); $params['gender'] = $genders[$params['gender_id']]; } @@ -878,7 +878,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { } //format the website params. - if (CRM_Utils_Array::value('url', $values)) { + if (!empty($values['url'])) { static $websiteFields; if (!is_array($websiteFields)) { require_once 'CRM/Core/DAO/Website.php'; @@ -899,7 +899,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { } // get the formatted location blocks into params - w/ 3.0 format, CRM-4605 - if (CRM_Utils_Array::value('location_type_id', $values)) { + if (!empty($values['location_type_id'])) { _civicrm_api3_deprecated_add_formatted_location_blocks($values, $params); return TRUE; } @@ -931,7 +931,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { /* Check for custom field values */ - if (!CRM_Utils_Array::value('custom', $fields)) { + if (empty($fields['custom'])) { $fields['custom'] = &CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $values), FALSE, FALSE, NULL, NULL, FALSE, FALSE, FALSE ); @@ -998,7 +998,7 @@ function _civicrm_api3_deprecated_add_formatted_location_blocks(&$values, &$para $params[$name][++$blockCnt] ); - if (!CRM_Utils_Array::value('id', $params) && ($blockCnt == 1)) { + if (empty($params['id']) && ($blockCnt == 1)) { $params[$name][$blockCnt]['is_primary'] = TRUE; } @@ -1030,7 +1030,7 @@ function _civicrm_api3_deprecated_add_formatted_location_blocks(&$values, &$para // Note: we doing multiple value formatting here for address custom fields, plus putting into right format. // The actual formatting (like date, country ..etc) for address custom fields is taken care of while saving // the address in CRM_Core_BAO_Address::create method - if (CRM_Utils_Array::value('location_type_id', $values)) { + if (!empty($values['location_type_id'])) { static $customFields = array(); if (empty($customFields)) { $customFields = CRM_Core_BAO_CustomField::getFields('Address'); @@ -1165,7 +1165,7 @@ function _civicrm_api3_deprecated_validate_formatted_contact(&$params) { } //check for loc type id. - if (!CRM_Utils_Array::value('location_type_id', $values)) { + if (empty($values['location_type_id'])) { return civicrm_api3_create_error('Location Type Id missing.'); } } @@ -1228,7 +1228,7 @@ function _civicrm_api3_deprecated_create_participant_formatted($params, $onDupli function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplicate = FALSE) { //check if participant id is valid or not - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $participant = new CRM_Event_BAO_Participant(); $participant->id = $params['id']; if (!$participant->find(TRUE)) { @@ -1237,7 +1237,7 @@ function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplic } require_once 'CRM/Contact/BAO/Contact.php'; //check if contact id is valid or not - if (CRM_Utils_Array::value('contact_id', $params)) { + if (!empty($params['contact_id'])) { $contact = new CRM_Contact_BAO_Contact(); $contact->id = $params['contact_id']; if (!$contact->find(TRUE)) { @@ -1246,7 +1246,7 @@ function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplic } //check that event id is not an template - if (CRM_Utils_Array::value('event_id', $params)) { + if (!empty($params['event_id'])) { $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template'); if (!empty($isTemplate)) { return civicrm_api3_create_error(ts('Event templates are not meant to be registered')); @@ -1355,14 +1355,14 @@ function _civicrm_api3_deprecated_contact_check_params( } } - if (!CRM_Utils_Array::value('contact_id', $params) && CRM_Utils_Array::value('id', $params)) { + if (empty($params['contact_id']) && CRM_Utils_Array::value('id', $params)) { $valid = FALSE; $error = ''; foreach ($fields as $field) { if (is_array($field)) { $valid = TRUE; foreach ($field as $element) { - if (!CRM_Utils_Array::value($element, $params)) { + if (empty($params[$element])) { $valid = FALSE; $error .= $element; break; @@ -1370,7 +1370,7 @@ function _civicrm_api3_deprecated_contact_check_params( } } else { - if (CRM_Utils_Array::value($field, $params)) { + if (!empty($params[$field])) { $valid = TRUE; } } @@ -1414,7 +1414,7 @@ function _civicrm_api3_deprecated_contact_check_params( } //check for organisations with same name - if (CRM_Utils_Array::value('current_employer', $params)) { + if (!empty($params['current_employer'])) { $organizationParams = array(); $organizationParams['organization_name'] = $params['current_employer']; @@ -1425,15 +1425,13 @@ function _civicrm_api3_deprecated_contact_check_params( $dupeIds = CRM_Dedupe_Finder::dupesByParams($dedupParams, 'Organization', 'Supervised'); // check for mismatch employer name and id - if (CRM_Utils_Array::value('employer_id', $params) - && !in_array($params['employer_id'], $dupeIds) + if (!empty($params['employer_id']) && !in_array($params['employer_id'], $dupeIds) ) { return civicrm_api3_create_error('Employer name and Employer id Mismatch'); } // show error if multiple organisation with same name exist - if (!CRM_Utils_Array::value('employer_id', $params) - && (count($dupeIds) > 1) + if (empty($params['employer_id']) && (count($dupeIds) > 1) ) { return civicrm_api3_create_error('Found more than one Organisation with same Name.'); } diff --git a/CRM/Utils/Geocode/Google.php b/CRM/Utils/Geocode/Google.php index aba9acc525..32e5e58d6f 100644 --- a/CRM/Utils/Geocode/Google.php +++ b/CRM/Utils/Geocode/Google.php @@ -66,7 +66,7 @@ class CRM_Utils_Geocode_Google { */ static function format(&$values, $stateName = FALSE) { // we need a valid country, else we ignore - if (!CRM_Utils_Array::value('country', $values)) { + if (empty($values['country'])) { return FALSE; } @@ -74,7 +74,7 @@ class CRM_Utils_Geocode_Google { $add = ''; - if (CRM_Utils_Array::value('street_address', $values)) { + if (!empty($values['street_address'])) { $add = urlencode(str_replace('', '+', $values['street_address'])); $add .= ',+'; } @@ -85,8 +85,8 @@ class CRM_Utils_Geocode_Google { $add .= ',+'; } - if (CRM_Utils_Array::value('state_province', $values)) { - if (CRM_Utils_Array::value('state_province_id', $values)) { + if (!empty($values['state_province'])) { + if (!empty($values['state_province_id'])) { $stateProvince = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StateProvince', $values['state_province_id']); } else { @@ -109,12 +109,12 @@ class CRM_Utils_Geocode_Google { } } - if (CRM_Utils_Array::value('postal_code', $values)) { + if (!empty($values['postal_code'])) { $add .= '+' . urlencode(str_replace('', '+', $values['postal_code'])); $add .= ',+'; } - if (CRM_Utils_Array::value('country', $values)) { + if (!empty($values['country'])) { $add .= '+' . urlencode(str_replace('', '+', $values['country'])); } diff --git a/CRM/Utils/Geocode/Yahoo.php b/CRM/Utils/Geocode/Yahoo.php index d98a96e716..c0052fabaf 100644 --- a/CRM/Utils/Geocode/Yahoo.php +++ b/CRM/Utils/Geocode/Yahoo.php @@ -73,7 +73,7 @@ class CRM_Utils_Geocode_Yahoo { $whereComponents = array(); - if (CRM_Utils_Array::value('street_address', $values)) { + if (!empty($values['street_address'])) { $whereComponents['street'] = $values['street_address']; } @@ -81,8 +81,8 @@ class CRM_Utils_Geocode_Yahoo { $whereComponents['city'] = $city; } - if (CRM_Utils_Array::value('state_province', $values)) { - if (CRM_Utils_Array::value('state_province_id', $values)) { + if (!empty($values['state_province'])) { + if (!empty($values['state_province_id'])) { $stateProvince = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StateProvince', $values['state_province_id']); } else { @@ -104,11 +104,11 @@ class CRM_Utils_Geocode_Yahoo { } } - if (CRM_Utils_Array::value('postal_code', $values)) { + if (!empty($values['postal_code'])) { $whereComponents['postal'] = $values['postal_code']; } - if (CRM_Utils_Array::value('country', $values)) { + if (!empty($values['country'])) { $whereComponents['country'] = $values['country']; } diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index e5e56acabb..b45a48359c 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -72,8 +72,7 @@ class CRM_Utils_Mail { CRM_Utils_Hook::alterMailParams($params); // check if any module has aborted mail sending - if ( - CRM_Utils_Array::value('abortMailSend', $params) || + if (!empty($params['abortMailSend']) || !CRM_Utils_Array::value('toEmail', $params) ) { return FALSE; @@ -90,7 +89,7 @@ class CRM_Utils_Mail { $headers = array(); // CRM-10699 support custom email headers - if (CRM_Utils_Array::value('headers', $params)) { + if (!empty($params['headers'])) { $headers = array_merge($headers, $params['headers']); } $headers['From'] = $params['from']; @@ -118,7 +117,7 @@ class CRM_Utils_Mail { if ($includeMessageId) { $headers['Message-ID'] = '<' . uniqid('civicrm_', TRUE) . "@$emailDomain>"; } - if (CRM_Utils_Array::value('autoSubmitted', $params)) { + if (!empty($params['autoSubmitted'])) { $headers['Auto-Submitted'] = "Auto-Generated"; } @@ -171,10 +170,10 @@ class CRM_Utils_Mail { if (get_class($mailer) != "Mail_mail") { //get emails from headers, since these are //combination of name and email addresses. - if ( CRM_Utils_Array::value( 'Cc', $headers ) ) { + if (!empty($headers['Cc'])) { $to[] = CRM_Utils_Array::value( 'Cc', $headers ); } - if ( CRM_Utils_Array::value( 'Bcc', $headers ) ) { + if (!empty($headers['Bcc'])) { $to[] = CRM_Utils_Array::value( 'Bcc', $headers ); } } diff --git a/CRM/Utils/OpenFlashChart.php b/CRM/Utils/OpenFlashChart.php index 22f57b83b3..3e6d5f7191 100644 --- a/CRM/Utils/OpenFlashChart.php +++ b/CRM/Utils/OpenFlashChart.php @@ -64,7 +64,7 @@ class CRM_Utils_OpenFlashChart { if (empty($params)) { return $chart; } - if (!CRM_Utils_Array::value('multiValues', $params)) { + if (empty($params['multiValues'])) { $params['multiValues'] = array($params['values']); } @@ -445,7 +445,7 @@ class CRM_Utils_OpenFlashChart { // rotate the x labels. $chartData['xLabelAngle'] = CRM_Utils_Array::value('xLabelAngle', $rows, 0); - if (CRM_Utils_Array::value('tip', $rows)) { + if (!empty($rows['tip'])) { $chartData['tip'] = $rows['tip']; } @@ -456,7 +456,7 @@ class CRM_Utils_OpenFlashChart { // carry some chart params if pass. foreach (array( 'xSize', 'ySize', 'divName') as $f) { - if (CRM_Utils_Array::value($f, $rows)) { + if (!empty($rows[$f])) { $chartData[$f] = $rows[$f]; } } @@ -478,14 +478,14 @@ class CRM_Utils_OpenFlashChart { // rotate the x labels. $chartData['xLabelAngle'] = CRM_Utils_Array::value('xLabelAngle', $chartInfo, 20); - if (CRM_Utils_Array::value('tip', $chartInfo)) { + if (!empty($chartInfo['tip'])) { $chartData['tip'] = $chartInfo['tip']; } // carry some chart params if pass. foreach (array( 'xSize', 'ySize', 'divName') as $f) { - if (CRM_Utils_Array::value($f, $rows)) { + if (!empty($rows[$f])) { $chartData[$f] = $rows[$f]; } } diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 61bccf549e..cbb862db85 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -122,10 +122,10 @@ class CRM_Utils_REST { $result = self::error('Could not interpret return values from function.'); } - if (CRM_Utils_Array::value('json', $_REQUEST)) { + if (!empty($_REQUEST['json'])) { header('Content-Type: text/javascript'); $json = json_encode(array_merge($result)); - if (CRM_Utils_Array::value('debug', $_REQUEST)) { + if (!empty($_REQUEST['debug'])) { return self::jsonFormated($json); } return $json; diff --git a/CRM/Utils/Sort.php b/CRM/Utils/Sort.php index dbdd96e3c0..7c93a5832d 100644 --- a/CRM/Utils/Sort.php +++ b/CRM/Utils/Sort.php @@ -151,7 +151,7 @@ class CRM_Utils_Sort { * @access public */ function orderBy() { - if (!CRM_Utils_Array::value($this->_currentSortID, $this->_vars)) { + if (empty($this->_vars[$this->_currentSortID])) { return ''; } diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index f2cbf2c7b4..01775726cf 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -884,24 +884,24 @@ class CRM_Utils_System { return NULL; } - if (!CRM_Utils_Array::value('query', $items)) { + if (empty($items['query'])) { return $url; } $items['query'] = urlencode($items['query']); $url = $items['scheme'] . '://'; - if (CRM_Utils_Array::value('user', $items)) { + if (!empty($items['user'])) { $url .= "{$items['user']}:{$items['pass']}@"; } $url .= $items['host']; - if (CRM_Utils_Array::value('port', $items)) { + if (!empty($items['port'])) { $url .= ":{$items['port']}"; } $url .= "{$items['path']}?{$items['query']}"; - if (CRM_Utils_Array::value('fragment', $items)) { + if (!empty($items['fragment'])) { $url .= "#{$items['fragment']}"; } diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index 23ea8ee70e..f562826c4e 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -135,7 +135,7 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_DrupalBase { unset($_SESSION['messages']); } - if (CRM_Utils_Array::value('name', $params)) { + if (!empty($params['name'])) { if ($nameError = user_validate_name($params['name'])) { $errors['cms_name'] = $nameError; } @@ -150,7 +150,7 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_DrupalBase { } } - if (CRM_Utils_Array::value('mail', $params)) { + if (!empty($params['mail'])) { if ($emailError = user_validate_mail($params['mail'])) { $errors[$emailName] = $emailError; } diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 54bc32d49e..7bb0dad6be 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -153,10 +153,10 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { _user_edit_validate(NULL, $params); $errors = form_get_errors(); if ($errors) { - if (CRM_Utils_Array::value('name', $errors)) { + if (!empty($errors['name'])) { $errors['cms_name'] = $errors['name']; } - if (CRM_Utils_Array::value('mail', $errors)) { + if (!empty($errors['mail'])) { $errors[$emailName] = $errors['mail']; } // also unset drupal messages to avoid twice display of errors diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index 389c2c0692..ac4de75cf8 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -542,7 +542,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { $name = $dao->escape(CRM_Utils_Array::value('name', $params)); $email = $dao->escape(CRM_Utils_Array::value('mail', $params)); - if (CRM_Utils_Array::value('name', $params)) { + if (!empty($params['name'])) { if (!validate_username($params['name'])) { $errors['cms_name'] = ts("Your username contains invalid characters"); } @@ -551,7 +551,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { } } - if (CRM_Utils_Array::value('mail', $params)) { + if (!empty($params['mail'])) { if (!is_email($params['mail'])) { $errors[$emailName] = "Your email is invaid"; } diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index b6cbecb774..19201c9442 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -267,7 +267,7 @@ class CRM_Utils_Token { $value = NULL; /* Construct the address token */ - if (CRM_Utils_Array::value($token, $loc)) { + if (!empty($loc[$token])) { if ($html) { $value = $loc[$token][1]['display']; $value = str_replace("\n", '
', $value); @@ -285,7 +285,7 @@ class CRM_Utils_Token { /* Construct the phone and email tokens */ $value = NULL; - if (CRM_Utils_Array::value($token, $loc)) { + if (!empty($loc[$token])) { foreach ($loc[$token] as $index => $entity) { $value = $entity[$token]; break; @@ -1124,7 +1124,7 @@ class CRM_Utils_Token { //special case for greeting replacement foreach (array( 'email_greeting', 'postal_greeting', 'addressee') as $val) { - if (CRM_Utils_Array::value($val, $contactDetails[$contactID])) { + if (!empty($contactDetails[$contactID][$val])) { $contactDetails[$contactID][$val] = $contactDetails[$contactID]["{$val}_display"]; } } @@ -1181,18 +1181,18 @@ class CRM_Utils_Token { CRM_Core_DAO::storeValues($dao, $details[$dao->id]); // do the necessary transformation - if (CRM_Utils_Array::value('payment_instrument_id', $details[$dao->id])) { + if (!empty($details[$dao->id]['payment_instrument_id'])) { $piId = $details[$dao->id]['payment_instrument_id']; $pis = CRM_Contribute_PseudoConstant::paymentInstrument(); $details[$dao->id]['payment_instrument'] = $pis[$piId]; } - if (CRM_Utils_Array::value('campaign_id', $details[$dao->id])) { + if (!empty($details[$dao->id]['campaign_id'])) { $campaignId = $details[$dao->id]['campaign_id']; $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId); $details[$dao->id]['campaign'] = $campaigns[$campaignId]; } - if (CRM_Utils_Array::value('financial_type_id', $details[$dao->id])) { + if (!empty($details[$dao->id]['financial_type_id'])) { $financialtypeId = $details[$dao->id]['financial_type_id']; $ftis = CRM_Contribute_PseudoConstant::financialType(); $details[$dao->id]['financial_type'] = $ftis[$financialtypeId]; diff --git a/api/api.php b/api/api.php index b91940a033..9c537469d2 100644 --- a/api/api.php +++ b/api/api.php @@ -62,7 +62,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { // we do this before we _civicrm_api3_swap_out_aliases($apiRequest, $fields); if (strtolower($action) != 'getfields') { - if (!CRM_Utils_Array::value('id', $apiRequest['params'])) { + if (empty($apiRequest['params']['id'])) { $apiRequest['params'] = array_merge(_civicrm_api3_getdefaults($apiRequest, $fields), $apiRequest['params']); } //if 'id' is set then only 'version' will be checked but should still be checked for consistency @@ -103,7 +103,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { return 0; } } - if (CRM_Utils_Array::value('format.only_id', $apiRequest['params']) && isset($result['id'])) { + if (!empty($apiRequest['params']['format.only_id']) && isset($result['id'])) { return $result['id']; } if (CRM_Utils_Array::value('is_error', $result, 0) == 0) { @@ -130,7 +130,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { $data["error_code"] = DB::errorMessage($error->getCode()); $data["sql"] = $error->getDebugInfo(); } - if (CRM_Utils_Array::value('debug', $apiRequest['params'])) { + if (!empty($apiRequest['params']['debug'])) { if(method_exists($e, 'getUserInfo')) { $data['debug_info'] = $error->getUserInfo(); } @@ -143,7 +143,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { $data['tip'] = "add debug=1 to your API call to have more info about the error"; } $err = civicrm_api3_create_error($e->getMessage(), $data, $apiRequest); - if (CRM_Utils_Array::value('is_transactional', $apiRequest)) { + if (!empty($apiRequest['is_transactional'])) { $transaction->rollback(); } return $err; @@ -164,7 +164,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { ) { $err['trace'] = $e->getTraceAsString(); } - if (CRM_Utils_Array::value('is_transactional', $apiRequest)) { + if (!empty($apiRequest['is_transactional'])) { $transaction->rollback(); } return $err; @@ -175,10 +175,10 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { } $data = array(); $err = civicrm_api3_create_error($e->getMessage(), $data, $apiRequest, $e->getCode()); - if (CRM_Utils_Array::value('debug', $apiRequest['params'])) { + if (!empty($apiRequest['params']['debug'])) { $err['trace'] = $e->getTraceAsString(); } - if (CRM_Utils_Array::value('is_transactional', $apiRequest)) { + if (!empty($apiRequest['is_transactional'])) { $transaction->rollback(); } return $err; @@ -290,7 +290,7 @@ function _civicrm_api3_api_getfields(&$apiRequest) { if (strtolower($apiRequest['action'] == 'getfields')) { // the main param getfields takes is 'action' - however this param is not compatible with REST // so we accept 'api_action' as an alias of action on getfields - if (CRM_Utils_Array::value('api_action', $apiRequest['params'])) { + if (!empty($apiRequest['params']['api_action'])) { // $apiRequest['params']['action'] = $apiRequest['params']['api_action']; // unset($apiRequest['params']['api_action']); } diff --git a/api/v3/ActionSchedule.php b/api/v3/ActionSchedule.php index 46b7cef59d..5d1e145013 100644 --- a/api/v3/ActionSchedule.php +++ b/api/v3/ActionSchedule.php @@ -60,7 +60,7 @@ function civicrm_api3_action_schedule_get($params) { * {@getfields action_schedule_create} */ function civicrm_api3_action_schedule_create($params) { - if (!CRM_Utils_Array::value('id', $params)) { + if (empty($params['id'])) { // an update does not require any mandatory parameters civicrm_api3_verify_one_mandatory($params, NULL, diff --git a/api/v3/Activity.php b/api/v3/Activity.php index 4deab7fe53..99a6ca2cf9 100644 --- a/api/v3/Activity.php +++ b/api/v3/Activity.php @@ -54,7 +54,7 @@ */ function civicrm_api3_activity_create($params) { - if (!CRM_Utils_Array::value('id', $params)) { + if (empty($params['id'])) { // an update does not require any mandatory parameters civicrm_api3_verify_one_mandatory($params, NULL, @@ -96,9 +96,9 @@ function civicrm_api3_activity_create($params) { $case_id = ''; $createRevision = FALSE; $oldActivityValues = array(); - if (CRM_Utils_Array::value('case_id', $params)) { + if (!empty($params['case_id'])) { $case_id = $params['case_id']; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $oldActivityParams = array('id' => $params['id']); if (!$oldActivityValues) { CRM_Activity_BAO_Activity::retrieve($oldActivityParams, $oldActivityValues); @@ -408,7 +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 (!CRM_Utils_Array::value('id', $params) && + if (empty($params['id']) && !CRM_Utils_Array::value('activity_date_time', $params) ) { $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 674270f5b5..7ba429de30 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 (CRM_Utils_Array::value('contact_sub_type', $params) && CRM_Utils_Array::value('contact_type', $params)) { + if (!empty($params['contact_sub_type']) && CRM_Utils_Array::value('contact_type', $params)) { 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'])); } @@ -619,13 +619,13 @@ function civicrm_api3_contact_getquick($params) { $where .= " AND $aclWhere "; } - if (CRM_Utils_Array::value('org', $params)) { + if (!empty($params['org'])) { $where .= " AND contact_type = \"Organization\""; // CRM-7157, hack: get current employer details when // employee_id is present. $currEmpDetails = array(); - if (CRM_Utils_Array::value('employee_id', $params)) { + if (!empty($params['employee_id'])) { if ($currentEmployer = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', (int) $params['employee_id'], 'employer_id' @@ -650,23 +650,23 @@ function civicrm_api3_contact_getquick($params) { } } - if (CRM_Utils_Array::value('contact_sub_type', $params)) { + if (!empty($params['contact_sub_type'])) { $contactSubType = CRM_Utils_Type::escape($params['contact_sub_type'], 'String'); $where .= " AND cc.contact_sub_type = '{$contactSubType}'"; } //set default for current_employer or return contact with particular id - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $where .= " AND cc.id = " . (int) $params['id']; } - if (CRM_Utils_Array::value('cid', $params)) { + if (!empty($params['cid'])) { $where .= " AND cc.id <> " . (int) $params['cid']; } //contact's based of relationhip type $relType = NULL; - if (CRM_Utils_Array::value('rel', $params)) { + if (!empty($params['rel'])) { $relation = explode('_', CRM_Utils_Array::value('rel', $params)); $relType = CRM_Utils_Type::escape($relation[0], 'Integer'); $rel = CRM_Utils_Type::escape($relation[2], 'String'); @@ -719,7 +719,7 @@ function civicrm_api3_contact_getquick($params) { } // check if only CMS users are requested - if (CRM_Utils_Array::value('cmsuser', $params)) { + if (!empty($params['cmsuser'])) { $additionalFrom = " INNER JOIN civicrm_uf_match um ON (um.contact_id=cc.id) "; @@ -772,7 +772,7 @@ LIMIT 0, {$limit} } $t['data'] = $dao->data; $contactList[] = $t; - if (CRM_Utils_Array::value('org', $params) && + if (!empty($params['org']) && !empty($currEmpDetails) && $dao->id == $currEmpDetails['id'] ) { @@ -782,7 +782,7 @@ LIMIT 0, {$limit} //return organization name if doesn't exist in db if (empty($contactList)) { - if (CRM_Utils_Array::value('org', $params)) { + if (!empty($params['org'])) { if ($listCurrentEmployer && !empty($currEmpDetails)) { $contactList = array( array( diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 203bd5432c..0bc5a5fec5 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 (CRM_Utils_Array::value('id', $params) && CRM_Utils_Array::value('contribution_status_id', $params)) { + if (!empty($params['id']) && CRM_Utils_Array::value('contribution_status_id', $params)) { $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/CustomValue.php b/api/v3/CustomValue.php index 93bec607c0..ab3275faf8 100644 --- a/api/v3/CustomValue.php +++ b/api/v3/CustomValue.php @@ -206,14 +206,14 @@ function civicrm_api3_custom_value_get($params) { $n = $idArray[2]; $id = $fieldNumber . "." . $idArray[2]; } - if (CRM_Utils_Array::value('format.field_names', $params)) { + if (!empty($params['format.field_names'])) { $id = $info['field_name']; } else { $id = $fieldNumber; } $values[$id]['entity_id'] = $getParams['entityID']; - if (CRM_Utils_Array::value('entityType', $getParams)) { + if (!empty($getParams['entityType'])) { $values[$n]['entity_table'] = $getParams['entityType']; } //set 'latest' -useful for multi fields but set for single for consistency diff --git a/api/v3/Dashboard.php b/api/v3/Dashboard.php index 44545071ad..9b822627d5 100644 --- a/api/v3/Dashboard.php +++ b/api/v3/Dashboard.php @@ -48,7 +48,7 @@ * */ function civicrm_api3_dashboard_create($params) { - if (!CRM_Utils_Array::value('id', $params)) { + if (empty($params['id'])) { civicrm_api3_verify_one_mandatory($params, NULL, array( @@ -107,4 +107,4 @@ function civicrm_api3_dashboard_delete($params) { else { return civicrm_api3_create_error('Could not delete dashlet'); } -} \ No newline at end of file +} diff --git a/api/v3/Domain.php b/api/v3/Domain.php index 31314b2602..0cb52b074d 100644 --- a/api/v3/Domain.php +++ b/api/v3/Domain.php @@ -48,7 +48,7 @@ function civicrm_api3_domain_get($params) { unset($params['version']); $bao = new CRM_Core_BAO_Domain(); - if (CRM_Utils_Array::value('current_domain', $params)) { + if (!empty($params['current_domain'])) { $domainBAO = CRM_Core_Config::domainID(); $params['id'] = $domainBAO; } diff --git a/api/v3/Event.php b/api/v3/Event.php index 5721ee1c44..8990d1019c 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -119,19 +119,19 @@ function _civicrm_api3_event_create_legacy_support_42(&$params){ function civicrm_api3_event_get($params) { //legacy support for $params['return.sort'] - if (CRM_Utils_Array::value('return.sort', $params)) { + if (!empty($params['return.sort'])) { $params['options']['sort'] = $params['return.sort']; unset($params['return.sort']); } //legacy support for $params['return.offset'] - if (CRM_Utils_Array::value('return.offset', $params)) { + if (!empty($params['return.offset'])) { $params['options']['offset'] = $params['return.offset']; unset($params['return.offset']); } //legacy support for $params['return.max_results'] - if (CRM_Utils_Array::value('return.max_results', $params)) { + if (!empty($params['return.max_results'])) { $params['options']['limit'] = $params['return.max_results']; unset($params['return.max_results']); } @@ -139,14 +139,14 @@ function civicrm_api3_event_get($params) { $eventDAO = new CRM_Event_BAO_Event(); _civicrm_api3_dao_set_filter($eventDAO, $params, TRUE, 'Event'); - if (CRM_Utils_Array::value('is_template', $params)) { + if (!empty($params['is_template'])) { $eventDAO->whereAdd( '( is_template = 1 )' ); } elseif(empty($eventDAO->id)){ $eventDAO->whereAdd('( is_template IS NULL ) OR ( is_template = 0 )'); } - if (CRM_Utils_Array::value('isCurrent', $params)) { + if (!empty($params['isCurrent'])) { $eventDAO->whereAdd('(start_date >= CURDATE() || end_date >= CURDATE())'); } @@ -158,7 +158,7 @@ function civicrm_api3_event_get($params) { while ($eventDAO->fetch()) { $event[$eventDAO->id] = array(); CRM_Core_DAO::storeValues($eventDAO, $event[$eventDAO->id]); - if (CRM_Utils_Array::value('return.is_full', $params)) { + if (!empty($params['return.is_full'])) { _civicrm_api3_event_getisfull($event, $eventDAO->id); } _civicrm_api3_event_get_legacy_support_42($event, $eventDAO->id); diff --git a/api/v3/Generic.php b/api/v3/Generic.php index f02af9ed9d..3c4fc8a189 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -187,7 +187,7 @@ function civicrm_api3_generic_getvalue($apiRequest) { } // we only take "return=" as valid options - if (CRM_Utils_Array::value('return', $apiRequest['params'])) { + if (!empty($apiRequest['params']['return'])) { if (!isset($result['values'][0][$apiRequest['params']['return']])) { return civicrm_api3_create_error("field " . $apiRequest['params']['return'] . " unset or not existing", array('invalid_field' => $apiRequest['params']['return'])); } diff --git a/api/v3/Membership.php b/api/v3/Membership.php index 360d94685a..0f58352e05 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -112,11 +112,11 @@ function civicrm_api3_membership_create($params) { $action = CRM_Core_Action::ADD; // we need user id during add mode $ids = array (); - if(CRM_Utils_Array::value('contact_id', $params)) { + if (!empty($params['contact_id'])) { $ids['userId'] = $params['contact_id']; } //for edit membership id should be present - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $ids['membership'] = $params['id']; $action = CRM_Core_Action::UPDATE; } @@ -192,7 +192,7 @@ function civicrm_api3_membership_get($params) { } $activeOnly = CRM_Utils_Array::value('active_only', $params, $activeOnly); - if (CRM_Utils_Array::value('contact_id', $params) && !is_array($params['contact_id'])) { + if (!empty($params['contact_id']) && !is_array($params['contact_id'])) { $membershipValues = _civicrm_api3_membership_get_customv2behaviour($params, $membershipTypeId, $activeOnly ); } else { @@ -250,7 +250,7 @@ function _civicrm_api3_membership_relationsship_get_customv2behaviour(&$params, $membershipValues[$membershipId]['membership_name'] = $membershipType['name']; - if (CRM_Utils_Array::value('relationship_type_id', $membershipType)) { + if (!empty($membershipType['relationship_type_id'])) { $relationships[$membershipType['relationship_type_id']] = $membershipId; } diff --git a/api/v3/MembershipStatus.php b/api/v3/MembershipStatus.php index 8296daa688..50eb8f52ab 100644 --- a/api/v3/MembershipStatus.php +++ b/api/v3/MembershipStatus.php @@ -164,7 +164,7 @@ SELECT start_date, end_date, join_date $dao = &CRM_Core_DAO::executeQuery($query, $params); if ($dao->fetch()) { // Take the is_admin column in MembershipStatus into consideration when requested - if (! CRM_Utils_Array::value('ignore_admin_only', $membershipParams) ) { + if (empty($membershipParams['ignore_admin_only'])) { $result = &CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($dao->start_date, $dao->end_date, $dao->join_date, 'today', TRUE); } else { @@ -172,7 +172,7 @@ SELECT start_date, end_date, join_date } //make is error zero only when valid status found. - if (CRM_Utils_Array::value('id', $result)) { + if (!empty($result['id'])) { $result['is_error'] = 0; } } diff --git a/api/v3/Participant.php b/api/v3/Participant.php index cf39df191f..d552f8175f 100644 --- a/api/v3/Participant.php +++ b/api/v3/Participant.php @@ -56,7 +56,7 @@ */ function civicrm_api3_participant_create($params) { //check that event id is not an template - should be done @ BAO layer - if (CRM_Utils_Array::value('event_id', $params)) { + if (!empty($params['event_id'])) { $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template'); if (!empty($isTemplate)) { return civicrm_api3_create_error(ts('Event templates are not meant to be registered')); diff --git a/api/v3/ParticipantPayment.php b/api/v3/ParticipantPayment.php index 9e6318e3a9..67fdad9c82 100644 --- a/api/v3/ParticipantPayment.php +++ b/api/v3/ParticipantPayment.php @@ -58,7 +58,7 @@ function civicrm_api3_participant_payment_create($params) { $ids = array(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $ids['id'] = $params['id']; } $participantPayment = CRM_Event_BAO_ParticipantPayment::create($params, $ids); diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 300873f298..385d5c6673 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -271,7 +271,7 @@ function civicrm_api3_profile_submit($params) { ); } - if (CRM_Utils_Array::value('add_to_group_id', $ufGroupDetails)) { + if (!empty($ufGroupDetails['add_to_group_id'])) { $contactIds = array($params['contact_id']); CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $ufGroupDetails['add_to_group_id'] diff --git a/api/v3/Relationship.php b/api/v3/Relationship.php index 7ed5b63db2..b36069a410 100644 --- a/api/v3/Relationship.php +++ b/api/v3/Relationship.php @@ -56,7 +56,7 @@ function civicrm_api3_relationship_create($params) { _civicrm_api3_relationship_format_params($params, $values); $ids = array(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $ids['contactTarget'] = $values['contact_id_b']; } @@ -138,7 +138,7 @@ function civicrm_api3_relationship_delete($params) { function civicrm_api3_relationship_get($params) { $options = _civicrm_api3_get_options_from_params($params); - if (!CRM_Utils_Array::value('contact_id', $params)) { + if (empty($params['contact_id'])) { if(!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) { CRM_Contact_BAO_Relationship::membershipTypeToRelationshipTypes($params); } @@ -186,7 +186,7 @@ function _civicrm_api3_relationship_format_params($params, &$values) { _civicrm_api3_store_values($fields, $params, $values); $relationTypes = CRM_Core_PseudoConstant::relationshipType('name'); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $relation = new CRM_Contact_BAO_Relationship(); $relation->id = $params['id']; if (!$relation->find(TRUE)) { @@ -244,7 +244,7 @@ function _civicrm_api3_relationship_format_params($params, &$values) { } if ($relationshipTypeId) { - if (CRM_Utils_Array::value('relationship_type_id', $values) && + if (!empty($values['relationship_type_id']) && $relationshipTypeId != $values['relationship_type_id'] ) { throw new Exception('Mismatched Relationship Type and Relationship Type Id'); diff --git a/api/v3/Setting.php b/api/v3/Setting.php index b12c24a2c6..38eeb3e722 100644 --- a/api/v3/Setting.php +++ b/api/v3/Setting.php @@ -61,7 +61,7 @@ function civicrm_api3_setting_getfields($params) { CRM_Utils_Array::value('profile', $params, null) ); // find any supplemental information - if(CRM_Utils_Array::value('action',$params)){ + if (!empty($params['action'])){ $specFunction = '_civicrm_api3_setting_' . strtolower($params['action']) . '_spec'; if (function_exists($specFunction)) { $specFunction($result); diff --git a/api/v3/utils.php b/api/v3/utils.php index ad2f2e4f90..c65a2850f3 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -655,7 +655,7 @@ function _civicrm_api3_get_options_from_params(&$params, $queryObject = FALSE, $ } } if ($entity && $action =='get') { - if (CRM_Utils_Array::value('id',$returnProperties)) { + if (!empty($returnProperties['id'])) { $returnProperties[$entity . '_id'] = 1; unset($returnProperties['id']); } @@ -734,7 +734,7 @@ function _civicrm_api3_apply_options_to_dao(&$params, &$dao, $entity) { function _civicrm_api3_build_fields_array(&$bao, $unique = TRUE) { $fields = $bao->fields(); if ($unique) { - if(!CRM_Utils_Array::value('id', $fields)){ + if (empty($fields['id'])){ $entity = _civicrm_api_get_entity_name_from_dao($bao); $fields['id'] = $fields[$entity . '_id']; unset($fields[$entity . '_id']); @@ -912,7 +912,7 @@ function _civicrm_api3_check_required_fields($params, $daoName, $return = FALSE) continue; } - if (CRM_Utils_Array::value('required', $v)) { + if (!empty($v['required'])) { // 0 is a valid input for numbers, CRM-8122 if (!isset($params[$k]) || (empty($params[$k]) && !($params[$k] === 0))) { $missing[] = $k; @@ -1195,15 +1195,15 @@ function _civicrm_api3_validate_fields($entity, $action, &$params, $fields, $err // intensive checks - usually only called after DB level fail if (!empty($errorMode) && strtolower($action) == 'create') { - if (CRM_Utils_Array::value('FKClassName', $fieldInfo)) { - if (CRM_Utils_Array::value($fieldName, $params)) { + if (!empty($fieldInfo['FKClassName'])) { + if (!empty($params[$fieldName])) { _civicrm_api3_validate_constraint($params, $fieldName, $fieldInfo); } - elseif (CRM_Utils_Array::value('required', $fieldInfo)) { + elseif (!empty($fieldInfo['required'])) { throw new Exception("DB Constraint Violation - possibly $fieldName should possibly be marked as mandatory for this API. If so, please raise a bug report"); } } - if (CRM_Utils_Array::value('api.unique', $fieldInfo)) { + if (!empty($fieldInfo['api.unique'])) { $params['entity'] = $entity; _civicrm_api3_validate_uniquekey($params, $fieldName, $fieldInfo); } @@ -1229,7 +1229,7 @@ function _civicrm_api3_validate_fields($entity, $action, &$params, $fields, $err */ function _civicrm_api3_validate_date(&$params, &$fieldName, &$fieldInfo) { //should we check first to prevent it from being copied if they have passed in sql friendly format? - if (CRM_Utils_Array::value($fieldInfo['name'], $params)) { + if (!empty($params[$fieldInfo['name']])) { //accept 'whatever strtotime accepts if (strtotime($params[$fieldInfo['name']]) === FALSE) { throw new Exception($fieldInfo['name'] . " is not a valid date: " . $params[$fieldInfo['name']]); @@ -1503,7 +1503,7 @@ function _civicrm_api3_getrequired($apiRequest, $fields) { $required = array('version'); foreach ($fields as $field => $values) { - if (CRM_Utils_Array::value('api.required', $values)) { + if (!empty($values['api.required'])) { $required[] = $field; } } @@ -1519,7 +1519,7 @@ function _civicrm_api3_getrequired($apiRequest, $fields) { function _civicrm_api3_swap_out_aliases(&$apiRequest, $fields) { foreach ($fields as $field => $values) { $uniqueName = CRM_Utils_Array::value('uniqueName', $values); - if (CRM_Utils_Array::value('api.aliases', $values)) { + if (!empty($values['api.aliases'])) { // if aliased field is not set we try to use field alias if (!isset($apiRequest['params'][$field])) { foreach ($values['api.aliases'] as $alias) { @@ -1566,7 +1566,7 @@ function _civicrm_api3_swap_out_aliases(&$apiRequest, $fields) { */ function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $entity) { //if fieldname exists in params - if (CRM_Utils_Array::value($fieldName, $params)) { + if (!empty($params[$fieldName])) { // if value = 'user_contact_id' (or similar), replace value with contact id if (!is_numeric($params[$fieldName]) && is_scalar($params[$fieldName])) { $realContactId = _civicrm_api3_resolve_contactID($params[$fieldName]); diff --git a/bin/deprecated/ParticipantProcessor.php b/bin/deprecated/ParticipantProcessor.php index 24936fe36a..46a1b2b656 100644 --- a/bin/deprecated/ParticipantProcessor.php +++ b/bin/deprecated/ParticipantProcessor.php @@ -107,7 +107,7 @@ LEFT JOIN civicrm_event event ON ( event.id = participant.event_id ) foreach ($participantDetails as $participantId => $values) { //process the additional participant at the time of //primary participant, don't process separately. - if (CRM_Utils_Array::value('registered_by_id', $values)) { + if (!empty($values['registered_by_id'])) { continue; } @@ -156,7 +156,7 @@ LEFT JOIN civicrm_event event ON ( event.id = participant.event_id ) foreach ($participantDetails as $participantId => $values) { //process the additional participant at the time of //primary participant, don't process separately. - if (CRM_Utils_Array::value('registered_by_id', $values)) { + if (!empty($values['registered_by_id'])) { continue; } diff --git a/bin/deprecated/UpdateAddress.php b/bin/deprecated/UpdateAddress.php index 255c60ebdd..3c1b139adc 100644 --- a/bin/deprecated/UpdateAddress.php +++ b/bin/deprecated/UpdateAddress.php @@ -224,7 +224,7 @@ WHERE {$whereClause} $success = TRUE; // consider address is automatically parseable, // when we should found street_number and street_name - if (!CRM_Utils_Array::value('street_name', $parsedFields) || + if (empty($parsedFields['street_name']) || !CRM_Utils_Array::value('street_number', $parsedFields) ) { $success = FALSE; diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 9b9e68e85a..05a4b7277f 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -486,10 +486,10 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { foreach ($options as $oIndex => $oValue) { $validateStrings[] = $oValue['label']; $validateStrings[] = $oValue['amount']; - if (CRM_Utils_Array::value('membership_type_id', $oValue)) { + if (!empty($oValue['membership_type_id'])) { $this->select("membership_type_id_{$oIndex}", "value={$oValue['membership_type_id']}"); } - if (CRM_Utils_Array::value('financial_type_id', $oValue)) { + if (!empty($oValue['financial_type_id'])) { $this->select("option_financial_type_id_{$oIndex}", "label={$oValue['financial_type_id']}"); } $this->type("option_label_{$oIndex}", $oValue['label']); diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index bdcc2c96bb..119b05db8d 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -910,7 +910,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { */ private function _contactCreate($params) { $result = $this->callAPISuccess('contact', 'create', $params); - if (CRM_Utils_Array::value('is_error', $result) || + if (!empty($result['is_error']) || !CRM_Utils_Array::value('id', $result) ) { throw new Exception('Could not create test contact, with message: ' . CRM_Utils_Array::value('error_message', $result) . "\nBacktrace:" . CRM_Utils_Array::value('trace', $result)); @@ -2194,7 +2194,7 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) if (array_key_exists('id', $unformattedArray)) { unset($unformattedArray['id']); } - if (CRM_Utils_Array::value('values', $unformattedArray) && is_array($unformattedArray['values'])) { + if (!empty($unformattedArray['values']) && is_array($unformattedArray['values'])) { foreach ($unformattedArray['values'] as $key => $value) { if (is_Array($value)) { foreach ($value as $k => $v) { diff --git a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php index 0062415a51..255e209e3e 100644 --- a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php @@ -354,7 +354,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $this->type("non_deductible_amount", "{$nonDeductibleAmt}"); } - if (CRM_Utils_Array::value('premium', $params)) { + if (!empty($params['premium'])) { //Premium section $this->click("Premium"); $this->waitForElementPresent("fulfilled_date"); diff --git a/tests/phpunit/api/v3/GrantTest.php b/tests/phpunit/api/v3/GrantTest.php index cf57b99ad5..cdd306a512 100644 --- a/tests/phpunit/api/v3/GrantTest.php +++ b/tests/phpunit/api/v3/GrantTest.php @@ -139,7 +139,7 @@ class api_v3_GrantTest extends CiviUnitTestCase { case CRM_Utils_Type::T_INT: // probably created with a 1 $entity[$field] = 2; - if (CRM_Utils_Array::value('FKClassName', $specs)) { + if (!empty($specs['FKClassName'])) { $entity[$field] = empty($entity2[$field]) ? $entity2[$specs]['uniqueName'] : $entity2[$field]; } break; diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 20b2759d29..77c492fcbd 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -698,7 +698,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { case CRM_Utils_Type::T_INT: // probably created with a 1 $entity[$fieldName] = '6'; - if (CRM_Utils_Array::value('FKClassName', $specs)) { + if (!empty($specs['FKClassName'])) { if($specs['FKClassName'] == $baoString){ $entity[$fieldName] = (string) $entity2['id']; } diff --git a/tools/CRM/Auction/BAO/Auction.php b/tools/CRM/Auction/BAO/Auction.php index 4a604dd05b..6435cfe8eb 100644 --- a/tools/CRM/Auction/BAO/Auction.php +++ b/tools/CRM/Auction/BAO/Auction.php @@ -97,7 +97,7 @@ class CRM_Auction_BAO_Auction extends CRM_Auction_DAO_Auction { function add(&$params) { require_once 'CRM/Utils/Hook.php'; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Auction', $params['id'], $params); } else { @@ -109,7 +109,7 @@ class CRM_Auction_BAO_Auction extends CRM_Auction_DAO_Auction { $auction->copyValues($params); $result = $auction->save(); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'Auction', $auction->id, $auction); } else { diff --git a/tools/CRM/Auction/BAO/Item.php b/tools/CRM/Auction/BAO/Item.php index 1925a0d966..85aea59392 100644 --- a/tools/CRM/Auction/BAO/Item.php +++ b/tools/CRM/Auction/BAO/Item.php @@ -97,7 +97,7 @@ class CRM_Auction_BAO_Item extends CRM_Auction_DAO_Auction { function add(&$params) { require_once 'CRM/Utils/Hook.php'; - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Auction_Item', $params['id'], $params); } else { @@ -121,7 +121,7 @@ class CRM_Auction_BAO_Item extends CRM_Auction_DAO_Auction { $auction->id ); - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'Auction_Item', $auction->id, $auction); } else { diff --git a/tools/CRM/Auction/Form/SearchAuction.php b/tools/CRM/Auction/Form/SearchAuction.php index 1a89ae7f21..1ee3945cb8 100644 --- a/tools/CRM/Auction/Form/SearchAuction.php +++ b/tools/CRM/Auction/Form/SearchAuction.php @@ -42,7 +42,7 @@ class CRM_Auction_Form_SearchAuction extends CRM_Core_Form { require_once 'CRM/Core/ShowHideBlocks.php'; $this->_showHide = new CRM_Core_ShowHideBlocks(); - if (!CRM_Utils_Array::value('auctionsByDates', $defaults)) { + if (empty($defaults['auctionsByDates'])) { $this->_showHide->addHide('id_fromToDates'); } diff --git a/tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php b/tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php index 35bdd14af3..dc008e1642 100755 --- a/tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php +++ b/tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php @@ -316,7 +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 (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { if ($tableName == 'civicrm_address') { @@ -335,7 +335,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form { // only include statistics columns if set - if (CRM_Utils_Array::value('statistics', $field)) { + if (!empty($field['statistics'])) { foreach ($field['statistics'] as $stat => $label) { switch (strtolower($stat)) { case 'sum': @@ -376,12 +376,12 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form { } // insert first and last contribution at end - if (CRM_Utils_Array::value('first_contribution', $this->_params['options'])) { + if (!empty($this->_params['options']['first_contribution'])) { $select[] = " '' as first_contribution"; $this->_columnHeaders['first_contribution']['title'] = ts('First Contribution'); } - if (CRM_Utils_Array::value('last_contribution', $this->_params['options'])) { + if (!empty($this->_params['options']['last_contribution'])) { $select[] = " '' as last_contribution"; $this->_columnHeaders['last_contribution']['title'] = ts('Last Contribution'); } diff --git a/tools/extensions/org.civicrm.report.grant/Grant.php b/tools/extensions/org.civicrm.report.grant/Grant.php index dd4b734dc2..b8d40be8e9 100644 --- a/tools/extensions/org.civicrm.report.grant/Grant.php +++ b/tools/extensions/org.civicrm.report.grant/Grant.php @@ -216,7 +216,7 @@ class org_civicrm_report_grant extends CRM_Report_Form { } if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (CRM_Utils_Array::value('required', $field) || + if (!empty($field['required']) || CRM_Utils_Array::value($fieldName, $this->_params['fields']) ) { @@ -284,14 +284,14 @@ class org_civicrm_report_grant extends CRM_Report_Form { function groupBy() { $this->_groupBy = ""; - if (CRM_Utils_Array::value('group_bys', $this->_params) && + if (!empty($this->_params['group_bys']) && is_array($this->_params['group_bys']) && !empty($this->_params['group_bys']) ) { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('group_bys', $table)) { foreach ($table['group_bys'] as $fieldName => $field) { - if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) { + if (!empty($this->_params['group_bys'][$fieldName])) { $this->_groupBy[] = $field['dbAlias']; } } diff --git a/tools/extensions/org.civicrm.search.multivalue/MultiValue.php b/tools/extensions/org.civicrm.search.multivalue/MultiValue.php index 9f351f0480..e171438181 100644 --- a/tools/extensions/org.civicrm.search.multivalue/MultiValue.php +++ b/tools/extensions/org.civicrm.search.multivalue/MultiValue.php @@ -65,7 +65,7 @@ class org_civicrm_search_multivalue extends CRM_Contact_Form_Search_Custom_Basei // add all the fields for chosen groups $this->_tables = $this->_options = array(); foreach ($this->_groupTree as $groupID => $group) { - if (!CRM_Utils_Array::value($groupID, $this->_customGroupIDs)) { + if (empty($this->_customGroupIDs[$groupID])) { continue; } @@ -122,7 +122,7 @@ class org_civicrm_search_multivalue extends CRM_Contact_Form_Search_Custom_Basei $includeContactIDs = FALSE ) { //redirect if custom group not select in search criteria - if (!CRM_Utils_Array::value('custom_group', $this->_formValues)) { + if (empty($this->_formValues['custom_group'])) { CRM_Core_Error::statusBounce(ts("You must select at least one Custom Group as a search criteria."), CRM_Utils_System::url('civicrm/contact/search/custom', "reset=1&csid={$this->_formValues['customSearchID']}", -- 2.25.1