break;
case 'checkbox':
- $this->_config->$settingName = CRM_Utils_Array::value($settingName, $this->_params) ? 1 : 0;
+ $this->_config->$settingName = !empty($this->_params[$settingName]) ? 1 : 0;
break;
case 'text':
}
if ($surveyID) {
- $reset = CRM_Utils_Array::value('reset', $_GET) ? 'reset=1&' : '';
+ $reset = !empty($_GET['reset']) ? 'reset=1&' : '';
foreach ($tabs as $key => $value) {
if (!isset($tabs[$key]['qfKey'])) {
foreach ($formValues as $id => $values) {
if ($id == 'privacy') {
if (is_array($formValues['privacy'])) {
- $op = CRM_Utils_Array::value('do_not_toggle', $formValues['privacy']) ? '=' : '!=';
+ $op = !empty($formValues['privacy']['do_not_toggle']) ? '=' : '!=';
foreach ($formValues['privacy'] as $key => $value) {
if ($value) {
$params[] = array($key, $op, $value, 0, 0);
continue;
}
list($table, $field) = explode('.', CRM_Utils_Array::value("where_$count", $values));
- $length = CRM_Utils_Array::value("length_$count", $values) ? CRM_Utils_Array::value("length_$count", $values) : NULL;
+ $length = !empty($values["length_$count"]) ? CRM_Utils_Array::value("length_$count", $values) : NULL;
$weight = $values["weight_$count"];
if ($table and $field) {
$ruleDao = new CRM_Dedupe_DAO_Rule();
//fixes for CRM-7985
//only if the relationship has been toggled to enable /disable
if (CRM_Utils_Array::value('is_active', $params) != $this->_enabled) {
- $active = CRM_Utils_Array::value('is_active', $params) ? CRM_Core_Action::ENABLE : CRM_Core_Action::DISABLE;
+ $active = !empty($params['is_active']) ? CRM_Core_Action::ENABLE : CRM_Core_Action::DISABLE;
CRM_Contact_BAO_Relationship::disableEnableRelationship($this->_relationshipId, $active);
}
}
}
elseif ($params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatus)
&& $params['prevContribution']->is_pay_later) {
- $financialTypeID = CRM_Utils_Array::value('financial_type_id', $params) ? $params['financial_type_id'] : $params['prevContribution']->financial_type_id;
+ $financialTypeID = !empty($params['financial_type_id']) ? $params['financial_type_id'] : $params['prevContribution']->financial_type_id;
if ($params['contribution']->contribution_status_id == array_search('Cancelled', $contributionStatus)) {
$params['trxnParams']['to_financial_account_id'] = NULL;
$params['trxnParams']['total_amount'] = - $params['total_amount'];
list($ccDisplayName, $ccEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($values['related_contact']);
$ccMailId = "{$ccDisplayName} <{$ccEmail}>";
- $values['cc_receipt'] = CRM_Utils_Array::value('cc_receipt', $values) ? ($values['cc_receipt'] . ',' . $ccMailId) : $ccMailId;
+ $values['cc_receipt'] = !empty($values['cc_receipt']) ? ($values['cc_receipt'] . ',' . $ccMailId) : $ccMailId;
// reset primary-email in the template
$tplParams['email'] = $ccEmail;
}
elseif ($this->_action & CRM_Core_Action::UPDATE) {
if (CRM_Utils_Array::value('contact_id', $defaults) || CRM_Utils_Array::value('created_id', $defaults)) {
- $contactID = CRM_Utils_Array::value('created_id', $defaults) ? $defaults['created_id'] : $defaults['contact_id'];
+ $contactID = !empty($defaults['created_id']) ? $defaults['created_id'] : $defaults['contact_id'];
$this->assign('created_id', $contactID);
$this->assign('organisationId', $contactID);
}
}
if ($deleteAmountBlk ) {
- $priceField = CRM_Utils_Array::value('price_field_id', $params)?$params['price_field_id']:CRM_Utils_Array::value('price_field_other', $params);
+ $priceField = !empty($params['price_field_id']) ?$params['price_field_id']:CRM_Utils_Array::value('price_field_other', $params);
if ($priceField) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceField, 'price_set_id');
CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
$params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
- $params['is_for_organization'] = CRM_Utils_Array::value('is_organization', $params) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
+ $params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], TRUE);
$params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
}
if ($contribPageId) {
- $reset = CRM_Utils_Array::value('reset', $_GET) ? 'reset=1&' : '';
+ $reset = !empty($_GET['reset']) ? 'reset=1&' : '';
foreach ($tabs as $key => $value) {
if (!isset($tabs[$key]['qfKey'])) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$financialAccountType = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id']);
$accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND label IN ('Premiums Inventory Account is', 'Cost of Sales Account is')");
- $toFinancialAccount = CRM_Utils_Array::value('isDeleted', $params) ? 'Premiums Inventory Account is' : 'Cost of Sales Account is';
- $fromFinancialAccount = CRM_Utils_Array::value('isDeleted', $params) ? 'Cost of Sales Account is': 'Premiums Inventory Account is';
+ $toFinancialAccount = !empty($params['isDeleted']) ? 'Premiums Inventory Account is' : 'Cost of Sales Account is';
+ $fromFinancialAccount = !empty($params['isDeleted']) ? 'Cost of Sales Account is': 'Premiums Inventory Account is';
$accountRelationship = array_flip($accountRelationship);
$financialtrxn = array(
'to_financial_account_id' => $financialAccountType[$accountRelationship[$toFinancialAccount]],
}
return $value;
}
-}
\ No newline at end of file
+}
foreach (array(
'phone', 'email', 'im', 'address') as $loc) {
- $locBlock["{$loc}_id"] = CRM_Utils_Array::value(0, $location["$loc"]) ? $location["$loc"][0]->id : NULL;
- $locBlock["{$loc}_2_id"] = CRM_Utils_Array::value(1, $location["$loc"]) ? $location["$loc"][1]->id : NULL;
+ $locBlock["{$loc}_id"] = !empty($location["$loc"][0]) ? $location["$loc"][0]->id : NULL;
+ $locBlock["{$loc}_2_id"] = !empty($location["$loc"][1]) ? $location["$loc"][1]->id : NULL;
}
$countNull = 0;
continue;
}
- $query = CRM_Utils_Array::value('path_arguments', $item) ? str_replace(',', '&', $item['path_arguments']) . '&reset=1' : 'reset=1';
+ $query = !empty($item['path_arguments']) ? str_replace(',', '&', $item['path_arguments']) . '&reset=1' : 'reset=1';
$value = array(
'title' => $item['title'],
if (array_key_exists($currentPath, $menu) &&
isset($menu[$currentPath]['title'])
) {
- $urlVar = CRM_Utils_Array::value('path_arguments', $menu[$currentPath]) ? '&' . $menu[$currentPath]['path_arguments'] : '';
+ $urlVar = !empty($menu[$currentPath]['path_arguments']) ? '&' . $menu[$currentPath]['path_arguments'] : '';
$crumbs[] = array(
'title' => $menu[$currentPath]['title'],
'url' => CRM_Utils_System::url($currentPath,
}
//keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($val)) {
- $tokens["{contact.$val}"] = CRM_Utils_Array::value($customFieldId, $customFields) ? $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
+ $tokens["{contact.$val}"] = !empty($customFields[$customFieldId]) ? $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
}
else {
// Support legacy token names
}
//keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($val)) {
- $tokens["{participant.$val}"] = CRM_Utils_Array::value($customFieldId, $customFields) ? $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
+ $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ? $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
}
else {
$tokens["{participant.$val}"] = $exportFields[$val]['title'];
}
}
- $discountPriceSets = CRM_Utils_Array::value('discount_price_set', $this->_defaultValues) ? $this->_defaultValues['discount_price_set']: array();
- $discountFieldIDs = CRM_Utils_Array::value('discount_option_id', $this->_defaultValues) ? $this->_defaultValues['discount_option_id']: array();
+ $discountPriceSets = !empty($this->_defaultValues['discount_price_set']) ? $this->_defaultValues['discount_price_set']: array();
+ $discountFieldIDs = !empty($this->_defaultValues['discount_option_id']) ? $this->_defaultValues['discount_option_id']: array();
if (CRM_Utils_Array::value('is_discount', $params) == 1) {
// if there are discounted set of label / values,
// create custom options for them
}
}
else {
- $customPreId = CRM_Utils_Array::value('custom_pre_id', $values) ? $values['custom_pre_id'] : NULL;
+ $customPreId = !empty($values['custom_pre_id']) ? $values['custom_pre_id'] : NULL;
}
//check whether the additional custom pre profile is of type 'Individual' and its subtypes
if (!empty($customPreId)) {
}
}
else {
- $customPostId = CRM_Utils_Array::value('custom_post_id', $values) ? $values['custom_post_id'] : NULL;
+ $customPostId = !empty($values['custom_post_id']) ? $values['custom_post_id'] : NULL;
}
//check whether the additional custom post profile is of type 'Individual' and its subtypes
if (!empty($customPostId)) {
case 'ScheduleReminders':
$class = 'reminder';
- $new = CRM_Utils_Array::value('new', $_GET) ? '&new=1' : '';
+ $new = !empty($_GET['new']) ? '&new=1' : '';
break;
default:
}
if ($eventID) {
- $reset = CRM_Utils_Array::value('reset', $_GET) ? 'reset=1&' : '';
+ $reset = !empty($_GET['reset']) ? 'reset=1&' : '';
foreach ($tabs as $key => $value) {
if (!isset($tabs[$key]['qfKey'])) {
$contributionParams['currency'] = $config->defaultCurrency;
$contributionParams['non_deductible_amount'] = 'null';
- $contributionParams['receipt_date'] = CRM_Utils_Array::value('send_receipt', $params) ? CRM_Utils_Array::value('receive_date', $params) : 'null';
+ $contributionParams['receipt_date'] = !empty($params['send_receipt']) ? CRM_Utils_Array::value('receive_date', $params) : 'null';
$recordContribution = array( 'contact_id', 'financial_type_id',
'payment_instrument_id', 'trxn_id',
$pending = TRUE;
//get the participant statuses.
$pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'");
- $status = CRM_Utils_Array::value('is_pay_later', $value) ? 'Pending from pay later' : 'Pending from incomplete transaction';
+ $status = !empty($value['is_pay_later']) ? 'Pending from pay later' : 'Pending from incomplete transaction';
$value['participant_status_id'] = $value['participant_status'] = array_search($status, $pendingStatuses);
}
}
function getEntityValue($id, $entity, $logDate) {
if (CRM_Utils_Array::value('bracket_info', $this->_logTables[$entity])) {
if (CRM_Utils_Array::value('entity_column', $this->_logTables[$entity]['bracket_info'])) {
- $logTable = CRM_Utils_Array::value('table_name', $this->_logTables[$entity]) ? $this->_logTables[$entity]['table_name'] : $entity;
+ $logTable = !empty($this->_logTables[$entity]['table_name']) ? $this->_logTables[$entity]['table_name'] : $entity;
$sql = "
SELECT {$this->_logTables[$entity]['bracket_info']['entity_column']}
FROM `{$this->loggingDB}`.{$logTable}
}
}
- $index = CRM_Utils_Array::value('is_separate_payment', $memBlockDetails) ? 2 : 1;
+ $index = !empty($memBlockDetails['is_separate_payment']) ? 2 : 1;
if (!CRM_Utils_Array::value($index, $errors)) {
if (isset($membershipParams['onbehalf']) &&
$this->assign('amount', $params['total_amount']);
}
- $params['contribution_status_id'] = CRM_Utils_Array::value('is_recur', $paymentParams) ? 2 : 1;
+ $params['contribution_status_id'] = !empty($paymentParams['is_recur']) ? 2 : 1;
$params['receive_date'] = $now;
$params['invoice_id'] = $this->_params['invoiceID'];
$params['contribution_source'] = ts('%1 Membership Signup: Credit card or direct debit (by %2)',
CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
if (!CRM_Utils_Array::value('id', $editedResults)) {
$fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245));
- $fieldParams['label'] = CRM_Utils_Array::value('new_title', $params) ? $params['new_title'] : ts('Membership');
+ $fieldParams['label'] = !empty($params['new_title']) ? $params['new_title'] : ts('Membership');
if (!CRM_Utils_Array::value('mem_price_field_id', $params)) {
CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', 0, 1, array('price_set_id' => $priceSetID));
}
$fieldParams['is_active'] = 1;
$fieldParams['html_type'] = 'Radio';
- $fieldParams['is_required'] = CRM_Utils_Array::value('is_required', $params) ? 1 : 0;
- $fieldParams['is_display_amounts'] = CRM_Utils_Array::value('display_min_fee', $params) ? 1 : 0;
+ $fieldParams['is_required'] = !empty($params['is_required']) ? 1 : 0;
+ $fieldParams['is_display_amounts'] = !empty($params['display_min_fee']) ? 1 : 0;
$rowCount = 1;
$options = array();
if (CRM_Utils_Array::value('id', $fieldParams)) {
$frequencyUnits = CRM_Core_OptionGroup::values('recur_frequency_units');
foreach ($freqUnitVals as $key => $val) {
if (array_key_exists($val, $frequencyUnits)) {
- $freqUnits[$val] = CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock) ? "{$frequencyUnits[$val]}(s)" : $frequencyUnits[$val];
+ $freqUnits[$val] = !empty($pledgeBlock['is_pledge_interval']) ? "{$frequencyUnits[$val]}(s)" : $frequencyUnits[$val];
}
}
$form->addElement('select', 'pledge_frequency_unit', NULL, $freqUnits);
foreach ($customOption as $opId => $opt) {
if ($field->is_display_amounts) {
- $opt['label'] = CRM_Utils_Array::value('label', $opt) ? $opt['label'] : '';
+ $opt['label'] = !empty($opt['label']) ? $opt['label'] : '';
$opt['label'] = '<span class="crm-price-amount-amount">' . CRM_Utils_Money::format($opt[$valueFieldName]) . '</span> <span class="crm-price-amount-label">' . $opt['label'] . '</span>';
}
$count = CRM_Utils_Array::value('count', $opt, '');
CRM_Utils_Array::value("{$fieldName}_from_time", $this->_params),
CRM_Utils_Array::value("{$fieldName}_to_time", $this->_params)
);
- $from_time_format = CRM_Utils_Array::value("{$fieldName}_from_time", $this->_params) ? 'h' : 'd';
+ $from_time_format = !empty($this->_params["{$fieldName}_from_time"]) ? 'h' : 'd';
$from = CRM_Utils_Date::customFormat($from, null, array($from_time_format));
- $to_time_format = CRM_Utils_Array::value("{$fieldName}_to_time", $this->_params) ? 'h' : 'd';
+ $to_time_format = !empty($this->_params["{$fieldName}_to_time"]) ? 'h' : 'd';
$to = CRM_Utils_Date::customFormat($to, null, array($to_time_format));
if ($from || $to) {
if (CRM_Utils_Array::value('charts', $this->_params)) {
if (CRM_Utils_Array::value('receive_date', $this->_params['group_bys'])) {
- $contrib = CRM_Utils_Array::value('total_amount', $this->_params['fields']) ? TRUE : FALSE;
- $softContrib = CRM_Utils_Array::value('soft_amount', $this->_params['fields']) ? TRUE : FALSE;
+ $contrib = !empty($this->_params['fields']['total_amount']) ? TRUE : FALSE;
+ $softContrib = !empty($this->_params['fields']['soft_amount']) ? TRUE : FALSE;
foreach ($rows as $key => $row) {
if ($row['civicrm_contribution_receive_date_subtotal']) {
$row = array();
foreach ($this->_columnHeaders as $columnKey => $columnValue) {
if (array_key_exists($columnKey, $value)) {
- $row[$columnKey] = CRM_Utils_Array::value($columnKey, $value) ? $value[$columnKey] : '';
+ $row[$columnKey] = !empty($value[$columnKey]) ? $value[$columnKey] : '';
}
}
$rows[] = $row;
foreach ($customOption as $opId => $opt) {
if ($field->is_display_amounts) {
- $opt['label'] = CRM_Utils_Array::value('label', $opt) ? $opt['label'] . ' - ' : '';
+ $opt['label'] = !empty($opt['label']) ? $opt['label'] . ' - ' : '';
$opt['label'] .= CRM_Utils_Money::format($opt[$valueFieldName]);
}
$count = CRM_Utils_Array::value('count', $opt, '');
}
// get the required data.
- $chartTitle = CRM_Utils_Array::value('legend', $params) ? $params['legend'] : ts('Bar Chart');
+ $chartTitle = !empty($params['legend']) ? $params['legend'] : ts('Bar Chart');
$xValues = $yValues = array();
$xValues = array_keys($values[0]);
foreach ($allValues as $label => $value) {
$values[] = new pie_value((double)$value, $label);
}
- $graphTitle = CRM_Utils_Array::value('legend', $params) ? $params['legend'] : ts('Pie Chart');
+ $graphTitle = !empty($params['legend']) ? $params['legend'] : ts('Pie Chart');
//get the currency.
$config = CRM_Core_Config::singleton();
$count++;
}
- $chartTitle = CRM_Utils_Array::value('legend', $params) ? $params['legend'] : ts('Bar Chart');
+ $chartTitle = !empty($params['legend']) ? $params['legend'] : ts('Bar Chart');
//set y axis parameters.
$yMin = 0;
if ($contactID == $session->get('userID')) {
return civicrm_api3_create_error('This contact record is linked to the currently logged in user account - and cannot be deleted.');
}
- $restore = CRM_Utils_Array::value('restore', $params) ? $params['restore'] : FALSE;
- $skipUndelete = CRM_Utils_Array::value('skip_undelete', $params) ? $params['skip_undelete'] : FALSE;
+ $restore = !empty($params['restore']) ? $params['restore'] : FALSE;
+ $skipUndelete = !empty($params['skip_undelete']) ? $params['skip_undelete'] : FALSE;
// CRM-12929
// restrict permanent delete if a contact has financial trxn associated with it
*/
function civicrm_api3_contribution_delete($params) {
- $contributionID = CRM_Utils_Array::value('contribution_id', $params) ? $params['contribution_id'] : $params['id'];
+ $contributionID = !empty($params['contribution_id']) ? $params['contribution_id'] : $params['id'];
if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionID)) {
return civicrm_api3_create_success(array($contributionID => 1));
}
}
}
- $skipPermissions = CRM_Utils_Array::value('check_permissions', $params)? 0 :1;
+ $skipPermissions = !empty($params['check_permissions']) ? 0 :1;
list($entities, $options) = CRM_Contact_BAO_Query::apiQuery(
$newParams,
// check if the script is being used for civimail processing or email to
// activity processing.
- $isCiviMail = CRM_Utils_Array::value('emailtoactivity', $_REQUEST) ? FALSE : TRUE;
+ $isCiviMail = !empty($_REQUEST['emailtoactivity']) ? FALSE : TRUE;
CRM_Utils_Mail_EmailProcessor::process($isCiviMail);
$lock->release();