}
// Set priority to Normal for Auto-populated activities (for Cases)
- if (CRM_Utils_Array::value('priority_id', $params) === NULL &&
+ if (!isset($params['priority_id']) &&
// if not set and not 0
- !CRM_Utils_Array::value('id', $params)
+ empty($params['id'])
) {
$priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id');
$params['priority_id'] = array_search('Normal', $priority);
'version' => 3,
'key' => $this->_key,
]);
- if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
+ if (empty($result['is_error'])) {
CRM_Core_Session::setStatus("", ts('Extension Upgraded'), "success");
}
else {
'end_date',
];
- if (!CRM_Utils_Array::value('absolute_date', $params)) {
+ if (empty($params['absolute_date'])) {
$params['absolute_date'] = 'null';
}
foreach ($moreKeys as $mkey) {
$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'])) {
$params['repetition_frequency_unit'] = 'null';
$params['repetition_frequency_interval'] = 'null';
$params['end_frequency_unit'] = 'null';
}
// 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'])) {
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'];
}
}
$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']);
}
}
// 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)) {
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.");
}
}
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',
$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 {
$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);
}
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;
}
$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';
}
}
$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
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 = [];
$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)));
}
$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']);
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.');
}
//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\'.');
$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.');
}
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.');
}
}
$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');
}
}
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 {
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;
}
];
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',
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;
}
}
}
// 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.');
}
$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',
}
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;
}
$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;
}
// 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));
}
}
}
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'];
}
}
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);
}
// 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'];
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'];
}
}
$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];
}
$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];
}
//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']);
$this->addElement('checkbox', 'toggleSelect', NULL, NULL, ['class' => 'select-rows']);
if (!empty($rows)) {
foreach ($rows as $row) {
- if (CRM_Utils_Array::value('checkbox', $row)) {
+ if (!empty($row['checkbox'])) {
$this->addElement('checkbox', $row['checkbox'], NULL, NULL, ['class' => 'select-row']);
}
}
}
foreach ($optionalParams as $param => $type) {
- if (CRM_Utils_Array::value($param, $_GET)) {
+ if (!empty($_GET[$param])) {
if (!is_array($_GET[$param])) {
$params[$param] = CRM_Utils_Type::validate(CRM_Utils_Array::value($param, $_GET), $type);
}
public static function updateMode() {
$finalResult = [];
- if (CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST) && CRM_Utils_Array::value('entityTable', $_REQUEST)) {
+ if (!empty($_REQUEST['mode']) && !empty($_REQUEST['entityId']) && !empty($_REQUEST['entityTable'])) {
$mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer');
$entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer');
$entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String');
if (!empty($defaults['is_view'])) {
CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.'));
}
- elseif (CRM_Utils_Array::value('is_active', $defaults) == 0) {
+ elseif (empty($defaults['is_active'])) {
CRM_Core_Error::statusBounce(ts('This field is inactive so it will not display on edit form.'));
}
if ($participant->must_wait) {
$participant_status = 'On waitlist';
}
- elseif (CRM_Utils_Array::value('is_pay_later', $params, FALSE)) {
+ elseif (!empty($params['is_pay_later'])) {
$participant_status = 'Pending from pay later';
}
else {
$participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities);
//Check if participants exists for events
foreach ($getRelatedEntities as $key => $value) {
- if (!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $eventID) {
+ if (empty($participantDetails['countByID'][$value['id']]) && $value['id'] != $eventID) {
//CRM_Event_BAO_Event::del($value['id']);
$eventIdsWithNoRegistration[] = $value['id'];
}
$this->assign($v, $params[$v]);
}
}
- elseif (CRM_Utils_Array::value('amount', $params) == 0) {
+ elseif (empty($params['amount'])) {
$this->assign($v, CRM_Utils_Array::value($v, $params));
}
}
$participantCount[$participantNum] = 'participant';
}
$totalTaxAmount += CRM_Utils_Array::value('tax_amount', $record, 0);
- if (CRM_Utils_Array::value('is_primary', $record)) {
+ if (!empty($record['is_primary'])) {
$taxAmount = &$params[$participantNum]['tax_amount'];
}
//lets get additional participant id to cancel.
protected static function isZeroAmount($fields, $form): bool {
$isZeroAmount = FALSE;
if (!empty($fields['priceSetId'])) {
- if (CRM_Utils_Array::value('amount', $fields) == 0) {
+ if (empty($fields['amount'])) {
$isZeroAmount = TRUE;
}
}
"_qf_Register_display=1&qfKey={$this->controller->_key}",
TRUE, NULL, FALSE
);
- if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) {
+ if (!empty($params['additional_participants'])) {
$urlArgs = "_qf_Participant_1_display=1&rfp=1&qfKey={$this->controller->_key}";
}
else {
}
// If registering > 1 participant, give status message
- if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) {
+ if (!empty($params['additional_participants'])) {
$statusMsg = ts('Registration information for participant 1 has been saved.');
CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
}
$realSetting = \Civi::$statics[__CLASS__]['is_acl_enabled'] = Civi::settings()->get('acl_financial_type');
if (!$realSetting) {
$contributeSettings = Civi::settings()->get('contribution_invoice_settings');
- if (CRM_Utils_Array::value('acl_financial_type', $contributeSettings)) {
+ if (!empty($contributeSettings['acl_financial_type'])) {
\Civi::$statics[__CLASS__]['is_acl_enabled'] = TRUE;
}
}
$trxn = CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams);
// @todo - this is just weird & historical & inconsistent - why 2 tracks?
- if (CRM_Utils_Array::value('line_item', $params) && !empty($trxn)) {
+ if (!empty($params['line_item']) && !empty($trxn)) {
foreach ($params['line_item'] as $values) {
foreach ($values as $id => $amount) {
$p = ['id' => $id];
if ($values['financial_account_type_id'] != $financialAccountTypeId) {
$errorMsg['financial_account_type_id'] = ts('Taxable accounts should have Financial Account Type set to Liability.');
}
- if (CRM_Utils_Array::value('tax_rate', $values) == NULL) {
+ if (!isset($values['tax_rate'])) {
$errorMsg['tax_rate'] = ts('Please enter value for tax rate');
}
}
foreach ($params['line_item'] as $priceSetId => $lineItems) {
foreach ($lineItems as $lineIndex => $lineItem) {
$lineMembershipType = CRM_Utils_Array::value('membership_type_id', $lineItem);
- if (CRM_Utils_Array::value('contribution', $params)) {
+ if (!empty($params['contribution'])) {
$params['line_item'][$priceSetId][$lineIndex]['contribution_id'] = $params['contribution']->id;
}
if ($lineMembershipType && $lineMembershipType == CRM_Utils_Array::value('membership_type_id', $params)) {
$params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $membership->id;
$params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_membership';
}
- elseif (!$lineMembershipType && CRM_Utils_Array::value('contribution', $params)) {
+ elseif (!$lineMembershipType && !empty($params['contribution'])) {
$params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $params['contribution']->id;
$params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_contribution';
}
CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'],
$formValues, $lineItem[$this->_priceSetId], NULL, $this->_priceSetId);
- if (CRM_Utils_Array::value('tax_amount', $formValues)) {
+ if (!empty($formValues['tax_amount'])) {
$params['tax_amount'] = $formValues['tax_amount'];
}
$params['total_amount'] = CRM_Utils_Array::value('amount', $formValues);
// if selected membership doesn't match with earlier membership
!in_array($this->_memType, $this->_memTypeSelected)
) {
- if (CRM_Utils_Array::value('is_recur', $inputParams)) {
+ if (!empty($inputParams['is_recur'])) {
CRM_Core_Session::setStatus(ts('Associated recurring contribution cannot be updated on membership type change.', ts('Error'), 'error'));
return;
}
public static function getPledgeStartDate($date, $pledgeBlock) {
$startDate = (array) json_decode($pledgeBlock['pledge_start_date']);
foreach ($startDate as $field => $value) {
- if (!empty($date) && !CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) {
+ if (!empty($date) && empty($pledgeBlock['is_pledge_start_date_editable'])) {
return $date;
}
if (empty($date)) {
}
$form->addElement('select', 'pledge_frequency_unit', NULL, $freqUnits, ['aria-label' => ts('Frequency Units')]);
// CRM-18854
- if (CRM_Utils_Array::value('is_pledge_start_date_visible', $pledgeBlock)) {
- if (CRM_Utils_Array::value('pledge_start_date', $pledgeBlock)) {
+ if (!empty($pledgeBlock['is_pledge_start_date_visible'])) {
+ if (!empty($pledgeBlock['pledge_start_date'])) {
$defaults = array();
$date = (array) json_decode($pledgeBlock['pledge_start_date']);
foreach ($date as $field => $value) {
$form->setDefaults($defaults);
$form->assign('start_date_display', $paymentDate);
$form->assign('start_date_editable', FALSE);
- if (CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) {
+ if (!empty($pledgeBlock['is_pledge_start_date_editable'])) {
$form->assign('start_date_editable', TRUE);
if ($field == 'calendar_month') {
$form->assign('is_date', FALSE);
$params['unit_price'] = 0;
}
}
- if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
+ if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) {
if (empty($params['financial_type_id'])) {
throw new Exception('Mandatory key(s) missing from params array: financial_type_id');
}
$field['options'][$optionValueId]['tax_amount'] = round($taxAmount['tax_amount'], 2);
}
}
- if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) {
+ if (!empty($field['options'][$optionValueId]['tax_rate'])) {
$lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax);
}
$totalPrice += $lineItem[$firstOption['id']]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[key($field['options'])]);
$optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]);
CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, $amount_override);
- if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) {
+ if (!empty($field['options'][$optionValueId]['tax_rate'])) {
$lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax);
if ($amount_override) {
$lineItem[$optionValueId]['line_total'] = $lineItem[$optionValueId]['unit_price'] = CRM_Utils_Rule::cleanMoney($lineItem[$optionValueId]['line_total'] - $lineItem[$optionValueId]['tax_amount']);
$optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]);
CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params));
- if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) {
+ if (!empty($field['options'][$optionValueId]['tax_rate'])) {
$lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax);
}
$totalPrice += $lineItem[$optionValueId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionValueId]);
CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params));
foreach ($params["price_{$id}"] as $optionId => $option) {
- if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionId])) {
+ if (!empty($field['options'][$optionId]['tax_rate'])) {
$lineItem = self::setLineItem($field, $lineItem, $optionId, $totalTax);
}
$totalPrice += $lineItem[$optionId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionId]);
}
if ((is_numeric(CRM_Utils_Array::value('count', $fields)) &&
- CRM_Utils_Array::value('count', $fields) == 0
+ empty($fields['count'])
) &&
(CRM_Utils_Array::value('html_type', $fields) == 'Text')
) {
$contributionOrSoftVal = $this->getElementValue('contribution_or_soft_value');
if ($contributionOrSoftVal[0] == 'contributions_only') {
$groupBySoft = $this->getElementValue('group_bys');
- if (CRM_Utils_Array::value('soft_credit_id', $groupBySoft)) {
+ if (!empty($groupBySoft['soft_credit_id'])) {
$this->setElementError('group_bys', ts('You cannot group by soft credit when displaying contributions only. Please uncheck "Soft Credit" in the Grouping tab.'));
}
}
$rows[$key]['civicrm_event_id'] . ") ";
}
- if (CRM_Utils_Array::value('totalAmount', $rows[$key]) == 0) {
+ if (empty($rows[$key]['totalAmount'])) {
$countEvent = count($rows);
}
public function toApiOutput($apiRequest, $result) {
$reloadMode = NULL;
if ($apiRequest['action'] === 'create' && isset($apiRequest['params'], $apiRequest['params']['options']) && is_array($apiRequest['params']['options']) && isset($apiRequest['params']['options']['reload'])) {
- if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
+ if (empty($result['is_error'])) {
$reloadMode = $apiRequest['params']['options']['reload'];
}
$id = (!empty($apiRequest['params']['sequential'])) ? 0 : $result['id'];
$alternateName = $alternate2;
}
//Include values which prepend 'billing_' to country and state_province.
- if (CRM_Utils_Array::value($alternateName, $params)) {
+ if (!empty($params[$alternateName])) {
if (empty($value) || !is_numeric($value)) {
$value = $params[$alternateName];
}
* Array of matching line_items
*/
function civicrm_api3_line_item_get($params) {
- if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
+ if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) {
CRM_Price_BAO_LineItem::getAPILineItemParams($params);
}
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* @throws API_Exception
*/
function civicrm_api3_line_item_delete($params) {
- if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
+ if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) {
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types, CRM_Core_Action::DELETE);
if (empty($params['financial_type_id'])) {
$params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_LineItem', $params['id'], 'financial_type_id');
$contributions = [];
$params['api.line_item.get'] = ['qty' => ['<>' => 0]];
$isSequential = FALSE;
- if (CRM_Utils_Array::value('sequential', $params)) {
+ if (!empty($params['sequential'])) {
$params['sequential'] = 0;
$isSequential = TRUE;
}
$entity = NULL;
$entityIds = [];
- if (CRM_Utils_Array::value('line_items', $params) && is_array($params['line_items'])) {
+ if (!empty($params['line_items']) && is_array($params['line_items'])) {
$priceSetID = NULL;
CRM_Contribute_BAO_Contribution::checkLineItems($params);
foreach ($params['line_items'] as $lineItems) {
}
$contribution = civicrm_api3('Contribution', 'create', $params);
// add payments
- if ($entity && CRM_Utils_Array::value('id', $contribution)) {
+ if ($entity && !empty($contribution['id'])) {
foreach ($entityIds as $entityId) {
$paymentParams = [
'contribution_id' => $contribution['id'],
function civicrm_api3_payment_get($params) {
$financialTrxn = [];
$limit = '';
- if (isset($params['options']) && CRM_Utils_Array::value('limit', $params['options'])) {
+ if (isset($params['options']) && !empty($params['options']['limit'])) {
$limit = CRM_Utils_Array::value('limit', $params['options']);
}
$params['options']['limit'] = 0;
*/
function civicrm_api3_payment_create($params) {
// Check if it is an update
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$amount = $params['total_amount'];
civicrm_api3('Payment', 'cancel', $params);
$params['total_amount'] = $amount;