* @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;
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)
) {
}
//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
$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;
*/
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');
}
}
- if (!empty($_POST) && CRM_Utils_Array::value('entity', $_POST)) {
+ if (!empty($_POST) && !empty($_POST['entity'])) {
$mappingID = $_POST['entity'][0];
}
elseif ($this->_mappingID) {
// 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']))
)
) {
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');
$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 {
}
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'])) {
$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();
$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');
}
$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'];
//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'];
}
// 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]>";
}
// 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]);
}
//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'];
}
// 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();
$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;
$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',
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']);
'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'])) {
*/
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;
}
$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'];
}
$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 =
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);
}
$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'] ) {
}
}
- 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) {
$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 {
* @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;
$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)
}
// 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'];
}
$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();
*/
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;
}
$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',
$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;
// 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']);
}
$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) {
*/
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;
$value = $individual->$dbName;
// the db has name values
- if ($value && CRM_Utils_Array::value('preserveDBName', $params)) {
+ if ($value && !empty($params['preserveDBName'])) {
$useDBNames[] = $name;
}
}
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';
}
}
$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) {
}
}
- 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)) {
$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();
}
$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,
$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++;
}
// 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"
);
*/
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'];
}
}
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 {
'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);
$hasPrimary[] = $instance;
if (!$primaryID &&
in_array($name, array(
- 'email', 'openid')) &&
- CRM_Utils_Array::value($name, $blockValues)
- ) {
+ 'email', 'openid')) && !empty($blockValues[$name])) {
$primaryID = $blockValues[$name];
}
}
}
}
- 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;
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'];
}
}
//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;
}
$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;
}
}
$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;
}
// 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');
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) {
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'];
}
}
}
- 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.');
}
}
// 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();
}
//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';
$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'])
);
//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 {
$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.');
}
'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);
$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'];
}
}
$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'];
}
}
$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'];
}
}
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]);
}
// 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);
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
// 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;
}
$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)
) {
*/
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;
}
}
- 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) {
$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) {
//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;
}
);
// 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';
$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);
}
$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)) {
* @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();
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;
}
}
}
- if (!$contactTypeAdded && CRM_Utils_Array::value('contact_type', $params)) {
+ if (!$contactTypeAdded && !empty($params['contact_type'])) {
$searchValues[] = array('contact_type', '=', $params['contact_type'], 0, 0);
}
//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), '');
}
// 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
}
// 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'],
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);
// 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... )"
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;
}
}
// 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... )"
$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'],
$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
}
}
- 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) {
$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,
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);
//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();
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');
}
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');
}
/* 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');
}
}
//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,
)))) {
//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;
}
// 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;
}
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']));
//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'],
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( );
//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), '');
}
//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'];
}
);
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(
);
}
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)
)
) {
);
}
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)
)
) {
}
// 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'));
}
// 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');
}
}
// 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;
}
}
$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;
}
}
// 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);
}
* @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;
$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'];
}
$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;
$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',
),
);
}
- 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',
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',
),
);
}
- 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',
}
}
- 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();
$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;
}
}
$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) {
}
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);
$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]];
}
}
$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;
$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;
$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);
// 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);
}
}
}
- 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');
$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'];
}
// 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;
);
// 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;
$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');
//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';
}
$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));
//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'];
}
//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;
$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);
}
//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;
$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;
}
}
}
// 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'];
}
}
// 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
$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);
$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'];
}
}
// 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
}
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'];
}
}
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,
'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),
//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);
}
$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(
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'])) {
// 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;
}
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;
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;
}
$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);
}
}
//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);
}
}
$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
)
) {
}
}
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;
}
}
}
// $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.');
}
}
$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) {
}
}
}
- 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];
}
// 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) == ''
) {
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;
$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'])) {
$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'];
$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']);
$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');
}
}
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;
}
$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);
$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'];
}
}
//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) {
);
$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',
}
}
$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.');
}
}
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;
}
);
}
}
- /* || 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')) {
$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 {
$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',
}
}
}
- 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)) {
}
}
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'])) {
$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.');
}
//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',
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);
}
}
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]));
}
}
}
}
// 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'];
* @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;
// 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.');
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'];
}
//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;
}
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),
* 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');
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 {
}
}
//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) {
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]);
continue;
}
- if ($isPrimary && CRM_Utils_Array::value('is_primary', $value)) {
+ if ($isPrimary && !empty($value['is_primary'])) {
$contactFields['is_primary'] = $value['is_primary'];
$isPrimary = FALSE;
}
$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;
}
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;
}
'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',
$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;
}
$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,
) {
// 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);
}
* @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;
}
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'];
//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],
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;
}
}
// 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;
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];
}
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;
}
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;
$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;
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');
}
}
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) {
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) {
$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) {
}
$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
}
// 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) {
}
$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'];
}
$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();
}
// 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);
}
// 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)
)
) {
$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
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')");
}
}
// 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.');
}
}
$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']);
}
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);
$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;
}
}
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;
// 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');
}
$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);
//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'] . '>';
}
}
//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;
}
//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;
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) {
$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;
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 {
}
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'];
}
}
}
- 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']]);
}
}
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'];
}
}
}
- 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;
}
$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;
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']]);
}
$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
}
$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);
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') {
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);
}
}
// 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);
}
// 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'))
)
// 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']))
$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
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'];
}
$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'],
$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']
);
$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);
$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,
}
//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);
}
// 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';
}
// 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',
//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'
);
//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') . "');");
}
$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
) {
//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]);
}
}
// 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
) {
$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]);
}
$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));
}
}
- 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 &&
}
//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);
}
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']);
}
}
}
- 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 {
//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');
// 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]);
}
$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',
// 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);
}
$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
$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
$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
// 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
) {
}
//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'])) {
$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}"];
}
}
}
$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) {
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;
}
//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.
$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.
$priceSetId = $form->get('priceSetId');
if (!$priceSetId ||
!is_array($priceSet) ||
- empty($priceSet) ||
- !CRM_Utils_Array::value('optionsMaxValueTotal', $priceSet)
- ) {
+ empty($priceSet) || empty($priceSet['optionsMaxValueTotal'])) {
return;
}
$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;
}
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
) {
}
// 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)
) {
//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.");
}
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;
$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))
) {
}
}
- 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.");
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
) {
$this->_expressButtonName . '_x',
$this->_expressButtonName . '_y',
)
- ) &&
- !CRM_Utils_Array::value('is_pay_later', $params) &&
+ ) && empty($params['is_pay_later']) &&
!$this->_allowWaitlist &&
!$this->_requireApproval
) {
// 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);
}
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'])) {
}
}
- 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');
}
$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',
$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);
}
}
- 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 = "
$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)
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');
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));
}
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
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
);
//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'];
}
//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'];
}
$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']);
}
$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];
$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();
);
}
- 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;
}
}
//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')
);
);
//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
);
}
}
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.');
}
}
// 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) {
$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;
}
}
//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);
}
// 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',
$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)) {
//@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)
)
) {
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 {
//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;
}
//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'];
}
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);
}
}
//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 );
// 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;
}
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 {
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.');
}
}
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.');
}
}
// 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'))
)
}
//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',
}
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'];
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;
$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]);
}
}
}
- 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.');
}
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.');
}
}
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 {
$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']);
}
$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;
$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')));
$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);
}
$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'];
}
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;
}
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.');
}
// 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.
* @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;
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);
}
}
'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;
$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]);
}
$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);
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(
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 {
$_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;
}
$_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) {
*/
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.');
$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']) &&
}
// 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'];
}
);
$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)
)) {
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)) {
$errors = array();
// if no values, return
- if (empty($fields) || !CRM_Utils_Array::value('edit', $fields)) {
+ if (empty($fields) || empty($fields['edit'])) {
return TRUE;
}
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;
);
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'
);
$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'],
$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);
// 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";
$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'),
}
$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;
}
$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.
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";
$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);
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;
}
}
//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;
}
}
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;
}
//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') {
}
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;
}
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]),
$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");
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));
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";
}
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;
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;
}
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;
}
$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',
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;
}
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;
}
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;
$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;
}
$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;
}
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;
}
}
- 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();
}
// 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
$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
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')))
)
) {
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);
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}";
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);
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;
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;
}
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
// 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']}";
}
}
$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',
// 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']}";
}
}
{$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
}
//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')
$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();
// 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",
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;
}
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}";
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.");
}
// 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
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;
}
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}";
$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}";
}
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;
}
}
// 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',
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'];
}
}
- 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");
}
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') {
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'])) {
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";
}
$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]),
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);
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}";
$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}";
}
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) {
$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'] . "¤cy_value=" . $row['civicrm_contribution_currency'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
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)) {
$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)) {
$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'] = '_ _ _ _';
}
}
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;
}
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}";
}
}
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);
}
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();
}
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}";
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}";
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;
}
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;
}
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}";
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;
}
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'])) {
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;
}
";
//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)
}
//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')
$this->_select .= ", {$section['dbAlias']} as {$alias}";
}
- if ($applyLimit && !CRM_Utils_Array::value('charts', $this->_params)) {
+ if ($applyLimit && empty($this->_params['charts'])) {
$this->limit();
}
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";
}
}
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);
}
}
// 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',
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;
}
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;
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'])) {
}
}
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 {
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]),
$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']
) {
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;
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;
$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]),
$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;
}
}
}
}
- 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.');
}
}
$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;
}
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;
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(
$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') {
}
// 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.
}
}
- 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();',
// 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-');
$_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;
}
$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;
}
}
}
- 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) {
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;
}
}
// 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);
}
) {
$key = 'domain';
if (
- !$knownTokens ||
- !CRM_Utils_Array::value($key, $knownTokens)
- ) {
+ !$knownTokens || empty($knownTokens[$key])) {
return $str;
}
// 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;
}
// 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;
}
* @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;
}
// 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;
}
//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'));
}
$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']));
}
$list = array();
foreach ($acpref as $value) {
- if ($value && CRM_Utils_Array::value($value, $acOptions)) {
+ if ($value && !empty($acOptions[$value])) {
$list[$value] = $acOptions[$value];
}
}
'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
$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]);
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");
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);
}
*/
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()) {
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;
}
$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]);
}
}
}
- 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']];
}
// 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'])
$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;
}
*/
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'];
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;
}
}
// 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",
}
// 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",
}
// 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",
}
// 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
}
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}";