Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap CRM_Utils_Array::value for empty() in conditionals #15005

Merged
merged 1 commit into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ public static function create(&$params) {
}

// Set priority to Normal for Auto-populated activities (for Cases)
if (CRM_Utils_Array::value('priority_id', $params) === NULL &&
if (!isset($params['priority_id']) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK - it's not the same but I guess priority_id can't be 0....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this not the same @eileenmcnaughton? The default return value of CRM_Utils_Array::value is NULL if the variable isn't set, and isset($foo = NULL) returns FALSE.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right - it could be set & equal to NULL or not set - I think here it doesn't matter in that set & equal to null would still be empty

// if not set and not 0
!CRM_Utils_Array::value('id', $params)
empty($params['id'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

) {
$priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id');
$params['priority_id'] = array_search('Normal', $priority);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function postProcess() {
'version' => 3,
'key' => $this->_key,
]);
if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
if (empty($result['is_error'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

CRM_Core_Session::setStatus("", ts('Extension Upgraded'), "success");
}
else {
Expand Down
4 changes: 2 additions & 2 deletions CRM/Admin/Form/ScheduleReminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ public function parseActionSchedule($values) {
'end_date',
];

if (!CRM_Utils_Array::value('absolute_date', $params)) {
if (empty($params['absolute_date'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

$params['absolute_date'] = 'null';
}
foreach ($moreKeys as $mkey) {
Expand Down Expand Up @@ -577,7 +577,7 @@ public function parseActionSchedule($values) {

$params['is_active'] = CRM_Utils_Array::value('is_active', $values, 0);

if (CRM_Utils_Array::value('is_repeat', $values) == 0) {
if (empty($values['is_repeat'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok - I guess is_repeat is a boolean - although that sort of thing always feels like a big assumption with our code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well since this statement uses loose == and not strict ===, in this case the two statements are equivalent.

$params['repetition_frequency_unit'] = 'null';
$params['repetition_frequency_interval'] = 'null';
$params['end_frequency_unit'] = 'null';
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Setting/Localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function postProcess() {
}

// add a new db locale if the requested language is not yet supported by the db
if (!CRM_Utils_Array::value('makeSinglelingual', $values) and CRM_Utils_Array::value('addLanguage', $values)) {
if (empty($values['makeSinglelingual']) && !empty($values['addLanguage'])) {
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
if (!substr_count($domain->locales, $values['addLanguage'])) {
Expand Down
4 changes: 2 additions & 2 deletions CRM/Badge/BAO/Badge.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ public function labelCreator(&$formattedRow, $cellspacing = 0) {
break;
}
$this->pdf->Image($formattedRow['participant_image'], $x + $imageAlign, $y + $startOffset, CRM_Utils_Array::value('width_participant_image', $formattedRow), CRM_Utils_Array::value('height_participant_image', $formattedRow));
if ($startOffset == NULL && CRM_Utils_Array::value('height_participant_image', $formattedRow)) {
$startOffset = CRM_Utils_Array::value('height_participant_image', $formattedRow);
if ($startOffset == NULL && !empty($formattedRow['height_participant_image'])) {
$startOffset = $formattedRow['height_participant_image'];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was silly as the conditional already established it was not empty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean earlier in the formatLabel function? Anyway this seems ok but makes spidey-sense tingle for me for a different reason - out of scope here but for reference I don't see how $startOffset could be NULL, and even if it could be then adding it to $y in line 227 is iffy even if it works.

}
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Form/Activity/ChangeCaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static function beginPostProcess(&$form, &$params) {
$params['id'] = $form->_id;
}

if (CRM_Utils_Array::value('is_reset_timeline', $params) == 0) {
if (empty($params['is_reset_timeline'])) {
unset($params['reset_date_time']);
}
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/DedupeRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function preProcess() {
// check if $contactType is valid
$contactTypes = civicrm_api3('Contact', 'getOptions', ['field' => "contact_type", 'context' => "validate"]);
$contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
if (CRM_Utils_Array::value($contactType, $contactTypes['values'])) {
if (!empty($contactTypes['values'][$contactType])) {
$this->_contactType = $contactType;
}
elseif (!empty($contactType)) {
Expand Down
4 changes: 1 addition & 3 deletions CRM/Contact/Form/Task/ProximityCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ public static function formRule($fields, $files, $form) {
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
!CRM_Utils_Array::value('prox_city', $fields)
) {
if (empty($fields['prox_postal_code']) && empty($fields['prox_city'])) {
$errors["prox_distance"] = ts("City OR Postal Code are required to search by distance.");
}
}
Expand Down
8 changes: 4 additions & 4 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -2962,7 +2962,7 @@ public function _gatherMessageValues($input, &$values, $ids = []) {
if (!empty($lineItems)) {
$firstLineItem = reset($lineItems);
$priceSet = [];
if (CRM_Utils_Array::value('price_set_id', $firstLineItem)) {
if (!empty($firstLineItem['price_set_id'])) {
$priceSet = civicrm_api3('PriceSet', 'getsingle', [
'id' => $firstLineItem['price_set_id'],
'return' => 'is_quick_config, id',
Expand Down Expand Up @@ -4013,7 +4013,7 @@ public static function getPaymentInfo($id, $component = 'contribution', $getTrxn
$baseTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contributionId);
$baseTrxnId = $baseTrxnId['financialTrxnId'];
}
if (!CRM_Utils_Array::value('total_amount', $total) || $usingLineTotal) {
if (empty($total['total_amount']) || $usingLineTotal) {
$total = CRM_Price_BAO_LineItem::getLineTotal($contributionId);
}
else {
Expand Down Expand Up @@ -4538,7 +4538,7 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re
$contributionResult = civicrm_api3('Contribution', 'create', $contributionParams);

// Add new soft credit against current $contribution.
if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) {
if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) {
CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id);
}

Expand Down Expand Up @@ -5046,7 +5046,7 @@ protected function addContributionPageValuesToValuesHeavyHandedly(&$values) {
public static function checkContributeSettings($name = NULL, $checkInvoicing = FALSE) {
$contributeSettings = Civi::settings()->get('contribution_invoice_settings');

if ($checkInvoicing && !CRM_Utils_Array::value('invoicing', $contributeSettings)) {
if ($checkInvoicing && empty($contributeSettings['invoicing'])) {
return NULL;
}

Expand Down
10 changes: 5 additions & 5 deletions CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,10 @@ public function buildQuickForm() {
$componentDetails = [];
if ($this->_id) {
$componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id);
if (CRM_Utils_Array::value('membership', $componentDetails)) {
if (!empty($componentDetails['membership'])) {
$component = 'membership';
}
elseif (CRM_Utils_Array::value('participant', $componentDetails)) {
elseif (!empty($componentDetails['participant'])) {
$component = 'participant';
}
}
Expand Down Expand Up @@ -831,8 +831,8 @@ public function buildQuickForm() {
$componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id);
$isCancelledStatus = ($this->_values['contribution_status_id'] == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Cancelled'));

if (CRM_Utils_Array::value('membership', $componentDetails) ||
CRM_Utils_Array::value('participant', $componentDetails) ||
if (!empty($componentDetails['membership']) ||
!empty($componentDetails['participant']) ||
// if status is Cancelled freeze Amount, Payment Instrument, Check #, Financial Type,
// Net and Fee Amounts are frozen in AdditionalInfo::buildAdditionalDetail
$isCancelledStatus
Expand Down Expand Up @@ -1710,7 +1710,7 @@ protected function submit($submittedValues, $action, $pledgePaymentID) {
protected function invoicingPostProcessHook($submittedValues, $action, $lineItem) {

$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
if (!CRM_Utils_Array::value('invoicing', $invoiceSettings)) {
if (empty($invoiceSettings['invoicing'])) {
return;
}
$taxRate = [];
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static function handlePledge(&$form, $params, $contributionParams, $pledg
$pledgeParams['frequency_day'] = 1;
}
$pledgeParams['create_date'] = $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date("Ymd");
if (CRM_Utils_Array::value('start_date', $params)) {
if (!empty($params['start_date'])) {
$pledgeParams['frequency_day'] = intval(date("d", strtotime(CRM_Utils_Array::value('start_date', $params))));
$pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date('Ymd', strtotime(CRM_Utils_Array::value('start_date', $params)));
}
Expand Down Expand Up @@ -1942,7 +1942,7 @@ public static function submit($params) {
$form->_fields['billing_first_name'] = 1;
$form->_fields['billing_last_name'] = 1;
// CRM-18854 - Set form values to allow pledge to be created for api test.
if (CRM_Utils_Array::value('pledge_block_id', $params)) {
if (!empty($params['pledge_block_id'])) {
$form->_values['pledge_id'] = CRM_Utils_Array::value('pledge_id', $params, NULL);
$form->_values['pledge_block_id'] = $params['pledge_block_id'];
$pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($params['id']);
Expand Down
22 changes: 9 additions & 13 deletions CRM/Contribute/Form/Contribution/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,7 @@ public static function buildRecur(&$form) {
public static function formRule($fields, $files, $self) {
$errors = [];
$amount = self::computeAmount($fields, $self->_values);
if (CRM_Utils_Array::value('auto_renew', $fields) &&
CRM_Utils_Array::value('payment_processor_id', $fields) == 0
) {
if (!empty($fields['auto_renew']) && empty($fields['payment_processor_id'])) {
$errors['auto_renew'] = ts('You cannot have auto-renewal on if you are paying later.');
}

Expand Down Expand Up @@ -876,15 +874,13 @@ public static function formRule($fields, $files, $self) {
//CRM-16285 - Function to handle validation errors on form, for recurring contribution field.
CRM_Contribute_BAO_ContributionRecur::validateRecurContribution($fields, $files, $self, $errors);

if (!empty($fields['is_recur']) &&
CRM_Utils_Array::value('payment_processor_id', $fields) == 0
) {
if (!empty($fields['is_recur']) && empty($fields['payment_processor_id'])) {
$errors['_qf_default'] = ts('You cannot set up a recurring contribution if you are not paying online by credit card.');
}

// validate PCP fields - if not anonymous, we need a nick name value
if ($self->_pcpId && !empty($fields['pcp_display_in_roll']) &&
(CRM_Utils_Array::value('pcp_is_anonymous', $fields) == 0) &&
empty($fields['pcp_is_anonymous']) &&
CRM_Utils_Array::value('pcp_roll_nickname', $fields) == ''
) {
$errors['pcp_roll_nickname'] = ts('Please enter a name to include in the Honor Roll, or select \'contribute anonymously\'.');
Expand Down Expand Up @@ -915,13 +911,13 @@ public static function formRule($fields, $files, $self) {
$errors['pledge_installments'] = ts('Please enter a valid number of pledge installments.');
}
else {
if (CRM_Utils_Array::value('pledge_installments', $fields) == NULL) {
if (!isset($fields['pledge_installments'])) {
$errors['pledge_installments'] = ts('Pledge Installments is required field.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ok. I r-run'd to check. Note that CRM_Utils_Rule::positiveInteger() above lets 0 thru (both int and string), and then as a string it gets thru here both originally and with the replacement, and then it gets caught down below by both the original and replacement on line 924.

}
elseif (CRM_Utils_Array::value('pledge_installments', $fields) == 1) {
$errors['pledge_installments'] = ts('Pledges consist of multiple scheduled payments. Select one-time contribution if you want to make your gift in a single payment.');
}
elseif (CRM_Utils_Array::value('pledge_installments', $fields) == 0) {
elseif (empty($fields['pledge_installments'])) {
$errors['pledge_installments'] = ts('Pledge Installments field must be > 1.');
}
}
Expand All @@ -931,10 +927,10 @@ public static function formRule($fields, $files, $self) {
$errors['pledge_frequency_interval'] = ts('Please enter a valid Pledge Frequency Interval.');
}
else {
if (CRM_Utils_Array::value('pledge_frequency_interval', $fields) == NULL) {
if (!isset($fields['pledge_frequency_interval'])) {
$errors['pledge_frequency_interval'] = ts('Pledge Frequency Interval. is required field.');
}
elseif (CRM_Utils_Array::value('pledge_frequency_interval', $fields) == 0) {
elseif (empty($fields['pledge_frequency_interval'])) {
$errors['pledge_frequency_interval'] = ts('Pledge frequency interval field must be > 0');
}
}
Expand All @@ -947,7 +943,7 @@ public static function formRule($fields, $files, $self) {
return $errors;
}

if (CRM_Utils_Array::value('payment_processor_id', $fields) === NULL) {
if (!isset($fields['payment_processor_id'])) {
$errors['payment_processor_id'] = ts('Payment Method is a required field.');
}
else {
Expand Down Expand Up @@ -1192,7 +1188,7 @@ public function submit($params) {
if ($params['amount'] != 0 && (($this->_values['is_pay_later'] &&
empty($this->_paymentProcessor) &&
!array_key_exists('hidden_processor', $params)) ||
(CRM_Utils_Array::value('payment_processor_id', $params) == 0))
empty($params['payment_processor_id']))
) {
$params['is_pay_later'] = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/ContributionPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function setDefaultValues() {
];
foreach ($pledgeBlock as $key) {
$defaults[$key] = CRM_Utils_Array::value($key, $pledgeBlockDefaults);
if ($key == 'pledge_start_date' && CRM_Utils_Array::value($key, $pledgeBlockDefaults)) {
if ($key == 'pledge_start_date' && !empty($pledgeBlockDefaults[$key])) {
$defaultPledgeDate = (array) json_decode($pledgeBlockDefaults['pledge_start_date']);
$pledgeDateFields = [
'pledge_calendar_date' => 'calendar_date',
Expand Down
14 changes: 7 additions & 7 deletions CRM/Contribute/Form/ContributionPage/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ public function buildQuickForm() {
if ($id != 0) {
$paymentProcessor[$id] = $processor['name'];
}
if (CRM_Utils_Array::value('is_recur', $processor)) {
if (!empty($processor['is_recur'])) {
$recurringPaymentProcessor[] = $id;
}
if (CRM_Utils_Array::value('object', $processor) && $processor['object']->supports('FutureRecurStartDate')) {
if (!empty($processor['object']) && $processor['object']->supports('FutureRecurStartDate')) {
$futurePaymentProcessor[] = $id;
}
}
Expand Down Expand Up @@ -345,7 +345,7 @@ public static function formRule($fields, $files, $self) {
}

// CRM-18854 Check if recurring start date is in the future.
if (CRM_Utils_Array::value('pledge_calendar_date', $fields)) {
if (!empty($fields['pledge_calendar_date'])) {
if (date('Ymd') > date('Ymd', strtotime($fields['pledge_calendar_date']))) {
$errors['pledge_calendar_date'] = ts('The recurring start date cannot be prior to the current date.');
}
Expand Down Expand Up @@ -506,7 +506,7 @@ public function postProcess() {
$params['is_recur_installments'] = CRM_Utils_Array::value('is_recur_installments', $params, FALSE);
}

if (CRM_Utils_Array::value('adjust_recur_start_date', $params)) {
if (!empty($params['adjust_recur_start_date'])) {
$fieldValue = '';
$pledgeDateFields = [
'calendar_date' => 'pledge_calendar_date',
Expand All @@ -517,7 +517,7 @@ public function postProcess() {
}
else {
foreach ($pledgeDateFields as $key => $pledgeDateField) {
if (CRM_Utils_Array::value($pledgeDateField, $params) && $params['pledge_default_toggle'] == $key) {
if (!empty($params[$pledgeDateField]) && $params['pledge_default_toggle'] == $key) {
$fieldValue = json_encode([$key => $params[$pledgeDateField]]);
break;
}
Expand All @@ -531,10 +531,10 @@ public function postProcess() {
$params['is_pledge_start_date_visible'] = 0;
$params['is_pledge_start_date_editable'] = 0;
}
if (!CRM_Utils_Array::value('is_pledge_start_date_visible', $params)) {
if (empty($params['is_pledge_start_date_visible'])) {
$params['is_pledge_start_date_visible'] = 0;
}
if (!CRM_Utils_Array::value('is_pledge_start_date_editable', $params)) {
if (empty($params['is_pledge_start_date_editable'])) {
$params['is_pledge_start_date_editable'] = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function create(&$params, $fixAddress = TRUE, $entity = NULL) {
// when we come from a form which displays all the location elements (like the edit form or the inline block
// elements, we can skip the below check. The below check adds quite a feq queries to an already overloaded
// form
if (!CRM_Utils_Array::value('updateBlankLocInfo', $params, FALSE)) {
if (empty($params['updateBlankLocInfo'])) {
// make sure contact should have only one primary block, CRM-5051
self::checkPrimaryBlocks(CRM_Utils_Array::value('contact_id', $params));
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/RecurringEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ public function mapFormValuesToDB($formParams = []) {
}
}
if ($formParams['repeats_by'] == 2) {
if (CRM_Utils_Array::value('entity_status_1', $formParams) && CRM_Utils_Array::value('entity_status_2', $formParams)) {
if (!empty($formParams['entity_status_1']) && !empty($formParams['entity_status_2'])) {
$dbParams['entity_status'] = $formParams['entity_status_1'] . " " . $formParams['entity_status_2'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another instance where only the last one on the line was converted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

}
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public static function isEnvironmentSet($setting, $value = NULL) {
public static function isAPIJobAllowedToRun($params) {
$environment = CRM_Core_Config::environment(NULL, TRUE);
if ($environment != 'Production') {
if (CRM_Utils_Array::value('runInNonProductionEnvironment', $params)) {
if (!empty($params['runInNonProductionEnvironment'])) {
$mailing = Civi::settings()->get('mailing_backend_store');
if ($mailing) {
Civi::settings()->set('mailing_backend', $mailing);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/StatusPreference.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static function create($params) {
}

// Check if this StatusPreference already exists.
if (empty($params['id']) && CRM_Utils_Array::value('name', $params)) {
if (empty($params['id']) && !empty($params['name'])) {
$statusPreference->domain_id = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
$statusPreference->name = $params['name'];

Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/UFField.php
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ public static function assignAddressField($key, &$profileAddressFields, $profile
if (in_array($field['field_name'], $validBillingFields)) {
$validProfileFields[] = $field['field_name'];
}
if (CRM_Utils_Array::value('is_required', $field)) {
if (!empty($field['is_required'])) {
$requiredProfileFields[] = $field['field_name'];
}
}
Expand Down
4 changes: 2 additions & 2 deletions CRM/Core/DAO/AllCoreTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public static function getExports($dao, $labelName, $prefix, $foreignDAOs) {
$fields = $dao::fields();

foreach ($fields as $name => $field) {
if (CRM_Utils_Array::value('export', $field)) {
if (!empty($field['export'])) {
if ($prefix) {
$exports[$labelName] = & $fields[$name];
}
Expand Down Expand Up @@ -340,7 +340,7 @@ public static function getImports($dao, $labelName, $prefix, $foreignDAOs) {
$fields = $dao::fields();

foreach ($fields as $name => $field) {
if (CRM_Utils_Array::value('import', $field)) {
if (!empty($field['import'])) {
if ($prefix) {
$imports[$labelName] = & $fields[$name];
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Form/RecurringEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public static function postProcess($params = [], $type, $linkedEntities = []) {

//exclude dates
$excludeDateList = [];
if (CRM_Utils_Array::value('exclude_date_list', $params) && CRM_Utils_Array::value('parent_entity_id', $params) && $actionScheduleObj->entity_value) {
if (!empty($params['exclude_date_list']) && !empty($params['parent_entity_id']) && $actionScheduleObj->entity_value) {
//Since we get comma separated values lets get them in array
$excludeDates = explode(",", $params['exclude_date_list']);

Expand Down
Loading