CRM-14106 - Regex targeting other conditionals
authorColeman Watts <coleman@civicrm.org>
Wed, 22 Jan 2014 05:50:44 +0000 (21:50 -0800)
committerColeman Watts <coleman@civicrm.org>
Wed, 22 Jan 2014 05:50:44 +0000 (21:50 -0800)
Pattern used:
\s*(&&|\|\|)\s*CRM_Utils_Array::value\s*\([ ]*(['"$0-9][^,]*),\s*(\$[^ )]*)\s*\)\s*(\&\&|\|\||\))
 $1 !empty\($3\[$2\]\)$4

216 files changed:
CRM/Activity/BAO/Activity.php
CRM/Activity/Form/Activity.php
CRM/Admin/Form/Options.php
CRM/Admin/Form/ScheduleReminders.php
CRM/Admin/Form/Setting/Localization.php
CRM/Admin/Form/WordReplacements.php
CRM/Badge/BAO/Badge.php
CRM/Batch/BAO/Batch.php
CRM/Batch/Form/Entry.php
CRM/Campaign/BAO/Campaign.php
CRM/Campaign/Form/Search.php
CRM/Campaign/Form/Survey/Main.php
CRM/Campaign/Form/Survey/Results.php
CRM/Campaign/Form/Survey/TabHeader.php
CRM/Campaign/Form/Task/Interview.php
CRM/Campaign/Page/AJAX.php
CRM/Case/BAO/Case.php
CRM/Case/BAO/Query.php
CRM/Case/Form/Activity/ChangeCaseStatus.php
CRM/Case/Form/Activity/OpenCase.php
CRM/Case/Form/CaseView.php
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Contact/Utils.php
CRM/Contact/BAO/Group.php
CRM/Contact/BAO/GroupOrganization.php
CRM/Contact/BAO/Individual.php
CRM/Contact/BAO/Query.php
CRM/Contact/BAO/Relationship.php
CRM/Contact/BAO/RelationshipType.php
CRM/Contact/BAO/SavedSearch.php
CRM/Contact/Form/Contact.php
CRM/Contact/Form/Edit/Address.php
CRM/Contact/Form/Edit/CommunicationPreferences.php
CRM/Contact/Form/Edit/CustomData.php
CRM/Contact/Form/Edit/Individual.php
CRM/Contact/Form/Inline/Address.php
CRM/Contact/Form/Inline/IM.php
CRM/Contact/Form/Inline/OpenID.php
CRM/Contact/Form/Inline/Phone.php
CRM/Contact/Form/Location.php
CRM/Contact/Form/ProfileContact.php
CRM/Contact/Form/Relationship.php
CRM/Contact/Form/Search.php
CRM/Contact/Form/Search/Advanced.php
CRM/Contact/Form/Search/Basic.php
CRM/Contact/Form/Search/Builder.php
CRM/Contact/Form/Search/Custom/Basic.php
CRM/Contact/Form/Task/AddToHousehold.php
CRM/Contact/Form/Task/Batch.php
CRM/Contact/Form/Task/EmailCommon.php
CRM/Contact/Form/Task/Label.php
CRM/Contact/Form/Task/LabelCommon.php
CRM/Contact/Form/Task/PDFLetterCommon.php
CRM/Contact/Form/Task/ProximityCommon.php
CRM/Contact/Form/Task/SMSCommon.php
CRM/Contact/Import/Form/MapField.php
CRM/Contact/Import/Parser/Contact.php
CRM/Contact/Page/Inline/ContactInfo.php
CRM/Contact/Page/View/Summary.php
CRM/Contact/Selector.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/Contribution/Utils.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/BAO/Query.php
CRM/Contribute/Form.php
CRM/Contribute/Form/AdditionalInfo.php
CRM/Contribute/Form/AdditionalPayment.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/Contribution/OnBehalfOf.php
CRM/Contribute/Form/Contribution/ThankYou.php
CRM/Contribute/Form/ContributionBase.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Contribute/Form/ContributionPage/Settings.php
CRM/Contribute/Form/ContributionPage/TabHeader.php
CRM/Contribute/Form/ContributionPage/Widget.php
CRM/Contribute/Form/ManagePremiums.php
CRM/Contribute/Form/SoftCredit.php
CRM/Contribute/Form/Task/PDF.php
CRM/Contribute/Import/Parser/Contribution.php
CRM/Core/BAO/Address.php
CRM/Core/BAO/Block.php
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/CustomGroup.php
CRM/Core/BAO/CustomOption.php
CRM/Core/BAO/Dashboard.php
CRM/Core/BAO/File.php
CRM/Core/BAO/FinancialTrxn.php
CRM/Core/BAO/Log.php
CRM/Core/BAO/Mapping.php
CRM/Core/BAO/SchemaHandler.php
CRM/Core/BAO/Setting.php
CRM/Core/BAO/UFGroup.php
CRM/Core/BAO/Website.php
CRM/Core/Error.php
CRM/Core/Form.php
CRM/Core/Form/Tag.php
CRM/Core/OptionValue.php
CRM/Core/Payment/BaseIPN.php
CRM/Core/Payment/ProcessorForm.php
CRM/Custom/Form/Field.php
CRM/Dedupe/Merger.php
CRM/Event/BAO/Event.php
CRM/Event/BAO/Participant.php
CRM/Event/BAO/Query.php
CRM/Event/Cart/Form/Checkout/Payment.php
CRM/Event/Form/EventFees.php
CRM/Event/Form/ManageEvent/Fee.php
CRM/Event/Form/ManageEvent/Location.php
CRM/Event/Form/ManageEvent/Registration.php
CRM/Event/Form/ManageEvent/TabHeader.php
CRM/Event/Form/Participant.php
CRM/Event/Form/Registration.php
CRM/Event/Form/Registration/AdditionalParticipant.php
CRM/Event/Form/Registration/Confirm.php
CRM/Event/Form/Registration/Register.php
CRM/Event/Import/Parser/Participant.php
CRM/Event/Page/EventInfo.php
CRM/Export/BAO/Export.php
CRM/Export/Form/Map.php
CRM/Export/Form/Select.php
CRM/Financial/Form/FinancialTypeAccount.php
CRM/Friend/BAO/Friend.php
CRM/Group/Form/Edit.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/Form/Test.php
CRM/Mailing/Form/Upload.php
CRM/Member/BAO/Membership.php
CRM/Member/BAO/MembershipStatus.php
CRM/Member/BAO/Query.php
CRM/Member/Form.php
CRM/Member/Form/Membership.php
CRM/Member/Form/MembershipBlock.php
CRM/Member/Form/MembershipRenewal.php
CRM/Member/Form/MembershipType.php
CRM/Member/Form/MembershipView.php
CRM/Member/Import/Parser/Membership.php
CRM/PCP/Form/Campaign.php
CRM/Pledge/BAO/Pledge.php
CRM/Pledge/BAO/Query.php
CRM/Pledge/Form/Pledge.php
CRM/Price/BAO/LineItem.php
CRM/Price/BAO/PriceField.php
CRM/Price/BAO/PriceSet.php
CRM/Price/Form/Field.php
CRM/Price/Form/Option.php
CRM/Profile/Form.php
CRM/Profile/Form/Dynamic.php
CRM/Profile/Form/Edit.php
CRM/Profile/Page/Listings.php
CRM/Report/BAO/ReportInstance.php
CRM/Report/Form.php
CRM/Report/Form/Activity.php
CRM/Report/Form/ActivitySummary.php
CRM/Report/Form/Campaign/SurveyDetails.php
CRM/Report/Form/Case/Demographics.php
CRM/Report/Form/Case/Detail.php
CRM/Report/Form/Case/Summary.php
CRM/Report/Form/Case/TimeSpent.php
CRM/Report/Form/Contact/CurrentEmployer.php
CRM/Report/Form/Contact/Detail.php
CRM/Report/Form/Contact/Log.php
CRM/Report/Form/Contact/Relationship.php
CRM/Report/Form/Contact/Summary.php
CRM/Report/Form/Contribute/Bookkeeping.php
CRM/Report/Form/Contribute/Detail.php
CRM/Report/Form/Contribute/History.php
CRM/Report/Form/Contribute/HouseholdSummary.php
CRM/Report/Form/Contribute/Lybunt.php
CRM/Report/Form/Contribute/OrganizationSummary.php
CRM/Report/Form/Contribute/Repeat.php
CRM/Report/Form/Contribute/SoftCredit.php
CRM/Report/Form/Contribute/Summary.php
CRM/Report/Form/Contribute/Sybunt.php
CRM/Report/Form/Contribute/TopDonor.php
CRM/Report/Form/Event/IncomeCountSummary.php
CRM/Report/Form/Event/ParticipantListCount.php
CRM/Report/Form/Event/ParticipantListing.php
CRM/Report/Form/Event/Summary.php
CRM/Report/Form/Extended.php
CRM/Report/Form/Grant/Detail.php
CRM/Report/Form/Grant/Statistics.php
CRM/Report/Form/Mailing/Bounce.php
CRM/Report/Form/Mailing/Clicks.php
CRM/Report/Form/Mailing/Detail.php
CRM/Report/Form/Mailing/Opened.php
CRM/Report/Form/Mailing/Summary.php
CRM/Report/Form/Member/ContributionDetail.php
CRM/Report/Form/Member/Detail.php
CRM/Report/Form/Member/Lapse.php
CRM/Report/Form/Member/Summary.php
CRM/Report/Form/Membership/Summary.php
CRM/Report/Form/Pledge/Pbnp.php
CRM/Report/Form/Pledge/Summary.php
CRM/Report/Form/Walklist/Walklist.php
CRM/SMS/Form/Upload.php
CRM/UF/Form/Field.php
CRM/Upgrade/Incremental/php/FourTwo.php
CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php
CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php
CRM/Utils/Address/BatchUpdate.php
CRM/Utils/DeprecatedUtils.php
CRM/Utils/Mail.php
CRM/Utils/Rule.php
CRM/Utils/Token.php
api/v3/Activity.php
api/v3/Contact.php
api/v3/Contribution.php
api/v3/Participant.php
api/v3/PledgePayment.php
api/v3/utils.php
bin/deprecated/UpdateAddress.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tools/extensions/org.civicrm.report.baykeeper/Baykeeper.php
tools/extensions/org.civicrm.report.grant/Grant.php

index b5e2878552d2ff7f5110ccb6cb7295ee179ad36a..164a841b9b44006875d376e3b8402543ed572054 100644 (file)
@@ -64,9 +64,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
    * @access public
    */
   public static function dataExists(&$params) {
-    if (!empty($params['source_contact_id']) ||
-      CRM_Utils_Array::value('id', $params)
-    ) {
+    if (!empty($params['source_contact_id']) || !empty($params['id'])) {
       return TRUE;
     }
     return FALSE;
@@ -294,10 +292,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
       unset($params['id']);
     }
 
-    if (empty($params['status_id']) &&
-      !CRM_Utils_Array::value('activity_status_id', $params) &&
-      !CRM_Utils_Array::value('id', $params)
-    ) {
+    if (empty($params['status_id']) && empty($params['activity_status_id']) && empty($params['id'])) {
       if (isset($params['activity_date_time']) &&
         strcmp($params['activity_date_time'], CRM_Utils_Date::processDate(date('Ymd')) == -1)
       ) {
index 6f02353848cc288414249ffd4c72b0459a603e33..bc09379a2a454ba66de76271a4b5e607da8f2a49 100644 (file)
@@ -937,9 +937,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
     }
 
     //Activity type is mandatory if creating new activity, CRM-4515
-    if (array_key_exists('activity_type_id', $fields) &&
-      !CRM_Utils_Array::value('activity_type_id', $fields)
-    ) {
+    if (array_key_exists('activity_type_id', $fields) && empty($fields['activity_type_id'])) {
       $errors['activity_type_id'] = ts('Activity Type is required field.');
     }
     //FIX me temp. comment
@@ -960,13 +958,11 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       $errors['status_id'] = ts('You cannot record scheduled SMS activity.');
     }
 
-    if (!empty($fields['followup_activity_type_id']) && !CRM_Utils_Array::value('followup_date', $fields)) {
+    if (!empty($fields['followup_activity_type_id']) && empty($fields['followup_date'])) {
       $errors['followup_date_time'] = ts('Followup date is a required field.');
     }
     //Activity type is mandatory if subject or follow-up date is specified for an Follow-up activity, CRM-4515
-    if ((CRM_Utils_Array::value('followup_activity_subject', $fields) || CRM_Utils_Array::value('followup_date', $fields)) &&
-      !CRM_Utils_Array::value('followup_activity_type_id', $fields)
-    ) {
+    if ((!empty($fields['followup_activity_subject']) || !empty($fields['followup_date'])) && empty($fields['followup_activity_type_id'])) {
       $errors['followup_activity_subject'] = ts('Follow-up Activity type is a required field.');
     }
     return $errors;
index a23d9a1329abb42f6261f7056de202d1d1b3a817..d6ced2669a17a990406d4226a5404b1c20b43c12 100644 (file)
@@ -325,13 +325,11 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
    */
   static function formRule($fields, $files, $self) {
     $errors = array();
-    if ($self->_gName == 'case_status' && !CRM_Utils_Array::value('grouping', $fields)) {
+    if ($self->_gName == 'case_status' && empty($fields['grouping'])) {
       $errors['grouping'] = ts('Status class is a required field');
     }
 
-    if (in_array($self->_gName, array('email_greeting', 'postal_greeting', 'addressee'))
-      && !CRM_Utils_Array::value('is_reserved', $self->_defaultValues)
-    ) {
+    if (in_array($self->_gName, array('email_greeting', 'postal_greeting', 'addressee')) && empty($self->_defaultValues['is_reserved'])) {
       $label               = $fields['label'];
       $condition           = " AND v.label = '{$label}' ";
       $values              = CRM_Core_OptionGroup::values($self->_gName, FALSE, FALSE, FALSE, $condition, 'filter');
index 4c78e29624f3a051e6ca4fbdab6d1c7f28f1c63d..4340407847653c400823877b9b467cbf9a18780d 100644 (file)
@@ -77,7 +77,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
       }
     }
 
-    if (!empty($_POST) && CRM_Utils_Array::value('entity', $_POST)) {
+    if (!empty($_POST) && !empty($_POST['entity'])) {
       $mappingID = $_POST['entity'][0];
     }
     elseif ($this->_mappingID) {
index 8ef3af4c02dcc593ef421daf404b0ebef7d62282..2c1138a2e161bc46e7299c41461f6f1e594496a1 100644 (file)
@@ -223,7 +223,7 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting {
 
     // CRM-7962, CRM-7713, CRM-9004
     if (!empty($fields['defaultContactCountry']) &&
-      (CRM_Utils_Array::value('countryLimit', $fields) &&
+      (!empty($fields['countryLimit']) &&
         (!in_array($fields['defaultContactCountry'], $fields['countryLimit']))
       )
     ) {
index 88989ec6b521815d338e981c39b9bb9d5551aed9..c7ef9d18aedf55881e40618bae6b52c8813d6729 100644 (file)
@@ -187,8 +187,8 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form {
       elseif (!$v && $newValues[$k]) {
         $errors['old[' . $k . ']'] = ts('Please Enter the value for Original Word');
       }
-      elseif ((!CRM_Utils_Array::value($k, $newValues) && !CRM_Utils_Array::value($k, $oldValues))
-        && (CRM_Utils_Array::value($k, $enabled) || CRM_Utils_Array::value($k, $exactMatch))
+      elseif ((empty($newValues[$k]) && empty($oldValues[$k]))
+        && (!empty($enabled[$k]) || !empty($exactMatch[$k]))
       ) {
         $errors['old[' . $k . ']'] = ts('Please Enter the value for Original Word');
         $errors['new[' . $k . ']'] = ts('Please Enter the value for Replacement Word');
@@ -211,13 +211,9 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form {
 
     $enabled['exactMatch'] = $enabled['wildcardMatch'] = $disabled['exactMatch'] = $disabled['wildcardMatch'] = array();
     for ($i = 1; $i <= $this->_numStrings; $i++) {
-      if (!empty($params['new'][$i]) &&
-        CRM_Utils_Array::value($i, $params['old'])
-      ) {
-        if (isset($params['enabled']) && CRM_Utils_Array::value($i, $params['enabled'])) {
-          if (!empty($params['cb']) &&
-            CRM_Utils_Array::value($i, $params['cb'])
-          ) {
+      if (!empty($params['new'][$i]) && !empty($params['old'][$i])) {
+        if (isset($params['enabled']) && !empty($params['enabled'][$i])) {
+          if (!empty($params['cb']) && !empty($params['cb'][$i])) {
             $enabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
           }
           else {
index 6c0d49fd8b3bec7607f9616d654683de0a8a0411..00910dd389b5f0932adf57e39aafd203c6a69bb8 100644 (file)
@@ -171,8 +171,7 @@ class CRM_Badge_BAO_Badge {
     }
 
     if ((CRM_Utils_Array::value('height_image_1', $formattedRow) >
-      CRM_Utils_Array::value('height_image_2', $formattedRow)) &&
-      CRM_Utils_Array::value('height_image_1', $formattedRow)) {
+      CRM_Utils_Array::value('height_image_2', $formattedRow)) && !empty($formattedRow['height_image_1'])) {
       $startOffset = CRM_Utils_Array::value('height_image_1', $formattedRow);
     }
     elseif (!empty($formattedRow['height_image_2'])) {
index 8b6c74c741f04017b81a6c5a3b767de84e2d5b21..e2f7ee75ed52e3dde730633d572efabcfdc25e11 100644 (file)
@@ -66,7 +66,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
 
     $batch = new CRM_Batch_DAO_Batch();
     $batch->copyValues($params);
-    if ($context == 'financialBatch' && CRM_Utils_Array::value('batchID', $ids)) {
+    if ($context == 'financialBatch' && !empty($ids['batchID'])) {
       $batch->id = $ids['batchID'];
     }
     $batch->save();
index 367200592b09f4f2368420956db24fcb9d5ac7c2..309b4a2c25a11799574acdba00ff80a113a84ec7 100644 (file)
@@ -256,11 +256,10 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
       $batchTotal += $value['total_amount'];
 
       //validate for soft credit fields
-      if (!empty($params['soft_credit_contact_select_id'][$key]) && !CRM_Utils_Array::value($key, $params['soft_credit_amount'])) {
+      if (!empty($params['soft_credit_contact_select_id'][$key]) && empty($params['soft_credit_amount'][$key])) {
         $errors["soft_credit_amount[$key]"] = ts('Please enter the soft credit amount.');
       }
-      if (!empty($params['soft_credit_amount']) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])
-        && CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value($key, $params['soft_credit_amount'])) > CRM_Utils_Rule::cleanMoney($value['total_amount'])) {
+      if (!empty($params['soft_credit_amount']) && !empty($params['soft_credit_amount'][$key]) && CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value($key, $params['soft_credit_amount'])) > CRM_Utils_Rule::cleanMoney($value['total_amount'])) {
         $errors["soft_credit_amount[$key]"] = ts('Soft credit amount should not be greater than the total amount');
       }
 
@@ -417,7 +416,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         $this->updateContactInfo($value);
 
         //build soft credit params
-        if (!empty($params['soft_credit_contact_select_id'][$key]) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) {
+        if (!empty($params['soft_credit_contact_select_id'][$key]) && !empty($params['soft_credit_amount'][$key])) {
           $value['soft_credit'][$key]['contact_id'] = $params['soft_credit_contact_select_id'][$key];
           $value['soft_credit'][$key]['amount'] = CRM_Utils_Rule::cleanMoney($params['soft_credit_amount'][$key]);
           $value['soft_credit'][$key]['soft_credit_type_id'] = $params['field'][$key]['soft_credit_type'];
@@ -477,7 +476,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         //CRM-11529 for backoffice transactions
         //when financial_type_id is passed in form, update the
         //lineitems with the financial type selected in form
-        if (!empty($value['financial_type_id']) && CRM_Utils_Array::value($priceSetId, $lineItem)) {
+        if (!empty($value['financial_type_id']) && !empty($lineItem[$priceSetId])) {
           foreach ($lineItem[$priceSetId] as &$values) {
             $values['financial_type_id'] = $value['financial_type_id'];
           }
@@ -510,8 +509,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         // end of premium
 
         //send receipt mail.
-        if ( $contribution->id &&
-          CRM_Utils_Array::value( 'send_receipt', $value ) ) {
+        if ( $contribution->id && !empty($value['send_receipt'])) {
             // add the domain email id
             $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
             $domainEmail = "$domainEmail[0] <$domainEmail[1]>";
@@ -632,7 +630,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         }
 
         // handle soft credit
-        if (is_array(CRM_Utils_Array::value('soft_credit_contact_select_id', $params)) && CRM_Utils_Array::value($key, $params['soft_credit_contact_select_id']) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) {
+        if (is_array(CRM_Utils_Array::value('soft_credit_contact_select_id', $params)) && !empty($params['soft_credit_contact_select_id'][$key]) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) {
           $value['soft_credit'][$key]['contact_id'] = $params['soft_credit_contact_select_id'][$key];
           $value['soft_credit'][$key]['amount'] = CRM_Utils_Rule::cleanMoney($params['soft_credit_amount'][$key]);
         }
@@ -687,7 +685,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
           //CRM-11529 for backoffice transactions
           //when financial_type_id is passed in form, update the
           //lineitems with the financial type selected in form
-          if (!empty($value['financial_type_id']) && CRM_Utils_Array::value($priceSetId, $lineItem)) {
+          if (!empty($value['financial_type_id']) && !empty($lineItem[$priceSetId])) {
             foreach ($lineItem[$priceSetId] as &$values) {
               $values['financial_type_id'] = $value['financial_type_id'];
             }
@@ -743,8 +741,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         // end of premium
 
         //send receipt mail.
-        if ( $membership->id &&
-          CRM_Utils_Array::value( 'send_receipt', $value ) ) {
+        if ( $membership->id && !empty($value['send_receipt'])) {
 
             // add the domain email id
             $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
index 707005b282dab4d0e439dc5d9064d4924076a675..8987e529d2c05b0f282375d6c2e78f1ede46875e 100644 (file)
@@ -76,7 +76,7 @@ Class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign {
 
     $groupTableName = CRM_Contact_BAO_Group::getTableName();
 
-    if (isset($params['groups']) && CRM_Utils_Array::value('include', $params['groups']) && is_array($params['groups']['include'])) {
+    if (isset($params['groups']) && !empty($params['groups']['include']) && is_array($params['groups']['include'])) {
       foreach ($params['groups']['include'] as $entityId) {
         $dao               = new CRM_Campaign_DAO_CampaignGroup();
         $dao->campaign_id  = $campaign->id;
index c7ba98a9d740638e9807f28722e8410fe11eda6c..35efeb9d4d33286803cdcf76a8fd0542bb183285 100755 (executable)
@@ -293,9 +293,7 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form {
 
       $currentTaskValue = CRM_Utils_Array::value($this->_operation, $taskMapping);
       $taskValue = array($currentTaskValue => $allTasks[$currentTaskValue]);
-      if ($this->_operation == 'interview' &&
-        CRM_Utils_Array::value('campaign_survey_id', $this->_formValues)
-      ) {
+      if ($this->_operation == 'interview' && !empty($this->_formValues['campaign_survey_id'])) {
         $activityTypes = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
 
         $surveyTypeId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey',
index 8fe61103089421132ab0fe79f5fc1723c57f0869..552df9686c27e048e0b7cf76a9264cf8d1080f66 100644 (file)
@@ -118,9 +118,7 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey {
 
     if ($this->_surveyId) {
 
-      if (!empty($defaults['result_id']) &&
-        CRM_Utils_Array::value('recontact_interval', $defaults)
-      ) {
+      if (!empty($defaults['result_id']) && !empty($defaults['recontact_interval'])) {
 
         $resultId = $defaults['result_id'];
         $recontactInterval = unserialize($defaults['recontact_interval']);
index f4daeef73056d3f23cc25742c773f732f3681eea..2bc46584173ebb1fec70186743dc1d0038de2a2f 100644 (file)
@@ -131,7 +131,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
         'onclick' => "showOptionSelect();"), '<br/>', TRUE
     );
 
-    if (empty($optionGroups) || !CRM_Utils_Array::value('result_id', $this->_values)) {
+    if (empty($optionGroups) || empty($this->_values['result_id'])) {
       $this->setdefaults(array('option_type' => 1));
     }
     elseif (!empty($this->_values['result_id'])) {
@@ -206,24 +206,19 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
    */
   static function formRule($fields, $files, $form) {
     $errors = array();
-    if (!empty($fields['option_label']) &&
-      CRM_Utils_Array::value('option_value', $fields) &&
+    if (!empty($fields['option_label']) && !empty($fields['option_value']) &&
       (count(array_filter($fields['option_label'])) == 0) &&
       (count(array_filter($fields['option_value'])) == 0)
     ) {
       $errors['option_label[1]'] = ts('Enter at least one result option.');
       return $errors;
     }
-    elseif (empty($fields['option_label']) &&
-      !CRM_Utils_Array::value('option_value', $fields)
-    ) {
+    elseif (empty($fields['option_label']) && empty($fields['option_value'])) {
       return $errors;
     }
 
     if (
-      $fields['option_type'] == 2 &&
-      !CRM_Utils_Array::value('option_group_id', $fields)
-    ) {
+      $fields['option_type'] == 2 && empty($fields['option_group_id'])) {
       $errors['option_group_id'] = ts("Please select a Survey Result Set.");
       return $errors;
     }
@@ -343,9 +338,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
 
     $updateResultSet = FALSE;
     $resultSetOptGrpId = NULL;
-    if ((CRM_Utils_Array::value('option_type', $params) == 2) &&
-      CRM_Utils_Array::value('option_group_id', $params)
-    ) {
+    if ((CRM_Utils_Array::value('option_type', $params) == 2) && !empty($params['option_group_id'])) {
       $updateResultSet = TRUE;
       $resultSetOptGrpId = $params['option_group_id'];
     }
@@ -399,7 +392,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
     $survey = CRM_Campaign_BAO_Survey::create($params);
 
     // create report if required.
-    if ( !$this->_reportId && $survey->id && CRM_Utils_Array::value('create_report', $params) ) {
+    if ( !$this->_reportId && $survey->id && !empty($params['create_report'])) {
       $activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
       $activityStatus = array_flip($activityStatus);
       $this->_params =
index 015778821e62ca3c35c22c358313db5287580d8c..f491c238bffbb9455f6f271dc8c7b17f9718f0a9 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Campaign_Form_Survey_TabHeader {
 
   static function build(&$form) {
     $tabs = $form->get('tabHeader');
-    if (!$tabs || !CRM_Utils_Array::value('reset', $_GET)) {
+    if (!$tabs || empty($_GET['reset'])) {
       $tabs = self::process($form);
       $form->set('tabHeader', $tabs);
     }
index e6a451c42b1bb440d18383349f575347b1cd278f..2f6fd08c52c84a8e25cbc6ebb1c77d2b8932b35c 100755 (executable)
@@ -103,8 +103,7 @@ class CRM_Campaign_Form_Task_Interview extends CRM_Campaign_Form_Task {
 
     $orderClause = false;
     $buttonName  = $this->controller->getButtonName();
-    if ( $buttonName == '_qf_Interview_submit_orderBy' &&
-      CRM_Utils_Array::value('order_bys', $_POST) ) {
+    if ( $buttonName == '_qf_Interview_submit_orderBy' && !empty($_POST['order_bys'])) {
       $orderByParams = CRM_Utils_Array::value('order_bys', $_POST);
     }
     elseif ( CRM_Core_OptionGroup::getValue('activity_type','WalkList') == $this->_surveyDetails['activity_type_id'] ) {
index 29ec3fa06a419157c8bb18d13398931b69a75097..7dcf6006fa6a4cabbe0328d2c4f59544b34a4fb3 100644 (file)
@@ -64,8 +64,7 @@ class CRM_Campaign_Page_AJAX {
       }
     }
 
-    if (isset($_POST['field']) &&
-      CRM_Utils_Array::value($voterId, $_POST['field']) &&
+    if (isset($_POST['field']) && !empty($_POST['field'][$voterId]) &&
       is_array($_POST['field'][$voterId])
     ) {
       foreach ($_POST['field'][$voterId] as $fieldKey => $value) {
index f748309dce4aa54583c14e96155ce10716599f3d..ae76dc5b8b9cd4db903a04ddb0440f164e7602da 100644 (file)
@@ -927,7 +927,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type
 
     $res = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     while ($res->fetch()) {
-      if (!empty($rows[$res->case_type]) && CRM_Utils_Array::value($res->case_status, $rows[$res->case_type])) {
+      if (!empty($rows[$res->case_type]) && !empty($rows[$res->case_type][$res->case_status])) {
         $rows[$res->case_type][$res->case_status]['count'] = $rows[$res->case_type][$res->case_status]['count'] + 1;
       }
       else {
index 2a5ffa0e617f5d1768dd3abc2b827187083fc7e4..a2a37907e5c30fbb499461694b32ea01f34c5221 100644 (file)
@@ -51,9 +51,7 @@ class CRM_Case_BAO_Query {
    * @access public
    */
   static function select(&$query) {
-    if (($query->_mode & CRM_Contact_BAO_Query::MODE_CASE) ||
-      CRM_Utils_Array::value('case_id', $query->_returnProperties)
-    ) {
+    if (($query->_mode & CRM_Contact_BAO_Query::MODE_CASE) || !empty($query->_returnProperties['case_id'])) {
       $query->_select['case_id'] = "civicrm_case.id as case_id";
       $query->_element['case_id'] = 1;
       $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
index e39601b05cc99ef12b6faca02b09b822ac516eea..91f10ed18473f4c112cf3e6a3ca4c763d7a8bfa7 100644 (file)
@@ -114,9 +114,7 @@ class CRM_Case_Form_Activity_ChangeCaseStatus {
     $groupingValues = CRM_Core_OptionGroup::values('case_status', FALSE, TRUE, FALSE, NULL, 'value');
 
     // Set case end_date if we're closing the case. Clear end_date if we're (re)opening it.
-    if (CRM_Utils_Array::value($params['case_status_id'], $groupingValues) == 'Closed'
-      && CRM_Utils_Array::value('activity_date_time', $params)
-    ) {
+    if (CRM_Utils_Array::value($params['case_status_id'], $groupingValues) == 'Closed' && !empty($params['activity_date_time'])) {
       $params['end_date'] = $params['activity_date_time'];
 
       // End case-specific relationships (roles)
index 6153f2f4182edf044b819c329b2c09d525dc14b1..aab99ce3d0985e0445003007ea4cb6a47175f8f1 100644 (file)
@@ -207,7 +207,7 @@ class CRM_Case_Form_Activity_OpenCase {
     }
 
     // set the contact, when contact is selected
-    if (isset($params['contact_select_id']) && CRM_Utils_Array::value(1, $params['contact_select_id'])) {
+    if (isset($params['contact_select_id']) && !empty($params['contact_select_id'][1])) {
       $params['contact_id'] = $params['contact_select_id'][1];
       $form->_currentlyViewedContactId = $params['contact_id'];
     }
index 8acee3dc87afa83b4bc11c95fb545061adfd8ead..248e19955c72f889b76c6e369cfb1433c907905c 100644 (file)
@@ -488,9 +488,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form {
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext($url);
 
-    if (!empty($params['timeline_id']) &&
-      CRM_Utils_Array::value('_qf_CaseView_next', $_POST)
-    ) {
+    if (!empty($params['timeline_id']) && !empty($_POST['_qf_CaseView_next'])) {
       $session            = CRM_Core_Session::singleton();
       $this->_uid         = $session->get('userID');
       $xmlProcessor       = new CRM_Case_XMLProcessor_Process();
index da63d1e565c468ad6d01d108f3c2d6051b513a04..fafe395c9a32d47670f6a0a9739c145c6db20b7e 100644 (file)
@@ -272,9 +272,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
    */
   static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
       $contact = NULL;
-      if (empty($params['contact_type']) &&
-        !CRM_Utils_Array::value('contact_id', $params)
-      ) {
+      if (empty($params['contact_type']) && empty($params['contact_id'])) {
         return $contact;
       }
 
@@ -1765,9 +1763,7 @@ ORDER BY civicrm_email.is_primary DESC";
       $isOptOut           = CRM_Utils_Array::value('is_opt_out', $params, FALSE);
       $data['is_opt_out'] = $isOptOut;
       // on change, create new civicrm_subscription_history entry
-      if (($wasOptOut != $isOptOut) &&
-        CRM_Utils_Array::value('contact_id', $contactDetails)
-      ) {
+      if (($wasOptOut != $isOptOut) && !empty($contactDetails['contact_id'])) {
         $shParams = array(
           'contact_id' => $contactDetails['contact_id'],
           'status' => $isOptOut ? 'Removed' : 'Added',
index c1d31856ff6aa1e39772da941a9b5c269f6ba023..6169b972123a9a5a73714dc363e797d49e8dc329 100644 (file)
@@ -848,9 +848,7 @@ Group By  componentId";
     $skipFields = array('is_primary', 'location_type_id', 'is_billing', 'master_id');
     foreach ($address as & $values) {
       // 2. check if master id exists, if not continue
-      if (empty($values['master_id']) ||
-        !CRM_Utils_Array::value('use_shared_address', $values)
-      ) {
+      if (empty($values['master_id']) || empty($values['use_shared_address'])) {
         // we should unset master id when use uncheck share address for existing address
         $values['master_id'] = 'null';
         continue;
index dcc59a8b4d026d45417e3199d31123ff35fe0c97..706d99125871e26255286b995b1dd8a7f6c5ff2f 100644 (file)
@@ -355,9 +355,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
 
     // form the name only if missing: CRM-627
     $nameParam = CRM_Utils_Array::value('name', $params, NULL);
-    if (!$nameParam &&
-      !CRM_Utils_Array::value('id', $params)
-    ) {
+    if (!$nameParam && empty($params['id'])) {
       $params['name'] = CRM_Utils_String::titleToVar($params['title']);
     }
 
@@ -709,8 +707,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
         $groupList[$id]['class'] = implode(' ', $value['class']);
 
         // append parent names if in search mode
-        if (empty($params['parent_id']) &&
-        CRM_Utils_Array::value( 'parents', $value ) ) {
+        if (empty($params['parent_id']) && !empty($value['parents'])) {
           $groupIds = explode(',', $value['parents']);
           $title = array();
           foreach($groupIds as $gId) {
index db3c0d0b4f1dd698594954a63356db33d9d952af..01c0df9cb1d511a256441566f49b47b4ab48d303 100644 (file)
@@ -101,9 +101,7 @@ class CRM_Contact_BAO_GroupOrganization extends CRM_Contact_DAO_GroupOrganizatio
    */
   static function dataExists($params) {
     // return if no data present
-    if (!empty($params['organization_id']) &&
-      CRM_Utils_Array::value('group_id', $params)
-    ) {
+    if (!empty($params['organization_id']) && !empty($params['group_id'])) {
       return TRUE;
     }
     return FALSE;
index 5d13d0c5e5a001239c61a26a659492f573115fcf..104b88976062576f48358dc84449f7accd2dd73a 100644 (file)
@@ -101,7 +101,7 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
           $value = $individual->$dbName;
 
           // the db has name values
-          if ($value && CRM_Utils_Array::value('preserveDBName', $params)) {
+          if ($value && !empty($params['preserveDBName'])) {
             $useDBNames[] = $name;
           }
         }
@@ -109,12 +109,12 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
         foreach (array('prefix', 'suffix') as $name) {
           $dbName = "{$name}_id";
           $value = $individual->$dbName;
-          if ($value && CRM_Utils_Array::value('preserveDBName', $params)) {
+          if ($value && !empty($params['preserveDBName'])) {
             $useDBNames[] = $name;
           }
         }
 
-        if ($individual->formal_title && CRM_Utils_Array::value('preserveDBName', $params)) {
+        if ($individual->formal_title && !empty($params['preserveDBName'])) {
           $useDBNames[] = 'formal_title';
         }
 
index 56c7d8f0cabfc17a8080da4d3eafb5d0290317ef..69e4a22e4adc10f5bd7468f37868d8d019cb3730 100644 (file)
@@ -647,8 +647,7 @@ class CRM_Contact_BAO_Query {
       }
 
       $cfID = CRM_Core_BAO_CustomField::getKeyID($name);
-      if (!empty($this->_paramLookup[$name]) ||
-        CRM_Utils_Array::value($name, $this->_returnProperties) ||
+      if (!empty($this->_paramLookup[$name]) || !empty($this->_returnProperties[$name]) ||
         $makeException
       ) {
         if ($cfID) {
@@ -838,9 +837,7 @@ class CRM_Contact_BAO_Query {
         }
       }
 
-      if ($cfID &&
-        CRM_Utils_Array::value('is_search_range', $field)
-      ) {
+      if ($cfID && !empty($field['is_search_range'])) {
         // this is a custom field with range search enabled, so we better check for two/from values
         if (!empty($this->_paramLookup[$name . '_from'])) {
           if (!array_key_exists($cfID, $this->_cfIDs)) {
@@ -1833,7 +1830,7 @@ class CRM_Contact_BAO_Query {
     $grouping = CRM_Utils_Array::value(3, $values);
     $wildcard = CRM_Utils_Array::value(4, $values);
 
-    if (isset($grouping) && !CRM_Utils_Array::value($grouping, $this->_where)) {
+    if (isset($grouping) && empty($this->_where[$grouping])) {
       $this->_where[$grouping] = array();
     }
 
@@ -2282,27 +2279,21 @@ class CRM_Contact_BAO_Query {
       $tables = array_merge(array('civicrm_country' => 1), $tables);
     }
 
-    if ((CRM_Utils_Array::value('civicrm_state_province', $tables) ||
-        CRM_Utils_Array::value('civicrm_country', $tables) ||
+    if ((!empty($tables['civicrm_state_province']) || !empty($tables['civicrm_country']) ||
         CRM_Utils_Array::value('civicrm_county', $tables)
-      ) &&
-      !CRM_Utils_Array::value('civicrm_address', $tables)
-    ) {
+      ) && empty($tables['civicrm_address'])) {
       $tables = array_merge(array('civicrm_address' => 1),
         $tables
       );
     }
 
     // add group_contact table if group table is present
-    if (!empty($tables['civicrm_group']) &&
-      !CRM_Utils_Array::value('civicrm_group_contact', $tables)
-    ) {
+    if (!empty($tables['civicrm_group']) && empty($tables['civicrm_group_contact'])) {
       $tables['civicrm_group_contact'] = " LEFT JOIN civicrm_group_contact ON civicrm_group_contact.contact_id = contact_a.id AND civicrm_group_contact.status = 'Added'";
     }
 
     // add group_contact and group table is subscription history is present
-    if (!empty($tables['civicrm_subscription_history']) && !CRM_Utils_Array::value('civicrm_group', $tables)
-    ) {
+    if (!empty($tables['civicrm_subscription_history']) && empty($tables['civicrm_group'])) {
       $tables = array_merge(array(
         'civicrm_group' => 1,
           'civicrm_group_contact' => 1,
index 7ec060ba9635c38b94c5336d29205160e2b6d5aa..68bb10fcd8ee1587c57136ab67718e93810f0af2 100644 (file)
@@ -132,9 +132,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
 
       $validContacts = TRUE;
       //validate contacts in update mode also.
-      if (!empty($ids['contact']) &&
-        CRM_Utils_Array::value('contactTarget', $ids)
-      ) {
+      if (!empty($ids['contact']) && !empty($ids['contactTarget'])) {
         if (self::checkValidRelationship($params, $ids, $ids['contactTarget'])) {
           $validContacts = FALSE;
           $invalid++;
@@ -150,7 +148,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
     }
 
     // do not add to recent items for import, CRM-4399
-    if (!(CRM_Utils_Array::value('skipRecentView', $params) || $invalid || $duplicate)) {
+    if (!(!empty($params['skipRecentView']) || $invalid || $duplicate)) {
       $url = CRM_Utils_System::url('civicrm/contact/view/rel',
         "action=view&reset=1&id={$relationship->id}&cid={$relationship->contact_id_a}&context=home"
       );
index 390a90dd5d6c0bcd448260544f14f5964ad87e64..09906576920ecb719b6eca7a192cf640ebd8166f 100644 (file)
@@ -92,21 +92,21 @@ class CRM_Contact_BAO_RelationshipType extends CRM_Contact_DAO_RelationshipType
    */
   static function add(&$params, &$ids) {
     //to change name, CRM-3336
-    if (empty($params['label_a_b']) && CRM_Utils_Array::value('name_a_b', $params)) {
+    if (empty($params['label_a_b']) && !empty($params['name_a_b'])) {
       $params['label_a_b'] = $params['name_a_b'];
     }
 
-    if (empty($params['label_b_a']) && CRM_Utils_Array::value('name_b_a', $params)) {
+    if (empty($params['label_b_a']) && !empty($params['name_b_a'])) {
       $params['label_b_a'] = $params['name_b_a'];
     }
 
     // set label to name if it's not set - but *only* for
     // ADD action. CRM-3336 as part from (CRM-3522)
     if (empty($ids['relationshipType'])) {
-      if (empty($params['name_a_b']) && CRM_Utils_Array::value('label_a_b', $params)) {
+      if (empty($params['name_a_b']) && !empty($params['label_a_b'])) {
         $params['name_a_b'] = $params['label_a_b'];
       }
-      if (empty($params['name_b_a']) && CRM_Utils_Array::value('label_b_a', $params)) {
+      if (empty($params['name_b_a']) && !empty($params['label_b_a'])) {
         $params['name_b_a'] = $params['label_b_a'];
       }
     }
index 3c74e1fd130632e53cc333698afd84b7a93894a7..1f630b660583499dfe2f766d4de3a9b4fe7cfb05 100644 (file)
@@ -169,9 +169,7 @@ class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch {
 
   static function contactIDsSQL($id) {
     $params = self::getSearchParams($id);
-    if ($params &&
-      CRM_Utils_Array::value('customSearchID', $params)
-    ) {
+    if ($params && !empty($params['customSearchID'])) {
       return CRM_Contact_BAO_SearchCustom::contactIDSQL(NULL, $id);
     }
     else {
index b1b89e79e590dbad5a942404740fbf189e317678..2610fa6376240f6bde6f232cd8a4b2f22b4b2bb2 100644 (file)
@@ -265,9 +265,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
         'address_options'
       );
       $this->_parseStreetAddress = FALSE;
-      if (!empty($addressOptions['street_address']) &&
-        CRM_Utils_Array::value('street_address_parsing', $addressOptions)
-      ) {
+      if (!empty($addressOptions['street_address']) && !empty($addressOptions['street_address_parsing'])) {
         $this->_parseStreetAddress = TRUE;
       }
       $this->set('parseStreetAddress', $this->_parseStreetAddress);
@@ -659,9 +657,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
               $hasPrimary[] = $instance;
               if (!$primaryID &&
                 in_array($name, array(
-                  'email', 'openid')) &&
-                CRM_Utils_Array::value($name, $blockValues)
-              ) {
+                  'email', 'openid')) && !empty($blockValues[$name])) {
                 $primaryID = $blockValues[$name];
               }
             }
@@ -671,7 +667,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
             }
           }
 
-          if ($name == 'openid' && CRM_Utils_Array::value($name, $blockValues)) {
+          if ($name == 'openid' && !empty($blockValues[$name])) {
             $oid         = new CRM_Core_DAO_OpenID();
             $oid->openid = $openIds[$instance] = CRM_Utils_Array::value($name, $blockValues);
             $cid         = isset($contactId) ? $contactId : 0;
@@ -895,9 +891,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
       CRM_Contact_BAO_Contact::processImageParams($params);
     }
 
-    if (is_numeric(CRM_Utils_Array::value('current_employer_id', $params))
-      && CRM_Utils_Array::value('current_employer', $params)
-    ) {
+    if (is_numeric(CRM_Utils_Array::value('current_employer_id', $params)) && !empty($params['current_employer'])) {
       $params['current_employer'] = $params['current_employer_id'];
     }
 
@@ -918,10 +912,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     }
 
     //make deceased date null when is_deceased = false
-    if ($this->_contactType == 'Individual' &&
-      CRM_Utils_Array::value('Demographics', $this->_editOptions) &&
-      !CRM_Utils_Array::value('is_deceased', $params)
-    ) {
+    if ($this->_contactType == 'Individual' && !empty($this->_editOptions['Demographics']) && empty($params['is_deceased'])) {
       $params['is_deceased'] = FALSE;
       $params['deceased_date'] = NULL;
     }
@@ -980,9 +971,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
       $contactGroupList = CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], 'Added');
       if (is_array($contactGroupList)) {
         foreach ($contactGroupList as $key) {
-          if ((!array_key_exists($key['group_id'], $params['group']) || $params['group'][$key['group_id']] != 1)
-            && !CRM_Utils_Array::value('is_hidden', $key)
-          ) {
+          if ((!array_key_exists($key['group_id'], $params['group']) || $params['group'][$key['group_id']] != 1) && empty($key['is_hidden'])) {
             $params['group'][$key['group_id']] = -1;
           }
         }
@@ -1273,9 +1262,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
         $success = TRUE;
         // consider address is automatically parseable,
         // when we should found street_number and street_name
-        if (empty($parsedFields['street_name']) ||
-          !CRM_Utils_Array::value('street_number', $parsedFields)
-        ) {
+        if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) {
           $success = FALSE;
         }
 
@@ -1379,9 +1366,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
 
     // process to set membership status to deceased for both active/inactive membership
     if ($contactId &&
-      $this->_contactType == 'Individual' &&
-      CRM_Utils_Array::value('is_deceased', $deceasedParams)
-    ) {
+      $this->_contactType == 'Individual' && !empty($deceasedParams['is_deceased'])) {
 
       $session = CRM_Core_Session::singleton();
       $userId = $session->get('userID');
index 2f89b7e7a1f59bbc67faa324d21d935e0a997dcf..d6b47e9503291a9042b889787da5e58147ea8d39 100644 (file)
@@ -140,9 +140,7 @@ class CRM_Contact_Form_Edit_Address {
       if (empty($addressOptions[$nameWithoutID])) {
         $continue = TRUE;
         if (in_array($nameWithoutID, array(
-          'street_number', 'street_name', 'street_unit')) &&
-          CRM_Utils_Array::value('street_address_parsing', $addressOptions)
-        ) {
+          'street_number', 'street_name', 'street_unit')) && !empty($addressOptions['street_address_parsing'])) {
           $continue = FALSE;
         }
         if ($continue) {
@@ -219,7 +217,7 @@ class CRM_Contact_Form_Edit_Address {
     CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap);
 
     $entityId = NULL;
-    if (!empty($form->_values['address']) && CRM_Utils_Array::value($blockId, $form->_values['address'])) {
+    if (!empty($form->_values['address']) && !empty($form->_values['address'][$blockId])) {
       $entityId = $form->_values['address'][$blockId]['id'];
     }
 
@@ -400,7 +398,7 @@ class CRM_Contact_Form_Edit_Address {
           }
         }
 
-        if (!empty($addressValues['use_shared_address']) && !CRM_Utils_Array::value('master_id', $addressValues)) {
+        if (!empty($addressValues['use_shared_address']) && empty($addressValues['master_id'])) {
           $errors["address[$instance][use_shared_address]"] = ts('Please select valid shared contact or a contact with valid address.');
         }
       }
@@ -476,10 +474,8 @@ class CRM_Contact_Form_Edit_Address {
 
     // CRM-7296 freeze the select for state if address is shared with household
     // CRM-9070 freeze the select for state if it is view only
-    if (isset($form->_fields) &&
-      CRM_Utils_Array::value($stateElementName, $form->_fields) &&
-      (CRM_Utils_Array::value('is_shared', $form->_fields[$stateElementName]) ||
-        CRM_Utils_Array::value('is_view', $form->_fields[$stateElementName]))
+    if (isset($form->_fields) && !empty($form->_fields[$stateElementName]) &&
+      (!empty($form->_fields[$stateElementName]['is_shared']) || !empty($form->_fields[$stateElementName]['is_view']))
     ) {
       $stateSelect->freeze();
     }
@@ -563,9 +559,7 @@ class CRM_Contact_Form_Edit_Address {
 
         //hack to handle show/hide address fields.
         $parsedAddress = array();
-        if ($form->_contactId &&
-          CRM_Utils_Array::value('address', $_POST)
-          && is_array($_POST['address'])
+        if ($form->_contactId && !empty($_POST['address']) && is_array($_POST['address'])
         ) {
           foreach ($_POST['address'] as $cnt => $values) {
             $showField = 'streetAddress';
index aa2bc1952d4b82b62d6f0c3c76c2649044a54c8a..8b5880c6e0fc9c023bff54c91373085fc8e3c34d 100644 (file)
@@ -152,9 +152,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
     $greetings = self::getGreetingFields($self->_contactType);
     foreach ($greetings as $greeting => $details) {
       $customizedValue = CRM_Core_OptionGroup::getValue($greeting, 'Customized', 'name');
-      if (CRM_Utils_Array::value($details['field'], $fields) == $customizedValue
-        && !CRM_Utils_Array::value($details['customField'], $fields)
-      ) {
+      if (CRM_Utils_Array::value($details['field'], $fields) == $customizedValue && empty($fields[$details['customField']])) {
         $errors[$details['customField']] = ts('Custom  %1 is a required field if %1 is of type Customized.',
           array(1 => $details['label'])
         );
index 6bbaf902a67e40a81adf6cbeed47933424093b21..7ccf43f1684b25630ea90310b51c4ced360f5727 100644 (file)
@@ -89,9 +89,7 @@ class CRM_Contact_Form_Edit_CustomData {
 
     //build custom data.
     $contactSubType = NULL;
-    if (!empty($_POST["hidden_custom"]) &&
-      CRM_Utils_Array::value('contact_sub_type', $_POST)
-    ) {
+    if (!empty($_POST["hidden_custom"]) && !empty($_POST['contact_sub_type'])) {
       $contactSubType = $_POST['contact_sub_type'];
     }
     else {
index 692d8e5d3193a2b5a5b90494ab0f65da588cddaa..2ceac12ca2e9469f0eb03edf833f821b6acb52cc 100644 (file)
@@ -157,9 +157,7 @@ class CRM_Contact_Form_Edit_Individual {
     $primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID);
 
     // make sure that firstName and lastName or a primary OpenID is set
-    if (!$primaryID && (!CRM_Utils_Array::value('first_name', $fields) ||
-        !CRM_Utils_Array::value('last_name', $fields)
-      )) {
+    if (!$primaryID && (empty($fields['first_name']) || empty($fields['last_name']))) {
       $errors['_qf_default'] = ts('First Name and Last Name OR an email OR an OpenID in the Primary Location should be set.');
     }
 
index 8f10acdcdeebbdbdaaf7a6bbae134afee14e0d72..e7f0b3e64d2e26f01046a991496ec0f876ae328c 100644 (file)
@@ -111,9 +111,7 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline {
         'address_options'
       );
       $this->_parseStreetAddress = FALSE;
-      if (!empty($addressOptions['street_address']) &&
-        CRM_Utils_Array::value('street_address_parsing', $addressOptions)
-      ) {
+      if (!empty($addressOptions['street_address']) && !empty($addressOptions['street_address_parsing'])) {
         $this->_parseStreetAddress = TRUE;
       }
       $this->set('parseStreetAddress', $this->_parseStreetAddress);
index 85e5777763973c1da0a290a70ee65bf700f56cf2..aab720440a1a98e02e624881eb5651a94dd6a2c4 100644 (file)
@@ -116,8 +116,7 @@ class CRM_Contact_Form_Inline_IM extends CRM_Contact_Form_Inline {
           $hasData[] = $instance;
           if (!empty($blockValues['is_primary'])) {
             $hasPrimary[] = $instance;
-            if (!$primaryID &&
-              CRM_Utils_Array::value('im', $blockValues)) {
+            if (!$primaryID && !empty($blockValues['im'])) {
                 $primaryID = $blockValues['im'];
             }
           }
index ca76f95874e39f82a27d3b87ceeee2e5279d2c24..327d0ff5d22f6ba6de48e1a5b816f30e505ea59c 100644 (file)
@@ -116,8 +116,7 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
           $hasData[] = $instance;
           if (!empty($blockValues['is_primary'])) {
             $hasPrimary[] = $instance;
-            if (!$primaryID &&
-              CRM_Utils_Array::value('openid', $blockValues)) {
+            if (!$primaryID && !empty($blockValues['openid'])) {
                 $primaryID = $blockValues['openid'];
             }
           }
index 1122945c8afc1335af6f31ac295b1ee52240fbd2..91fd56375b99d57e826b1eb4683082946155d517 100644 (file)
@@ -117,8 +117,7 @@ class CRM_Contact_Form_Inline_Phone extends CRM_Contact_Form_Inline {
           $hasData[] = $instance;
           if (!empty($blockValues['is_primary'])) {
             $hasPrimary[] = $instance;
-            if (!$primaryID &&
-              CRM_Utils_Array::value('phone', $blockValues)) {
+            if (!$primaryID && !empty($blockValues['phone'])) {
                 $primaryID = $blockValues['phone'];
             }
           }
index 3e3694110512867db68bd70c80f50982307cf6e6..c42e370863eac12781ed64bd93ea6c50dfe26acf 100644 (file)
@@ -91,7 +91,7 @@ class CRM_Contact_Form_Location {
       if (!empty($_POST[$name]) && is_array($_POST[$name])) {
         $instances = array_keys($_POST[$name]);
       }
-      elseif (property_exists($form, '_values') && CRM_Utils_Array::value($name, $form->_values) && is_array($form->_values[$name])) {
+      elseif (property_exists($form, '_values') && !empty($form->_values[$name]) && is_array($form->_values[$name])) {
         $instances = array_keys($form->_values[$name]);
       }
 
index 9249162ebabaa6cff4dccd2b21e7112263e4ffb0..11e268c542fb63a16f377f57d4247176d5606fdd 100644 (file)
@@ -101,10 +101,7 @@ class CRM_Contact_Form_ProfileContact {
     // add the form elements
     foreach ($honoreeProfileFields as $name => $field) {
       // If soft credit type is not chosen then make omit requiredness from honoree profile fields
-      if (count($form->_submitValues) &&
-        !CRM_Utils_Array::value('soft_credit_type_id', $form->_submitValues) &&
-        CRM_Utils_Array::value('is_required', $field)
-      ) {
+      if (count($form->_submitValues) && empty($form->_submitValues['soft_credit_type_id']) && !empty($field['is_required'])) {
         $field['is_required'] = FALSE;
       }
       CRM_Core_BAO_UFGroup::buildProfile($form, $field, CRM_Profile_Form::MODE_CREATE, NULL, FALSE, FALSE, NULL, $prefix);
@@ -114,7 +111,7 @@ class CRM_Contact_Form_ProfileContact {
   static function postProcess($form) {
     $params = $form->_params;
     $values = $form->_values;
-    if ($form->get('honor_block_is_active') && CRM_Utils_Array::value('soft_credit_type_id', $params)) {
+    if ($form->get('honor_block_is_active') && !empty($params['soft_credit_type_id'])) {
       $honorId = null;
 
       //check if there is any duplicate contact
index 6dddf7a7ca4c25dad52f2be3ca6b24a4d2e616de..f4d7bd44ef558cffe3ad408e536108828ff240ac 100644 (file)
@@ -469,9 +469,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
     // store the submitted values in an array
     $params = $this->controller->exportValues($this->_name);
     $quickSave = FALSE;
-    if (!empty($_POST['_qf_Relationship_refresh_save']) ||
-      CRM_Utils_Array::value('_qf_Relationship_refresh_savedetails', $_POST)
-    ) {
+    if (!empty($_POST['_qf_Relationship_refresh_save']) || !empty($_POST['_qf_Relationship_refresh_savedetails'])) {
       $quickSave = TRUE;
     }
 
@@ -635,9 +633,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
         $orgId = $params['employee_of'];
       }
       elseif ($this->_action & CRM_Core_Action::UPDATE) {
-        if (!empty($params['is_current_employer']) &&
-          CRM_Utils_Array::value('is_active', $params)
-        ) {
+        if (!empty($params['is_current_employer']) && !empty($params['is_active'])) {
           if (CRM_Utils_Array::value('contactTarget', $ids) !=
             CRM_Utils_Array::value('current_employer_id', $this->_values)
           ) {
@@ -710,8 +706,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
    */
   static function formRule($params, $files, $form) {
     // hack, no error check for refresh
-    if (!empty($_POST['_qf_Relationship_refresh']) ||
-      CRM_Utils_Array::value('_qf_Relationship_refresh_save', $_POST) ||
+    if (!empty($_POST['_qf_Relationship_refresh']) || !empty($_POST['_qf_Relationship_refresh_save']) ||
       CRM_Utils_Array::value('_qf_Relationship_refresh_savedetails', $_POST)
     ) {
       return TRUE;
@@ -759,8 +754,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
       }
     }
 
-    if (!empty($params['employer_of']) &&
-      CRM_Utils_Array::value('contact_check', $params) &&
+    if (!empty($params['employer_of']) && !empty($params['contact_check']) &&
       array_diff(array_keys($params['employer_of']), array_keys($params['contact_check']))
     ) {
       if ($form->_callAjax) {
@@ -787,9 +781,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
     $errors = array();
 
     // check start and end date
-    if (!empty($params['start_date']) &&
-      CRM_Utils_Array::value('end_date', $params)
-    ) {
+    if (!empty($params['start_date']) && !empty($params['end_date'])) {
       $start_date = CRM_Utils_Date::format(CRM_Utils_Array::value('start_date', $params));
       $end_date = CRM_Utils_Date::format(CRM_Utils_Array::value('end_date', $params));
       if ($start_date && $end_date && (int ) $end_date < (int ) $start_date) {
index 999aa71772a04eef8c4c36d4d604c802d5510c27..23981363cc08d0a2e206582e04a721960c520112 100644 (file)
@@ -851,21 +851,15 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
     //get the button name
     $buttonName = $this->controller->getButtonName();
 
-    if (isset($this->_ufGroupID) &&
-      !CRM_Utils_Array::value('uf_group_id', $this->_formValues)
-    ) {
+    if (isset($this->_ufGroupID) && empty($this->_formValues['uf_group_id'])) {
       $this->_formValues['uf_group_id'] = $this->_ufGroupID;
     }
 
-    if (isset($this->_componentMode) &&
-      !CRM_Utils_Array::value('component_mode', $this->_formValues)
-    ) {
+    if (isset($this->_componentMode) && empty($this->_formValues['component_mode'])) {
       $this->_formValues['component_mode'] = $this->_componentMode;
     }
 
-    if (isset($this->_operator) &&
-      !CRM_Utils_Array::value('operator', $this->_formValues)
-    ) {
+    if (isset($this->_operator) && empty($this->_formValues['operator'])) {
       $this->_formValues['operator'] = $this->_operator;
     }
 
index a74a9cdfc93a04a2c85a82ba943196a61d8385fe..5d77be01b8c3e29f78337782cc14978e09700dd6 100644 (file)
@@ -145,8 +145,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
       );
 
       // see if we need to include this paneName in the current form
-      if ($this->_searchPane == $type ||
-        CRM_Utils_Array::value("hidden_{$type}", $_POST) ||
+      if ($this->_searchPane == $type || !empty($_POST["hidden_{$type}"]) ||
         CRM_Utils_Array::value("hidden_{$type}", $this->_formValues)
       ) {
         $allPanes[$name]['open'] = 'true';
@@ -261,7 +260,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
       $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
     }
 
-    if (isset($this->_groupID) && !CRM_Utils_Array::value('group', $this->_formValues)) {
+    if (isset($this->_groupID) && empty($this->_formValues['group'])) {
       $this->_formValues['group'] = array($this->_groupID => 1);
     }
 
index 46e76dc98fe4665850f662f182fcea96d92be930..096ad8e1cc7df56a56ca62b84cf903298c5bd423 100644 (file)
@@ -174,7 +174,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
       $this->normalizeFormValues();
     }
 
-    if (isset($this->_groupID) && !CRM_Utils_Array::value('group', $this->_formValues)) {
+    if (isset($this->_groupID) && empty($this->_formValues['group'])) {
       $this->_formValues['group'][$this->_groupID] = 1;
     }
     elseif (isset($this->_ssID) && empty($_POST)) {
index 3159c6d644c6694f0821ecdf473aa9faf5d7c840..b2abeb0586eb76ef582eea5d6434c44802253686 100644 (file)
@@ -146,7 +146,7 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search {
    * @access public
    */
   static function formRule($values, $files, $self) {
-    if (!empty($values['addMore']) || CRM_Utils_Array::value('addBlock', $values)) {
+    if (!empty($values['addMore']) || !empty($values['addBlock'])) {
       return TRUE;
     }
     $fields = self::fields();
index 80613aa979480fb7e72435845d12479d2e3ef7be..0a3a3e5c096e14efddee05ed1c1c5e4d568c7cb1 100644 (file)
@@ -62,9 +62,7 @@ class CRM_Contact_Form_Search_Custom_Basic extends CRM_Contact_Form_Search_Custo
 
     foreach ($this->_columns as $name => $field) {
       if (in_array($field, array(
-        'street_address', 'city', 'state_province', 'postal_code', 'country')) &&
-        !CRM_Utils_Array::value($field, $addressOptions)
-      ) {
+        'street_address', 'city', 'state_province', 'postal_code', 'country')) && empty($addressOptions[$field])) {
         unset($this->_columns[$name]);
         continue;
       }
index 128693830e98dec83f05d72bfcc640b36b80f180..84b142605d6346fc03592487cae1e9999253a1fc 100644 (file)
@@ -233,7 +233,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task {
       }
     }
 
-    if (!$contactTypeAdded && CRM_Utils_Array::value('contact_type', $params)) {
+    if (!$contactTypeAdded && !empty($params['contact_type'])) {
       $searchValues[] = array('contact_type', '=', $params['contact_type'], 0, 0);
     }
 
index e6d67bcec953a6ff4b1709bfda735d4c5854dd0f..7dae82b1d17854f7e9ba068e72f5d8d752cc952f 100644 (file)
@@ -330,9 +330,7 @@ class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task {
 
         //street address consider to be parsed properly,
         //If we get street_name and street_number.
-        if (empty($parsedFields['street_name']) ||
-          !CRM_Utils_Array::value('street_number', $parsedFields)
-        ) {
+        if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) {
           $parsedFields = array_fill_keys(array_keys($parsedFields), '');
         }
 
index 484c44a318d82b297f9db7ba3d76366d33482c92..232c890535735ea26d8818895376e147a31e82af 100644 (file)
@@ -204,7 +204,7 @@ class CRM_Contact_Form_Task_EmailCommon {
       // perform all validations
       foreach ($form->_allContactIds as $key => $contactId) {
         $value = $form->_contactDetails[$contactId];
-        if ($value['do_not_email'] || empty($value['email']) || CRM_Utils_Array::value('is_deceased', $value) || $value['on_hold']) {
+        if ($value['do_not_email'] || empty($value['email']) || !empty($value['is_deceased']) || $value['on_hold']) {
           $suppressedEmails++;
 
           // unset contact details for contacts that we won't be sending email. This is prevent extra computation
@@ -381,8 +381,7 @@ class CRM_Contact_Form_Task_EmailCommon {
     }
 
     // process message template
-    if (!empty($formValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $formValues)
-    ) {
+    if (!empty($formValues['saveTemplate']) || !empty($formValues['updateTemplate'])) {
       $messageTemplate = array(
         'msg_text' => $formValues['text_message'],
         'msg_html' => $formValues['html_message'],
@@ -395,9 +394,7 @@ class CRM_Contact_Form_Task_EmailCommon {
         CRM_Core_BAO_MessageTemplate::add($messageTemplate);
       }
 
-      if (!empty($formValues['template']) &&
-        CRM_Utils_Array::value('updateTemplate', $formValues)
-      ) {
+      if (!empty($formValues['template']) && !empty($formValues['updateTemplate'])) {
         $messageTemplate['id'] = $formValues['template'];
         unset($messageTemplate['msg_title']);
         CRM_Core_BAO_MessageTemplate::add($messageTemplate);
index 1fd7f30bb46e6c05206efc3bc1a53eb7274f7984..b9581b2be20a6a28791b42e7716c6bb6615211f1 100644 (file)
@@ -258,7 +258,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task {
       // we need to remove all the "_id"
       unset($contact['contact_id']);
 
-      if ($locName && CRM_Utils_Array::value($locName, $contact)) {
+      if ($locName && !empty($contact[$locName])) {
         // If location type is not primary, $contact contains
         // one more array as "$contact[$locName] = array( values... )"
 
index 33f4d6570a4a292666df2ebdd15c67d32d35e575..d85e391cd524295233615074b1b1f16418ccde6a 100644 (file)
@@ -48,7 +48,7 @@ class CRM_Contact_Form_Task_LabelCommon {
   function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) {
     foreach (array_merge($mailingFormatProperties, array_fill_keys($tokenFields, 1)) as $key => $dontCare) {
       //we should not consider addressee for data exists, CRM-6025
-       if ($key != 'addressee' && CRM_Utils_Array::value($key, $contact)) {
+       if ($key != 'addressee' && !empty($contact[$key])) {
         return TRUE;
       }
     }
@@ -188,7 +188,7 @@ class CRM_Contact_Form_Task_LabelCommon {
       // we need to remove all the "_id"
       unset($contact['contact_id']);
 
-      if ($locName && CRM_Utils_Array::value($locName, $contact)) {
+      if ($locName && !empty($contact[$locName])) {
         // If location type is not primary, $contact contains
         // one more array as "$contact[$locName] = array( values... )"
 
index 21e049b9eb2939ef5caea25c739fe6bafdd0be1d..df180c918f2b83c36c7128f7583326d5ef3a6358 100644 (file)
@@ -260,7 +260,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
     $formValues = $form->controller->exportValues($form->getName());
 
     // process message template
-    if (!empty($formValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $formValues)) {
+    if (!empty($formValues['saveTemplate']) || !empty($formValues['updateTemplate'])) {
       $messageTemplate = array(
         'msg_text' => NULL,
         'msg_html' => $formValues['html_message'],
index ce4483a9ecaf67d226d10e2bae7c13b47801b684..c249fe62fc42102c841cd5dc4d597262ecde221d 100644 (file)
@@ -134,9 +134,7 @@ class CRM_Contact_Form_Task_ProximityCommon extends CRM_Contact_Form_Task {
     $errors = array();
     // If Distance is present, make sure state, country and city or postal code are populated.
     if (!empty($fields['prox_distance'])) {
-      if (empty($fields['prox_state_province_id']) ||
-        !CRM_Utils_Array::value('prox_country_id', $fields)
-      ) {
+      if (empty($fields['prox_state_province_id']) || empty($fields['prox_country_id'])) {
         $errors["prox_state_province_id"] = ts("Country AND State/Province are required to search by distance.");
       }
       if (!CRM_Utils_Array::value('prox_postal_code', $fields) AND
index 3ea82538e360e4b966a17ae6ff04ecc7518e94be..d3f762eb3041fe06f470a9e1efdd6c1601b4f36b 100644 (file)
@@ -208,13 +208,11 @@ class CRM_Contact_Form_Task_SMSCommon {
           }
         }
 
-        if ((isset($value['phone_type_id']) && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes)) || $value['do_not_sms'] || empty($value['phone']) || CRM_Utils_Array::value('is_deceased', $value)) {
+        if ((isset($value['phone_type_id']) && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes)) || $value['do_not_sms'] || empty($value['phone']) || !empty($value['is_deceased'])) {
 
           //if phone is not primary check if non-primary phone is "Mobile"
           if (!empty($value['phone'])
-            && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes)
-            && !CRM_Utils_Array::value('is_deceased', $value)
-          ) {
+            && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes) && empty($value['is_deceased'])) {
             $filter = array('do_not_sms' => 0);
             $contactPhones = CRM_Core_BAO_Phone::allPhones($contactId, FALSE, 'Mobile', $filter);
             if (count($contactPhones) > 0) {
@@ -350,8 +348,7 @@ class CRM_Contact_Form_Task_SMSCommon {
     $fromSmsProviderId = $thisValues['sms_provider_id'];
 
     // process message template
-    if (!empty($thisValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $thisValues)
-    ) {
+    if (!empty($thisValues['saveTemplate']) || !empty($thisValues['updateTemplate'])) {
       $messageTemplate = array(
         'msg_text' => $thisValues['text_message'],
         'is_active' => TRUE,
@@ -362,9 +359,7 @@ class CRM_Contact_Form_Task_SMSCommon {
         CRM_Core_BAO_MessageTemplate::add($messageTemplate);
       }
 
-      if (!empty($thisValues['template']) &&
-        CRM_Utils_Array::value('updateTemplate', $thisValues)
-      ) {
+      if (!empty($thisValues['template']) && !empty($thisValues['updateTemplate'])) {
         $messageTemplate['id'] = $thisValues['template'];
         unset($messageTemplate['msg_title']);
         CRM_Core_BAO_MessageTemplate::add($messageTemplate);
index 7f5c8d1e4ffe2ae851c04ca9f1530f3e11d0474a..3e1b675fb94786b89ee21346b196936a11504449 100644 (file)
@@ -343,8 +343,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
 
         //Modified the Relationship fields if the fields are
         //present in dedupe rule
-        if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK &&
-          CRM_Utils_Array::value($cType, $this->_dedupeFields) &&
+        if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK && !empty($this->_dedupeFields[$cType]) &&
           is_array($this->_dedupeFields[$cType])
         ) {
           static $cTypeArray = array();
index 36af9e51b56ede8d5221fac9a8e022ef17e215e7..0f3bc84976c5f60a22581e5bd0729f0500ac865a 100644 (file)
@@ -284,11 +284,11 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
     switch ($this->_contactType) {
       case 'Individual':
         $missingNames = array();
-        if ($this->_firstNameIndex < 0 || !CRM_Utils_Array::value($this->_firstNameIndex, $values)) {
+        if ($this->_firstNameIndex < 0 || empty($values[$this->_firstNameIndex])) {
           $errorRequired = TRUE;
           $missingNames[] = ts('First Name');
         }
-        if ($this->_lastNameIndex < 0 || !CRM_Utils_Array::value($this->_lastNameIndex, $values)) {
+        if ($this->_lastNameIndex < 0 || empty($values[$this->_lastNameIndex])) {
           $errorRequired = TRUE;
           $missingNames[] = ts('Last Name');
         }
@@ -299,14 +299,14 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
         break;
 
       case 'Household':
-        if ($this->_householdNameIndex < 0 || !CRM_Utils_Array::value($this->_householdNameIndex, $values)) {
+        if ($this->_householdNameIndex < 0 || empty($values[$this->_householdNameIndex])) {
           $errorRequired = TRUE;
           $errorMessage = ts('Missing required fields:') . ' ' . ts('Household Name');
         }
         break;
 
       case 'Organization':
-        if ($this->_organizationNameIndex < 0 || !CRM_Utils_Array::value($this->_organizationNameIndex, $values)) {
+        if ($this->_organizationNameIndex < 0 || empty($values[$this->_organizationNameIndex])) {
           $errorRequired = TRUE;
           $errorMessage = ts('Missing required fields:') . ' ' . ts('Organization Name');
         }
@@ -319,7 +319,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
       /* If we don't have the required fields, bail */
 
       if ($this->_contactType == 'Individual' && !$this->_updateWithId) {
-        if ($errorRequired && !CRM_Utils_Array::value($this->_emailIndex, $values)) {
+        if ($errorRequired && empty($values[$this->_emailIndex])) {
           if ($errorMessage) {
             $errorMessage .= ' ' . ts('OR') . ' ' . ts('Email Address');
           }
@@ -478,7 +478,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
     }
 
     //check if external identifier exists in database
-    if (!empty($params['external_identifier']) && (CRM_Utils_Array::value('id', $params) || in_array($onDuplicate, array(
+    if (!empty($params['external_identifier']) && (!empty($params['id']) || in_array($onDuplicate, array(
             CRM_Import_Parser::DUPLICATE_SKIP,
             CRM_Import_Parser::DUPLICATE_NOCHECK,
           )))) {
@@ -515,7 +515,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
 
     //get contact id to format common data in update/fill mode,
     //if external identifier is present, CRM-4423
-    if ($this->_updateWithId && !CRM_Utils_Array::value('id', $params) && CRM_Utils_Array::value('external_identifier', $params)) {
+    if ($this->_updateWithId && empty($params['id']) && !empty($params['external_identifier'])) {
       if ($cid = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['external_identifier'], 'id', 'external_identifier')) {
         $formatted['id'] = $cid;
       }
@@ -529,7 +529,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
     // Support Match and Update Via Contact ID
     if ($this->_updateWithId) {
       $createNewContact = FALSE;
-      if (empty($params['id']) && CRM_Utils_Array::value('external_identifier', $params)) {
+      if (empty($params['id']) && !empty($params['external_identifier'])) {
         if ($cid) {
           $params['id'] = $cid;
         }
@@ -788,7 +788,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
           if (in_array($onDuplicate, array(
                 CRM_Import_Parser::DUPLICATE_UPDATE,
                 CRM_Import_Parser::DUPLICATE_FILL,
-              )) && CRM_Utils_Array::value('id', $params[$key])) {
+              )) && !empty($params[$key]['id'])) {
             $relatedContactType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$key]['id'], 'contact_type');
             if (!$relatedContactType) {
               $errorMessage = ts("No contact found for this related contact ID: %1", array(1 => $params[$key]['id']));
@@ -1683,7 +1683,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
     //get the id of the contact whose street address is not parsable, CRM-5886
     if ($this->_parseStreetAddress && is_object($newContact) && property_exists($newContact, 'address') && $newContact->address) {
       foreach ($newContact->address as $address) {
-        if (!empty($address['street_address']) && (!CRM_Utils_Array::value('street_number', $address) || !CRM_Utils_Array::value('street_name', $address))) {
+        if (!empty($address['street_address']) && (empty($address['street_number']) || empty($address['street_name']))) {
           $this->_unparsedStreetAddressContacts[] = array(
             'id' => $newContact->id,
             'streetAddress' => $address['street_address'],
@@ -1957,7 +1957,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
         case 'AdvMulti-Select':
         case 'Multi-Select':
 
-          if (!empty($formatted[$key]) && CRM_Utils_Array::value( $key, $params ) ) {
+          if (!empty($formatted[$key]) && !empty($params[$key])) {
             $mulValues       = explode( ',', $formatted[$key] );
             $customOption    = CRM_Core_BAO_CustomOption::getCustomOption( $customFieldID, true );
             $formatted[$key] = array( );
@@ -2009,7 +2009,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
 
           //street address consider to be parsed properly,
           //If we get street_name and street_number.
-          if (empty($parsedFields['street_name']) || !CRM_Utils_Array::value('street_number', $parsedFields)) {
+          if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) {
             $parsedFields = array_fill_keys(array_keys($parsedFields), '');
           }
 
index bd91099d155c6a52e557ef491f2d4859231be523..d84079dcac34bdc9759acf2eb3f58f5068baa02f 100644 (file)
@@ -59,8 +59,7 @@ class CRM_Contact_Page_Inline_ContactInfo extends CRM_Core_Page {
 
     //get the current employer name
     if (CRM_Utils_Array::value('contact_type', $defaults) == 'Individual') {
-      if (!empty($defaults['employer_id']) &&
-        CRM_Utils_Array::value('organization_name', $defaults)) {
+      if (!empty($defaults['employer_id']) && !empty($defaults['organization_name'])) {
         $defaults['current_employer'] = $defaults['organization_name'];
         $defaults['current_employer_id'] = $defaults['employer_id'];
       }
index 2832c8f47dbad6ca035b7ba770aa92a2c179c673..dc47daaf228716b7d205143d4fff23de798bd858 100644 (file)
@@ -365,7 +365,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
     );
 
     foreach ($rest as $k => $v) {
-      if ($accessCiviCRM && CRM_Utils_Array::value($k, $this->_viewOptions)) {
+      if ($accessCiviCRM && !empty($this->_viewOptions[$k])) {
         $allTabs[] = $v + array(
           'id' => $k,
           'url' => CRM_Utils_System::url(
index c9bf383854060d3ccfbd23a8d3c6d38d58a34c00..a3b8ad63aa80f9be4b9973e6a4b31274a61f061f 100644 (file)
@@ -759,8 +759,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
           );
         }
         elseif ((is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) ||
-          ($config->mapGeoCoding &&
-            CRM_Utils_Array::value('city', $row) &&
+          ($config->mapGeoCoding && !empty($row['city']) &&
             CRM_Utils_Array::value('state_province', $row)
           )
         ) {
@@ -902,8 +901,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
         );
       }
       elseif ((is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) ||
-        ($config->mapGeoCoding &&
-          CRM_Utils_Array::value('city', $row) &&
+        ($config->mapGeoCoding && !empty($row['city']) &&
           CRM_Utils_Array::value('state_province', $row)
         )
       ) {
index 1201e6d9ea5fac78a87473cf21c92ae28797dc75..00d803d042ce3bcf6dd608f709d5de5c3dc71fcc 100644 (file)
@@ -126,7 +126,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
     }
 
     // CRM-13420, set payment instrument to default if payment_instrument_id is empty
-    if (!$contributionID && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
+    if (!$contributionID && empty($params['payment_instrument_id'])) {
       $params['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument',
         FALSE, FALSE, FALSE, 'AND is_default = 1'));
     }
@@ -140,7 +140,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
 
     // contribution status is missing, choose Completed as default status
     // do this for create mode only
-    if (empty($ids['contribution']) && !CRM_Utils_Array::value('contribution_status_id', $params)) {
+    if (empty($ids['contribution']) && empty($params['contribution_status_id'])) {
       $params['contribution_status_id'] = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
     }
 
@@ -1322,11 +1322,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
     }
 
     // do check for required ids.
-    if (empty($componentDetails['membership']) &&
-      !CRM_Utils_Array::value('participant', $componentDetails) &&
-      !CRM_Utils_Array::value('pledge_payment', $componentDetails) ||
-      !CRM_Utils_Array::value('contact_id', $componentDetails)
-    ) {
+    if (empty($componentDetails['membership']) && empty($componentDetails['participant']) && empty($componentDetails['pledge_payment']) || empty($componentDetails['contact_id'])) {
       return $updateResult;
     }
 
@@ -2537,7 +2533,7 @@ WHERE  contribution_id = %1 ";
       }
 
       $totalAmount = CRM_Utils_Array::value('total_amount', $params);
-      if (!isset($totalAmount) && CRM_Utils_Array::value('prevContribution', $params)) {
+      if (!isset($totalAmount) && !empty($params['prevContribution'])) {
         $totalAmount = $params['total_amount'] = $params['prevContribution']->total_amount;
       }
 
@@ -2690,8 +2686,7 @@ WHERE  contribution_id = %1 ";
     }
 
     // when a fee is charged
-    if (!empty($params['fee_amount']) && (!CRM_Utils_Array::value('prevContribution', $params)
-      || $params['contribution']->fee_amount != $params['prevContribution']->fee_amount) && $skipRecords) {
+    if (!empty($params['fee_amount']) && (empty($params['prevContribution']) || $params['contribution']->fee_amount != $params['prevContribution']->fee_amount) && $skipRecords) {
       CRM_Core_BAO_FinancialTrxn::recordFees($params);
     }
 
@@ -2866,7 +2861,7 @@ WHERE  contribution_id = %1 ";
    * @static
    */
   static function checkStatusValidation($values, &$fields, &$errors) {
-    if (CRM_Utils_System::isNull($values) && CRM_Utils_Array::value('id', $fields)) {
+    if (CRM_Utils_System::isNull($values) && !empty($fields['id'])) {
       $values['contribution_status_id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $fields['id'], 'contribution_status_id');
       if ($values['contribution_status_id'] == $fields['contribution_status_id']) {
         return FALSE;
index 536105ba5046ab790fb4ab8b0d8a99af046b3ba1..bfeaa0138ddce636e9e75e0dc8285510e9080350 100644 (file)
@@ -605,7 +605,7 @@ INNER JOIN   civicrm_contact contact ON ( contact.id = contrib.contact_id )
             $params['address'][1][$mapper['location'][$field]] = $info['VALUE'];
           }
           elseif (!empty($mapper['contact'][$field])) {
-            if ($newOrder && CRM_Utils_Array::value('structured-name', $newOrder['buyer-billing-address'])) {
+            if ($newOrder && !empty($newOrder['buyer-billing-address']['structured-name'])) {
               foreach ($newOrder['buyer-billing-address']['structured-name'] as $namePart => $nameValue) {
                 $params[$mapper['contact'][$namePart]] = $nameValue['VALUE'];
               }
index 6f66c4c610c01e6422f1d6554e24a4702bd5d0d8..605bd3a30c33d33ce8d270caec685259b71d950c 100644 (file)
@@ -55,8 +55,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
     $dao = new CRM_Contribute_DAO_ContributionPage();
     $dao->copyValues($params);
     $dao->save();
-    if ($financialTypeId && CRM_Utils_Array::value('financial_type_id', $params)
-      && $financialTypeId != $params['financial_type_id']) {
+    if ($financialTypeId && !empty($params['financial_type_id']) && $financialTypeId != $params['financial_type_id']) {
       CRM_Price_BAO_PriceFieldValue::updateFinancialType($params['id'], 'civicrm_contribution_page', $params['financial_type_id']);
     }
     return $dao;
@@ -119,7 +118,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
     $email = NULL;
     if (isset($values['custom_pre_id'])) {
       $preProfileType = CRM_Core_BAO_UFField::getProfileType($values['custom_pre_id']);
-      if ($preProfileType == 'Membership' && CRM_Utils_Array::value('membership_id', $values)) {
+      if ($preProfileType == 'Membership' && !empty($values['membership_id'])) {
         $params['custom_pre_id'] = array(
           array(
             'member_id',
@@ -130,7 +129,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
           ),
         );
       }
-      elseif ($preProfileType == 'Contribution' && CRM_Utils_Array::value('contribution_id', $values)) {
+      elseif ($preProfileType == 'Contribution' && !empty($values['contribution_id'])) {
         $params['custom_pre_id'] = array(
           array(
             'contribution_id',
@@ -147,7 +146,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
 
     if (isset($values['custom_post_id'])) {
       $postProfileType = CRM_Core_BAO_UFField::getProfileType($values['custom_post_id']);
-      if ($postProfileType == 'Membership' && CRM_Utils_Array::value('membership_id', $values)) {
+      if ($postProfileType == 'Membership' && !empty($values['membership_id'])) {
         $params['custom_post_id'] = array(
           array(
             'member_id',
@@ -158,7 +157,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
           ),
         );
       }
-      elseif ($postProfileType == 'Contribution' && CRM_Utils_Array::value('contribution_id', $values)) {
+      elseif ($postProfileType == 'Contribution' && !empty($values['contribution_id'])) {
         $params['custom_post_id'] = array(
           array(
             'contribution_id',
@@ -232,8 +231,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
       }
     }
 
-    if (!empty($values['is_email_receipt']) ||
-      CRM_Utils_Array::value('onbehalf_dupe_alert', $values) ||
+    if (!empty($values['is_email_receipt']) || !empty($values['onbehalf_dupe_alert']) ||
       $returnMessageText
     ) {
       $template = CRM_Core_Smarty::singleton();
index b536430b4d6a93ea1f73d3493daea0247d6aa863..20e6bc8039ffa056778e80485552aebcb609fcd5 100644 (file)
@@ -864,8 +864,7 @@ class CRM_Contribute_BAO_Query {
       $tables = array_merge(array('civicrm_contribution' => 1), $tables);
     }
 
-    if (!empty($tables['civicrm_contribution_product']) &&
-      !CRM_Utils_Array::value('civicrm_product', $tables)) {
+    if (!empty($tables['civicrm_contribution_product']) && empty($tables['civicrm_product'])) {
       $tables['civicrm_product'] = 1;
     }
   }
index 60c7a7d9e2d9ee0eacfabbf3817b2bb7164abe2d..4cf363715a38d2ba1ebcdfe982325bc7f77028bc 100644 (file)
@@ -77,7 +77,7 @@ class CRM_Contribute_Form extends CRM_Core_Form {
         $baoName::retrieve($params, $defaults);
       }
     }
-    if ($this->_action == CRM_Core_Action::DELETE && CRM_Utils_Array::value('name', $defaults)) {
+    if ($this->_action == CRM_Core_Action::DELETE && !empty($defaults['name'])) {
       $this->assign('delName', $defaults['name']);
     }
     elseif ($this->_action == CRM_Core_Action::ADD) {
@@ -88,7 +88,7 @@ class CRM_Contribute_Form extends CRM_Core_Form {
 
     }
     elseif ($this->_action & CRM_Core_Action::UPDATE) {
-      if (!empty($defaults['contact_id']) || CRM_Utils_Array::value('created_id', $defaults)) {
+      if (!empty($defaults['contact_id']) || !empty($defaults['created_id'])) {
         $contactID = !empty($defaults['created_id']) ? $defaults['created_id'] : $defaults['contact_id'];
         $this->assign('created_id', $contactID);
         $this->assign('organisationId', $contactID);
index 713f87066281298c6e53dceb45fbb39ef072fb6b..f6623f342024012e75271a72459d37762456d04f 100644 (file)
@@ -376,11 +376,8 @@ class CRM_Contribute_Form_AdditionalInfo {
         $params['product_name'] = $productDAO->name;
         $params['product_sku'] = $productDAO->sku;
 
-        if (empty($params['product_option']) &&
-          CRM_Utils_Array::value($params['product_name'][0],
-            $form->_options
-          )
-        ) {
+        if (empty($params['product_option']) && !empty($form->_options
+[$params['product_name'][0]])) {
           $params['product_option'] = $form->_options[$params['product_name'][0]][$params['product_name'][1]];
         }
       }
index 20b5545531f45798506b26695a6fcf51651ee9b7..b37a5bacaa5b872b6b606e866096b65b92458f2d 100644 (file)
@@ -163,8 +163,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
       $showAdditionalInfo = FALSE;
 
       foreach ($ccPane as $name => $type) {
-        if ($this->_formType == $type ||
-          CRM_Utils_Array::value("hidden_{$type}", $_POST) ||
+        if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) ||
           CRM_Utils_Array::value("hidden_{$type}", $defaults)
         ) {
           $showAdditionalInfo = TRUE;
@@ -324,7 +323,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
       $result = CRM_Contribute_BAO_Contribution::recordAdditionPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId);
 
       // email sending
-      if (!empty($result) && CRM_Utils_Array::value('is_email_receipt', $submittedValues)) {
+      if (!empty($result) && !empty($submittedValues['is_email_receipt'])) {
         $submittedValues['contact_id'] = $this->_contactId;
         $submittedValues['contribution_id'] = $this->_contributionId;
 
@@ -376,7 +375,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
     $fields = array();
 
     // we need to retrieve email address
-    if ($this->_context == 'standalone' && CRM_Utils_Array::value('is_email_receipt', $submittedValues)) {
+    if ($this->_context == 'standalone' && !empty($submittedValues['is_email_receipt'])) {
       list($this->userDisplayName,
         $this->userEmail
       ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
@@ -521,9 +520,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
     // process the additional payment
     $trxnRecord = CRM_Contribute_BAO_Contribution::recordAdditionPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId);
 
-    if ($trxnRecord->id &&
-      CRM_Utils_Array::value('is_email_receipt', $this->_params)
-    ) {
+    if ($trxnRecord->id && !empty($this->_params['is_email_receipt'])) {
       $sendReceipt = self::emailReceipt($this, $this->_params);
     }
 
index 91cc25c756286cd96e7317ec17d9789e9255a24d..4db4bdea08db1fbd8a89d6a97e4f32d39c9bc686 100644 (file)
@@ -388,7 +388,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       }
     }
 
-    if (!$this->_id && !CRM_Utils_Array::value('receive_date', $defaults)) {
+    if (!$this->_id && empty($defaults['receive_date'])) {
       list($defaults['receive_date'],
         $defaults['receive_date_time']
         ) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
@@ -405,7 +405,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $this->assign('totalAmount', CRM_Utils_Array::value('total_amount', $defaults));
 
     //inherit campaign from pledge.
-    if ($this->_ppID && CRM_Utils_Array::value('campaign_id', $this->_pledgeValues)) {
+    if ($this->_ppID && !empty($this->_pledgeValues['campaign_id'])) {
       $defaults['campaign_id'] = $this->_pledgeValues['campaign_id'];
     }
 
@@ -428,7 +428,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     // build price set form.
     $buildPriceSet = FALSE;
     if (empty($this->_lineItems) &&
-      ($this->_priceSetId || CRM_Utils_Array::value('price_set_id', $_POST))
+      ($this->_priceSetId || !empty($_POST['price_set_id']))
     ) {
       $buildPriceSet = TRUE;
       $getOnlyPriceSetElements = TRUE;
@@ -525,8 +525,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       );
 
       // see if we need to include this paneName in the current form
-      if ($this->_formType == $type ||
-        CRM_Utils_Array::value("hidden_{$type}", $_POST) ||
+      if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) ||
         CRM_Utils_Array::value("hidden_{$type}", $defaults)
       ) {
         $showAdditionalInfo = TRUE;
@@ -864,7 +863,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
 
     $softErrors = CRM_Contribute_Form_SoftCredit::formRule($fields, $errors, $self);
 
-    if (!empty($fields['total_amount']) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) {
+    if (!empty($fields['total_amount']) && (!empty($fields['net_amount']) || !empty($fields['fee_amount']))) {
       $sum = CRM_Utils_Rule::cleanMoney($fields['net_amount']) + CRM_Utils_Rule::cleanMoney($fields['fee_amount']);
       if (CRM_Utils_Rule::cleanMoney($fields['total_amount']) != $sum) {
         $errors['total_amount'] = ts('The sum of fee amount and net amount must be equal to total amount');
@@ -950,7 +949,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       //CRM-10964
       $pId = ($this->_compId && $this->_context == 'participant') ? $this->_compId : CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'participant_id', 'contribution_id');
     }
-    if (!$priceSetId && CRM_Utils_Array::value('total_amount', $submittedValues) && $this->_id) {
+    if (!$priceSetId && !empty($submittedValues['total_amount']) && $this->_id) {
       // 10117 update th line items for participants
       if ($pId) {
         $entityTable = 'participant';
@@ -975,7 +974,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       }
       $itemId = key($lineItems);
       $fieldType = NULL;
-      if ($itemId && CRM_Utils_Array::value('price_field_id', $lineItems[$itemId])) {
+      if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) {
         $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type');
       }
       $lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues));
@@ -992,8 +991,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     //CRM-11529 for quick config backoffice transactions
     //when financial_type_id is passed in form, update the
     //lineitems with the financial type selected in form
-    if ($isQuickConfig && CRM_Utils_Array::value('financial_type_id', $submittedValues)
-      && CRM_Utils_Array::value($this->_priceSetId, $lineItem)
+    if ($isQuickConfig && !empty($submittedValues['financial_type_id']) && CRM_Utils_Array::value($this->_priceSetId, $lineItem)
     ) {
       foreach ($lineItem[$this->_priceSetId] as &$values) {
         $values['financial_type_id'] = $submittedValues['financial_type_id'];
@@ -1198,7 +1196,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       }
 
       //send receipt mail.
-      if ($contribution->id && CRM_Utils_Array::value('is_email_receipt', $formValues)) {
+      if ($contribution->id && !empty($formValues['is_email_receipt'])) {
         $formValues['contact_id'] = $this->_contactID;
         $formValues['contribution_id'] = $contribution->id;
 
@@ -1333,7 +1331,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $fields = array();
 
     // we need to retrieve email address
-    if ($this->_context == 'standalone' && CRM_Utils_Array::value('is_email_receipt', $submittedValues)) {
+    if ($this->_context == 'standalone' && !empty($submittedValues['is_email_receipt'])) {
       list($this->userDisplayName,
         $this->userEmail
         ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
@@ -1558,9 +1556,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     }
 
     //send receipt mail.
-    if ($contribution->id &&
-      CRM_Utils_Array::value('is_email_receipt', $this->_params)
-    ) {
+    if ($contribution->id && !empty($this->_params['is_email_receipt'])) {
       $this->_params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result);
       $this->_params['contact_id'] = $this->_contactID;
       $this->_params['contribution_id'] = $contribution->id;
index b2c78593a5e3690eb77cdfeb952a196fe593ab4e..e58ecbe7beee26db9e7dc3f9ddeada09e46097a1 100644 (file)
@@ -168,11 +168,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
                 $this->_params["price_{$priceField->id}"], 'membership_type_id');
             }
           } // if seperate payment we set contribution amount to be null, so that it will not show contribution amount same as membership amount.
-          elseif ((CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock))
-              && CRM_Utils_Array::value($priceField->id, $this->_values['fee'])
-              && ($this->_values['fee'][$priceField->id]['name'] == "other_amount")
-              && CRM_Utils_Array::value("price_{$contriPriceId}", $this->_params) < 1
-              && !CRM_Utils_Array::value("price_{$priceField->id}", $this->_params)) {
+          elseif ((CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock)) && !empty($this->_values['fee'][$priceField->id]) && ($this->_values['fee'][$priceField->id]['name'] == "other_amount")
+              && CRM_Utils_Array::value("price_{$contriPriceId}", $this->_params) < 1 && empty($this->_params["price_{$priceField->id}"])) {
               $this->_params['amount'] = null;
           }
         }
@@ -188,9 +185,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
     // if onbehalf-of-organization
     if (!empty($this->_params['hidden_onbehalf_profile'])) {
-      if (!empty($this->_params['org_option']) &&
-        CRM_Utils_Array::value('organization_id', $this->_params)
-      ) {
+      if (!empty($this->_params['org_option']) && !empty($this->_params['organization_id'])) {
         if (!empty($this->_params['onbehalfof_id'])) {
           $this->_params['organization_id'] = $this->_params['onbehalfof_id'];
         }
@@ -322,14 +317,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
 
     // if auto renew checkbox is set, initiate a open-ended recurring membership
-    if ((CRM_Utils_Array::value('selectMembership', $this->_params) ||
-        CRM_Utils_Array::value('priceSetId', $this->_params)
-      ) &&
-      CRM_Utils_Array::value('is_recur', $this->_paymentProcessor) &&
-      CRM_Utils_Array::value('auto_renew', $this->_params) &&
-      !CRM_Utils_Array::value('is_recur', $this->_params) &&
-      !CRM_Utils_Array::value('frequency_interval', $this->_params)
-    ) {
+    if ((!empty($this->_params['selectMembership']) || !empty($this->_params['priceSetId'])) && !empty($this->_paymentProcessor['is_recur']) &&
+      CRM_Utils_Array::value('auto_renew', $this->_params) && empty($this->_params['is_recur']) && empty($this->_params['frequency_interval'])) {
 
       $this->_params['is_recur'] = $this->_values['is_recur'] = 1;
       // check if price set is not quick config
@@ -376,7 +365,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $params = $this->_params;
     $honor_block_is_active = $this->get('honor_block_is_active');
     // make sure we have values for it
-    if ($honor_block_is_active && CRM_Utils_Array::value('soft_credit_type_id', $params)) {
+    if ($honor_block_is_active && !empty($params['soft_credit_type_id'])) {
       $honorName = null;
       $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
 
@@ -544,9 +533,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
             $defaults["{$name}_id"] = $contact["{$name}_id"];
           }
         }
-        elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting'))
-          && CRM_Utils_Array::value($name . '_custom', $contact)
-        ) {
+        elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && !empty($contact[$name . '_custom'])) {
           $defaults[$name . '_custom'] = $contact[$name . '_custom'];
         }
       }
@@ -845,7 +832,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
 
     // store the fact that this is a membership and membership type is selected
     $processMembership = FALSE;
-    if ((CRM_Utils_Array::value('selectMembership', $membershipParams) &&
+    if ((!empty($membershipParams['selectMembership']) &&
         $membershipParams['selectMembership'] != 'no_thanks'
       ) ||
       $this->_useForMember
@@ -882,8 +869,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       }
 
       if (!empty($membershipParams['onbehalf']) &&
-        is_array($membershipParams['onbehalf']) &&
-        CRM_Utils_Array::value('member_campaign_id', $membershipParams['onbehalf'])) {
+        is_array($membershipParams['onbehalf']) && !empty($membershipParams['onbehalf']['member_campaign_id'])) {
         $this->_params['campaign_id'] = $membershipParams['onbehalf']['member_campaign_id'];
       }
 
@@ -1083,7 +1069,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       }
 
       CRM_Contribute_BAO_Contribution::addPremium($params);
-      if ($productDAO->cost && CRM_Utils_Array::value('financial_type_id', $params)) {
+      if ($productDAO->cost && !empty($params['financial_type_id'])) {
         $trxnParams = array(
           'cost' => $productDAO->cost,
           'currency' => $productDAO->currency,
@@ -1222,7 +1208,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       'invoice_id' => $params['invoiceID'],
       'currency' => $params['currencyID'],
       'source' =>
-      (!$online || CRM_Utils_Array::value('source', $params)) ?
+      (!$online || !empty($params['source'])) ?
       CRM_Utils_Array::value('source', $params) :
       CRM_Utils_Array::value('description', $params),
       'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0),
@@ -1290,10 +1276,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
 
     //create an contribution address
     if (
-      $form->_contributeMode != 'notify' &&
-      !CRM_Utils_Array::value('is_pay_later', $params) &&
-      CRM_Utils_Array::value('is_monetary', $form->_values)
-    ) {
+      $form->_contributeMode != 'notify' && empty($params['is_pay_later']) && !empty($form->_values['is_monetary'])) {
       $contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID);
     }
 
@@ -1302,9 +1285,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $contribParams['total_amount'] = trim(CRM_Utils_Money::format($contribParams['total_amount'], ' '));
 
     // Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
-    if (!empty($params['pcp_made_through_id']) ||
-      CRM_Utils_Array::value('soft_credit_to', $params)
-    ) {
+    if (!empty($params['pcp_made_through_id']) || !empty($params['soft_credit_to'])) {
       // if its due to pcp
       if (!empty($params['pcp_made_through_id'])) {
         $contribSoftContactId = CRM_Core_DAO::getFieldValue(
@@ -1339,11 +1320,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution);
 
     //handle pledge stuff.
-    if (empty($form->_params['separate_membership_payment']) &&
-      CRM_Utils_Array::value('pledge_block_id', $form->_values) &&
-      (CRM_Utils_Array::value('is_pledge', $form->_params) ||
-        CRM_Utils_Array::value('pledge_id', $form->_values)
-      )
+    if (empty($form->_params['separate_membership_payment']) && !empty($form->_values['pledge_block_id']) &&
+      (!empty($form->_params['is_pledge']) || !empty($form->_values['pledge_id']))
     ) {
 
       if (!empty($form->_values['pledge_id'])) {
@@ -1494,9 +1472,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     // or the user has not chosen the recurring option
 
     //this is online case validation.
-    if ((!CRM_Utils_Array::value('is_recur', $form->_values) && $online) ||
-      !CRM_Utils_Array::value('is_recur', $params)
-    ) {
+    if ((empty($form->_values['is_recur']) && $online) || empty($params['is_recur'])) {
       return NULL;
     }
 
@@ -1577,9 +1553,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
   static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) {
     $isCurrentEmployer = FALSE;
     $orgID = NULL;
-    if (!empty($behalfOrganization['organization_id']) &&
-      CRM_Utils_Array::value('org_option', $behalfOrganization)
-    ) {
+    if (!empty($behalfOrganization['organization_id']) && !empty($behalfOrganization['org_option'])) {
       $orgID = $behalfOrganization['organization_id'];
       unset($behalfOrganization['organization_id']);
       $isCurrentEmployer = TRUE;
@@ -1718,9 +1692,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
   static function processPcp(&$page, $params) {
     $params['pcp_made_through_id'] = $page->_pcpId;
     $page->assign('pcpBlock', TRUE);
-    if (!empty($params['pcp_display_in_roll']) &&
-      !CRM_Utils_Array::value('pcp_roll_nickname', $params)
-    ) {
+    if (!empty($params['pcp_display_in_roll']) && empty($params['pcp_roll_nickname'])) {
       $params['pcp_roll_nickname'] = ts('Anonymous');
       $params['pcp_is_anonymous'] = 1;
     }
index ac9ba33cf14d8479d9b8d9e99cc44188f9583d2a..cd6b62b91bd9cc6075a7eff4acddf2547b6ef0db 100644 (file)
@@ -471,8 +471,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
       $this->set('priceSetId', $this->_priceSetId);
       CRM_Price_BAO_PriceSet::buildPriceSet($this);
       if ($this->_values['is_monetary'] &&
-        $this->_values['is_recur'] && !CRM_Utils_Array::value('pledge_id', $this->_values)
-      ) {
+        $this->_values['is_recur'] && empty($this->_values['pledge_id'])) {
         self::buildRecur($this);
       }
     }
@@ -509,9 +508,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     //don't build pledge block when mid is passed
     if (!$this->_mid) {
       $config = CRM_Core_Config::singleton();
-      if (in_array('CiviPledge', $config->enableComponents)
-        && CRM_Utils_Array::value('pledge_block_id', $this->_values)
-      ) {
+      if (in_array('CiviPledge', $config->enableComponents) && !empty($this->_values['pledge_block_id'])) {
         CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this);
       }
     }
@@ -720,10 +717,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     $errors = array();
     $amount = self::computeAmount($fields, $self);
 
-    if ((CRM_Utils_Array::value('selectMembership', $fields) &&
+    if ((!empty($fields['selectMembership']) &&
         $fields['selectMembership'] != 'no_thanks'
       ) ||
-      (CRM_Utils_Array::value('priceSetId', $fields) &&
+      (!empty($fields['priceSetId']) &&
         $self->_useForMember
       )
     ) {
@@ -756,7 +753,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
           }
         }
         if ($priceField->name == 'other_amount') {
-          if ($self->_quickConfig && !CRM_Utils_Array::value("price_{$priceField->id}", $fields) &&
+          if ($self->_quickConfig && empty($fields["price_{$priceField->id}"]) &&
             array_key_exists("price_{$previousId}", $fields) && isset($fields["price_{$previousId}"]) && $self->_values['fee'][$previousId]['name'] == 'contribution_amount' && empty($fields["price_{$previousId}"])) {
             $otherAmount = $priceField->id;
           }
@@ -805,8 +802,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
           }
         }
         // $membershipFieldId is set and additional amount is 'No thank you' or NULL then throw error
-        if ($membershipFieldId && !(CRM_Utils_Array::value('price_' . $contributionFieldId, $fields, -1) > 0)
-          && !CRM_Utils_Array::value('price_' . $otherFieldId, $fields)) {
+        if ($membershipFieldId && !(CRM_Utils_Array::value('price_' . $contributionFieldId, $fields, -1) > 0) && empty($fields['price_' . $otherFieldId])) {
           $errors["price_{$errorKey}"] = ts('Additional Contribution is required.');
         }
       }
@@ -827,7 +823,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
         $priceFieldMemTypes = array();
 
         foreach ($self->_priceSet['fields'] as $priceId => $value) {
-          if (!empty($fields['price_' . $priceId]) || ($self->_quickConfig && $value['name'] == 'membership_amount' && !CRM_Utils_Array::value('is_required', $self->_membershipBlock))) {
+          if (!empty($fields['price_' . $priceId]) || ($self->_quickConfig && $value['name'] == 'membership_amount' && empty($self->_membershipBlock['is_required']))) {
             if (!empty($fields['price_' . $priceId]) && is_array($fields['price_' . $priceId])) {
               foreach ($fields['price_' . $priceId] as $priceFldVal => $isSet) {
                 if ($isSet) {
@@ -835,7 +831,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
                 }
               }
             }
-            elseif (!$value['is_enter_qty'] && CRM_Utils_Array::value('price_' . $priceId, $fields)) {
+            elseif (!$value['is_enter_qty'] && !empty($fields['price_' . $priceId])) {
               // The check for {!$value['is_enter_qty']} is done since, quantity fields allow entering
               // quantity. And the quantity can't be conisdered as civicrm_price_field_value.id, CRM-9577
               $priceFieldIDS[] = $fields['price_' . $priceId];
@@ -941,7 +937,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     }
 
     // validate PCP fields - if not anonymous, we need a nick name value
-    if ($self->_pcpId && CRM_Utils_Array::value('pcp_display_in_roll', $fields) &&
+    if ($self->_pcpId && !empty($fields['pcp_display_in_roll']) &&
       (CRM_Utils_Array::value('pcp_is_anonymous', $fields) == 0) &&
       CRM_Utils_Array::value('pcp_roll_nickname', $fields) == ''
     ) {
@@ -953,8 +949,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     if ($self->_paymentProcessor &&
       $self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
     ) {
-      if (!empty($fields[$self->_expressButtonName . '_x']) ||
-        CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) ||
+      if (!empty($fields[$self->_expressButtonName . '_x']) || !empty($fields[$self->_expressButtonName . '_y']) ||
         CRM_Utils_Array::value($self->_expressButtonName, $fields)
       ) {
         return $errors;
@@ -1039,9 +1034,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
       $params['amount_other'] = CRM_Utils_Rule::cleanMoney($params['amount_other']);
     }
 
-    if (CRM_Utils_Array::value('amount', $params) == 'amount_other_radio' ||
-      CRM_Utils_Array::value('amount_other', $params)
-    ) {
+    if (CRM_Utils_Array::value('amount', $params) == 'amount_other_radio' || !empty($params['amount_other'])) {
       $amount = $params['amount_other'];
     }
     elseif (!empty($params['pledge_amount'])) {
@@ -1173,7 +1166,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
       $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config');
       if ($is_quick_config) {
         foreach ($this->_priceSet['fields'] as $fieldKey => $fieldVal) {
-          if ($fieldVal['name'] == 'membership_amount' && CRM_Utils_Array::value('price_' . $fieldKey , $params)) {
+          if ($fieldVal['name'] == 'membership_amount' && !empty($params['price_' . $fieldKey ])) {
             $fieldId     = $fieldVal['id'];
             $fieldOption = $params['price_' . $fieldId];
             $proceFieldAmount += $fieldVal['options'][$this->_submitValues['price_' . $fieldId]]['amount'];
@@ -1232,7 +1225,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
       $this->set('lineItem', $lineItem);
     }
 
-    if ($this->_membershipBlock['is_separate_payment'] && CRM_Utils_Array::value('separate_amount', $params)) {
+    if ($this->_membershipBlock['is_separate_payment'] && !empty($params['separate_amount'])) {
       $this->set('amount', $params['separate_amount']);
     } else {
       $this->set('amount', $params['amount']);
@@ -1258,9 +1251,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
         $buttonName = $this->controller->getButtonName();
         if (in_array($buttonName,
             array($this->_expressButtonName, $this->_expressButtonName . '_x', $this->_expressButtonName . '_y')
-          ) &&
-          !CRM_Utils_Array::value('is_pay_later', $params)
-        ) {
+          ) && empty($params['is_pay_later'])) {
           $this->set('contributeMode', 'express');
 
           $donateURL           = CRM_Utils_System::url('civicrm/contribute', '_qf_Contribute_display=1');
index 3b4f7dd6149aa8661fbfe1b144f1b74a2b21e33c..25c1f029b9569f9153f3424ee63442ba43931972 100644 (file)
@@ -172,9 +172,7 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf {
           }
         }
         elseif (in_array($prefixName, array(
-          'organization_name', 'email')) &&
-          !CRM_Utils_Array::value('is_required', $field)
-        ) {
+          'organization_name', 'email')) && empty($field['is_required'])) {
           $field['is_required'] = 1;
         }
 
index 1a1ba4d4cc8c0296abf23ab1ba1218b7bd2144ae..66d900e1b6e2aa81fe660f51b1a04bfd9420c678 100644 (file)
@@ -120,7 +120,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont
 
     $params = $this->_params;
     $honor_block_is_active = $this->get('honor_block_is_active');
-    if ($honor_block_is_active && CRM_Utils_Array::value('soft_credit_type_id', $params)) {
+    if ($honor_block_is_active && !empty($params['soft_credit_type_id'])) {
       $honorName = null;
       $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
 
@@ -243,9 +243,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont
             $defaults[$timeField] = $contact[$timeField];
           }
         }
-        elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting'))
-          && CRM_Utils_Array::value($name . '_custom', $contact)
-        ) {
+        elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && !empty($contact[$name . '_custom'])) {
           $defaults[$name . '_custom'] = $contact[$name . '_custom'];
         }
       }
index 7d5600d89f3aa900e32d1de64d2bcd95934e4a1c..c78d4a412d4c60c355262457fc3bfffa2f14dc89 100644 (file)
@@ -302,7 +302,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
 
       //FIXME: to support multiple payment processors
       if ($isMonetary &&
-        (!$isPayLater || CRM_Utils_Array::value('payment_processor', $this->_values))
+        (!$isPayLater || !empty($this->_values['payment_processor']))
       ) {
         $ppID = CRM_Utils_Array::value('payment_processor', $this->_values);
         if (!$ppID) {
@@ -527,9 +527,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
     );
 
     $config = CRM_Core_Config::singleton();
-    if (isset($this->_values['is_recur']) &&
-      CRM_Utils_Array::value('is_recur', $this->_paymentProcessor)
-    ) {
+    if (isset($this->_values['is_recur']) && !empty($this->_paymentProcessor['is_recur'])) {
       $this->assign('is_recur_enabled', 1);
       $vars = array_merge($vars, array(
         'is_recur', 'frequency_interval', 'frequency_unit',
index d3cf75c7b2c353a99a8b7eccc7e95d096679b2b9..9f629fe46880eb901511409428a80f41d8b8a275 100644 (file)
@@ -305,7 +305,7 @@ SELECT id
         }
       }
       $hasMembershipBlk = TRUE;
-      if ($membershipBlock->is_separate_payment && !CRM_Utils_Array::value('amount_block_is_active', $fields)) {
+      if ($membershipBlock->is_separate_payment && empty($fields['amount_block_is_active'])) {
         $errors['amount_block_is_active'] = ts('To disable Contribution Amounts section you need to first disable Separate Membership Payment option from Membership Settings.');
       }
     }
@@ -500,7 +500,7 @@ SELECT id
         if ($priceSetID) {
           // add/update price set.
           $deletePriceSet = FALSE;
-          if (!empty($params['price_field_id']) || CRM_Utils_Array::value('price_field_other', $params) ) {
+          if (!empty($params['price_field_id']) || !empty($params['price_field_other'])) {
             $deleteAmountBlk = TRUE;
           }
 
@@ -529,12 +529,12 @@ SELECT id
               );
             }
           }
-            /* || CRM_Utils_Array::value( 'price_field_value', $params ) || CRM_Utils_Array::value( 'price_field_other', $params )*/
-          if (!empty($options) || CRM_Utils_Array::value('is_allow_other_amount', $params)) {
+            /* || !empty($params['price_field_value']) || CRM_Utils_Array::value( 'price_field_other', $params )*/
+          if (!empty($options) || !empty($params['is_allow_other_amount'])) {
             $fieldParams['is_quick_config'] = 1;
             $noContriAmount = NULL;
             $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3);
-            if (!(CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params)) && !$usedPriceSetId) {
+            if (!(!empty($params['price_field_id']) || !empty($params['price_field_other'])) && !$usedPriceSetId) {
               $pageTitle = strtolower(CRM_Utils_String::munge($this->_values['title'], '_', 245));
               $setParams['title'] = $this->_values['title'];
               if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $pageTitle, 'id', 'name')) {
@@ -553,7 +553,7 @@ SELECT id
               $priceSet = CRM_Price_BAO_PriceSet::create($setParams);
               $priceSetId = $priceSet->id;
             }
-            elseif ($usedPriceSetId && !CRM_Utils_Array::value('price_field_id', $params)) {
+            elseif ($usedPriceSetId && empty($params['price_field_id'])) {
               $priceSetId = $usedPriceSetId;
             }
             else {
@@ -613,7 +613,7 @@ SELECT id
               $fieldParams['default_option'] = $params['default'];
               $priceField = CRM_Price_BAO_PriceField::create($fieldParams);
             }
-            if (!empty($params['is_allow_other_amount']) && !CRM_Utils_Array::value('price_field_other', $params)) {
+            if (!empty($params['is_allow_other_amount']) && empty($params['price_field_other'])) {
               $editedFieldParams = array(
                  'price_set_id' => $priceSetId,
                  'name' => 'other_amount',
@@ -661,7 +661,7 @@ SELECT id
                 }
               }
             } 
-            elseif (empty($params['is_allow_other_amount']) && CRM_Utils_Array::value('price_field_other', $params)) {
+            elseif (empty($params['is_allow_other_amount']) && !empty($params['price_field_other'])) {
               CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0');
             } 
             elseif ($priceFieldID = CRM_Utils_Array::value('price_field_other', $params)) {
@@ -707,7 +707,7 @@ SELECT id
         }
       }
       else {
-        if (!empty($params['price_field_id']) || CRM_Utils_Array::value('price_field_other', $params)) {
+        if (!empty($params['price_field_id']) || !empty($params['price_field_other'])) {
           $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3);
           if ($usedPriceSetId) {
             if (!empty($params['price_field_id'])) {
index 8f4c52801cce131dd1c0b0bd478e944b9055ea86..8dbf599f317df3cc549780a1c579440f442829a2 100644 (file)
@@ -250,9 +250,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
       $errors['title'] = ts("Please do not use '/' in Title");
     }
 
-    if (!empty($values['is_organization']) &&
-      !CRM_Utils_Array::value('onbehalf_profile_id', $values)
-    ) {
+    if (!empty($values['is_organization']) && empty($values['onbehalf_profile_id'])) {
       $errors['onbehalf_profile_id'] = ts('Please select a profile to collect organization information on this contribution page.');
     }
 
@@ -269,7 +267,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
 
     //dont allow on behalf of save when
     //pre or post profile consists of membership fields
-    if ($contributionPageId && CRM_Utils_Array::value('is_organization', $values)) {
+    if ($contributionPageId && !empty($values['is_organization'])) {
       $ufJoinParams = array(
         'module' => 'CiviContribute',
         'entity_table' => 'civicrm_contribution_page',
index bec94c9fd97f5e0d3b8b0a8093f81e017e12b5b3..6342ed8c4d22c31be770ed4aed65e8f0814ccbfb 100644 (file)
@@ -39,7 +39,7 @@
 class CRM_Contribute_Form_ContributionPage_TabHeader {
   static function build(&$form) {
     $tabs = $form->get('tabHeader');
-    if (!$tabs || !CRM_Utils_Array::value('reset', $_GET)) {
+    if (!$tabs || empty($_GET['reset'])) {
       $tabs = self::process($form);
       $form->set('tabHeader', $tabs);
     }
index a00ba954dfbd2974814485ca8ad31f2c7556f058..a33c88cfc2d0208bdbccc6bfceb30bd8b096fdcb 100644 (file)
@@ -214,7 +214,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co
       }
 
       foreach ($params as $key => $val) {
-        if (substr($key, 0, 6) == 'color_' && !CRM_Utils_Array::value($key, $params)) {
+        if (substr($key, 0, 6) == 'color_' && empty($params[$key])) {
           $errors[$key] = ts('%1 is a required field.', array(1 => $self->_colorFields[$key][0]));
         }
       }
index 621b1800dfacb1d0b87051b62c65e72acd89a4ca..6e7abf2aaf6a48ff2106a920b070f24fec54e35b 100644 (file)
@@ -250,7 +250,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
       }
     }
     // CRM-13231 financial type required if product has cost
-    if (!empty($params['cost']) && !CRM_Utils_Array::value('financial_type_id', $params)) {
+    if (!empty($params['cost']) && empty($params['financial_type_id'])) {
       $errors['financial_type_id'] = ts('Financial Type is required for product having cost.');
     }
     $fileLocation = $files['uploadFile']['tmp_name'];
index dba1314cec5b17e11f625ecfcc6c01636de504ef..eab4cb5e263cde7fc2a2dec0d74a337a84b5ab33 100644 (file)
@@ -47,7 +47,7 @@ class CRM_Contribute_Form_SoftCredit {
    * @return void
    */
   static function buildQuickForm(&$form) {
-    if ($form->_mode == 'live' && CRM_Utils_Array::value('honor_block_is_active', $form->_values)) {
+    if ($form->_mode == 'live' && !empty($form->_values['honor_block_is_active'])) {
       $ufJoinDAO = new CRM_Core_DAO_UFJoin();
       $ufJoinDAO->module = 'soft_credit';
       $ufJoinDAO->entity_id = $form->_id;
@@ -185,8 +185,7 @@ class CRM_Contribute_Form_SoftCredit {
 
     // if honor roll fields are populated but no PCP is selected
     if (empty($fields['pcp_made_through_id'])) {
-      if (!empty($fields['pcp_display_in_roll']) ||
-        CRM_Utils_Array::value('pcp_roll_nickname', $fields) ||
+      if (!empty($fields['pcp_display_in_roll']) || !empty($fields['pcp_roll_nickname']) ||
         CRM_Utils_Array::value('pcp_personal_note', $fields)
       ) {
         $errors['pcp_made_through'] = ts('Please select a Personal Campaign Page, OR uncheck Display in Honor Roll and clear both the Honor Roll Name and the Personal Note field.');
index 8eb00ca4b76bd72121f1dae06be0cd4c32b0866b..cd40ff9c9ed02422a7fbb63ebd6d63fd52de2ccd 100644 (file)
@@ -179,11 +179,8 @@ AND    {$this->_componentClause}";
       list($contactDetails) = CRM_Utils_Token::getTokenDetails($this->_contactIds, $returnProperties, FALSE, FALSE);
       $suppressedEmails = 0;
       foreach ($contactDetails as $id => $values) {
-        if (empty($values['email']) ||
-          CRM_Utils_Array::value('do_not_email', $values) ||
-          CRM_Utils_Array::value('is_deceased', $values) ||
-          CRM_Utils_Array::value('on_hold', $values)
-        ) {
+        if (empty($values['email']) || !empty($values['do_not_email']) ||
+          CRM_Utils_Array::value('is_deceased', $values) || !empty($values['on_hold'])) {
           $suppressedEmails++;
           $excludeContactIds[] = $values['contact_id'];
         }
index d9165c71d0ee2ff844b2eb773053e226b31472c2..8019b57ed44036373ac1d3d0c064b638c1d92f4a 100644 (file)
@@ -307,9 +307,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
 
     //import contribution record according to select contact type
     if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP &&
-      (CRM_Utils_Array::value('contribution_contact_id', $paramValues) ||
-        CRM_Utils_Array::value('external_identifier', $paramValues)
-      )
+      (!empty($paramValues['contribution_contact_id']) || !empty($paramValues['external_identifier']))
     ) {
       $paramValues['contact_type'] = $this->_contactType;
     }
@@ -353,8 +351,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
     else {
       //fix for CRM-2219 - Update Contribution
       // onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE
-      if (!empty($paramValues['invoice_id']) ||
-          CRM_Utils_Array::value('trxn_id', $paramValues) || $paramValues['contribution_id']) {
+      if (!empty($paramValues['invoice_id']) || !empty($paramValues['trxn_id']) || $paramValues['contribution_id']) {
         $dupeIds = array(
           'id' => CRM_Utils_Array::value('contribution_id', $paramValues),
           'trxn_id' => CRM_Utils_Array::value('trxn_id', $paramValues),
@@ -561,9 +558,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
    *  Function to process pledge payments
    */
   function processPledgePayments(&$formatted) {
-    if (!empty($formatted['pledge_payment_id']) &&
-      CRM_Utils_Array::value('pledge_id', $formatted)
-    ) {
+    if (!empty($formatted['pledge_payment_id']) && !empty($formatted['pledge_id'])) {
       //get completed status
       $completeStatusID = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
 
index 2c3d4c983664cf60c779f4a2ec69ab54ebf93e88..e7d7abdda9f51d316cd6d887aeda0863116ef3db 100644 (file)
@@ -105,14 +105,14 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address {
         continue;
       }
 
-      if ($isPrimary && CRM_Utils_Array::value('is_primary', $value)) {
+      if ($isPrimary && !empty($value['is_primary'])) {
         $isPrimary = FALSE;
       }
       else {
         $value['is_primary'] = 0;
       }
 
-      if ($isBilling && CRM_Utils_Array::value('is_billing', $value)) {
+      if ($isBilling && !empty($value['is_billing'])) {
         $isBilling = FALSE;
       }
       else {
index 846f63a3c30f723a2996ff0e85933d10707824c8..03d109d7023a7f307b3824687007dd66e2906aef 100644 (file)
@@ -256,9 +256,7 @@ class CRM_Core_BAO_Block {
           }
         }
         //lets allow to update primary w/ more cleanly.
-        if (!$resetPrimaryId &&
-          CRM_Utils_Array::value('is_primary', $value)
-        ) {
+        if (!$resetPrimaryId && !empty($value['is_primary'])) {
           $primaryId = TRUE;
           if (is_array($blockIds)) {
             foreach ($blockIds as $blockId => $blockValue) {
@@ -327,7 +325,7 @@ class CRM_Core_BAO_Block {
               if ($valueId) {
                 //assigned id as first come first serve basis
                 $value['id'] = $blockValue['id'];
-                if (!$primaryId && CRM_Utils_Array::value('is_primary', $blockValue)) {
+                if (!$primaryId && !empty($blockValue['is_primary'])) {
                   $value['is_primary'] = $blockValue['is_primary'];
                 }
                 unset($blockIds[$blockId]);
@@ -352,7 +350,7 @@ class CRM_Core_BAO_Block {
         continue;
       }
 
-      if ($isPrimary && CRM_Utils_Array::value('is_primary', $value)) {
+      if ($isPrimary && !empty($value['is_primary'])) {
         $contactFields['is_primary'] = $value['is_primary'];
         $isPrimary = FALSE;
       }
@@ -360,7 +358,7 @@ class CRM_Core_BAO_Block {
         $contactFields['is_primary'] = 0;
       }
 
-      if ($isBilling && CRM_Utils_Array::value('is_billing', $value)) {
+      if ($isBilling && !empty($value['is_billing'])) {
         $contactFields['is_billing'] = $value['is_billing'];
         $isBilling = FALSE;
       }
index a197f04569518bdbb8611207e054bad19fdab97c..63a65d7866d34da7acc5d19134a54c68273eac99 100644 (file)
@@ -618,7 +618,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
     foreach ($fields as $id => $values) {
       // for now we should not allow multiple fields in profile / export etc, hence unsetting
       if (!$search &&
-        (CRM_Utils_Array::value('is_multiple', $values) && !$withMultiple)
+        (!empty($values['is_multiple']) && !$withMultiple)
       ) {
         continue;
       }
index 24f2917fe9a8db94dbcb38a7f9837506342301b7..90654c569fe55e662a2b2b4e73f83ee5958540b4 100644 (file)
@@ -129,7 +129,7 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup {
         'is_multiple'
       );
 
-      if ((CRM_Utils_Array::value('is_multiple', $params) || $isMultiple) &&
+      if ((!empty($params['is_multiple']) || $isMultiple) &&
         ($params['is_multiple'] != $isMultiple)
       ) {
         $oldTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup',
index 236ca8f0b13f5fc70c35656c691e45eb5f9ac239..999e4d32f29af0503f3a1f18d68cd6a70d9449bc 100644 (file)
@@ -92,7 +92,7 @@ class CRM_Core_BAO_CustomOption {
     $optionValues = CRM_Core_BAO_OptionValue::getOptionValuesArray($optionGroupID);
 
     foreach ($optionValues as $id => $value) {
-      if (!$inactiveNeeded && !CRM_Utils_Array::value('is_active', $value)) {
+      if (!$inactiveNeeded && empty($value['is_active'])) {
         continue;
       }
 
index 710ba42dcd66a6f07db6628d837fa4c600b9731c..a0257c4a5ee365aeb95e02d1d89af250ab25b3a5 100644 (file)
@@ -123,7 +123,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
 
     $allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']);
     $defaultDashlets = array();
-    if (!$hasDashlets && CRM_Utils_Array::value('blog', $allDashlets)) {
+    if (!$hasDashlets && !empty($allDashlets['blog'])) {
       $defaultDashlets['blog'] = array(
         'dashboard_id' => $allDashlets['blog']['id'],
         'is_active' => 1,
index a6a228f1b7712b78b37fcffb0b8a452295515cb3..540d4ec628d4f13c436f541c5fae8dad1bb7b2b7 100644 (file)
    ) {
 
      // delete current attachments if applicable
-     if ($entityID && CRM_Utils_Array::value('is_delete_attachment', $formValues)) {
+     if ($entityID && !empty($formValues['is_delete_attachment'])) {
        CRM_Core_BAO_File::deleteEntityFile($entityTable, $entityID);
      }
 
index 5da796b618e0cd94be5e87692b62f65014a3df60..df9bdf12f85a23e8deca0c32c337ea1c08c648b0 100644 (file)
@@ -303,7 +303,7 @@ WHERE ceft.entity_id = %1";
    * @static
    */
   static function createPremiumTrxn($params) {
-    if ((!CRM_Utils_Array::value('financial_type_id', $params) || !CRM_Utils_Array::value('contributionId', $params)) && !CRM_Utils_Array::value('oldPremium', $params)) {
+    if ((empty($params['financial_type_id']) || empty($params['contributionId'])) && empty($params['oldPremium'])) {
       return;
     }
 
index 4c949445ede153bd86dc8cbb6400622d22af77fc..19814b926ac1e242cccb7d38515cf414ec4fe53e 100644 (file)
@@ -176,8 +176,8 @@ UPDATE civicrm_log
       CRM_Report_BAO_ReportInstance::retrieve($params, $instance);
 
       if (!empty($instance) &&
-        (!CRM_Utils_Array::value('permission', $instance) ||
-          (CRM_Utils_Array::value('permission', $instance) && CRM_Core_Permission::check($instance['permission']))
+        (empty($instance['permission']) ||
+          (!empty($instance['permission']) && CRM_Core_Permission::check($instance['permission']))
         )
       ) {
         return $instance['id'];
index a626dff2f82af7165f299f8ac339560cfeb28ff5..12d8e74d85ea31205d8a4a79c7998f38ed429464 100644 (file)
@@ -376,9 +376,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
       //build the common contact fields array.
       $fields['Contact'] = array();
       foreach ($fields['Individual'] as $key => $value) {
-        if (!empty($fields['Household'][$key]) &&
-            CRM_Utils_Array::value($key, $fields['Organization'])
-            ) {
+        if (!empty($fields['Household'][$key]) && !empty($fields['Organization'][$key])) {
           $fields['Contact'][$key] = $value;
           unset($fields['Organization'][$key],
                 $fields['Household'][$key],
index 752337a454ccc42629146bbf2019c749933703cb..99ea2dd48100841536ca31759cf5da8fcbd31d1d 100644 (file)
@@ -235,9 +235,7 @@ ALTER TABLE {$tableName}
 
   static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) {
     $sql = NULL;
-    if (!empty($params['fk_table_name']) &&
-      CRM_Utils_Array::value('fk_field_name', $params)
-    ) {
+    if (!empty($params['fk_table_name']) && !empty($params['fk_field_name'])) {
       $sql .= $separator;
       $sql .= str_repeat(' ', 8);
       $sql .= $prefix;
index d9a17313edfbd476f49f09cd3bbe3b4eb1ccf99c..e0a38646d9ae1eb5f604ba3314594856dc12ca51 100644 (file)
@@ -996,7 +996,7 @@ AND domain_id = %3
         }
       }
       // CRM-10931, If DB doesn't have any value, carry on with any default value thats already available
-      if (!isset($value) && CRM_Utils_Array::value($dao->name, $params)) {
+      if (!isset($value) && !empty($params[$dao->name])) {
         $value = $params[$dao->name];
       }
       $params[$dao->name] = $value;
index bac03c95c0cd26840ca1d57eb31bc632643ada4d..f3a25170399da7884c8f97292f20d26d0daea518 100644 (file)
@@ -1057,9 +1057,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup {
               if ($htmlType == 'File') {
                 $entityId = $cid;
                 if (!$cid &&
-                  $fieldType == 'Activity' &&
-                  CRM_Utils_Array::value(2, $componentWhere[0])
-                ) {
+                  $fieldType == 'Activity' && !empty($componentWhere[0][2])) {
                   $entityId = $componentWhere[0][2];
                 }
 
index 7479464f54ee8ec9c6d3e71c898aac790c12eafb..5319f19f36800610f761047b3f4f7b70b92ee76c 100644 (file)
@@ -90,8 +90,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
         is_array($ids) && !empty($ids)
       ) {
         foreach ($ids as $id => $value) {
-          if (($value['website_type_id'] == $values['website_type_id'])
-            && CRM_Utils_Array::value('url', $values)) {
+          if (($value['website_type_id'] == $values['website_type_id']) && !empty($values['url'])) {
             $values['id'] = $id;
             unset($ids[$id]);
             break;
index be85234b39972f90b387210c27726fdb95420b06..c9ea0c0f085df5688422ae9409e254790503b292 100644 (file)
@@ -875,7 +875,7 @@ class CRM_Core_Error extends PEAR_ErrorStack {
   }
 
   public static function isAPIError($error, $type = CRM_Core_Error::FATAL_ERROR) {
-    if (is_array($error) && CRM_Utils_Array::value('is_error', $error)) {
+    if (is_array($error) && !empty($error['is_error'])) {
       $code = $error['error_message']['code'];
       if ($code == $type) {
         return TRUE;
index 663ff694e1718544250674e12f96db38f680480a..a645499491f41e09f9efd1eed7445c3bc86e68b0 100644 (file)
@@ -1099,9 +1099,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
 
     $this->add('text', $name, $label, $attributes);
 
-    if (!empty($attributes['addTime']) ||
-      CRM_Utils_Array::value('timeFormat', $attributes)
-    ) {
+    if (!empty($attributes['addTime']) || !empty($attributes['timeFormat'])) {
 
       if (!isset($attributes['timeFormat'])) {
         $timeFormat = $config->timeInputFormat;
@@ -1130,7 +1128,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
 
     if ($required) {
       $this->addRule($name, ts('Please select %1', array(1 => $label)), 'required');
-      if (!empty($attributes['addTime']) && CRM_Utils_Array::value('addTimeRequired', $attributes)) {
+      if (!empty($attributes['addTime']) && !empty($attributes['addTimeRequired'])) {
         $this->addRule($elementName, ts('Please enter a time.'), 'required');
       }
     }
index 4219e3a60311a26ceb14ec74cd0e43ea68307783..7263d9371bf3966f35036205c23c004ec7ec48f2 100644 (file)
@@ -120,9 +120,7 @@ class CRM_Core_Form_Tag {
 
           switch ($entityTable) {
             case 'civicrm_activity':
-              if (!empty($form->_submitValues['activity_taglist']) &&
-                CRM_Utils_Array::value($parentId, $form->_submitValues['activity_taglist'])
-              ) {
+              if (!empty($form->_submitValues['activity_taglist']) && !empty($form->_submitValues['activity_taglist'][$parentId])) {
                 $allTags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
                 $tagIds = explode(',', $form->_submitValues['activity_taglist'][$parentId]);
                 foreach ($tagIds as $tagId) {
@@ -141,9 +139,7 @@ class CRM_Core_Form_Tag {
               break;
 
             case 'civicrm_case':
-              if (!empty($form->_submitValues['case_taglist']) &&
-                CRM_Utils_Array::value($parentId, $form->_submitValues['case_taglist'])
-              ) {
+              if (!empty($form->_submitValues['case_taglist']) && !empty($form->_submitValues['case_taglist'][$parentId])) {
                 $allTags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
                 $tagIds = explode(',', $form->_submitValues['case_taglist'][$parentId]);
                 foreach ($tagIds as $tagId) {
@@ -166,9 +162,7 @@ class CRM_Core_Form_Tag {
                 $tagset[$i] = $tagset[$tagsetItem];
                 $tagset[$i]['tagsetElementName'] = "attachment_taglist_$i";
                 $form->add('text', "attachment_taglist_{$i}[{$parentId}]", NULL);
-                if (!empty($form->_submitValues["attachment_taglist_$i"]) &&
-                  CRM_Utils_Array::value($parentId, $form->_submitValues["attachment_taglist_$i"])
-                ) {
+                if (!empty($form->_submitValues["attachment_taglist_$i"]) && !empty($form->_submitValues["attachment_taglist_$i"][$parentId])) {
                   $allTags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
                   $tagIds = explode(',', $form->_submitValues["attachment_taglist_$i"][$parentId]);
                   foreach ($tagIds as $tagId) {
index c0264c5df3e9b6d19a3d208f00b112d31a560fe9..5846d64d3523f13817018c25bb7203e782be46fd 100644 (file)
@@ -210,7 +210,7 @@ class CRM_Core_OptionValue {
     }
     $params['option_group_id'] = $optionGroupID;
 
-    if (($action & CRM_Core_Action::ADD) && !CRM_Utils_Array::value('value', $params)) {
+    if (($action & CRM_Core_Action::ADD) && empty($params['value'])) {
       $fieldValues = array('option_group_id' => $optionGroupID);
       // use the next available value
       /* CONVERT(value, DECIMAL) is used to convert varchar
@@ -226,7 +226,7 @@ class CRM_Core_OptionValue {
     }
 
     // set name to label if it's not set - but *only* for ADD action (CRM-3522)
-    if (($action & CRM_Core_Action::ADD) && !CRM_Utils_Array::value('name', $params) && $params['label']) {
+    if (($action & CRM_Core_Action::ADD) && empty($params['name']) && $params['label']) {
       $params['name'] = $params['label'];
     }
     if ($action & CRM_Core_Action::UPDATE) {
index 0c80670ad6be89d23df53e45718b513d96ddba87..049926b760c8af6b51d0675ecb20de68147efcf1 100644 (file)
@@ -742,7 +742,7 @@ LIMIT 1;";
     }
     $input['is_test'] = $contribution->is_test;
     $input['net_amount'] = $contribution->net_amount;
-    if (!empty($input['fee_amount']) && CRM_Utils_Array::value('amount', $input)) {
+    if (!empty($input['fee_amount']) && !empty($input['amount'])) {
       $input['net_amount'] = $input['amount'] - $input['fee_amount'];
     }
 
index 8ce6e23089ba0de89b52814e08d483d5b891a874..0698ea846c61366bd3939a87974e97dcaf9cb94d 100644 (file)
@@ -53,9 +53,7 @@ class CRM_Core_Payment_ProcessorForm {
     $form->set('paymentProcessor', $form->_paymentProcessor);
 
     // also set cancel subscription url
-    if (!empty($form->_paymentProcessor['is_recur']) &&
-      CRM_Utils_Array::value('is_recur', $form->_values)
-    ) {
+    if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) {
       $form->_paymentObject = &CRM_Core_Payment::singleton($mode, $form->_paymentProcessor, $form);
       $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL();
     }
@@ -64,9 +62,7 @@ class CRM_Core_Payment_ProcessorForm {
     // we do this outside of the above conditional to avoid
     // saving the country/state list in the session (which could be huge)
 
-    if (($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) &&
-      CRM_Utils_Array::value('is_monetary', $form->_values)
-    ) {
+    if (($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) && !empty($form->_values['is_monetary'])) {
       if ($form->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) {
         CRM_Core_Payment_Form::setDirectDebitFields($form);
       }
@@ -87,15 +83,12 @@ class CRM_Core_Payment_ProcessorForm {
 
     // make sure we have a valid payment class, else abort
     if (!empty($form->_values['is_monetary']) &&
-      !$form->_paymentProcessor['class_name'] &&
-      !CRM_Utils_Array::value('is_pay_later', $form->_values)
-    ) {
+      !$form->_paymentProcessor['class_name'] && empty($form->_values['is_pay_later'])) {
       CRM_Core_Error::fatal(ts('Payment processor is not set for this page'));
     }
 
-    if (!empty($form->_membershipBlock) &&
-      CRM_Utils_Array::value('is_separate_payment', $form->_membershipBlock) &&
-      (CRM_Utils_Array::value('class_name', $form->_paymentProcessor) &&
+    if (!empty($form->_membershipBlock) && !empty($form->_membershipBlock['is_separate_payment']) &&
+      (!empty($form->_paymentProcessor['class_name']) &&
         !(CRM_Utils_Array::value('billing_mode', $form->_paymentProcessor) & CRM_Core_Payment::BILLING_MODE_FORM)
       )
     ) {
index 04a1ae661b1c1a0dc7f722914646c118fce1c528..9de5daf9211b1a03f4e9134fc779ed758a5b3bbc 100644 (file)
@@ -190,7 +190,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form {
         $defaults['default_value'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Country', $countryId);
       }
 
-      if ($defaults['data_type'] == 'ContactReference' && CRM_Utils_Array::value('filter', $defaults)) {
+      if ($defaults['data_type'] == 'ContactReference' && !empty($defaults['filter'])) {
         $contactRefFilter = 'Advance';
         if (strpos($defaults['filter'], 'action=lookup') !== FALSE &&
           strpos($defaults['filter'], 'group=') !== FALSE
@@ -660,9 +660,7 @@ SELECT count(*)
           break;
 
         case 'ContactReference':
-          if ($fields['filter_selected'] == 'Advance' &&
-            CRM_Utils_Array::value('filter', $fields)
-          ) {
+          if ($fields['filter_selected'] == 'Advance' && !empty($fields['filter'])) {
             if (strpos($fields['filter'], 'entity=') !== FALSE) {
               $errors['filter'] = ts("Please do not include entity parameter (entity is always 'contact')");
             }
@@ -876,9 +874,7 @@ AND    option_group_id = %2";
     }
 
     // we can not set require and view at the same time.
-    if (!empty($fields['is_required']) &&
-      CRM_Utils_Array::value('is_view', $fields)
-    ) {
+    if (!empty($fields['is_required']) && !empty($fields['is_view'])) {
       $errors['is_view'] = ts('Can not set this field Required and View Only at the same time.');
     }
 
@@ -919,11 +915,11 @@ AND    option_group_id = %2";
     }
 
     $filter = 'null';
-    if ($dataTypeKey == 11 && CRM_Utils_Array::value('filter_selected', $params)) {
+    if ($dataTypeKey == 11 && !empty($params['filter_selected'])) {
       if ($params['filter_selected'] == 'Advance' && trim(CRM_Utils_Array::value('filter', $params))) {
         $filter = trim($params['filter']);
       }
-      elseif ($params['filter_selected'] == 'Group' && CRM_Utils_Array::value('group_id', $params)) {
+      elseif ($params['filter_selected'] == 'Group' && !empty($params['group_id'])) {
 
         $filter = 'action=lookup&group=' . implode(',', $params['group_id']);
       }
index c7ac62103f0304df3375fc41f73d1da3a35fa41e..132c47987c55ddc6656096fc3464070f7f38c91d 100644 (file)
@@ -896,8 +896,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
           if ($value === 0 or $value === '0') {
             $value = $qfZeroBug;
           }
-          if (is_array($value) &&
-              !CRM_Utils_Array::value(1, $value)) {
+          if (is_array($value) && empty($value[1])) {
             $value[1] = NULL;
           }
           $elements[] = array('advcheckbox', "move_$field", NULL, NULL, NULL, $value);
@@ -1469,9 +1468,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     $viewOnlyCustomFields = array();
     foreach ($submitted as $key => $value) {
       $fid = (int) substr($key, 7);
-      if (array_key_exists($fid, $cFields) &&
-        CRM_Utils_Array::value('is_view', $cFields[$fid]['attributes'])
-      ) {
+      if (array_key_exists($fid, $cFields) && !empty($cFields[$fid]['attributes']['is_view'])) {
         $viewOnlyCustomFields[$key] = $value;
       }
     }
index 607205377cdd769a2ef13c0fe1d3693320132a12..3ac4dc31f59e6347520cb48d4e1bb87731f97e8e 100644 (file)
@@ -112,8 +112,7 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event {
     else {
       CRM_Utils_Hook::post('create', 'Event', $event->id, $event);
     }
-    if ($financialTypeId && CRM_Utils_Array::value('financial_type_id', $params)
-      && $financialTypeId != $params['financial_type_id']) {
+    if ($financialTypeId && !empty($params['financial_type_id']) && $financialTypeId != $params['financial_type_id']) {
       CRM_Price_BAO_PriceFieldValue::updateFinancialType($params['id'], 'civicrm_event', $params['financial_type_id']);
     }
     return $result;
@@ -1106,7 +1105,7 @@ WHERE civicrm_event.is_active = 1
 
         // CRM-13890 : NOTE wait list condition need to be given so that
         // wait list message is shown properly in email i.e. WRT online event registration template
-        if (empty($tplParams['participant_status']) && !CRM_Utils_Array::value('isOnWaitlist', $values['params'])) {
+        if (empty($tplParams['participant_status']) && empty($values['params']['isOnWaitlist'])) {
           $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantId, 'status_id', 'id');
           $tplParams['participant_status'] = CRM_Event_PseudoConstant::participantStatus($statusId, NULL, 'label');
         }
@@ -1942,8 +1941,7 @@ WHERE  ce.loc_block_id = $locBlockId";
       $eventEmail       = array();
 
       CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $params, $eventEmail, $returnProperties);
-      if (!empty($eventEmail['confirm_from_name']) && CRM_Utils_Array::value('confirm_from_email', $eventEmail)
-      ) {
+      if (!empty($eventEmail['confirm_from_name']) && !empty($eventEmail['confirm_from_email'])) {
         $eventEmailId = "{$eventEmail['confirm_from_name']} <{$eventEmail['confirm_from_email']}>";
 
         $fromEmailValues['from_email_id'][$eventEmailId] = htmlspecialchars($eventEmailId);
index ec55eecc20d624ae734f8e783cfb4291981ce143..8ee25cded21fbcd32efa8984aa6618c399dc8542 100644 (file)
@@ -1447,9 +1447,7 @@ UPDATE  civicrm_participant
 
       //take a receipt from as event else domain.
       $receiptFrom = $domainValues['name'] . ' <' . $domainValues['email'] . '>';
-      if (!empty($eventDetails['confirm_from_name']) &&
-        CRM_Utils_Array::value('confirm_from_email', $eventDetails)
-      ) {
+      if (!empty($eventDetails['confirm_from_name']) && !empty($eventDetails['confirm_from_email'])) {
         $receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>';
       }
 
index c2429467c97f98129d87d906b52a708272aae547..ec486c1592d3aceb8ace204801fe4db84345aa6e 100644 (file)
@@ -82,9 +82,7 @@ class CRM_Event_BAO_Query {
       }
 
       //add event title also if event id is select
-      if (!empty($query->_returnProperties['event_id']) ||
-        CRM_Utils_Array::value('event_title', $query->_returnProperties)
-      ) {
+      if (!empty($query->_returnProperties['event_id']) || !empty($query->_returnProperties['event_title'])) {
         $query->_select['event_id'] = "civicrm_event.id as event_id";
         $query->_select['event_title'] = "civicrm_event.title as event_title";
         $query->_element['event_id'] = 1;
@@ -120,9 +118,7 @@ class CRM_Event_BAO_Query {
       }
 
       //add status and status_id
-      if (!empty($query->_returnProperties['participant_status']) ||
-        CRM_Utils_Array::value('participant_status_id', $query->_returnProperties)
-      ) {
+      if (!empty($query->_returnProperties['participant_status']) || !empty($query->_returnProperties['participant_status_id'])) {
         $query->_select['participant_status'] = "participant_status.label as participant_status";
         $query->_select['participant_status_id'] = "participant_status.id as participant_status_id";
         $query->_element['participant_status_id'] = 1;
index 3d69472aaebe41b97f52bfea94458422f92a0877..a33205d36dfc3afff1a2f089fa0cf2a275faa44a 100644 (file)
@@ -357,7 +357,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
   static function formRule($fields, $files, $self) {
     $errors = array();
 
-    if ($self->payment_required && !CRM_Utils_Array::value('is_pay_later', $self->_submitValues)) {
+    if ($self->payment_required && empty($self->_submitValues['is_pay_later'])) {
       $payment = &CRM_Core_Payment::singleton($self->_mode, $self->_paymentProcessor, $this);
       $error = $payment->checkConfig($self->_mode);
       if ($error) {
@@ -448,7 +448,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
     $params['invoiceID'] = md5(uniqid(rand(), TRUE));
     $params['amount'] = $this->total;
         $params['financial_type_id'] = $this->financial_type_id;
-    if ($this->payment_required && !CRM_Utils_Array::value('is_pay_later', $params)) {
+    if ($this->payment_required && empty($params['is_pay_later'])) {
       $trxn = $this->make_payment($params);
       $params['trxn_id'] = $trxn->trxn_id;
       $params['trxn_date'] = $trxn->trxn_date;
@@ -468,7 +468,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
     else {
       $params['payment_instrument_id'] = CRM_Core_OptionGroup::getValue('payment_instrument', 'Credit Card', 'name');
     }
-    if ($this->is_pay_later && !CRM_Utils_Array::value('payment_completed', $params)) {
+    if ($this->is_pay_later && empty($params['payment_completed'])) {
       $params['contribution_status_id'] = array_search('Pending', $contribution_statuses);
     }
     else {
@@ -571,7 +571,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
   }
 
   function record_contribution(&$mer_participant, &$params, $event) {
-    if (self::is_administrator() && CRM_Utils_Array::value('payment_type', $params)) {
+    if (self::is_administrator() && !empty($params['payment_type'])) {
       $params['payment_instrument_id'] = $params['payment_type'];
     }
 
index 1f35cb46a4a599384ce85d31eb15212a88fd3ee4..ac26d648a3ef8b8da9e7914858bbcaf206caf50a 100644 (file)
@@ -100,7 +100,7 @@ class CRM_Event_Form_EventFees {
           }
         }
 
-        if ($form->_discountId && CRM_Utils_Array::value($defaults[$form->_pId]['discount_id'], $discounts)) {
+        if ($form->_discountId && !empty($discounts[$defaults[$form->_pId]['discount_id']])) {
           $form->assign('discount', $discounts[$defaults[$form->_pId]['discount_id']]);
         }
 
@@ -111,7 +111,7 @@ class CRM_Event_Form_EventFees {
     }
     else {
       $defaults[$form->_pId]['send_receipt'] = (strtotime(CRM_Utils_Array::value('start_date', $details[$form->_eventId])) >= time()) ? 1 : 0;
-      if ($form->_eventId && CRM_Utils_Array::value('confirm_email_text', $details[$form->_eventId])) {
+      if ($form->_eventId && !empty($details[$form->_eventId]['confirm_email_text'])) {
         //set receipt text
         $defaults[$form->_pId]['receipt_text'] = $details[$form->_eventId]['confirm_email_text'];
       }
@@ -199,13 +199,11 @@ class CRM_Event_Form_EventFees {
         }
       }
 
-      if ($form->_action == CRM_Core_Action::ADD && CRM_Utils_Array::value('fields', $form->_priceSet)) {
+      if ($form->_action == CRM_Core_Action::ADD && !empty($form->_priceSet['fields'])) {
         foreach ($form->_priceSet['fields'] as $key => $val) {
           foreach ($val['options'] as $keys => $values) {
             if ($values['is_default']) {
-              if (get_class($form) != 'CRM_Event_Form_Participant' &&
-                CRM_Utils_Array::value('is_full', $values)
-              ) {
+              if (get_class($form) != 'CRM_Event_Form_Participant' && !empty($values['is_full'])) {
                 continue;
               }
 
index 60cc6a20ddeaa8cb49ae33c4f3df8e233d9fc452..0c4351e24206742e53ee36a7c12053cf3a22fabb 100644 (file)
@@ -201,9 +201,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
     $defaults['id'] = $eventId;
     if (!empty($totalLables)) {
       $maxKey = count($totalLables) - 1;
-      if (isset($maxKey) &&
-        CRM_Utils_Array::value('value', $totalLables[$maxKey])
-      ) {
+      if (isset($maxKey) && !empty($totalLables[$maxKey]['value'])) {
         foreach ($totalLables[$maxKey]['value'] as $i => $v) {
           if ($totalLables[$maxKey]['amount_id'][$i] == CRM_Utils_Array::value('default_discount_fee_id', $defaults)) {
             $defaults['discounted_default'] = $i;
@@ -749,7 +747,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
                   if (!empty($value['is_default'])) {
                     $fieldParams['default_option'] = $value['weight'];
                   }
-                  if (!empty($discountFieldIDs[$j]) && CRM_Utils_Array::value($value['weight'], $discountFieldIDs[$j])) {
+                  if (!empty($discountFieldIDs[$j]) && !empty($discountFieldIDs[$j][$value['weight']])) {
                     $fieldParams['option_id'][$value['weight']] = $discountFieldIDs[$j][$value['weight']];
                     unset($discountFieldIDs[$j][$value['weight']]);
                   }
index 844f67aa5a222fbd872833267d3440a4a218ce81..600a7b07f53af6a57254eb2ac9fdfdc7905c4370 100644 (file)
@@ -248,8 +248,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent {
     $deleteOldBlock = FALSE;
 
     // if 'use existing location' option is selected -
-    if (CRM_Utils_Array::value('location_option', $params) == 2 &&
-      CRM_Utils_Array::value('loc_event_id', $params) &&
+    if (CRM_Utils_Array::value('location_option', $params) == 2 && !empty($params['loc_event_id']) &&
       ($params['loc_event_id'] != $this->_oldLocBlockId)
     ) {
       // if new selected loc is different from old loc, update the loc_block_id
index f43f9c26f63fdc9c25bb78cb4268fc5e253d2714..6762b89a1c1cd8cd519eb91c55be4563eccbbcae 100644 (file)
@@ -501,9 +501,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
       }
       $additionalCustomPreId = $additionalCustomPostId = NULL;
       $isPreError = $isPostError = TRUE;
-      if (!empty($values['allow_same_participant_emails']) &&
-        CRM_Utils_Array::value('is_multiple_registrations', $values)
-      ) {
+      if (!empty($values['allow_same_participant_emails']) && !empty($values['is_multiple_registrations'])) {
         $types = array_merge(array('Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
         $profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
 
@@ -798,7 +796,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
       if (!empty($params['additional_custom_post_id_multiple'])) {
         $additionalPostMultiple = array();
         foreach ($params['additional_custom_post_id_multiple'] as $key => $value) {
-          if (!$value && CRM_Utils_Array::value('custom_post_id', $params)) {
+          if (!$value && !empty($params['custom_post_id'])) {
             $additionalPostMultiple[$key] = $params['custom_post_id'];
           }
           elseif ($value == 'none') {
index 03151fc964b70fb52c51b0848a3a2dd3f8a45946..c8d7cb6789f13e8dadb3f1c029ddb9b19d0bfff2 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Event_Form_ManageEvent_TabHeader {
 
   static function build(&$form) {
     $tabs = $form->get('tabHeader');
-    if (!$tabs || !CRM_Utils_Array::value('reset', $_GET)) {
+    if (!$tabs || empty($_GET['reset'])) {
       $tabs = self::process($form);
       $form->set('tabHeader', $tabs);
     }
index 5406562b70610e5f2105c9c29123d68fd8d8178e..97410f02faeedf7951d2e5f23107e370f2c2ac84 100644 (file)
@@ -407,8 +407,7 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task {
     }
 
     // when fee amount is included in form
-    if (!empty($_POST['hidden_feeblock']) || CRM_Utils_Array::value('send_receipt', $_POST)
-    ) {
+    if (!empty($_POST['hidden_feeblock']) || !empty($_POST['send_receipt'])) {
       CRM_Event_Form_EventFees::preProcess($this);
       CRM_Event_Form_EventFees::buildQuickForm($this);
       CRM_Event_Form_EventFees::setDefaultValues($this);
@@ -1008,8 +1007,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
     }
 
     // validate contribution status for 'Failed'.
-    if ($self->_onlinePendingContributionId &&
-      CRM_Utils_Array::value('record_contribution', $values) &&
+    if ($self->_onlinePendingContributionId && !empty($values['record_contribution']) &&
       (CRM_Utils_Array::value('contribution_status_id', $values) ==
         array_search('Failed', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'))
       )
@@ -1019,8 +1017,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
 
     // do the amount validations.
     //skip for update mode since amount is freeze, CRM-6052
-    if ((!$self->_id &&
-        !CRM_Utils_Array::value('total_amount', $values) &&
+    if ((!$self->_id && empty($values['total_amount']) &&
         empty($self->_values['line_items'])
       ) ||
       ($self->_id && !$self->_paymentId && isset($self->_values['line_items']) && is_array($self->_values['line_items']))
@@ -1130,8 +1127,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
 
         $params['fee_level'] = $params['amount_level'];
         $contributionParams['total_amount'] = $params['amount'];
-        if ($this->_quickConfig && CRM_Utils_Array::value('total_amount', $params)
-          && $params['status_id'] != array_search('Partially paid', $participantStatus)) {
+        if ($this->_quickConfig && !empty($params['total_amount']) && $params['status_id'] != array_search('Partially paid', $participantStatus)) {
           $params['fee_amount'] = $params['total_amount'];
         } else {
           //fix for CRM-3086
@@ -1533,8 +1529,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
           if (is_array($value) && $value != 'skip') {
             foreach ($value as $lineKey => $line) {
               //10117 update the line items for participants if contribution amount is recorded
-              if ($this->_quickConfig && CRM_Utils_Array::value('total_amount', $params )
-                && $params['status_id'] != array_search('Partially paid', $participantStatus)
+              if ($this->_quickConfig && !empty($params['total_amount']) && $params['status_id'] != array_search('Partially paid', $participantStatus)
               ) {
                 $line['unit_price'] = $line['line_total'] = $params['total_amount'];
               }
@@ -1549,9 +1544,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
     $updateStatusMsg = NULL;
     //send mail when participant status changed, CRM-4326
     if ($this->_id && $this->_statusId &&
-      $this->_statusId != CRM_Utils_Array::value('status_id', $params) &&
-      CRM_Utils_Array::value('is_notify', $params)
-    ) {
+      $this->_statusId != CRM_Utils_Array::value('status_id', $params) && !empty($params['is_notify'])) {
 
       $updateStatusMsg = CRM_Event_BAO_Participant::updateStatusMessage($this->_id,
         $params['status_id'],
index 82bfebc44701ca4f7ef73ff6aa55c2906bfa804b..4a51eebd63b53881af1316d5226cc3d78357928b 100644 (file)
@@ -304,7 +304,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
       $isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later');
       //check for variour combination for paylater, payment
       //process with paid event.
-      if ($isMonetary && (!$isPayLater || CRM_Utils_Array::value('payment_processor', $this->_values['event']))) {
+      if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) {
         $ppID = CRM_Utils_Array::value('payment_processor',
           $this->_values['event']
         );
@@ -532,9 +532,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
 
     $this->assign('address', CRM_Utils_Address::format($addressFields));
 
-    if ($this->_contributeMode == 'direct' &&
-      !CRM_Utils_Array::value('is_pay_later', $params)
-    ) {
+    if ($this->_contributeMode == 'direct' && empty($params['is_pay_later'])) {
       $date = CRM_Utils_Date::format(CRM_Utils_Array::value('credit_card_exp_date', $params));
       $date = CRM_Utils_Date::mysqlToIso($date);
       $this->assign('credit_card_exp_date', $date);
@@ -779,9 +777,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
       $createPayment = TRUE;
     }
 
-    if ($createPayment && $this->_values['event']['is_monetary'] &&
-      CRM_Utils_Array::value('contributionID', $this->_params)
-    ) {
+    if ($createPayment && $this->_values['event']['is_monetary'] && !empty($this->_params['contributionID'])) {
       $paymentParams = array(
         'participant_id' => $participant->id,
         'contribution_id' => $contribution->id,
@@ -791,9 +787,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
     }
 
     //set only primary participant's params for transfer checkout.
-    if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify')
-      && CRM_Utils_Array::value('is_primary', $this->_params)
-    ) {
+    if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify') && !empty($this->_params['is_primary'])) {
       $this->_params['participantID'] = $participant->id;
       $this->set('primaryParticipant', $this->_params);
     }
@@ -821,9 +815,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
       // 3. waiting list participant.
       // 4. require approval participant.
       if (!empty($this->_params['is_pay_later']) ||
-        $this->_allowWaitlist || $this->_requireApproval ||
-        !CRM_Utils_Array::value('is_monetary', $this->_values['event'])
-      ) {
+        $this->_allowWaitlist || $this->_requireApproval || empty($this->_values['event']['is_monetary'])) {
         $mail = 'email-Primary';
       }
 
@@ -909,9 +901,7 @@ WHERE  v.option_group_id = g.id
 
     // reuse id if one already exists for this one (can happen
     // with back button being hit etc)
-    if (!$participantParams['id'] &&
-      CRM_Utils_Array::value('contributionID', $params)
-    ) {
+    if (!$participantParams['id'] && !empty($params['contributionID'])) {
       $pID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment',
         $params['contributionID'],
         'participant_id',
index ac72739690e22878e5e173f6220eaf395f27dc98..9688ba80c0765528ee628958652584e57a9de61d 100644 (file)
@@ -102,7 +102,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
     //fix for CRM-3088, default value for discount set.
     if (!empty($this->_values['discount'])) {
       $discountId = CRM_Core_BAO_Discount::findSet($this->_eventId, 'civicrm_event');
-      if ($discountId && CRM_Utils_Array::value('default_discount_fee_id', $this->_values['event'])) {
+      if ($discountId && !empty($this->_values['event']['default_discount_fee_id'])) {
         $discountKey = CRM_Core_DAO::getFieldValue("CRM_Core_DAO_OptionValue", $this->_values['event']['default_discount_fee_id']
           , 'weight', 'id'
         );
@@ -206,7 +206,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
 
     //add buttons
     $js = NULL;
-    if ($this->isLastParticipant(TRUE) && !CRM_Utils_Array::value('is_monetary', $this->_values['event'])) {
+    if ($this->isLastParticipant(TRUE) && empty($this->_values['event']['is_monetary'])) {
       $js = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');");
     }
 
@@ -226,8 +226,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
       $processedCnt = self::getParticipantCount($this, $this->_params, TRUE);
     }
 
-    if (!$this->_allowConfirmation &&
-      CRM_Utils_Array::value('bypass_payment', $this->_params[0]) &&
+    if (!$this->_allowConfirmation && !empty($this->_params[0]['bypass_payment']) &&
       $this->_lastParticipant
     ) {
 
@@ -250,9 +249,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
 
       //lets allow to become a part of runtime waiting list, if primary selected pay later.
       $realPayLater = FALSE;
-      if (!empty($this->_values['event']['is_monetary']) &&
-        CRM_Utils_Array::value('is_pay_later', $this->_values['event'])
-      ) {
+      if (!empty($this->_values['event']['is_monetary']) && !empty($this->_values['event']['is_pay_later'])) {
         $realPayLater = CRM_Utils_Array::value('is_pay_later', $this->_params[0]);
       }
 
@@ -295,8 +292,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
     }
 
     // for priceset with count
-    if ($pricesetFieldsCount &&
-      CRM_Utils_Array::value('has_waitlist', $this->_values['event']) &&
+    if ($pricesetFieldsCount && !empty($this->_values['event']['has_waitlist']) &&
       !$this->_allowConfirmation
     ) {
 
@@ -385,9 +381,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
     $button = substr($self->controller->getButtonName(), -4);
 
     $realPayLater = FALSE;
-    if (!empty($self->_values['event']['is_monetary']) &&
-      CRM_Utils_Array::value('is_pay_later', $self->_values['event'])
-    ) {
+    if (!empty($self->_values['event']['is_monetary']) && !empty($self->_values['event']['is_pay_later'])) {
       $realPayLater = CRM_Utils_Array::value('is_pay_later', $self->_params[0]);
     }
 
@@ -476,8 +470,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
             $errors['_qf_default'] = ts("Your event registration will be confirmed. Please go back to the main registration page, to complete payment information.");
           }
           //check for availability of registrations.
-          if (!$self->_allowConfirmation &&
-            !CRM_Utils_Array::value('has_waitlist', $self->_values['event']) &&
+          if (!$self->_allowConfirmation && empty($self->_values['event']['has_waitlist']) &&
             $totalParticipants > $self->_availableRegistrations
           ) {
             $errors['_qf_default'] = ts('It looks like event has only %2 seats available and you are trying to register %1 participants, so could you please select price options accordingly.', array(1 => $totalParticipants, 2 => $self->_availableRegistrations));
@@ -486,14 +479,13 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
       }
     }
 
-    if ($button == 'skip' && $self->_lastParticipant && CRM_Utils_Array::value('priceSetId', $fields)) {
+    if ($button == 'skip' && $self->_lastParticipant && !empty($fields['priceSetId'])) {
       $pricesetFieldsCount = CRM_Price_BAO_PriceSet::getPricesetCount($fields['priceSetId']);
       if (($pricesetFieldsCount < 1) || $self->_allowConfirmation) {
         return $errors;
       }
 
-      if (!empty($self->_values['event']['has_waitlist']) &&
-        CRM_Utils_Array::value('bypass_payment', $self->_params[0]) &&
+      if (!empty($self->_values['event']['has_waitlist']) && !empty($self->_params[0]['bypass_payment']) &&
         !$self->_allowWaitlist &&
         !$realPayLater &&
         !$self->_requireApproval &&
@@ -721,9 +713,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
     }
 
     //to check whether call processRegistration()
-    if (!$this->_values['event']['is_monetary']
-      && CRM_Utils_Array::value('additional_participants', $this->_params[0])
-      && $this->isLastParticipant()
+    if (!$this->_values['event']['is_monetary'] && !empty($this->_params[0]['additional_participants']) && $this->isLastParticipant()
     ) {
       CRM_Event_Form_Registration_Register::processRegistration($this->_params, NULL);
     }
index 2c4d5aef9232d5989d6271a05423808ed5c2227a..bec64c18eaf8f574219080b2dbaab03053f8cde4 100644 (file)
@@ -78,9 +78,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
 
     CRM_Utils_Hook::eventDiscount($this, $this->_params);
 
-    if (!empty($this->_params[0]['discount']) &&
-      CRM_Utils_Array::value('applied', $this->_params[0]['discount'])
-    ) {
+    if (!empty($this->_params[0]['discount']) && !empty($this->_params[0]['discount']['applied'])) {
       $this->set('hookDiscount', $this->_params[0]['discount']);
       $this->assign('hookDiscount', $this->_params[0]['discount']);
     }
@@ -241,7 +239,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
             }
           }
 
-          if (!empty($v['first_name']) && CRM_Utils_Array::value('last_name', $v)) {
+          if (!empty($v['first_name']) && !empty($v['last_name'])) {
             $append = $v['first_name'] . ' ' . $v['last_name'];
           }
           else {
@@ -361,8 +359,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
     //consider total amount.
     $this->assign('isAmountzero', ($this->_totalAmount <= 0) ? TRUE : FALSE);
 
-    if ($this->_paymentProcessor['payment_processor_type'] == 'Google_Checkout' &&
-      !CRM_Utils_Array::value('is_pay_later', $this->_params[0]) && !($this->_params[0]['amount'] == 0) &&
+    if ($this->_paymentProcessor['payment_processor_type'] == 'Google_Checkout' && empty($this->_params[0]['is_pay_later']) && !($this->_params[0]['amount'] == 0) &&
       !$this->_allowWaitlist && !$this->_requireApproval
     ) {
       $this->_checkoutButtonName = $this->getButtonName('next', 'checkout');
@@ -463,13 +460,9 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
 
     // if a discount has been applied, lets now deduct it from the amount
     // and fix the fee level
-    if (!empty($this->_params[0]['discount']) &&
-      CRM_Utils_Array::value('applied', $this->_params[0]['discount'])
-    ) {
+    if (!empty($this->_params[0]['discount']) && !empty($this->_params[0]['discount']['applied'])) {
       foreach ($this->_params as $k => $v) {
-        if (CRM_Utils_Array::value('amount', $this->_params[$k]) > 0 &&
-          CRM_Utils_Array::value('discountAmount', $this->_params[$k])
-        ) {
+        if (CRM_Utils_Array::value('amount', $this->_params[$k]) > 0 && !empty($this->_params[$k]['discountAmount'])) {
           $this->_params[$k]['amount'] -= $this->_params[$k]['discountAmount'];
           $this->_params[$k]['amount_level'] .= CRM_Utils_Array::value('discountMessage', $this->_params[$k]);
         }
@@ -516,9 +509,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
       $this->fixLocationFields($value, $fields);
       //unset the billing parameters if it is pay later mode
       //to avoid creation of billing location
-      if ($this->_allowWaitlist || $this->_requireApproval ||
-        CRM_Utils_Array::value('is_pay_later', $value) || !CRM_Utils_Array::value('is_primary', $value)
-      ) {
+      if ($this->_allowWaitlist || $this->_requireApproval || !empty($value['is_pay_later']) || empty($value['is_primary'])) {
         $billingFields = array(
           "email-{$this->_bltID}",
           'billing_first_name',
@@ -559,7 +550,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
       // we dont store in userID in case the user is doing multiple
       // transactions etc
       // for things like tell a friend
-      if (!$this->getContactID() && CRM_Utils_Array::value('is_primary', $value)) {
+      if (!$this->getContactID() && !empty($value['is_primary'])) {
         $session = CRM_Core_Session::singleton();
         $session->set('transaction.userID', $contactID);
       }
@@ -604,7 +595,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
             $value['participant_status_id'] = $value['participant_status'] = array_search($status, $pendingStatuses);
           }
         }
-        elseif ($this->_contributeMode == 'express' && CRM_Utils_Array::value('is_primary', $value)) {
+        elseif ($this->_contributeMode == 'express' && !empty($value['is_primary'])) {
           if (is_object($payment))
             $result = $payment->doExpressCheckout($value);
           else
@@ -648,7 +639,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
           $createContrib = TRUE;
         }
 
-        if ($createContrib && CRM_Utils_Array::value('is_primary', $value) &&
+        if ($createContrib && !empty($value['is_primary']) &&
           !$this->_allowWaitlist && !$this->_requireApproval
         ) {
           // if paid event add a contribution record
@@ -682,7 +673,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
         $value['currencyID'] = $primaryCurrencyID;
       }
 
-      if (!$pending && CRM_Utils_Array::value('is_primary', $value) &&
+      if (!$pending && !empty($value['is_primary']) &&
         !$this->_allowWaitlist && !$this->_requireApproval
       ) {
         // transactionID & receive date required while building email template
@@ -766,8 +757,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
     // for Transfer checkout.
     if (($this->_contributeMode == 'checkout' ||
         $this->_contributeMode == 'notify'
-      ) &&
-      !CRM_Utils_Array::value('is_pay_later', $params[0]) &&
+      ) && empty($params[0]['is_pay_later']) &&
       !$this->_allowWaitlist && !$this->_requireApproval &&
       $this->_totalAmount > 0
     ) {
@@ -962,14 +952,12 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
     }
 
     //create an contribution address
-    if ($form->_contributeMode != 'notify' && !CRM_Utils_Array::value('is_pay_later', $params)) {
+    if ($form->_contributeMode != 'notify' && empty($params['is_pay_later'])) {
       $contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID);
     }
 
     // Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
-    if (!empty($params['pcp_made_through_id']) ||
-      CRM_Utils_Array::value('soft_credit_to', $params)
-    ) {
+    if (!empty($params['pcp_made_through_id']) || !empty($params['soft_credit_to'])) {
 
       // if its due to pcp
       if (!empty($params['pcp_made_through_id'])) {
@@ -1036,14 +1024,11 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
     $fields['email-Primary'] = 1;
 
     //if its pay later or additional participant set email address as primary.
-    if ((CRM_Utils_Array::value('is_pay_later', $params) ||
-        !CRM_Utils_Array::value('is_primary', $params) ||
+    if ((!empty($params['is_pay_later']) || empty($params['is_primary']) ||
         !$this->_values['event']['is_monetary'] ||
         $this->_allowWaitlist ||
         $this->_requireApproval
-      ) &&
-      CRM_Utils_Array::value("email-{$this->_bltID}", $params)
-    ) {
+      ) && !empty($params["email-{$this->_bltID}"])) {
       $params['email-Primary'] = $params["email-{$this->_bltID}"];
     }
   }
index 645c56c49b1051384e46e01413b2cc2c2971ba67..05d34e4f9769ce9e2df6bfd6385aeb902e46326b 100644 (file)
@@ -96,9 +96,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     }
 
     $this->_allowWaitlist = FALSE;
-    if ($eventFull && !$this->_allowConfirmation &&
-      CRM_Utils_Array::value('has_waitlist', $this->_values['event'])
-    ) {
+    if ($eventFull && !$this->_allowConfirmation && !empty($this->_values['event']['has_waitlist'])) {
       $this->_allowWaitlist = TRUE;
       $this->_waitlistMsg = CRM_Utils_Array::value('waitlist_text', $this->_values['event']);
       if (!$this->_waitlistMsg) {
@@ -263,9 +261,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     if ($this->_priceSetId && !empty($this->_feeBlock)) {
       foreach ($this->_feeBlock as $key => $val) {
         foreach ($val['options'] as $keys => $values) {
-          if ($values['is_default'] &&
-            !CRM_Utils_Array::value('is_full', $values)
-          ) {
+          if ($values['is_default'] && empty($values['is_full'])) {
 
             if ($val['html_type'] == 'CheckBox') {
               $this->_defaults["price_{$key}"][$keys] = 1;
@@ -365,13 +361,11 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     }
 
     //hack to allow group to register w/ waiting
-    if ((CRM_Utils_Array::value('is_multiple_registrations', $this->_values['event']) ||
+    if ((!empty($this->_values['event']['is_multiple_registrations']) ||
         $this->_priceSetId
       ) &&
       !$this->_allowConfirmation &&
-      is_numeric($this->_availableRegistrations)
-      && CRM_Utils_Array::value('has_waitlist', $this->_values['event'])
-    ) {
+      is_numeric($this->_availableRegistrations) && !empty($this->_values['event']['has_waitlist'])) {
       $bypassPayment = TRUE;
       //case might be group become as a part of waitlist.
       //If not waitlist then they require admin approve.
@@ -500,8 +494,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
       $allAreBillingModeProcessors = FALSE;
     }
 
-    if (!$allAreBillingModeProcessors ||
-      CRM_Utils_Array::value('is_pay_later', $this->_values['event']) || $bypassPayment
+    if (!$allAreBillingModeProcessors || !empty($this->_values['event']['is_pay_later']) || $bypassPayment
     ) {
 
       //freeze button to avoid multiple calls.
@@ -668,9 +661,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     $priceSetId = $form->get('priceSetId');
     if (!$priceSetId ||
       !is_array($priceSet) ||
-      empty($priceSet) ||
-      !CRM_Utils_Array::value('optionsMaxValueTotal', $priceSet)
-    ) {
+      empty($priceSet) || empty($priceSet['optionsMaxValueTotal'])) {
       return;
     }
 
@@ -734,9 +725,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
           $form->_allowConfirmation &&
           !empty($formattedPriceSetDefaults)
         ) {
-          if (empty($formattedPriceSetDefaults["price_{$field}"]) ||
-            !CRM_Utils_Array::value($opId, $formattedPriceSetDefaults["price_{$fieldId}"])
-          ) {
+          if (empty($formattedPriceSetDefaults["price_{$field}"]) || empty($formattedPriceSetDefaults["price_{$fieldId}"][$opId])) {
             $optionFullIds[$optId] = $optId;
             $isFull = TRUE;
           }
@@ -776,8 +765,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
       self::checkRegistration($fields, $self);
     }
     //check for availability of registrations.
-    if (!$self->_allowConfirmation &&
-      !CRM_Utils_Array::value('bypass_payment', $fields) &&
+    if (!$self->_allowConfirmation && empty($fields['bypass_payment']) &&
       is_numeric($self->_availableRegistrations) &&
       CRM_Utils_Array::value('additional_participants', $fields) >= $self->_availableRegistrations
     ) {
@@ -785,8 +773,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     }
 
     // during confirmation don't allow to increase additional participants, CRM-4320
-    if ($self->_allowConfirmation &&
-      CRM_Utils_Array::value('additional_participants', $fields) &&
+    if ($self->_allowConfirmation && !empty($fields['additional_participants']) &&
       is_array($self->_additionalParticipantIds) &&
       $fields['additional_participants'] > count($self->_additionalParticipantIds)
     ) {
@@ -796,7 +783,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     //don't allow to register w/ waiting if enough spaces available.
     if (!empty($fields['bypass_payment'])) {
       if (!is_numeric($self->_availableRegistrations) ||
-        (!CRM_Utils_Array::value('priceSetId', $fields) && CRM_Utils_Array::value('additional_participants', $fields) < $self->_availableRegistrations)
+        (empty($fields['priceSetId']) && CRM_Utils_Array::value('additional_participants', $fields) < $self->_availableRegistrations)
       ) {
         $errors['bypass_payment'] = ts("Oops. There are enough available spaces in this event. You can not add yourself to the waiting list.");
       }
@@ -854,8 +841,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
       if ($self->_paymentProcessor &&
         $self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
       ) {
-        if (!empty($fields[$self->_expressButtonName . '_x']) ||
-          CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) ||
+        if (!empty($fields[$self->_expressButtonName . '_x']) || !empty($fields[$self->_expressButtonName . '_y']) ||
           CRM_Utils_Array::value($self->_expressButtonName, $fields)
         ) {
           return empty($errors) ? TRUE : $errors;
@@ -883,13 +869,12 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
         $isZeroAmount = TRUE;
       }
 
-      if ($isZeroAmount && !($self->_forcePayement && CRM_Utils_Array::value('additional_participants', $fields))) {
+      if ($isZeroAmount && !($self->_forcePayement && !empty($fields['additional_participants']))) {
         $skipPaymentValidation = TRUE;
       }
 
       // also return if paylater mode or zero fees for valid members
-      if (!empty($fields['is_pay_later']) ||
-        CRM_Utils_Array::value('bypass_payment', $fields) ||
+      if (!empty($fields['is_pay_later']) || !empty($fields['bypass_payment']) ||
         $skipPaymentValidation ||
         (!$self->_allowConfirmation && ($self->_requireApproval || $self->_allowWaitlist))
       ) {
@@ -926,9 +911,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
       }
     }
 
-    if (!$email && !(CRM_Utils_Array::value('first_name', $fields) &&
-        CRM_Utils_Array::value('last_name', $fields)
-      )) {
+    if (!$email && !(!empty($fields['first_name']) && !empty($fields['last_name']))) {
       $defaults = $params = array('id' => $eventId);
       CRM_Event_BAO_Event::retrieve($params, $defaults);
       $message = ts("Mandatory fields (first name and last name, OR email address) are missing from this form.");
@@ -993,8 +976,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     if (!empty($params['additional_participants'])) {
       $totalParticipants += $params['additional_participants'];
     }
-    if (!$this->_allowConfirmation &&
-      CRM_Utils_Array::value('bypass_payment', $params) &&
+    if (!$this->_allowConfirmation && !empty($params['bypass_payment']) &&
       is_numeric($this->_availableRegistrations) &&
       $totalParticipants > $this->_availableRegistrations
     ) {
@@ -1098,8 +1080,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
               $this->_expressButtonName . '_x',
               $this->_expressButtonName . '_y',
             )
-          ) &&
-            !CRM_Utils_Array::value('is_pay_later', $params) &&
+          ) && empty($params['is_pay_later']) &&
           !$this->_allowWaitlist &&
           !$this->_requireApproval
         ) {
@@ -1242,7 +1223,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
         // we dont store in userID in case the user is doing multiple
         // transactions etc
         // for things like tell a friend
-        if (!$this->getContactID() && CRM_Utils_Array::value('is_primary', $value)) {
+        if (!$this->getContactID() && !empty($value['is_primary'])) {
           $session->set('transaction.userID', $contactID);
         }
 
index 59c86472352652ba7ed522caebd2bd08cd159a2f..d94d88001f36bc45d8b51e530c87ec9e01402114 100644 (file)
@@ -176,7 +176,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser {
 
     if (!(($index < 0) || ($this->_participantStatusIndex < 0))) {
       $errorRequired = !CRM_Utils_Array::value($this->_participantStatusIndex, $values);
-      if (empty($params['event_id']) && !CRM_Utils_Array::value('event_title', $params)) {
+      if (empty($params['event_id']) && empty($params['event_title'])) {
         CRM_Contact_Import_Parser_Contact::addToErrorMsg('Event', $missingField);
       }
       if (empty($params['participant_status_id'])) {
@@ -302,7 +302,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser {
       }
     }
 
-    if (!(CRM_Utils_Array::value('participant_role_id', $params) || CRM_Utils_Array::value('participant_role', $params))) {
+    if (!(!empty($params['participant_role_id']) || !empty($params['participant_role']))) {
       if (!empty($params['event_id'])) {
         $params['participant_role_id'] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'default_role_id');
       }
index d0416b3cb3d3cc39425d0bafe7cf60893e3ad1c1..7c80266962b4c5fc5508015ec483b545b26edbf7 100644 (file)
@@ -94,7 +94,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
     $this->assign('isShowLocation', CRM_Utils_Array::value('is_show_location', $values['event']));
 
     // show event fees.
-    if ($this->_id && CRM_Utils_Array::value('is_monetary', $values['event'])) {
+    if ($this->_id && !empty($values['event']['is_monetary'])) {
       //CRM-6907
       $config = CRM_Core_Config::singleton();
       $config->defaultCurrency = CRM_Utils_Array::value('currency',
@@ -163,7 +163,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
     $this->assign('action', CRM_Core_Action::VIEW);
     //To show the event location on maps directly on event info page
     $locations = CRM_Event_BAO_Event::getMapInfo($this->_id);
-    if (!empty($locations) && CRM_Utils_Array::value('is_map', $values['event'])) {
+    if (!empty($locations) && !empty($values['event']['is_map'])) {
       $this->assign('locations', $locations);
       $this->assign('mapProvider', $config->mapProvider);
       $this->assign('mapKey', $config->mapAPIKey);
index 7796a8cbc6dd718b9055993da5cd070936de0cd2..51e62e483311e4bffeb567a7d41cb21beeef538c 100644 (file)
@@ -349,7 +349,7 @@ class CRM_Export_BAO_Export {
       }
     }
 
-    if (!$selectAll && $componentTable && CRM_Utils_Array::value('additional_group', $exportParams)) {
+    if (!$selectAll && $componentTable && !empty($exportParams['additional_group'])) {
       // If an Additional Group is selected, then all contacts in that group are
       // added to the export set (filtering out duplicates).
       $query = "
@@ -545,8 +545,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
     $queryString = "$select $from $where $having";
 
     $groupBy = "";
-    if (!empty($returnProperties['tags']) ||
-      CRM_Utils_Array::value('groups', $returnProperties) ||
+    if (!empty($returnProperties['tags']) || !empty($returnProperties['groups']) ||
       CRM_Utils_Array::value('notes', $returnProperties) ||
       // CRM-9552
       ($queryMode & CRM_Contact_BAO_Query::MODE_CONTACTS && $query->_useGroupBy)
index e8b2da1707f2fa27b58488d9aa2e00f9d5062542..1c57f0bb6b82a9175f57a759fd918f1ffb96cf30 100644 (file)
@@ -119,7 +119,7 @@ class CRM_Export_Form_Map extends CRM_Core_Form {
   static function formRule($fields, $values, $mappingTypeId) {
     $errors = array();
 
-    if (!empty($fields['saveMapping']) && CRM_Utils_Array::value('_qf_Map_next', $fields)) {
+    if (!empty($fields['saveMapping']) && !empty($fields['_qf_Map_next'])) {
       $nameField = CRM_Utils_Array::value('saveMappingName', $fields);
       if (empty($nameField)) {
         $errors['saveMappingName'] = ts('Name is required to save Export Mapping');
index 6d6109cf6fee467998b3a374955e4cc4d4125edf..86492b36e02b81f4669a5230ea82c43b7ecea626 100644 (file)
@@ -353,9 +353,7 @@ FROM   {$this->_componentTable}
       foreach ($greetings as $key => $value) {
         $otherOption = CRM_Utils_Array::value($key, $params);
 
-        if ((CRM_Utils_Array::value($otherOption, $self->_greetingOptions[$key]) == ts('Other')) &&
-          !CRM_Utils_Array::value($value, $params)
-        ) {
+        if ((CRM_Utils_Array::value($otherOption, $self->_greetingOptions[$key]) == ts('Other')) && empty($params[$value])) {
 
           $label = ucwords(str_replace('_', ' ', $key));
           $errors[$value] = ts('Please enter a value for %1 (merging > 2 contacts), or select a pre-configured option from the list.', array(1 => $label));
index 35503e980962fd83737f449ab9c09a5002ec6d54..a050cd33b82dc27798015857c6926a97fed5f15c 100644 (file)
@@ -177,7 +177,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
     }
 
     if ($this->_action == CRM_Core_Action::ADD) {
-      if (!empty($this->_submitValues['account_relationship']) || CRM_Utils_Array::value('financial_account_id', $this->_submitValues)) {
+      if (!empty($this->_submitValues['account_relationship']) || !empty($this->_submitValues['financial_account_id'])) {
         $financialAccountType = array(
            '5' => 5, //expense
            '3' => 1, //AR relation
@@ -272,7 +272,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
     if (CRM_Utils_Array::value('financial_account_id', $values) == 'select') {
       $errorMsg['financial_account_id'] = 'Financial Account is a required field.';
     }
-    if (!empty($values['account_relationship']) && CRM_Utils_Array::value('financial_account_id', $values)) {
+    if (!empty($values['account_relationship']) && !empty($values['financial_account_id'])) {
       $params = array(
         'account_relationship' => $values['account_relationship'],
         'entity_id'            => $self->_aid
index e14822eac67869a9193b20668fc18a454f840bb5..d42c34f43f9c37562e0f62de1eba6b7f52b9d53d 100644 (file)
@@ -191,7 +191,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend {
       );
       //if is_email_receipt is set then take receipt_from_email
       //as from_email
-      if (!empty($default['is_email_receipt']) && CRM_Utils_Array::value('receipt_from_email', $default)) {
+      if (!empty($default['is_email_receipt']) && !empty($default['receipt_from_email'])) {
         $mailParams['email_from'] = $default['receipt_from_email'];
       }
 
@@ -211,7 +211,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend {
 
       //if is_email_confirm is set then take confirm_from_email
       //as from_email
-      if (!empty($default['is_email_confirm']) && CRM_Utils_Array::value('confirm_from_email', $default)) {
+      if (!empty($default['is_email_confirm']) && !empty($default['confirm_from_email'])) {
         $mailParams['email_from'] = $default['confirm_from_email'];
       }
 
index f36a7be00674d6599dd6e4711325532437847739..5085648c9830f0493a06416d14ab6578651a6acf 100644 (file)
@@ -245,9 +245,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
 
     $groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
     $config = CRM_Core_Config::singleton();
-    if (isset($this->_id) &&
-      CRM_Utils_Array::value('saved_search_id', $this->_groupValues)
-    ) {
+    if (isset($this->_id) && !empty($this->_groupValues['saved_search_id'])) {
       unset($groupTypes['Access Control']);
     }
 
@@ -266,9 +264,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
     $groupNames = CRM_Core_PseudoConstant::group();
 
     $parentGroups = $parentGroupElements = array();
-    if (isset($this->_id) &&
-      CRM_Utils_Array::value('parents', $this->_groupValues)
-    ) {
+    if (isset($this->_id) && !empty($this->_groupValues['parents'])) {
       $parentGroupIds = explode(',', $this->_groupValues['parents']);
       foreach ($parentGroupIds as $parentGroupId) {
         $parentGroups[$parentGroupId] = $groupNames[$parentGroupId];
index 0f1124b49e36ea53a3a7f33091e1d0753d07411f..7dcdaa5809c8a05bbbc6b2a61b6e63da310e3fc4 100644 (file)
@@ -1565,8 +1565,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
     $mg = new CRM_Mailing_DAO_MailingGroup();
     foreach (array('groups', 'mailings') as $entity) {
       foreach (array('include', 'exclude', 'base') as $type) {
-        if (isset($params[$entity]) &&
-          CRM_Utils_Array::value($type, $params[$entity]) &&
+        if (isset($params[$entity]) && !empty($params[$entity][$type]) &&
           is_array($params[$entity][$type])) {
           foreach ($params[$entity][$type] as $entityId) {
             $mg->reset();
index 88c13c0d8800aa2a70c206c1d956463a088c75be..ae2c9cc2abd7247389392bc908d97cd0135ad563 100644 (file)
@@ -268,10 +268,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form {
       );
     }
 
-    if (!empty($_POST['_qf_Import_refresh']) ||
-      CRM_Utils_Array::value('_qf_Test_next', $testParams) ||
-      !CRM_Utils_Array::value('sendtest', $testParams)
-    ) {
+    if (!empty($_POST['_qf_Import_refresh']) || !empty($testParams['_qf_Test_next']) || empty($testParams['sendtest'])) {
       $error = TRUE;
       return $error;
     }
index 0698ccdf72ed7476f92f46f2e15bf0dc4a15acc1..6d2e3a02815ba96b0aefd4df81d00b1d72a32a90 100644 (file)
@@ -119,7 +119,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
       }
 
       //set default from email address.
-      if (!empty($defaults['from_name']) && CRM_Utils_Array::value('from_email', $defaults)) {
+      if (!empty($defaults['from_name']) && !empty($defaults['from_email'])) {
         $defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>',
           CRM_Core_OptionGroup::values('from_email_address')
         );
@@ -235,8 +235,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
     );
 
     //Added code to add custom field as Reply-To on form when it is enabled from Mailer settings
-    if (isset($config->replyTo) && !empty($config->replyTo) &&
-      ! CRM_Utils_Array::value( 'override_verp', $options ) ) {
+    if (isset($config->replyTo) && !empty($config->replyTo) && empty($options['override_verp'])) {
       $this->add('select', 'reply_to_address', ts('Reply-To'),
         array('' => '- select -') + $fromEmailAddress
       );
@@ -582,10 +581,10 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
       }
     }
     else {
-      if (empty($params['text_message']) && !CRM_Utils_Array::value('html_message', $params)) {
+      if (empty($params['text_message']) && empty($params['html_message'])) {
         $errors['html_message'] = ts('Please provide either a Text or HTML formatted message - or both.');
       }
-      if (!empty($params['saveTemplate']) && !CRM_Utils_Array::value('saveTemplateName', $params)) {
+      if (!empty($params['saveTemplate']) && empty($params['saveTemplateName'])) {
         $errors['saveTemplateName'] = ts('Please provide a Template Name.');
       }
     }
index 2609b3906a40359a3d225324b40b12b7a89b31bc..7ed98d56a77807e133b4c710f56a933f13912fea 100644 (file)
@@ -231,9 +231,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
     // To skip status calculation we should use 'skipStatusCal'.
     // eg pay later membership, membership update cron CRM-3984
 
-    if (empty($params['is_override']) &&
-      !CRM_Utils_Array::value('skipStatusCal', $params)
-    ) {
+    if (empty($params['is_override']) && empty($params['skipStatusCal'])) {
       $dates = array('start_date', 'end_date', 'join_date');
       $start_date = $end_date = $join_date = NULL; // declare these out of courtesy as IDEs don't pick up the setting of them below
       foreach ($dates as $date) {
@@ -244,9 +242,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
       $excludeIsAdmin = CRM_Utils_Array::value('exclude_is_admin', $params, FALSE);
 
       //CRM-3724 always skip is_admin if is_override != true.
-      if (!$excludeIsAdmin &&
-        !CRM_Utils_Array::value('is_override', $params)
-      ) {
+      if (!$excludeIsAdmin && empty($params['is_override'])) {
         $excludeIsAdmin = TRUE;
       }
 
@@ -309,7 +305,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
     }
 
     //record contribution for this membership
-    if (!empty($params['contribution_status_id']) && !CRM_Utils_Array::value('relate_contribution_id', $params)) {
+    if (!empty($params['contribution_status_id']) && empty($params['relate_contribution_id'])) {
       $memInfo = array_merge($params, array('membership_id' => $membership->id));
       $params['contribution'] = self::recordMembershipContribution($memInfo, $ids);
     }
@@ -329,9 +325,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
     // add activity record only during create mode and renew mode
     // also add activity if status changed CRM-3984 and CRM-2521
     if (empty($ids['membership']) ||
-      $activityType == 'Membership Renewal' ||
-      CRM_Utils_Array::value('createActivity', $params)
-    ) {
+      $activityType == 'Membership Renewal' || !empty($params['createActivity'])) {
       if (!empty($ids['membership'])) {
         $data = array();
         CRM_Core_DAO::commonRetrieveAll('CRM_Member_DAO_Membership',
@@ -1358,8 +1352,7 @@ AND civicrm_membership.is_test = %2";
     $index = !empty($memBlockDetails['is_separate_payment']) ? 2 : 1;
 
     if (empty($errors[$index])) {
-      if (isset($membershipParams['onbehalf']) &&
-        CRM_Utils_Array::value('member_campaign_id', $membershipParams['onbehalf'])) {
+      if (isset($membershipParams['onbehalf']) && !empty($membershipParams['onbehalf']['member_campaign_id'])) {
         $form->_params['campaign_id'] = $membershipParams['onbehalf']['member_campaign_id'];
       }
       if (is_array($membershipTypeID)) {
@@ -1530,14 +1523,11 @@ AND civicrm_membership.is_test = %2";
     //@todo this is a BAO function & should not inspect the form - the form should do this
     // & pass required params to the BAO
     if (CRM_Utils_Array::value('minimum_fee', $membershipTypeDetails) > 0.0) {
-      if (((isset($form->_contributeMode) && $form->_contributeMode == 'notify') ||
-          CRM_Utils_Array::value('is_pay_later', $form->_params) ||
-          (CRM_Utils_Array::value('is_recur', $form->_params)
-            && $form->_contributeMode == 'direct'
+      if (((isset($form->_contributeMode) && $form->_contributeMode == 'notify') || !empty($form->_params['is_pay_later']) ||
+          (!empty($form->_params['is_recur']) && $form->_contributeMode == 'direct'
           )
         ) &&
-        (($form->_values['is_monetary'] && $form->_amount > 0.0) ||
-         CRM_Utils_Array::value('separate_membership_payment', $form->_params) ||
+        (($form->_values['is_monetary'] && $form->_amount > 0.0) || !empty($form->_params['separate_membership_payment']) ||
          CRM_Utils_Array::value('record_contribution', $form->_params)
         )
       ) {
@@ -1689,7 +1679,7 @@ AND civicrm_membership.is_test = %2";
           if (!empty($form->_params['membership_source'])) {
             $memParams['source'] = $form->_params['membership_source'];
           }
-          elseif (property_exists($form, '_values') && CRM_Utils_Array::value('title', $form->_values)) {
+          elseif (property_exists($form, '_values') && !empty($form->_values['title'])) {
             $memParams['source'] = ts('Online Contribution:') . ' ' . $form->_values['title'];
           }
           else {
@@ -2690,9 +2680,7 @@ WHERE      civicrm_membership.is_test = 0";
 
 
     //insert payment record for this membership
-    if (empty($ids['contribution']) ||
-      CRM_Utils_Array::value('is_recur', $params)
-    ) {
+    if (empty($ids['contribution']) || !empty($params['is_recur'])) {
       $mpDAO = new CRM_Member_DAO_MembershipPayment();
       $mpDAO->membership_id = $membershipId;
       $mpDAO->contribution_id = $contribution->id;
index 58deb1170352b5f02461c9c5725a1a988db9ef79..0dd99f87c8b67095d50e99d71732b4e85f62bbaa 100644 (file)
@@ -134,18 +134,13 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus {
     }
 
     //copy name to label when not passed.
-    if (empty($params['label']) &&
-      CRM_Utils_Array::value('name', $params)
-    ) {
+    if (empty($params['label']) && !empty($params['name'])) {
       $params['label'] = $params['name'];
     }
 
     //for add mode, copy label to name.
     $statusId = CRM_Utils_Array::value('membershipStatus', $ids);
-    if (!$statusId &&
-      CRM_Utils_Array::value('label', $params) &&
-      !CRM_Utils_Array::value('name', $params)
-    ) {
+    if (!$statusId && !empty($params['label']) && empty($params['name'])) {
       $params['name'] = $params['label'];
     }
 
index 10f36ff01f3d3820730d1cc64cd0e680a2e9bd74..20e1a7cc3ac291b6027fc4fbf7f670e5a0b00f33 100644 (file)
@@ -457,7 +457,7 @@ class CRM_Member_BAO_Query {
 
   static function tableNames(&$tables) {
     //add membership table
-    if (!empty($tables['civicrm_membership_log']) || CRM_Utils_Array::value('civicrm_membership_status', $tables) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) {
+    if (!empty($tables['civicrm_membership_log']) || !empty($tables['civicrm_membership_status']) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) {
       $tables = array_merge(array('civicrm_membership' => 1), $tables);
     }
   }
index 51bebebc0bf075fdef773391ecdce88926dd4a79..81c983504066f89fa409755aced11bea530d472d 100644 (file)
@@ -183,7 +183,7 @@ class CRM_Member_Form extends CRM_Core_Form {
 
     //CRM-10375 Where the payer differs to the member the payer should get the email.
     // here we store details in order to do that
-    if (!empty($formValues['contribution_contact_select_id']) && CRM_Utils_Array::value('1', $formValues['contribution_contact_select_id'])) {
+    if (!empty($formValues['contribution_contact_select_id']) && !empty($formValues['contribution_contact_select_id']['1'])) {
       $this->_receiptContactId = $this->_contributorContactID = $formValues['contribution_contact_select_id'][1];
        list( $this->_contributorDisplayName,
          $this->_contributorEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails( $this->_contributorContactID );
index ce8a346e7be51ebfa87ac14fb774323c6b4b55ec..96b64b17360081e336ad30d847450cf62769fdb1 100644 (file)
@@ -468,7 +468,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
 
     // build price set form.
     $buildPriceSet = FALSE;
-    if ($this->_priceSetId || CRM_Utils_Array::value('price_set_id', $_POST)) {
+    if ($this->_priceSetId || !empty($_POST['price_set_id'])) {
       if (!empty($_POST['price_set_id'])) {
         $buildPriceSet = TRUE;
       }
@@ -562,7 +562,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     foreach ($allMemberships as $key => $values) {
       if (!empty($values['is_active'])) {
         $membershipType[$key] = CRM_Utils_Array::value('name', $values);
-        if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) {
+        if ($this->_mode && empty($values['minimum_fee'])) {
           continue;
         }
         else {
@@ -923,15 +923,15 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
       return $errors;
     }
 
-    if ($priceSetId && !$self->_mode && !CRM_Utils_Array::value('record_contribution', $params)) {
+    if ($priceSetId && !$self->_mode && empty($params['record_contribution'])) {
       $errors['record_contribution'] = ts('Record Membership Payment is required when you using price set.');
     }
 
-    if (!$priceSetId && $self->_mode && !CRM_Utils_Array::value('financial_type_id', $params)) {
+    if (!$priceSetId && $self->_mode && empty($params['financial_type_id'])) {
       $errors['financial_type_id'] = ts('Please enter the financial Type.');
     }
 
-    if (!empty($params['record_contribution']) && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
+    if (!empty($params['record_contribution']) && empty($params['payment_instrument_id'])) {
       $errors['payment_instrument_id'] = ts('Paid By is a required field.');
     }
 
@@ -1035,9 +1035,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
     }
 
     if (isset($params['is_override']) &&
-      $params['is_override'] &&
-      !CRM_Utils_Array::value('status_id', $params)
-    ) {
+      $params['is_override'] && empty($params['status_id'])) {
       $errors['status_id'] = ts('Please enter the status.');
     }
 
@@ -1053,8 +1051,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
     }
 
     // validate contribution status for 'Failed'.
-    if ($self->_onlinePendingContributionId &&
-      CRM_Utils_Array::value('record_contribution', $params) &&
+    if ($self->_onlinePendingContributionId && !empty($params['record_contribution']) &&
       (CRM_Utils_Array::value('contribution_status_id', $params) ==
         array_search('Failed', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'))
       )
@@ -1091,7 +1088,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
     }
 
     //take the required membership recur values.
-    if ($this->_mode && CRM_Utils_Array::value('auto_renew', $this->_params)) {
+    if ($this->_mode && !empty($this->_params['auto_renew'])) {
       $params['is_recur'] = $this->_params['is_recur'] = $formValues['is_recur'] = TRUE;
       $mapping = array(
         'frequency_interval' => 'duration_interval',
@@ -1539,22 +1536,20 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
     }
     else {
       $params['action'] = $this->_action;
-      if ($this->_onlinePendingContributionId &&
-        CRM_Utils_Array::value('record_contribution', $formValues)
-      ) {
+      if ($this->_onlinePendingContributionId && !empty($formValues['record_contribution'])) {
 
         // update membership as well as contribution object, CRM-4395
         $params['contribution_id'] = $this->_onlinePendingContributionId;
         $params['componentId'] = $params['id'];
         $params['componentName'] = 'contribute';
         $result = CRM_Contribute_BAO_Contribution::transitionComponents($params, TRUE);
-        if (!empty($result) && CRM_Utils_Array::value('contribution_id', $params)) {
+        if (!empty($result) && !empty($params['contribution_id'])) {
           $lineItem = array();
           $lineItems = CRM_Price_BAO_LineItem::getLineItems($params['contribution_id'], 'contribution');
           $itemId = key($lineItems);
           $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id');
           $fieldType = NULL;
-          if ($itemId && CRM_Utils_Array::value('price_field_id', $lineItems[$itemId])) {
+          if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) {
             $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type');
           }
           $lineItems[$itemId]['unit_price'] = $params['total_amount'];
@@ -1610,8 +1605,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
       else {
         $count = 0;
         foreach ($this->_memTypeSelected as $memType) {
-          if ($count &&
-            CRM_Utils_Array::value('record_contribution', $formValues) &&
+          if ($count && !empty($formValues['record_contribution']) &&
             ($relateContribution = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id))
           ) {
             $membershipTypeValues[$memType]['relate_contribution_id'] = $relateContribution;
@@ -1687,7 +1681,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
         $memEndDate = ($membership->end_date) ? $membership->end_date : $endDate;
 
         //get the end date from calculated dates.
-        if (!$memEndDate && !CRM_Utils_Array::value('is_recur', $params)) {
+        if (!$memEndDate && empty($params['is_recur'])) {
           $memEndDate = CRM_Utils_Array::value('end_date', $calcDates[$memType]);
         }
 
index d8dc8b8388234f5a66ef048af52532321e0c1232..795d014c3ade5fc0df49a08a666011ab911ea20c 100644 (file)
@@ -251,7 +251,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
         }
       }
 
-      if ($contributionPageId && CRM_Utils_Array::value('member_price_set_id', $params) &&
+      if ($contributionPageId && !empty($params['member_price_set_id']) &&
         CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active')) {
         $errors['member_price_set_id'] = ts('You cannot use Membership Price Sets with the Contribution Amounts section. However, a membership price set may include additional fields for non-membership options that requires an additional fee (e.g. magazine subscription) or an additional voluntary contribution.');
       }
@@ -291,7 +291,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
       if ($contributionPageId) {
         $amountBlock = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active');
 
-        if (!$amountBlock && CRM_Utils_Array::value('is_separate_payment', $params)) {
+        if (!$amountBlock && !empty($params['is_separate_payment'])) {
           $errors['is_separate_payment'] = ts('Please enable the contribution amount section to use this option.');
         }
       }
index a6aafefaf98709433506fb634b72f768b4c75d4f..307369316ee6a3092a032f799bb7b2aa09559786 100644 (file)
@@ -337,7 +337,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
     foreach( $allMemberships as $key => $values ) {
       if (!empty($values['is_active'])) {
         $membershipType[$key] = CRM_Utils_Array::value('name', $values);
-        if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) {
+        if ($this->_mode && empty($values['minimum_fee'])) {
           continue;
         }
         else {
index c3189c9bd0f0016b9ca0e3a37aea0739c396b946..b24043531f831bd8b512a52f68109dfe1c6eb0ff 100644 (file)
@@ -67,7 +67,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form {
     $defaults = parent::setDefaultValues();
 
     // get the member org display name
-    if ( $this->_id && CRM_Utils_Array::value('member_of_contact_id', $defaults)) {
+    if ( $this->_id && !empty($defaults['member_of_contact_id'])) {
       $this->assign('member_org_id', $defaults['member_of_contact_id']);
     }
 
@@ -398,9 +398,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form {
 
       $periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
       foreach ($periods as $per) {
-        if (!empty($params[$per]['M']) &&
-          CRM_Utils_Array::value('d', $params[$per])
-        ) {
+        if (!empty($params[$per]['M']) && !empty($params[$per]['d'])) {
           $mon          = $params[$per]['M'];
           $dat          = $params[$per]['d'];
           $mon          = ($mon < 10) ? '0' . $mon : $mon;
index 7b87250e4a6549a149ed54a53ce855975c470c4b..80e05bec3c0990be9b4244647607d4b542ef4da9 100644 (file)
@@ -222,8 +222,7 @@ END AS 'relType'
 
       $this->assign('has_related', FALSE);
       // if membership can be granted, and we are the owner of the membership
-      if (!empty($membershipType['relationship_type_id']) && !CRM_Utils_Array::value('owner_membership_id', $values)
-      ) {
+      if (!empty($membershipType['relationship_type_id']) && empty($values['owner_membership_id'])) {
         // display related contacts/membership block
         $this->assign('has_related', TRUE);
         $this->assign('max_related', CRM_Utils_Array::value('max_related', $values, ts('Unlimited')));
index e23a1b3265c9d9ce47939f6fca5c5d8f32028739..7fbedc15b8e23317501b650d46e0f25ba102ba3b 100644 (file)
@@ -161,7 +161,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
     $errorMessage = NULL;
 
     //To check whether start date or join date is provided
-    if (empty($params['membership_start_date']) && !CRM_Utils_Array::value('join_date', $params)) {
+    if (empty($params['membership_start_date']) && empty($params['join_date'])) {
       $errorMessage = 'Membership Start Date is required to create a memberships.';
       CRM_Contact_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage);
     }
@@ -266,9 +266,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
       $params = &$this->getActiveFieldParams();
 
       //assign join date equal to start date if join date is not provided
-      if (empty($params['join_date']) &&
-        CRM_Utils_Array::value('membership_start_date', $params)
-      ) {
+      if (empty($params['join_date']) && !empty($params['membership_start_date'])) {
         $params['join_date'] = $params['membership_start_date'];
       }
 
@@ -359,9 +357,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
       else {
         //fix for CRM-2219 Update Membership
         // onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE
-        if (!empty($formatted['is_override']) &&
-          !CRM_Utils_Array::value('status_id', $formatted)
-        ) {
+        if (!empty($formatted['is_override']) && empty($formatted['status_id'])) {
           array_unshift($values, 'Required parameter missing: Status');
           return CRM_Import_Parser::ERROR;
         }
index 197fe5053e099af17987cece63f2957530c42cc7..2f071ea4913128f970188756e9f815791b037dcf 100644 (file)
@@ -165,9 +165,7 @@ class CRM_PCP_Form_Campaign extends CRM_Core_Form {
     if (strlen($fields['donate_link_text']) >= 64) {
       $errors['donate_link_text'] = ts('Button Text must be less than 64 characters.');
     }
-    if (isset($files['attachFile_1']) &&
-      CRM_Utils_Array::value('tmp_name', $files['attachFile_1'])
-    ) {
+    if (isset($files['attachFile_1']) && !empty($files['attachFile_1']['tmp_name'])) {
       list($width, $height) = getimagesize($files['attachFile_1']['tmp_name']);
       if ($width > 360 || $height > 360) {
         $errors['attachFile_1'] = ts('Your picture or image file cannot be larger than 360 x 360 pixels in size.') . ' ' . ts("The dimensions of the image you have selected are %1 x %2.", array(1 => $width, 2 => $height)) . ' ' . ts('Please shrink or crop the file or find another smaller image and try again.');
index 0964327baed46f57250b9392922029676288444d..3f0e375ba7783d952eba1cac3e3fe691dc2daf67 100644 (file)
@@ -198,9 +198,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge {
     }
 
     // skip payment stuff inedit mode
-    if (!isset($params['id']) ||
-      CRM_Utils_Array::value('is_pledge_pending', $params)
-    ) {
+    if (!isset($params['id']) || !empty($params['is_pledge_pending'])) {
 
 
       //if pledge is pending delete all payments and recreate.
index 26b70453d0490b9849cf3f1589c279167e5edc7a..22ebe26572b757628410cb20b242af9e14a54657 100644 (file)
@@ -46,9 +46,7 @@ class CRM_Pledge_BAO_Query {
    * @access public
    */
   static function select(&$query) {
-    if (($query->_mode & CRM_Contact_BAO_Query::MODE_PLEDGE) ||
-      CRM_Utils_Array::value('pledge_id', $query->_returnProperties)
-    ) {
+    if (($query->_mode & CRM_Contact_BAO_Query::MODE_PLEDGE) || !empty($query->_returnProperties['pledge_id'])) {
       $query->_select['pledge_id'] = 'civicrm_pledge.id as pledge_id';
       $query->_element['pledge_id'] = 1;
       $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
@@ -629,9 +627,7 @@ class CRM_Pledge_BAO_Query {
 
   static function tableNames(&$tables) {
     //add status table
-    if (!empty($tables['pledge_status']) ||
-      CRM_Utils_Array::value('civicrm_pledge_payment', $tables)
-    ) {
+    if (!empty($tables['pledge_status']) || !empty($tables['civicrm_pledge_payment'])) {
       $tables = array_merge(array('civicrm_pledge' => 1), $tables);
     }
   }
index ab11019031bc3891a67d4380bb92befec5522d0b..eeffdabcae1099e231c3d2f4e24639cc5fd8f098 100644 (file)
@@ -294,8 +294,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
         'id' => $type,
       );
       //see if we need to include this paneName in the current form
-      if ($this->_formType == $type ||
-        CRM_Utils_Array::value("hidden_{$type}", $_POST) ||
+      if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) ||
         CRM_Utils_Array::value("hidden_{$type}", $defaults)
       ) {
         $showAdditionalInfo = TRUE;
@@ -576,7 +575,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
 
     $dates = array('create_date', 'start_date', 'acknowledge_date', 'cancel_date');
     foreach ($dates as $d) {
-      if ($this->_id && (!$this->_isPending) && CRM_Utils_Array::value($d, $this->_values)) {
+      if ($this->_id && (!$this->_isPending) && !empty($this->_values[$d])) {
         if ($d == 'start_date') {
           $params['scheduled_date'] = CRM_Utils_Date::processDate($this->_values[$d]);
         }
index 0bf6ee817c4a87e33ffe6721b371489290ce5ba4..3b2fe777537ae8daab18c2d53bc439f810e12f5e 100644 (file)
@@ -298,7 +298,7 @@ AND li.entity_id = {$entityId})";
         $line['entity_id'] = $entityId;
         // if financial type is not set and if price field value is NOT NULL
         // get financial type id of price field value
-        if (!empty($line['price_field_value_id']) && !CRM_Utils_Array::value('financial_type_id', $line)) {
+        if (!empty($line['price_field_value_id']) && empty($line['financial_type_id'])) {
           $line['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $line['price_field_value_id'], 'financial_type_id');
         }
         $lineItems = CRM_Price_BAO_LineItem::create($line);
index 1e2bebc6febe23f7ea24ed9bc15562b593473279..87af39f3bc1799504de2258073eecfd7460a8d7f 100644 (file)
@@ -121,8 +121,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
     for ($index = 1; $index <= $maxIndex; $index++) {
       if (array_key_exists('option_amount', $params) &&
         array_key_exists($index, $params['option_amount']) &&
-        (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) ||
-          CRM_Utils_Array::value('is_quick_config', $params)) &&
+        (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || !empty($params['is_quick_config'])) &&
         !CRM_Utils_System::isNull($params['option_amount'][$index])
       ) {
         $options = array(
@@ -389,7 +388,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
           if (!empty($otherAmount['is_allow_other_amount']) && $field->name == 'contribution_amount') {
             $none = ts('Other Amount');
           }
-          elseif (!empty($qf->_membershipBlock) && !CRM_Utils_Array::value('is_required', $qf->_membershipBlock) && $field->name == 'membership_amount') {
+          elseif (!empty($qf->_membershipBlock) && empty($qf->_membershipBlock['is_required']) && $field->name == 'membership_amount') {
             $none = ts('No thank you');
           }
           else {
index eaff867fab04728de56a6876c4852f5f059904ca..f62c9cbb2ee47381e91371260b7de0d6abc9734d 100644 (file)
@@ -874,7 +874,7 @@ WHERE  id = %1";
           $_contact_memberships[$userid][$value['membership_type_id']] = CRM_Member_BAO_Membership::getContactMembership($userid, $value['membership_type_id'], FALSE);
         }
         $currentMembership = $_contact_memberships[$userid][$value['membership_type_id']];
-        if (!empty($currentMembership) && !CRM_Utils_Array::value('end_date', $currentMembership)) {
+        if (!empty($currentMembership) && empty($currentMembership['end_date'])) {
           unset($options[$key]);
           $checklifetime = TRUE;
         }
index 002b25dd6ea36408b7720badd5a7982b6ee94de3..c61c1dad06ec32e97fbdaab88ecef5dee879cb38 100644 (file)
@@ -489,7 +489,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
               $_flagOption = 1;
             }
           }
-          if (!$noLabel && !$noAmount && CRM_Utils_Array::value('option_financial_type_id', $fields) && $fields['option_financial_type_id'][$index] == '' && $fields['html_type'] != 'Text') {
+          if (!$noLabel && !$noAmount && !empty($fields['option_financial_type_id']) && $fields['option_financial_type_id'][$index] == '' && $fields['html_type'] != 'Text') {
             $errors["option_financial_type_id[{$index}]"] = ts('Financial Type is a Required field.');
           }
           if ($noLabel && !$noAmount) {
index 3faaf8f62bad01c04a19eb765120afade81df36c..4fd62e2c03525d84201748816905bfee86d1e07e 100644 (file)
@@ -277,7 +277,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form {
    */
   static function formRule($fields, $files, $form) {
     $errors = array();
-    if (!empty($fields['count']) && CRM_Utils_Array::value('max_value', $fields) &&
+    if (!empty($fields['count']) && !empty($fields['max_value']) &&
       $fields['count'] > $fields['max_value']
     ) {
       $errors['count'] = ts('Participant count can not be greater than max participants.');
index b243bd1b46b975aef3b9d78b891064019f172931..a369e4cb126e3aad7edfb0e384c5248e7ed03ea7 100644 (file)
@@ -882,7 +882,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
 
     $profileActivityTypes = CRM_Core_BAO_UFGroup::groupTypeValues($gid, 'Activity');
 
-    if ((CRM_Utils_Array::value('Activity', $profileActivityTypes) &&
+    if ((!empty($profileActivityTypes['Activity']) &&
         !in_array($activityDetails['activity_type_id'], $profileActivityTypes['Activity'])
       ) ||
       (!in_array($contactId, $activityDetails['assignee_contact']) &&
@@ -927,16 +927,14 @@ class CRM_Profile_Form extends CRM_Core_Form {
     }
 
     // dont check for duplicates during registration validation: CRM-375
-    if (!$register && !CRM_Utils_Array::value('_qf_Edit_upload_duplicate', $fields)) {
+    if (!$register && empty($fields['_qf_Edit_upload_duplicate'])) {
       // fix for CRM-3240
       if (!empty($fields['email-Primary'])) {
         $fields['email'] = CRM_Utils_Array::value('email-Primary', $fields);
       }
 
       // fix for CRM-6141
-      if (!empty($fields['phone-Primary-1']) &&
-        !CRM_Utils_Array::value('phone-Primary', $fields)
-      ) {
+      if (!empty($fields['phone-Primary-1']) && empty($fields['phone-Primary'])) {
         $fields['phone-Primary'] = $fields['phone-Primary-1'];
       }
 
@@ -1125,8 +1123,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
       );
       $details = $contactDetails[0][$this->_id];
     }
-    if (!(CRM_Utils_Array::value('addressee_id', $details) ||
-        CRM_Utils_Array::value('email_greeting_id', $details) ||
+    if (!(!empty($details['addressee_id']) || !empty($details['email_greeting_id']) ||
         CRM_Utils_Array::value('postal_greeting_id', $details)
       )) {
 
@@ -1219,8 +1216,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
         substr($groupTypes, 1, -1)
       );
       //filter group of mailing type and unset it from params
-      if (in_array(2, $groupType) &&
-        CRM_Utils_Array::value('email', $result) &&
+      if (in_array(2, $groupType) && !empty($result['email']) &&
         CRM_Core_BAO_UFGroup::isProfileAddToGroupDoubleOptin()
       ) {
         if (!count($contactGroup)) {
index c7815bda33f1f9a76d44437ee13256a5279b4452..d1a1b04d5bdb3f5dbee5f33a46bb36a53aee5057 100644 (file)
@@ -109,7 +109,7 @@ class CRM_Profile_Form_Dynamic extends CRM_Profile_Form {
     $errors = array();
 
     // if no values, return
-    if (empty($fields) || !CRM_Utils_Array::value('edit', $fields)) {
+    if (empty($fields) || empty($fields['edit'])) {
       return TRUE;
     }
 
index cbaa13ed48f923676f5b7213515c0e66d3ef3acf..0ea8cfc1e723c91754dcea7c578318c1f1874441 100644 (file)
@@ -388,9 +388,7 @@ SELECT module
   function validate() {
     $errors = parent::validate();
 
-    if (!$errors &&
-      CRM_Utils_Array::value('errorURL', $_POST)
-    ) {
+    if (!$errors && !empty($_POST['errorURL'])) {
       $message = NULL;
       foreach ($this->_errors as $name => $mess) {
         $message .= $mess;
index ffa8023de1025661f2706a8af424a8386e0ec99e..db6d43bdb00a70e85675051697867166ae5ddeec 100644 (file)
@@ -157,7 +157,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
     );
 
     foreach ($this->_fields as $name => $field) {
-      if ((substr($name, 0, 6) == 'custom') && CRM_Utils_Array::value('is_search_range', $field)) {
+      if ((substr($name, 0, 6) == 'custom') && !empty($field['is_search_range'])) {
         $from = CRM_Utils_Request::retrieve($name . '_from', 'String',
           $this, FALSE, NULL, 'REQUEST'
         );
@@ -227,7 +227,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
 
       $customField = CRM_Utils_Array::value($name, $this->_customFields);
 
-      if (!empty($_POST) && !CRM_Utils_Array::value($name, $_POST)) {
+      if (!empty($_POST) && empty($_POST[$name])) {
         if ($customField) {
           // reset checkbox/radio because a form does not send null checkbox values
           if (in_array($customField['html_type'],
@@ -327,9 +327,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
     $this->assign('search', $this->_search);
 
     // search if search returned a form error?
-    if ((!CRM_Utils_Array::value('reset', $_GET) ||
-        CRM_Utils_Array::value('force', $_GET)
-      ) &&
+    if ((empty($_GET['reset']) || !empty($_GET['force'])) &&
       !$searchError
     ) {
       $this->assign('isReset', FALSE);
index 322e2e2ed7220aa1b7e88f8893200bfb0fc30428..a44debf1325964452ee53fa14504a365aa1eb1da 100644 (file)
@@ -188,9 +188,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance {
 
     // add / update navigation as required
     if (!empty($navigationParams)) {
-      if (empty($params['id']) &&
-        !CRM_Utils_Array::value('instance_id',$params) &&
-        CRM_Utils_Array::value('id', $navigationParams)) {
+      if (empty($params['id']) && empty($params['instance_id']) && !empty($navigationParams['id'])) {
         unset($navigationParams['id']);
       }
       $navigationParams['url'] = "civicrm/report/instance/{$instance->id}&reset=1";
index adf4c666ac76bf6e737dcf95b1d7f07b5b49f8c9..d419a6f15c7d67d06b64889182306535616a5033 100644 (file)
@@ -699,11 +699,8 @@ class CRM_Report_Form extends CRM_Core_Form {
           $this->_defaults['order_bys'] = array();
         }
         foreach ($table['order_bys'] as $fieldName => $field) {
-          if (!empty($field['default']) ||
-            CRM_Utils_Array::value('default_order', $field) ||
-            CRM_Utils_Array::value('default_is_section', $field) ||
-            CRM_Utils_Array::value('default_weight', $field)
-          ) {
+          if (!empty($field['default']) || !empty($field['default_order']) ||
+            CRM_Utils_Array::value('default_is_section', $field) || !empty($field['default_weight'])) {
             $order_by = array(
               'column' => $fieldName,
               'order' => CRM_Utils_Array::value('default_order', $field, 'ASC'),
@@ -838,7 +835,7 @@ class CRM_Report_Form extends CRM_Core_Form {
             }
 
             $colGroups[$tableName]['fields'][$fieldName] = CRM_Utils_Array::value('title', $field);
-            if ($groupTitle && !CRM_Utils_Array::value('group_title', $colGroups[$tableName])) {
+            if ($groupTitle && empty($colGroups[$tableName]['group_title'])) {
               $colGroups[$tableName]['group_title'] = $groupTitle;
             }
 
@@ -1827,9 +1824,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
             $this->_phoneField = TRUE;
           }
 
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             // 1. In many cases we want select clause to be built in slightly different way
             //    for a particular field of a particular type.
@@ -1915,8 +1910,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
             continue;
           }
 
-          if (!empty($this->_params['group_bys']) && CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])
-               && !empty($this->_params['group_bys_freq'])) {
+          if (!empty($this->_params['group_bys']) && !empty($this->_params['group_bys'][$fieldName]) && !empty($this->_params['group_bys_freq'])) {
             switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
               case 'YEARWEEK':
                 $select[]       = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
@@ -2165,7 +2159,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
       $this->_select .= ", {$section['dbAlias']} as {$alias}";
     }
 
-    if ($applyLimit && !CRM_Utils_Array::value('charts', $this->_params)) {
+    if ($applyLimit && empty($this->_params['charts'])) {
       $this->limit();
     }
     CRM_Utils_Hook::alterReportVar('sql', $this, $this);
@@ -2265,9 +2259,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             $selectColumns["{$tableName}_{$fieldName}"] = 1;
           }
@@ -3014,9 +3006,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
           }
 
           //might be survey response field.
-          if (!empty($this->_params['fields']['survey_response']) &&
-            CRM_Utils_Array::value('isSurveyResponseField', $prop['fields'][$fieldAlias])
-          ) {
+          if (!empty($this->_params['fields']['survey_response']) && !empty($prop['fields'][$fieldAlias]['isSurveyResponseField'])) {
             return TRUE;
           }
         }
@@ -3133,9 +3123,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
       foreach ($this->_columns as $tableName => $table) {
         if (array_key_exists('fields', $table)) {
           foreach ($table['fields'] as $fieldName => $field) {
-            if (!empty($field['required']) ||
-              CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-            ) {
+            if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
               $this->_selectedTables[] = $tableName;
               break;
             }
index c5648d9529f8f306007a3469e5deec3bfc5ae2c4..c901274d538cef893e8e5e3728b4f5c0dd674b16 100644 (file)
@@ -579,8 +579,7 @@ GROUP BY civicrm_activity_id {$this->_having} {$this->_orderBy}";
     //Assign those recordtype to array which have filter operator as 'Is not empty' or 'Is empty'
     $nullFilters = array();
     foreach (array('target', 'source', 'assignee') as $type) {
-      if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) == 'nnll' ||
-        CRM_Utils_Array::value("contact_{$type}_value", $this->_params)) {
+      if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) == 'nnll' || !empty($this->_params["contact_{$type}_value"])) {
         $nullFilters[] = " civicrm_contact_contact_{$type} IS NOT NULL ";
       }
       else if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) == 'nll') {
index 96062ec0dadc8aadddca475aa4fd762f88719de6..221ee3d3972428a74fe4d47f0d818c9b47b5beca 100644 (file)
@@ -235,9 +235,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
       }
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_email') {
               $this->_emailField = TRUE;
             }
@@ -401,9 +399,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
               if (!empty($field['chart'])) {
                 $this->assign('chartSupported', TRUE);
               }
-              if (!empty($table['group_bys'][$fieldName]['frequency']) &&
-                CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])
-              ) {
+              if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) {
 
                 $append = "YEAR({$field['dbAlias']}),";
                 if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]),
@@ -434,9 +430,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
     $contactFields = array('sort_name', 'email', 'phone');
     if (!empty($fields['group_bys'])) {
 
-      if (!empty($fields['group_bys']['activity_type_id']) &&
-        !CRM_Utils_Array::value('sort_name', $fields['group_bys'])
-      ) {
+      if (!empty($fields['group_bys']['activity_type_id']) && empty($fields['group_bys']['sort_name'])) {
         foreach ($fields['fields'] as $fieldName => $val) {
           if (in_array($fieldName, $contactFields)) {
             $errors['fields'] = ts("Please select GroupBy 'Contact' to display Contact Fields");
index ef9ae9ff2077ee75fc89d9f88fb08347a49a48e8..a7de7788a436d92f6484d5e2d6e737e3c66a5f7c 100644 (file)
@@ -286,8 +286,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form {
         continue;
       }
       foreach ($table['fields'] as $fieldName => $field) {
-        if (!empty($field['required']) ||
-          CRM_Utils_Array::value($fieldName, $this->_params['fields']) || CRM_Utils_Array::value('is_required', $field)
+        if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName]) || CRM_Utils_Array::value('is_required', $field)
         ) {
 
           $fieldsName = CRM_Utils_Array::value(1, explode('_', $tableName));
@@ -340,7 +339,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form {
 
     if($this->_locationBasedPhoneField){
       foreach($this->_surveyResponseFields as $key => $value){
-        if(substr($key,0,5) == 'phone' && CRM_Utils_Array::value('location_type_id',$value)){
+        if(substr($key,0,5) == 'phone' && !empty($value['location_type_id'])){
           $fName = str_replace('-','_',$key);
           $this->_from .= "LEFT JOIN civicrm_phone ".$this->_aliases["civicrm_phone_{$fName}"]." ON {$this->_aliases['civicrm_contact']}.id = ".$this->_aliases["civicrm_phone_{$fName}"].".contact_id AND ".$this->_aliases["civicrm_phone_{$fName}"].".location_type_id = {$value['location_type_id']} AND ".$this->_aliases["civicrm_phone_{$fName}"].".phone_type_id = {$value['phone_type_id']}\n";
         }
@@ -637,8 +636,7 @@ INNER JOIN  civicrm_option_value val ON ( val.option_group_id = survey.result_id
 
   private function _formatSurveyResult(&$rows) {
     $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
-    if (CRM_Utils_System::isNull($surveyIds) ||
-      !CRM_Utils_Array::value('result', $this->_params['fields']) ||
+    if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['result']) ||
       !in_array($this->_outputMode, array('print', 'pdf'))
     ) {
       return;
@@ -685,9 +683,7 @@ INNER JOIN  civicrm_survey survey ON ( survey.result_id = grp.id )
 
   private function _formatSurveyResponseData(&$rows) {
     $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
-    if (CRM_Utils_System::isNull($surveyIds) ||
-      !CRM_Utils_Array::value('survey_response', $this->_params['fields'])
-    ) {
+    if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['survey_response'])) {
       return;
     }
 
@@ -807,9 +803,7 @@ INNER JOIN  civicrm_custom_group cg ON ( cg.id = cf.custom_group_id )
 
   private function _addSurveyResponseColumns() {
     $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
-    if (CRM_Utils_System::isNull($surveyIds) ||
-      !CRM_Utils_Array::value('survey_response', $this->_params['fields'])
-    ) {
+    if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['survey_response'])) {
       return;
     }
 
@@ -819,7 +813,7 @@ INNER JOIN  civicrm_custom_group cg ON ( cg.id = cf.custom_group_id )
       $this->_surveyResponseFields = $responseFields;
     }
     foreach($responseFields as $key => $value){
-      if(substr($key,0,5) == 'phone' && CRM_Utils_Array::value('location_type_id',$value)){
+      if(substr($key,0,5) == 'phone' && !empty($value['location_type_id'])){
         $fName = str_replace('-','_',$key);
         $this->_columns["civicrm_{$fName}"] =
           array( 'dao' => 'CRM_Core_DAO_Phone',
index 12c03e0e9b06f674594dccb4e474ba9190759e18..6a31e539c025e66c83be1e2e59dfa32ffb32431e 100644 (file)
@@ -249,9 +249,7 @@ where (cg.extends='Contact' OR cg.extends='Individual' OR cg.extends_entity_colu
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_email') {
               $this->_emailField = TRUE;
             }
index 3a68446e8a7863f2f2a908bb622bae59e04b3289..3336d9a1d29d11d412164888ced95d97f93c12fd 100644 (file)
@@ -304,9 +304,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
           if ($tableName == 'civicrm_address') {
             $this->_addressField = TRUE;
           }
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_email') {
               $this->_emailField = TRUE;
             }
@@ -412,7 +410,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
           else {
 
             $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
-            if ($fieldName == 'case_type_id' && CRM_Utils_Array::value('case_type_id_value', $this->_params)) {
+            if ($fieldName == 'case_type_id' && !empty($this->_params['case_type_id_value'])) {
               foreach ($this->_params['case_type_id_value'] as $key => $value) {
                 if (strpos($value, CRM_Core_DAO::VALUE_SEPARATOR) === FALSE) {
                   $value = CRM_Core_DAO::VALUE_SEPARATOR . $value . CRM_Core_DAO::VALUE_SEPARATOR;
@@ -550,8 +548,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
       $this->_relField = TRUE;
     }
 
-    if (!empty($this->_params['activity_date_time_relative']) ||
-      CRM_Utils_Array::value('activity_date_time_from', $this->_params) ||
+    if (!empty($this->_params['activity_date_time_relative']) || !empty($this->_params['activity_date_time_from']) ||
       CRM_Utils_Array::value('activity_date_time_to', $this->_params)
     ) {
       $this->_activityLast = TRUE;
@@ -616,9 +613,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
         }
         $entryFound = TRUE;
       }
-      if (array_key_exists('civicrm_activity_last_completed_last_completed_activity_subject', $row) &&
-        !CRM_Utils_Array::value('civicrm_activity_last_completed_last_completed_activity_subject', $row)
-      ) {
+      if (array_key_exists('civicrm_activity_last_completed_last_completed_activity_subject', $row) && empty($row['civicrm_activity_last_completed_last_completed_activity_subject'])) {
         $rows[$rowNum]['civicrm_activity_last_completed_last_completed_activity_subject'] = ts('(No Subject)');
         $entryFound = TRUE;
       }
index e7f56531eb14c60d2ead50a56993387665f8067c..0e6c8e8b7198bd90abc297948f7b812f242b00ee 100644 (file)
@@ -179,9 +179,7 @@ class CRM_Report_Form_Case_Summary extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             if ($tableName == 'civicrm_relationship_type') {
               $this->_relField = TRUE;
@@ -322,9 +320,7 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id
         }
       }
 
-      if (array_key_exists('civicrm_case_case_type_id', $row) &&
-        CRM_Utils_Array::value('civicrm_case_case_type_id', $rows[$rowNum])
-      ) {
+      if (array_key_exists('civicrm_case_case_type_id', $row) && !empty($rows[$rowNum]['civicrm_case_case_type_id'])) {
         $value   = $row['civicrm_case_case_type_id'];
         $typeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
         $value   = array();
@@ -338,9 +334,7 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id
       }
 
       // convert Case ID and Subject to links to Manage Case
-      if (array_key_exists('civicrm_case_id', $row) &&
-        CRM_Utils_Array::value('civicrm_c2_id', $rows[$rowNum])
-      ) {
+      if (array_key_exists('civicrm_case_id', $row) && !empty($rows[$rowNum]['civicrm_c2_id'])) {
         $url = CRM_Utils_System::url("civicrm/contact/view/case",
           'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' . $row['civicrm_case_id'],
           $this->_absoluteUrl
@@ -349,9 +343,7 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id
         $rows[$rowNum]['civicrm_case_id_hover'] = ts("Manage Case");
         $entryFound = TRUE;
       }
-      if (array_key_exists('civicrm_case_subject', $row) &&
-        CRM_Utils_Array::value('civicrm_c2_id', $rows[$rowNum])
-      ) {
+      if (array_key_exists('civicrm_case_subject', $row) && !empty($rows[$rowNum]['civicrm_c2_id'])) {
         $url = CRM_Utils_System::url("civicrm/contact/view/case",
           'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' . $row['civicrm_case_id'],
           $this->_absoluteUrl
index 9f92d61c8c9c500ddd96d7c86515b36a943d120c..3448b04ffc0ca39351add3b838d95b7a05e06585 100644 (file)
@@ -181,8 +181,7 @@ class CRM_Report_Form_Case_TimeSpent extends CRM_Report_Form {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
           if (!empty($field['required']) ||
-            (CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-              && ((!$this->has_grouping) || !in_array($fieldName, array('case_id', 'subject', 'status_id')))
+            (!empty($this->_params['fields'][$fieldName]) && ((!$this->has_grouping) || !in_array($fieldName, array('case_id', 'subject', 'status_id')))
             )
           ) {
 
index 44b213486e22c4975fdb73cd5b97252284e4a061..95760c35ce287de059ef7e0d5c18ce0a6e09727f 100644 (file)
@@ -206,9 +206,7 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
             $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
index f23ea602deac8d40e4f56fddc90039bd8877dd3f..7b083916015617c7054ef441566895efed5782c1 100644 (file)
@@ -397,9 +397,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             //isolate the select clause compoenent wise
             if (in_array($table['alias'], $this->_component)) {
               $select[$table['alias']][] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
index f05615f11b81d92a1c9031327cba3443eaddae7f..858829f66e5cea563e4e409c44d289a161f1edf0 100644 (file)
@@ -158,9 +158,7 @@ class CRM_Report_Form_Contact_Log extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
             $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
index d92004cc3a49cedd4113be52e5f4095ac7f1763d..22a5eca5536967482a7017d0aeecb4300fca1398 100644 (file)
@@ -267,9 +267,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             if ($fieldName == 'email_a') {
               $this->_emailField_a = TRUE;
index a20a351526afb69946f8fe518f41b4758b8b1141..0e30ab76a183f71b4a221c6e0b65f0788481c0b8 100644 (file)
@@ -222,9 +222,7 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_email') {
               $this->_emailField = TRUE;
             }
index f3e34cbd7df5250726c79ab63bfffea0c75dc5eb..fe2d65d638610eefee9734b99407c4303ab7253c 100644 (file)
@@ -305,9 +305,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             switch ($fieldName) {
             case 'credit_accounting_code' :
               $select[] = " CASE
@@ -381,8 +379,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
     // please note this will just add the order-by columns to select query, and not display in column-headers.
     // This is a solution to not throw fatal errors when there is a column in order-by, not present in select/display columns.
     foreach ($this->_orderByFields as $orderBy) {
-      if (!array_key_exists($orderBy['name'], $this->_params['fields'])
-        && !CRM_Utils_Array::value('section', $orderBy)) {
+      if (!array_key_exists($orderBy['name'], $this->_params['fields']) && empty($orderBy['section'])) {
         $this->_select .= ", {$orderBy['dbAlias']} as {$orderBy['tplField']}";
       }
     }
@@ -486,8 +483,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
     $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
     foreach ($rows as $rowNum => $row) {
       // convert display name to links
-      if (array_key_exists('civicrm_contact_sort_name', $row) &&
-        CRM_Utils_Array::value('civicrm_contact_sort_name', $rows[$rowNum]) &&
+      if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
         array_key_exists('civicrm_contact_id', $row)
       ) {
         $url = CRM_Utils_System::url('civicrm/contact/view',
index d5a8c264eeea3de96b52bb1cb07acb136698511e..b2c4ca6afcb43b3ac30b7dc2a12cde9709d2b171 100644 (file)
@@ -375,8 +375,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
     // please note this will just add the order-by columns to select query, and not display in column-headers.
     // This is a solution to not throw fatal errors when there is a column in order-by, not present in select/display columns.
     foreach ($this->_orderByFields as $orderBy) {
-      if (!array_key_exists($orderBy['name'], $this->_params['fields'])
-        && !CRM_Utils_Array::value('section', $orderBy)) {
+      if (!array_key_exists($orderBy['name'], $this->_params['fields']) && empty($orderBy['section'])) {
         $this->_select .= ", {$orderBy['dbAlias']} as {$orderBy['tplField']}";
       }
     }
@@ -430,8 +429,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
                       {$this->_aliases['civicrm_email']}.is_primary = 1\n";
     }
     // include contribution note
-    if (!empty($this->_params['fields']['contribution_note']) ||
-      CRM_Utils_Array::value('note_value', $this->_params)) {
+    if (!empty($this->_params['fields']['contribution_note']) || !empty($this->_params['note_value'])) {
       $this->_from.= "
             LEFT JOIN civicrm_note {$this->_aliases['civicrm_note']}
                       ON ( {$this->_aliases['civicrm_note']}.entity_table = 'civicrm_contribution' AND
@@ -439,7 +437,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
     }
     //for contribution batches
     if ($this->_allBatches &&
-      (CRM_Utils_Array::value('batch_id', $this->_params['fields']) || !empty($this->_params['bid_value']))) {
+      (!empty($this->_params['fields']['batch_id']) || !empty($this->_params['bid_value']))) {
       $this->_from .= "
                 LEFT JOIN civicrm_entity_financial_trxn tx ON (tx.entity_id = {$this->_aliases['civicrm_contribution']}.id AND
                    tx.entity_table = 'civicrm_contribution')
@@ -536,9 +534,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency";
 
     $this->beginPostProcess();
 
-    if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only' &&
-      CRM_Utils_Array::value('soft_credit_type_id', $this->_params['fields'])
-    ) {
+    if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only' && !empty($this->_params['fields']['soft_credit_type_id'])) {
       unset($this->_params['fields']['soft_credit_type_id']);
       if (!empty($this->_params['soft_credit_type_id_value'])) {
         $this->_params['soft_credit_type_id_value'] = array();
@@ -666,8 +662,7 @@ UNION ALL
 
 
       // convert donor sort name to link
-      if (array_key_exists('civicrm_contact_sort_name', $row) &&
-        CRM_Utils_Array::value('civicrm_contact_sort_name', $rows[$rowNum]) &&
+      if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
         array_key_exists('civicrm_contact_id', $row)
       ) {
         $url = CRM_Utils_System::url("civicrm/contact/view",
index da10eef1433c0f0c04de94256fb4fefbd8dde3ed..7542ebaf9d2e4db43ee4f470cc8c5b629cc2dcc6 100644 (file)
@@ -281,9 +281,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
 
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
             }
@@ -306,11 +304,8 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
               continue;
             }
             elseif ($fieldName == 'receive_date') {
-                if ((CRM_Utils_Array::value('this_year_op', $this->_params) == 'fiscal' &&
-                     CRM_Utils_Array::value('this_year_value', $this->_params)) ||
-                    (CRM_Utils_Array::value('other_year_op', $this->_params == 'fiscal') &&
-                      CRM_Utils_Array::value('other_year_value', $this->_params)
-                     )){
+                if ((CRM_Utils_Array::value('this_year_op', $this->_params) == 'fiscal' && !empty($this->_params['this_year_value'])) ||
+                    (CRM_Utils_Array::value('other_year_op', $this->_params == 'fiscal') && !empty($this->_params['other_year_value']))){
                     $select[] = self::fiscalYearOffset($field['dbAlias']) . " as {$tableName}_{$fieldName}";
                 }else{
                     $select[] = " YEAR(".$field['dbAlias'].")" . " as {$tableName}_{$fieldName}";
@@ -477,8 +472,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
 
   static function formRule($fields, $files, $self) {
     $errors = array();
-    if (!empty($fields['this_year_value']) &&
-      CRM_Utils_Array::value('other_year_value', $fields) &&
+    if (!empty($fields['this_year_value']) && !empty($fields['other_year_value']) &&
       ($fields['this_year_value'] == $fields['other_year_value'])
     ) {
       $errors['other_year_value'] = ts("Value for filters 'This Year' and 'Other Years' can not be same.");
@@ -731,9 +725,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
       }
 
       // Convert Display name into link
-      if (!empty($row['civicrm_contact_sort_name']) &&
-        CRM_Utils_Array::value('civicrm_contact_id', $row)
-      ) {
+      if (!empty($row['civicrm_contact_sort_name']) && !empty($row['civicrm_contact_id'])) {
         $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
           'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
           $this->_absoluteUrl, $this->_id
index d40317274290b9af6427c631ac1d1cbf7e3cef39..163184477bd30ae276a0fc73ded465b5239a993a 100644 (file)
@@ -220,9 +220,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
             }
index 990c4f411f9f80861175fed1d37e4e893864a10f..222e78be72fc5515c9d48c169dd6918a9cac091e 100644 (file)
@@ -224,9 +224,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
 
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($fieldName == 'total_amount') {
               $select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}";
 
@@ -385,7 +383,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
       $this->setPager();
     }
 
-    if (!empty($contactIds) || CRM_Utils_Array::value('charts', $this->_params)) {
+    if (!empty($contactIds) || !empty($this->_params['charts'])) {
       if (!empty($this->_params['charts'])) {
         $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
       }
index 4ede8517b06ebb218c5cf19f17f6998261223d2b..d3f9d0515439503420eb35227c1c11cb32c70030 100644 (file)
@@ -221,9 +221,7 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
             }
@@ -449,10 +447,8 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form {
       }
 
       // convert Organization display name to links
-      if (array_key_exists('civicrm_contact_organization_organization_name', $row) &&
-        CRM_Utils_Array::value('civicrm_contact_organization_organization_name',
-          $rows[$rowNum]
-        ) &&
+      if (array_key_exists('civicrm_contact_organization_organization_name', $row) && !empty($rows[$rowNum]
+['civicrm_contact_organization_organization_name']) &&
         array_key_exists('civicrm_contact_organization_id', $row)
       ) {
         $url = CRM_Utils_System::url('civicrm/contact/view',
index 1e23eabf26797d962a589f514e4f003839be38a3..bb29ab17e31db4e3953ce6a9fbaf4fda121f7f7a 100644 (file)
@@ -281,9 +281,7 @@ contribution_civireport2.total_amount_sum as contribution2_total_amount_sum',
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if (isset($field['clause'])) {
               $select[] = $field['clause'];
 
@@ -527,7 +525,7 @@ LEFT JOIN civicrm_temp_civireport_repeat2 {$this->_aliases['civicrm_contribution
       }
     }
 
-    if (!empty($fields['gid_value']) && CRM_Utils_Array::value('group_bys', $fields)) {
+    if (!empty($fields['gid_value']) && !empty($fields['group_bys'])) {
       if (!array_key_exists('id', $fields['group_bys'])) {
         $errors['gid_value'] = ts("Filter with Group only allow with group by Contact");
       }
index 5565a2deece87b668e2ab75d97f871c9d78909f9..e0c6c853c92dae1139e1d80a23cfce4b7fd6ff9b 100644 (file)
@@ -281,9 +281,7 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             // include email column if set
             if ($tableName == 'civicrm_email') {
index 2ebe975693f30508111d71667860b364c4f0bc07..59d00fc0eecd6f947845ae00d2f5e2ec2c5ad932 100644 (file)
@@ -363,9 +363,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
           if ($tableName == 'civicrm_address') {
             $this->_addressField = TRUE;
           }
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             // only include statistics columns if set
             if (!empty($field['statistics'])) {
@@ -436,8 +434,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
 
   function from() {
     $softCreditJoin = "LEFT";
-    if (!empty($this->_params['fields']['soft_amount']) &&
-      !CRM_Utils_Array::value('total_amount', $this->_params['fields'])) {
+    if (!empty($this->_params['fields']['soft_amount']) && empty($this->_params['fields']['total_amount'])) {
       // if its only soft credit stats, use inner join
       $softCreditJoin = "INNER";
     }
@@ -482,9 +479,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
                 $this->assign('chartSupported', TRUE);
               }
 
-              if (!empty($table['group_bys'][$fieldName]['frequency']) &&
-                CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])
-              ) {
+              if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) {
 
                 $append = "YEAR({$field['dbAlias']}),";
                 if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]),
@@ -654,11 +649,8 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
 
     foreach ($rows as $rowNum => $row) {
       // make count columns point to detail report
-      if (!empty($this->_params['group_bys']['receive_date']) &&
-        CRM_Utils_Array::value('civicrm_contribution_receive_date_start', $row) &&
-        CRM_Utils_Array::value('civicrm_contribution_receive_date_start', $row) &&
-        CRM_Utils_Array::value('civicrm_contribution_receive_date_subtotal', $row)
-      ) {
+      if (!empty($this->_params['group_bys']['receive_date']) && !empty($row['civicrm_contribution_receive_date_start']) &&
+        CRM_Utils_Array::value('civicrm_contribution_receive_date_start', $row) && !empty($row['civicrm_contribution_receive_date_subtotal'])) {
 
         $dateStart = CRM_Utils_Date::customFormat($row['civicrm_contribution_receive_date_start'], '%Y%m%d');
         $endDate   = new DateTime($dateStart);
index d6b31111331b8c06d66986659e90a090a215a8ee..259943fa1ff8f08f09b3b26445cfadd7422d698e 100644 (file)
@@ -221,9 +221,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
 
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($fieldName == 'total_amount') {
               $select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}";
 
@@ -384,7 +382,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
       $this->setPager();
     }
 
-    if (!empty($contactIds) || CRM_Utils_Array::value('charts', $this->_params)) {
+    if (!empty($contactIds) || !empty($this->_params['charts'])) {
       if (!empty($this->_params['charts'])) {
         $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
       }
index 108d3a75091c7770cc8ebc434427e5e87d5be3fe..cca2b3e7e43d1f3bbd473db63c32a68ed41fb412 100644 (file)
@@ -198,9 +198,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             // only include statistics columns if set
             if (!empty($field['statistics'])) {
               foreach ($field['statistics'] as $stat => $label) {
@@ -434,9 +432,7 @@ ORDER BY civicrm_contribution_total_amount_sum DESC
         $rows[$rowNum]['civicrm_donor_rank'] = $rank++;
         // convert display name to links
         if (array_key_exists('civicrm_contact_display_name', $row) &&
-          array_key_exists('civicrm_contact_id', $row) &&
-            CRM_Utils_Array::value('civicrm_contribution_currency', $row)
-        ) {
+          array_key_exists('civicrm_contact_id', $row) && !empty($row['civicrm_contribution_currency'])) {
           $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
             'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'] . "&currency_value=" . $row['civicrm_contribution_currency'],
             $this->_absoluteUrl, $this->_id, $this->_drilldownReport
index 5ec97858718e3cc2c86705bd3fbe69f694547c27..6dd84ce2e9af7bbb514bb493b1d67dc50da45107 100644 (file)
@@ -152,9 +152,7 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form_Event {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if (!empty($field['statistics'])) {
               foreach ($field['statistics'] as $stat => $label) {
                 switch (strtolower($stat)) {
index db21c59cc3f7f460a4d657868c8a60bac4ccc6e8..5215b31ef6f087645cd56377064eaf6ceb5b3039 100644 (file)
@@ -321,16 +321,14 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event {
     $this->_columnHeaders = array();
 
     //add blank column at the Start
-    if (array_key_exists('options', $this->_params) && CRM_Utils_Array::value('blank_column_begin', $this->_params['options'])) {
+    if (array_key_exists('options', $this->_params) && !empty($this->_params['options']['blank_column_begin'])) {
       $select[] = " '' as blankColumnBegin";
       $this->_columnHeaders['blankColumnBegin']['title'] = '_ _ _ _';
     }
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if (!empty($field['statistics'])) {
               foreach ($field['statistics'] as $stat => $label) {
                 switch (strtolower($stat)) {
index 905f991fb92723605c4cc0c1d5e7733c541baf99..20aa8213b4b2342abc00a06ad3c3c2f7d31a53d5 100644 (file)
@@ -418,8 +418,7 @@ GROUP BY  cv.label
     $this->_columnHeaders = array();
 
     //add blank column at the Start
-    if (array_key_exists('options', $this->_params) &&
-      CRM_Utils_Array::value('blank_column_begin', $this->_params['options'])) {
+    if (array_key_exists('options', $this->_params) && !empty($this->_params['options']['blank_column_begin'])) {
       $select[] = " '' as blankColumnBegin";
       $this->_columnHeaders['blankColumnBegin']['title'] = '_ _ _ _';
     }
@@ -429,9 +428,7 @@ GROUP BY  cv.label
       }
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_contribution') {
               $this->_contribField = TRUE;
             }
index 6559b2649e4427af097dc2e72113f11cb7b6c6f3..2f30586ef4542594d208dd13af56a0e494d0034b 100644 (file)
@@ -111,9 +111,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form_Event {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
           }
         }
@@ -240,9 +238,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form_Event {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
             $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
index 70b3949c40b17433148fd621df4702f22276c59a..298c8703c97cb5d28db6797ca7df052775a34ad1 100644 (file)
@@ -105,7 +105,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   }
 
   function postProcess() {
-    if (!empty($this->_aclTable) && CRM_Utils_Array::value($this->_aclTable, $this->_aliases)) {
+    if (!empty($this->_aclTable) && !empty($this->_aliases[$this->_aclTable])) {
       $this->buildACLClause($this->_aliases[$this->_aclTable]);
     }
     parent::postProcess();
index 876ffd945f0bb69e5cf4ad47e28b608a6919856c..219c53e18fbcdf60a160daf06b351112f6c3ee2d 100644 (file)
@@ -250,9 +250,7 @@ class CRM_Report_Form_Grant_Detail extends CRM_Report_Form {
       }
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
 
index 1e02807114e79779db7e6fe9f582cc47b0c61da6..c06c01e519c92e1efd288b74a30d50e0d03f13cc 100644 (file)
@@ -248,9 +248,7 @@ class CRM_Report_Form_Grant_Statistics extends CRM_Report_Form {
 
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
 
index 4c7e2ec687adb100f916468cbaf6c9baacc97313..ceb97ff1dc1d803ba41188f897045cb41069c802 100644 (file)
@@ -221,9 +221,7 @@ class CRM_Report_Form_Mailing_Bounce extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_email') {
               $this->_emailField = TRUE;
             }
index 7c787c286a9776b2ffcbbaee7a3f1a93e98b5281..63ad86d35d1fd608f40c300da2cf6f51a1f1d707 100644 (file)
@@ -183,9 +183,7 @@ class CRM_Report_Form_Mailing_Clicks extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_email') {
               $this->_emailField = TRUE;
             }
index 5678af385a293259e29a64689b58d0af23160ab2..ae75540d9c4c1123f07dcd7fbf0fdb09ec604dd4 100644 (file)
@@ -281,9 +281,7 @@ class CRM_Report_Form_Mailing_Detail extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if (in_array($fieldName, array(
               'unsubscribe_id', 'optout_id', 'forward_id', 'reply_id'))) {
               $select[] = "IF({$field['dbAlias']} IS NULL, 'No', 'Yes') as {$tableName}_{$fieldName}";
index 2944c77c95cf8f4b31957f4512dd08511cce35fd..ef4ae1b3a92b910ad037653567d5fa5101b12a44 100644 (file)
@@ -174,9 +174,7 @@ class CRM_Report_Form_Mailing_Opened extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_email') {
               $this->_emailField = TRUE;
             }
index 954bf40d047d13582ab9fa51d9b61cbe6c5025db..8682fb7e4c64b6dfbece9ead5db2327eab247079 100644 (file)
@@ -287,9 +287,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             # for statistics
             if (!empty($field['statistics'])) {
index 4e650135fe03d74c1daf65f9edcd2b0b86887b9f..27bded09b068640f792a31e9082820098f61509f 100644 (file)
@@ -427,9 +427,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
             }
@@ -497,7 +495,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
 ";
 
     //for premiums
-    if (!empty($this->_params['fields']['product_name']) || CRM_Utils_Array::value('product_option', $this->_params['fields'])) {
+    if (!empty($this->_params['fields']['product_name']) || !empty($this->_params['fields']['product_option'])) {
       $this->_from .= "
                  LEFT JOIN  civicrm_contribution_product {$this->_aliases['civicrm_contribution_product']}
                         ON ({$this->_aliases['civicrm_contribution_product']}.contribution_id = {$this->_aliases['civicrm_contribution']}.id)
@@ -527,7 +525,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
     }
     //for contribution batches
     if ($this->_allBatches &&
-      (CRM_Utils_Array::value('batch_id', $this->_params['fields']) || !empty($this->_params['bid_value']))) {
+      (!empty($this->_params['fields']['batch_id']) || !empty($this->_params['bid_value']))) {
       $this->_from .= "
                 LEFT JOIN civicrm_entity_financial_trxn tx ON (tx.entity_id = {$this->_aliases['civicrm_contribution']}.id AND
                    tx.entity_table = 'civicrm_contribution')
@@ -593,7 +591,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
       $this->_select .= ", {$section['dbAlias']} as {$alias}";
     }
 
-    if ($applyLimit && !CRM_Utils_Array::value('charts', $this->_params)) {
+    if ($applyLimit && empty($this->_params['charts'])) {
       $this->limit();
     }
 
@@ -607,7 +605,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
 
   function orderBy() {
     $this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id ";
-    if (!empty($this->_params['fields']['first_donation_date']) || CRM_Utils_Array::value('first_donation_amount', $this->_params['fields'])) {
+    if (!empty($this->_params['fields']['first_donation_date']) || !empty($this->_params['fields']['first_donation_amount'])) {
       $this->_orderBy .= ", {$this->_aliases['civicrm_contribution']}.receive_date";
     }
   }
@@ -661,7 +659,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
       foreach ($this->_columns as $tableName => $table) {
         if (array_key_exists('fields', $table)) {
           foreach ($table['fields'] as $fieldName => $field) {
-            if (!empty($field['csv_display']) && CRM_Utils_Array::value('no_display', $field)) {
+            if (!empty($field['csv_display']) && !empty($field['no_display'])) {
               $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
               $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
             }
@@ -761,8 +759,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
       }
 
       // convert donor sort name to link
-      if (array_key_exists('civicrm_contact_sort_name', $row) &&
-        CRM_Utils_Array::value('civicrm_contact_sort_name', $rows[$rowNum]) &&
+      if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
         array_key_exists('civicrm_contact_id', $row)
       ) {
         $url = CRM_Utils_System::url('civicrm/contact/view',
index 6087588cb6edef713910a674283cbf01d8641f1f..e42c0f463c6adb8b57a0a2e745f82a1e54e0d9f7 100644 (file)
@@ -309,9 +309,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
             }
index 0fd672c810f31875f85932f8c74ecf8d175a0571..77916921ed104a782adcaf54a204d11f331e9570 100644 (file)
@@ -232,9 +232,7 @@ class CRM_Report_Form_Member_Lapse extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             // to include optional columns address ,email and phone only if checked
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
index 871fe7d776864e2ba90e3912b0f8f6d1a8c60487..202c21b67e50603ec5a2d1f0505930aa0390bf51 100644 (file)
@@ -270,9 +270,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form {
 
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             // only include statistics columns if set
             if (!empty($field['statistics'])) {
@@ -303,9 +301,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form {
               }
             }
             elseif ($fieldName == 'membership_type_id') {
-              if (empty($this->_params['group_bys']['membership_type_id']) &&
-                CRM_Utils_Array::value('join_date', $this->_params['group_bys'])
-              ) {
+              if (empty($this->_params['group_bys']['membership_type_id']) && !empty($this->_params['group_bys']['join_date'])) {
                 $select[] = "GROUP_CONCAT(DISTINCT {$field['dbAlias']}  ORDER BY {$field['dbAlias']} ) as {$tableName}_{$fieldName}";
               }
               else {
@@ -366,9 +362,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form {
               if (!empty($field['chart'])) {
                 $this->assign('chartSupported', TRUE);
               }
-              if (!empty($table['group_bys'][$fieldName]['frequency']) &&
-                CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])
-              ) {
+              if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) {
 
                 $append = "YEAR({$field['dbAlias']}),";
                 if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]),
@@ -528,8 +522,7 @@ GROUP BY    {$this->_aliases['civicrm_contribution']}.currency
     $entryFound = FALSE;
     foreach ($rows as $rowNum => $row) {
       // make count columns point to detail report
-      if (!empty($this->_params['group_bys']['join_date']) &&
-        CRM_Utils_Array::value('civicrm_membership_join_date_start', $row) &&
+      if (!empty($this->_params['group_bys']['join_date']) && !empty($row['civicrm_membership_join_date_start']) &&
         $row['civicrm_membership_join_date_start'] &&
         $row['civicrm_membership_join_date_subtotal']
       ) {
index c7477ca115f01bdf5153424f368c8c76a61978eb..a4e1bb1920b0f7315f238dd92b18cbdd51f469cf 100644 (file)
@@ -170,9 +170,7 @@ class CRM_Report_Form_Membership_Summary extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             // to include optional columns address and email, only if checked
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
index 660bdaf49023df18c460fef780f093287f1f48b8..9d71cf210999c057f1e74ff7df30ed8001ce6fec 100644 (file)
@@ -214,9 +214,7 @@ class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             // to include optional columns address and email, only if checked
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
index e47fdd7b559f00e7caba8d7e4fa2f48e82286c1a..91118532f55f20432519b07c75bfafba1e2081e8 100644 (file)
@@ -265,9 +265,7 @@ class CRM_Report_Form_Pledge_Summary extends CRM_Report_Form {
                 $this->assign('chartSupported', TRUE);
               }
 
-              if (!empty($table['group_bys'][$fieldName]['frequency']) &&
-                CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])
-              ) {
+              if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) {
 
                 $append = "YEAR({$field['dbAlias']}),";
                 if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]),
index d2c9a7e0a7554a97f7b85c7055d74152efe87708..8813c65fc627e854883a6c4cc8079167ce4817d2 100644 (file)
@@ -137,9 +137,7 @@ class CRM_Report_Form_Walklist_Walklist extends CRM_Report_Form {
     $this->_columnHeaders = array();
     foreach ($this->_columns as $tableName => $table) {
       foreach ($table['fields'] as $fieldName => $field) {
-        if (!empty($field['required']) ||
-          CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-        ) {
+        if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
           if ($tableName == 'civicrm_address') {
             $this->_addressField = TRUE;
           }
index 3a9476bde5db65a49dd396a893da2a08c57e5b82..a8d8422885839d7497cfe57fd0436458eaf877e3 100644 (file)
@@ -352,7 +352,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form {
           }
         }
       }
-      if (!empty($params['saveTemplate']) && !CRM_Utils_Array::value('saveTemplateName', $params)) {
+      if (!empty($params['saveTemplate']) && empty($params['saveTemplateName'])) {
         $errors['saveTemplateName'] = ts('Please provide a Template Name.');
       }
     }
index 120917cdf63caa9acaf1135923de2fe510e10bc7..e8e15465e08b8581d71e7e6486631eb02f84a520 100644 (file)
@@ -678,9 +678,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
       $params = array('id' => $customField->custom_group_id);
       $customGroup = array();
       CRM_Core_BAO_CustomGroup::retrieve($params, $customGroup);
-      if (($fieldType != CRM_Utils_Array::value('extends', $customGroup)) ||
-        !CRM_Utils_Array::value('extends_entity_column_value', $customGroup)
-      ) {
+      if (($fieldType != CRM_Utils_Array::value('extends', $customGroup)) || empty($customGroup['extends_entity_column_value'])) {
         return $errors;
       }
 
index 4d13d2959438906ba8990c53f3e9583499bee315..07ac5fde6f7e3ad459d35b59b3b3096c948148f6 100644 (file)
@@ -443,7 +443,7 @@ WHERE     cpse.price_set_id IS NULL";
       if (empty($optionValue))
         return;
     }
-    elseif (empty($options['otherAmount']) && !CRM_Utils_Array::value('membership', $options)) {
+    elseif (empty($options['otherAmount']) && empty($options['membership'])) {
       //CRM-12273
       //if options group, otherAmount, membersip is empty then return, contribution should be default price set
       return;
index ab11ee7f68bf4a0967785c61dec8f82975da2053..2339fd37bb21c0d73a1b65e63e0e03fb30f1f0cf 100644 (file)
@@ -123,8 +123,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p
 
       if (array_key_exists('option_amount', $params) &&
           array_key_exists($index, $params['option_amount']) &&
-          (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) ||
-           CRM_Utils_Array::value('is_quick_config', $params)) &&
+          (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || !empty($params['is_quick_config'])) &&
           !CRM_Utils_System::isNull($params['option_amount'][$index])
           ) {
         $options = array(
@@ -241,7 +240,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p
     $currencyName = $config->defaultCurrency;
 
     if (!isset($label)) {
-      $label = (property_exists($qf,'_membershipBlock') &&  CRM_Utils_Array::value('is_separate_payment', $qf->_membershipBlock) && $field->name == 'contribution_amount' && !CRM_Utils_Array::value('is_allow_other_amount', $otherAmount)) ? ts('Additional Contribution') : $field->label;
+      $label = (property_exists($qf,'_membershipBlock') && !empty($qf->_membershipBlock['is_separate_payment']) && $field->name == 'contribution_amount' && empty($otherAmount['is_allow_other_amount'])) ? ts('Additional Contribution') : $field->label;
     }
 
     if ($field->name == 'contribution_amount') {
@@ -274,7 +273,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p
         }
 
         // if seperate membership payment is used with quick config priceset then change the other amount label
-        if (property_exists($qf,'_membershipBlock') && CRM_Utils_Array::value('is_separate_payment', $qf->_membershipBlock) && $qf->_quickConfig && $field->name == 'other_amount' && !property_exists($qf,'_contributionAmount')) {
+        if (property_exists($qf,'_membershipBlock') && !empty($qf->_membershipBlock['is_separate_payment']) && $qf->_quickConfig && $field->name == 'other_amount' && !property_exists($qf,'_contributionAmount')) {
             $label = ts('Additional Contribution');
             $useRequired = 0;
         } elseif (!empty($fieldOptions[$optionKey]['label'])) {      //check for label.
@@ -347,7 +346,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p
           }
         }
 
-        if (property_exists($qf, '_membershipBlock') && CRM_Utils_Array::value('is_separate_payment', $qf->_membershipBlock) && $field->name == 'contribution_amount') {
+        if (property_exists($qf, '_membershipBlock') && !empty($qf->_membershipBlock['is_separate_payment']) && $field->name == 'contribution_amount') {
           $choice[] = $qf->createElement('radio', NULL, '', 'No thank you', '-1',
             array(
               'onclick' => 'clearAmountOther();',
@@ -359,7 +358,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p
           // add "none" option
           if (!empty($otherAmount['is_allow_other_amount']) && $field->name == 'contribution_amount') {
             $none = ts('Other Amount');
-          } elseif (property_exists($qf, '_membershipBlock') && !CRM_Utils_Array::value('is_required', $qf->_membershipBlock) && $field->name == 'membership_amount') {
+          } elseif (property_exists($qf, '_membershipBlock') && empty($qf->_membershipBlock['is_required']) && $field->name == 'membership_amount') {
             $none = ts('No thank you');
           } else {
             $none = ts('-none-');
index 0db307c6953814373d640489fb19f61710ae3005..f63ad3743f37cc87cb6ee5ef853a1c49faea5cc4 100644 (file)
@@ -831,7 +831,7 @@ if (!isset($_contact_memberships[$userid][$value['membership_type_id']])) {
 $_contact_memberships[$userid][$value['membership_type_id']] = CRM_Member_BAO_Membership::getContactMembership($userid, $value['membership_type_id'], FALSE);
 }
 $currentMembership = $_contact_memberships[$userid][$value['membership_type_id']];
-if (!empty($currentMembership) && !CRM_Utils_Array::value('end_date', $currentMembership)) {
+if (!empty($currentMembership) && empty($currentMembership['end_date'])) {
 unset($options[$key]);
 $checklifetime = TRUE;
 }
index 7d73c323cb5e02118d3cb10b8c0064a5cf5b6e89..4d8811e42f05e2dfd53783c27bcc26b59b7edd40 100644 (file)
@@ -211,9 +211,7 @@ class CRM_Utils_Address_BatchUpdate {
         $success = TRUE;
         // consider address is automatically parseable,
         // when we should found street_number and street_name
-        if (empty($parsedFields['street_name']) ||
-          !CRM_Utils_Array::value('street_number', $parsedFields)
-        ) {
+        if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) {
           $success = FALSE;
         }
 
index 17bdae1d4bcb102577b1283929b5962f5a2d85f4..84d488674e9aa8ab4217157f67f88675749122b6 100644 (file)
@@ -1355,7 +1355,7 @@ function _civicrm_api3_deprecated_contact_check_params(
       }
     }
 
-    if (empty($params['contact_id']) && CRM_Utils_Array::value('id', $params)) {
+    if (empty($params['contact_id']) && !empty($params['id'])) {
       $valid = FALSE;
       $error = '';
       foreach ($fields as $field) {
index b45a48359c3b40a8c8655f022026945aa13f51b9..877da5991293c9b86e493ee776c899f45a119d5b 100644 (file)
@@ -72,9 +72,7 @@ class CRM_Utils_Mail {
     CRM_Utils_Hook::alterMailParams($params);
 
     // check if any module has aborted mail sending
-    if (!empty($params['abortMailSend']) ||
-      !CRM_Utils_Array::value('toEmail', $params)
-    ) {
+    if (!empty($params['abortMailSend']) || empty($params['toEmail'])) {
       return FALSE;
     }
 
index 5f81e2cb917e498bb2ebe3873b09dd9723a8692c..89ee7718657ea599da2da4898d4e2ef3d8638c8e 100644 (file)
@@ -175,7 +175,7 @@ class CRM_Utils_Rule {
     }
 
     // CRM-9017 CiviContribute/CiviMember form with expiration date format 'm Y'
-    if (!$m && CRM_Utils_Array::value('m', $date)) {
+    if (!$m && !empty($date['m'])) {
       $m = CRM_Utils_Array::value('m', $date);
     }
 
index 19201c94423fb57e0a2f9cfca8e4f41d407de710..2a679152bb715dd22b87a464ad8e80398225fc2f 100644 (file)
@@ -230,9 +230,7 @@ class CRM_Utils_Token {
   ) {
     $key = 'domain';
     if (
-      !$knownTokens ||
-      !CRM_Utils_Array::value($key, $knownTokens)
-    ) {
+      !$knownTokens || empty($knownTokens[$key])) {
       return $str;
     }
 
@@ -519,7 +517,7 @@ class CRM_Utils_Token {
     // so that we remove anything we do not recognize
     // I hope to move this step out of here soon and
     // then we will just iterate on a list of tokens that are passed to us
-    if (!$knownTokens || !CRM_Utils_Array::value($key, $knownTokens)) {
+    if (!$knownTokens || empty($knownTokens[$key])) {
       return $str;
     }
 
@@ -607,7 +605,7 @@ class CRM_Utils_Token {
     // so that we remove anything we do not recognize
     // I hope to move this step out of here soon and
     // then we will just iterate on a list of tokens that are passed to us
-    if (!$knownTokens || !CRM_Utils_Array::value($key, $knownTokens)) {
+    if (!$knownTokens || empty($knownTokens[$key])) {
       return $str;
     }
 
@@ -1367,7 +1365,7 @@ class CRM_Utils_Token {
    * @return string string with replacements made
    */
   public static function replaceEntityTokens($entity, $entityArray, $str, $knownTokens = array(), $escapeSmarty = FALSE) {
-    if (!$knownTokens || !CRM_Utils_Array::value($entity, $knownTokens)) {
+    if (!$knownTokens || empty($knownTokens[$entity])) {
       return $str;
     }
 
@@ -1389,7 +1387,7 @@ class CRM_Utils_Token {
     // I hope to move this step out of here soon and
     // then we will just iterate on a list of tokens that are passed to us
     $key = 'contribution';
-    if (!$knownTokens || !CRM_Utils_Array::value($key, $knownTokens)) {
+    if (!$knownTokens || empty($knownTokens[$key])) {
       return $str;
     }
 
index 99a6ca2cf96a0c6c6b3522a8c5a2166263b09893..96b40dd26ad51ec99cd53815defe6d521f708d49 100644 (file)
@@ -408,9 +408,7 @@ SELECT  count(*)
   //if adding a new activity & date_time not set make it now
   // this should be managed by the wrapper layer & setting ['api.default'] in speces
   // needs testing
-  if (empty($params['id']) &&
-    !CRM_Utils_Array::value('activity_date_time', $params)
-  ) {
+  if (empty($params['id']) && empty($params['activity_date_time'])) {
     $params['activity_date_time'] = CRM_Utils_Date::processDate(date('Y-m-d H:i:s'));
   }
 
index 7ba429de3068ab5881d795bea266431f883b616f..1aac290b2fec6f6d49bdc2075d68cecfdb374468 100644 (file)
@@ -307,7 +307,7 @@ function _civicrm_api3_contact_check_params( &$params, $dupeCheck = true, $dupeE
     $params['preferred_communication_method'] = CRM_Utils_Array::implodePadded($params['preferred_communication_method']);
   }
 
-  if (!empty($params['contact_sub_type']) && CRM_Utils_Array::value('contact_type', $params)) {
+  if (!empty($params['contact_sub_type']) && !empty($params['contact_type'])) {
       if (!(CRM_Contact_BAO_ContactType::isExtendsContactType($params['contact_sub_type'], $params['contact_type']))) {
         throw new API_Exception("Invalid or Mismatched Contact SubType: " . implode(', ', (array)$params['contact_sub_type']));
       }
@@ -534,7 +534,7 @@ function civicrm_api3_contact_getquick($params) {
 
   $list = array();
   foreach ($acpref as $value) {
-    if ($value && CRM_Utils_Array::value($value, $acOptions)) {
+    if ($value && !empty($acOptions[$value])) {
       $list[$value] = $acOptions[$value];
     }
   }
index 0bc5a5fec554419f4f3012a76a97bf2642756177..eb2ffc7d71fe9370610d59c3677f4289000cc3a9 100644 (file)
@@ -60,7 +60,7 @@ function civicrm_api3_contribution_create(&$params) {
       'amount' => $params['total_amount']));
   }
 
-  if (!empty($params['id']) && CRM_Utils_Array::value('contribution_status_id', $params)) {
+  if (!empty($params['id']) && !empty($params['contribution_status_id'])) {
     $error = array();
     //throw error for invalid status change such as setting completed back to pending
     //@todo this sort of validation belongs in the BAO not the API - if it is not an OK
index d552f8175fc0e1746b1c8e4bfcf33604f0bd0bf4..aa1daa8af1ca8f8b4fe7e95ebebddf6031bb70f1 100644 (file)
@@ -69,7 +69,7 @@ function civicrm_api3_participant_create($params) {
 
   $participantBAO = CRM_Event_BAO_Participant::create($params);
 
-  if(empty($params['price_set_id']) && empty($params['id']) && CRM_Utils_Array::value('fee_level', $params)){
+  if(empty($params['price_set_id']) && empty($params['id']) && !empty($params['fee_level'])){
     _civicrm_api3_participant_createlineitem($params, $participantBAO);
   }
   _civicrm_api3_object_to_array($participantBAO, $participant[$participantBAO->id]);
index 122b22c2de047e25304c4b18be385df3a4745e25..c638cb640681c3225afa038021a850d57f0d1208 100644 (file)
@@ -56,7 +56,7 @@
 function civicrm_api3_pledge_payment_create($params) {
 
   $paymentParams = $params;
-  if (empty($params['id']) && !CRM_Utils_Array::value('option.create_new', $params)) {
+  if (empty($params['id']) && empty($params['option.create_new'])) {
     $paymentDetails = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($params['pledge_id']);
     if (empty($paymentDetails)) {
       return civicrm_api3_create_error("There are no unmatched payment on this pledge. Pass in the pledge_payment id to specify one or 'option.create_new' to create one");
index c65a2850f3071aa167bae7183a0d757199edae0f..0f489960cd871567eebf7f1352ac8bc39fdf8518 100644 (file)
@@ -161,7 +161,7 @@ function civicrm_api3_create_error($msg, $data = array(), &$dao = NULL) {
   if(isset($data['sql']) && CRM_Core_Permission::check('Administer CiviCRM')) {
     $data['debug_information'] = $data['sql'];
   }
-  if (is_array($dao) && isset($dao['params']) && is_array($dao['params']) && CRM_Utils_Array::value('api.has_parent', $dao['params'])) {
+  if (is_array($dao) && isset($dao['params']) && is_array($dao['params']) && !empty($dao['params']['api.has_parent'])) {
     $errorCode = empty($data['error_code']) ? 'chained_api_failed' : $data['error_code'];
     throw new API_Exception('Error in call to ' . $dao['entity'] . '_' . $dao['action'] . ' : ' . $msg, $errorCode, $data);
   }
@@ -777,7 +777,7 @@ function _civicrm_api3_get_unique_name_array(&$bao) {
  */
 function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $entity = "") {
   $result = array();
-  if(isset($params['options']) && CRM_Utils_Array::value('is_count', $params['options'])) {
+  if(isset($params['options']) && !empty($params['options']['is_count'])) {
     return $dao->count();
   }
   if (empty($dao) || !$dao->find()) {
@@ -788,7 +788,7 @@ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE,
     return $dao->count;
   }
   //if custom fields are required we will endeavour to set them . NB passing $entity in might be a bit clunky / unrequired
-  if (!empty($entity) && CRM_Utils_Array::value('return', $params) && is_array($params['return'])) {
+  if (!empty($entity) && !empty($params['return']) && is_array($params['return'])) {
     foreach ($params['return'] as $return) {
       if (substr($return, 0, 6) == 'custom') {
         $custom = TRUE;
@@ -1236,7 +1236,7 @@ function _civicrm_api3_validate_date(&$params, &$fieldName, &$fieldInfo) {
     }
     $params[$fieldInfo['name']] = CRM_Utils_Date::processDate($params[$fieldInfo['name']]);
   }
-  if ((CRM_Utils_Array::value('name', $fieldInfo) != $fieldName) && CRM_Utils_Array::value($fieldName, $params)) {
+  if ((CRM_Utils_Array::value('name', $fieldInfo) != $fieldName) && !empty($params[$fieldName])) {
     //If the unique field name differs from the db name & is set handle it here
     if (strtotime($params[$fieldName]) === FALSE) {
       throw new Exception($fieldName . " is not a valid date: " . $params[$fieldName]);
@@ -1532,9 +1532,7 @@ function _civicrm_api3_swap_out_aliases(&$apiRequest, $fields) {
         }
       }
     }
-    if (!isset($apiRequest['params'][$field])
-      && CRM_Utils_Array::value('name', $values)
-      && $field != $values['name']
+    if (!isset($apiRequest['params'][$field]) && !empty($values['name']) && $field != $values['name']
       && isset($apiRequest['params'][$values['name']])
     ) {
       $apiRequest['params'][$field] = $apiRequest['params'][$values['name']];
@@ -1588,9 +1586,7 @@ function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $ent
     }
 
     // Check our field length
-    if(is_string($params[$fieldName]) &&
-      CRM_Utils_Array::value('maxlength',$fieldInfo)
-      && strlen($params[$fieldName]) > $fieldInfo['maxlength']
+    if(is_string($params[$fieldName]) && !empty($fieldInfo['maxlength']) && strlen($params[$fieldName]) > $fieldInfo['maxlength']
       ){
       throw new API_Exception( $params[$fieldName] . " is " . strlen($params[$fieldName]) . " characters  - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters',
         2100, array('field' => $fieldName, "max_length"=>$fieldInfo['maxlength'])
index 3c1b139adc48faebf248907cd447c6fdf45eb07a..6f9d8b9fbf47ff113521eab7e83847b5adbc8278 100644 (file)
@@ -224,9 +224,7 @@ WHERE      {$whereClause}
       $success = TRUE;
       // consider address is automatically parseable,
       // when we should found street_number and street_name
-      if (empty($parsedFields['street_name']) ||
-        !CRM_Utils_Array::value('street_number', $parsedFields)
-      ) {
+      if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) {
         $success = FALSE;
       }
 
index 119b05db8d54b6e7b2480e6f20fc70045d8a3553..be51c1cb67ebace3f650211a0ea559d7940e001d 100644 (file)
@@ -910,9 +910,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
    */
   private function _contactCreate($params) {
     $result = $this->callAPISuccess('contact', 'create', $params);
-    if (!empty($result['is_error']) ||
-      !CRM_Utils_Array::value('id', $result)
-    ) {
+    if (!empty($result['is_error']) || empty($result['id'])) {
       throw new Exception('Could not create test contact, with message: ' . CRM_Utils_Array::value('error_message', $result) . "\nBacktrace:" . CRM_Utils_Array::value('trace', $result));
     }
     return $result['id'];
index dc008e1642dcc04313a5f9f59dfb7d95a0f9f70e..6ed3cc63c0b34678241cc3f61e5d757469fc8ee1 100755 (executable)
@@ -316,9 +316,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form {
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
             }
@@ -583,8 +581,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form {
       }
 
       // convert display name to links
-      if (array_key_exists('civicrm_contact_display_name', $row) &&
-        CRM_Utils_Array::value('civicrm_contact_display_name', $rows[$rowNum]) &&
+      if (array_key_exists('civicrm_contact_display_name', $row) && !empty($rows[$rowNum]['civicrm_contact_display_name']) &&
         array_key_exists('civicrm_contact_id', $row)
       ) {
         $url = CRM_Utils_System::url("civicrm/contact/view",
@@ -596,8 +593,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form {
       }
 
       // convert soft credit id to link
-      if (array_key_exists('soft_credit_display_name', $row) &&
-        CRM_Utils_Array::value('soft_credit_display_name', $rows[$rowNum]) &&
+      if (array_key_exists('soft_credit_display_name', $row) && !empty($rows[$rowNum]['soft_credit_display_name']) &&
         array_key_exists('id', $row)
       ) {
         $url = CRM_Utils_System::url("civicrm/contact/view",
@@ -609,8 +605,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form {
       }
 
       // convert hon/mem contact to link
-      if (array_key_exists('civicrm_contact_hon_mem_display_name', $row) &&
-        CRM_Utils_Array::value('civicrm_contribution_honor_contact_id', $rows[$rowNum]) &&
+      if (array_key_exists('civicrm_contact_hon_mem_display_name', $row) && !empty($rows[$rowNum]['civicrm_contribution_honor_contact_id']) &&
         array_key_exists('civicrm_contribution_honor_contact_id', $row)
       ) {
         $url = CRM_Utils_System::url("civicrm/contact/view",
@@ -622,9 +617,7 @@ class CRM_Report_Form_Contribute_Baykeeper extends CRM_Report_Form {
       }
 
       // honor of/memory of type
-      if ($value = CRM_Utils_Array::value('civicrm_contribution_honor_type_id', $row) &&
-        CRM_Utils_Array::value('civicrm_contribution_honor_type_id', $rows[$rowNum])
-      ) {
+      if ($value = CRM_Utils_Array::value('civicrm_contribution_honor_type_id', $row) && !empty($rows[$rowNum]['civicrm_contribution_honor_type_id'])) {
         // rather than do a join, just change the output here, since there these values are pretty static
 
 
index b8d40be8e9f4d1126cf7e65bfd235475c4e4bff0..a4ad27669e00d4523fb9cebe32f8b7918cd54a57 100644 (file)
@@ -216,9 +216,7 @@ class org_civicrm_report_grant extends CRM_Report_Form {
       }
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) ||
-            CRM_Utils_Array::value($fieldName, $this->_params['fields'])
-          ) {
+          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
 
             $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";