$dao->entity_id
);
}
- elseif (CRM_Utils_Array::value($dao->object_table, $permissions)) {
+ elseif (!empty($permissions[$dao->object_table])) {
$acl[$dao->entity_id]['object_table'] .= ", {$permissions[$dao->object_table]}";
}
}
* @access public
*/
public static function dataExists(&$params) {
- if (CRM_Utils_Array::value('source_contact_id', $params) ||
+ if (!empty($params['source_contact_id']) ||
CRM_Utils_Array::value('id', $params)
) {
return TRUE;
*/
public static function deleteActivity(&$params, $moveToTrash = FALSE) {
// CRM-9137
- if (CRM_Utils_Array::value('id', $params) && !is_array($params['id'])) {
+ if (!empty($params['id']) && !is_array($params['id'])) {
CRM_Utils_Hook::pre('delete', 'Activity', $params['id'], $params);
}
else {
unset($params['id']);
}
- if (!CRM_Utils_Array::value('status_id', $params) &&
+ if (empty($params['status_id']) &&
!CRM_Utils_Array::value('activity_status_id', $params) &&
!CRM_Utils_Array::value('id', $params)
) {
}
// CRM-9137
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Activity', $activity->id, $params);
}
else {
// attempt to save activity assignment
$resultAssignment = NULL;
- if (CRM_Utils_Array::value('assignee_contact_id', $params)) {
+ if (!empty($params['assignee_contact_id'])) {
$assignmentParams = array('activity_id' => $activityId);
else {
$assignmentParams['contact_id'] = $params['assignee_contact_id'];
$assignmentParams['record_type_id'] = $assigneeID;
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$assignment = new CRM_Activity_BAO_ActivityContact();
$assignment->activity_id = $activityId;
$assignment->record_type_id = $assigneeID;
// attempt to save activity targets
$resultTarget = NULL;
- if (CRM_Utils_Array::value('target_contact_id', $params)) {
+ if (!empty($params['target_contact_id'])) {
$targetParams = array('activity_id' => $activityId);
$resultTarget = array();
else {
$targetParams['contact_id'] = $params['target_contact_id'];
$targetParams['record_type_id'] = $targetID;
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$target = new CRM_Activity_BAO_ActivityContact();
$target->activity_id = $activityId;
$target->record_type_id = $targetID;
// write to changelog before transaction is committed/rolled
// back (and prepare status to display)
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$logMsg = "Activity (id: {$result->id} ) updated with ";
}
else {
$msgs[] = "source={$params['source_contact_id']}";
}
- if (CRM_Utils_Array::value('target_contact_id', $params)) {
+ if (!empty($params['target_contact_id'])) {
if (is_array($params['target_contact_id']) && !CRM_Utils_array::crmIsEmptyArray($params['target_contact_id'])) {
$msgs[] = "target=" . implode(',', $params['target_contact_id']);
// take only first target
self::logActivityAction($result, $logMsg);
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_activity', $result->id);
}
$transaction->commit();
- if (!CRM_Utils_Array::value('skipRecentView', $params)) {
+ if (empty($params['skipRecentView'])) {
$recentOther = array();
- if (CRM_Utils_Array::value('case_id', $params)) {
+ if (!empty($params['case_id'])) {
$caseContactID = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseContact', $params['case_id'], 'contact_id', 'case_id');
$url = CRM_Utils_System::url('civicrm/case/activity/view',
"reset=1&aid={$activity->id}&cid={$caseContactID}&caseID={$params['case_id']}&context=home"
}
$title = $title . $recentContactDisplay;
- if (CRM_Utils_Array::value($activity->activity_type_id, $activityTypes)) {
+ if (!empty($activityTypes[$activity->activity_type_id])) {
$title .= ' (' . $activityTypes[$activity->activity_type_id] . ')';
}
// reset the group contact cache since smart groups might be affected due to this
CRM_Contact_BAO_GroupContactCache::remove();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Activity', $activity->id, $activity);
}
else {
$values[$activityID]['campaign'] = $allCampaigns[$dao->campaign_id];
}
- if (!CRM_Utils_Array::value('assignee_contact_name', $values[$activityID])) {
+ if (empty($values[$activityID]['assignee_contact_name'])) {
$values[$activityID]['assignee_contact_name'] = array();
}
- if (!CRM_Utils_Array::value('target_contact_name', $values[$activityID])) {
+ if (empty($values[$activityID]['target_contact_name'])) {
$values[$activityID]['target_contact_name'] = array();
}
$components = array();
$compInfo = CRM_Core_Component::getEnabledComponents();
foreach ($compInfo as $compObj) {
- if (CRM_Utils_Array::value('showActivitiesInCore', $compObj->info)) {
+ if (!empty($compObj->info['showActivitiesInCore'])) {
if ($compObj->info['name'] == 'CiviCampaign') {
$componentPermission = "administer {$compObj->name}";
}
$status = CRM_Event_PseudoConstant::participantStatus();
$subject = $event[$activity->event_id];
- if (CRM_Utils_Array::value($activity->role_id, $roles)) {
+ if (!empty($roles[$activity->role_id])) {
$subject .= ' - ' . $roles[$activity->role_id];
}
- if (CRM_Utils_Array::value($activity->status_id, $status)) {
+ if (!empty($status[$activity->status_id])) {
$subject .= ' - ' . $status[$activity->status_id];
}
$date = date('YmdHis');
$followupParams['assignee_contact_id'] = CRM_Utils_Array::value('followup_assignee_contact_id', $params);
//create target contact for followup
- if (CRM_Utils_Array::value('target_contact_id', $params)) {
+ if (!empty($params['target_contact_id'])) {
$followupParams['target_contact_id'] = $params['target_contact_id'];
}
'civicrm/mailing/report/event',
"mid={$values['source_record_id']}&reset=1&event=queue&cid={$params['contact_id']}&context=activitySelector");
}
- elseif (CRM_Utils_Array::value('recipients', $values)) {
+ elseif (!empty($values['recipients'])) {
$contactActivities[$activityId]['target_contact'] = $values['recipients'];
}
elseif (!$values['target_contact_name']) {
// build links
$contactActivities[$activityId]['links'] = '';
$accessMailingReport = FALSE;
- if (CRM_Utils_Array::value('mailingId', $values)) {
+ if (!empty($values['mailingId'])) {
$accessMailingReport = TRUE;
}
* @access public
*/
static function select(&$query) {
- if (CRM_Utils_Array::value('activity_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_id'])) {
$query->_select['activity_id'] = "civicrm_activity.id as activity_id";
$query->_element['activity_id'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('activity_type_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_type_id'])) {
$query->_select['activity_type_id'] = "activity_type.id as activity_type_id";
$query->_element['activity_type_id'] = 1;
$query->_tables['civicrm_activity'] = 1;
$query->_whereTables['activity_type'] = 1;
}
- if (CRM_Utils_Array::value('activity_type', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_type'])) {
$query->_select['activity_type'] = "activity_type.label as activity_type";
$query->_element['activity_type'] = 1;
$query->_tables['civicrm_activity'] = 1;
$query->_whereTables['activity_type'] = 1;
}
- if (CRM_Utils_Array::value('activity_subject', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_subject'])) {
$query->_select['activity_subject'] = "civicrm_activity.subject as activity_subject";
$query->_element['activity_subject'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('activity_date_time', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_date_time'])) {
$query->_select['activity_date_time'] = "civicrm_activity.activity_date_time as activity_date_time";
$query->_element['activity_date_time'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('activity_status_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_status_id'])) {
$query->_select['activity_status_id'] = "activity_status.value as activity_status_id";
$query->_element['activity_status_id'] = 1;
$query->_tables['civicrm_activity'] = 1;
$query->_whereTables['activity_status'] = 1;
}
- if (CRM_Utils_Array::value('activity_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_status'])) {
$query->_select['activity_status'] = "activity_status.label as activity_status";
$query->_element['activity_status'] = 1;
$query->_tables['civicrm_activity'] = 1;
$query->_whereTables['activity_status'] = 1;
}
- if (CRM_Utils_Array::value('activity_duration', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_duration'])) {
$query->_select['activity_duration'] = "civicrm_activity.duration as activity_duration";
$query->_element['activity_duration'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('activity_location', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_location'])) {
$query->_select['activity_location'] = "civicrm_activity.location as activity_location";
$query->_element['activity_location'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('activity_details', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_details'])) {
$query->_select['activity_details'] = "civicrm_activity.details as activity_details";
$query->_element['activity_details'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('source_record_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['source_record_id'])) {
$query->_select['source_record_id'] = "civicrm_activity.source_record_id as source_record_id";
$query->_element['source_record_id'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('activity_is_test', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_is_test'])) {
$query->_select['activity_is_test'] = "civicrm_activity.is_test as activity_is_test";
$query->_element['activity_is_test'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('activity_campaign_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_campaign_id'])) {
$query->_select['activity_campaign_id'] = 'civicrm_activity.campaign_id as activity_campaign_id';
$query->_element['activity_campaign_id'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('activity_engagement_level', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_engagement_level'])) {
$query->_select['activity_engagement_level'] = 'civicrm_activity.engagement_level as activity_engagement_level';
$query->_element['activity_engagement_level'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
- if (CRM_Utils_Array::value('source_contact', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['source_contact'])) {
$query->_select['source_contact'] = 'source_contact.sort_name as source_contact';
$query->_element['source_contact'] = 1;
$query->_tables['source_contact'] = $query->_whereTables['source_contact'] = 1;
}
- if (CRM_Utils_Array::value('activity_result', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['activity_result'])) {
$query->_select['activity_result'] = 'civicrm_activity.result as activity_result';
$query->_element['result'] = 1;
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
// we need to set it in the session for the below code to work
// CRM-3014
//need to assign custom data subtype to the template
}
}
- if (!CRM_Utils_Array::value('activity_date_time', $defaults)) {
+ if (empty($defaults['activity_date_time'])) {
list($defaults['activity_date_time'], $defaults['activity_date_time_time']) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
}
elseif ($this->_action & CRM_Core_Action::UPDATE) {
$className = "CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}";
$defaults += $className::setDefaultValues($this);
}
- if (!CRM_Utils_Array::value('priority_id', $defaults)) {
+ if (empty($defaults['priority_id'])) {
$priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id');
$defaults['priority_id'] = array_search('Normal', $priority);
}
- if (!CRM_Utils_Array::value('status_id', $defaults)) {
+ if (empty($defaults['status_id'])) {
$defaults['status_id'] = CRM_Core_OptionGroup::getDefaultValue('activity_status');
}
return $defaults;
}
foreach ($this->_fields as $field => $values) {
- if (CRM_Utils_Array::value($field, $this->_fields)) {
+ if (!empty($this->_fields[$field])) {
$attribute = NULL;
- if (CRM_Utils_Array::value('attributes', $values)) {
+ if (!empty($values['attributes'])) {
$attribute = $values['attributes'];
}
$required = FALSE;
- if (CRM_Utils_Array::value('required', $values)) {
+ if (!empty($values['required'])) {
$required = TRUE;
}
if ($values['type'] == 'wysiwyg') {
$errors['status_id'] = ts('You cannot record scheduled SMS activity.');
}
- if (CRM_Utils_Array::value('followup_activity_type_id', $fields) && !CRM_Utils_Array::value('followup_date', $fields)) {
+ if (!empty($fields['followup_activity_type_id']) && !CRM_Utils_Array::value('followup_date', $fields)) {
$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
}
//set activity type id
- if (!CRM_Utils_Array::value('activity_type_id', $params)) {
+ if (empty($params['activity_type_id'])) {
$params['activity_type_id'] = $this->_activityTypeId;
}
- if (CRM_Utils_Array::value('hidden_custom', $params) &&
+ if (!empty($params['hidden_custom']) &&
!isset($params['custom'])
) {
$customFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE,
}
// assigning formated value to related variable
- if (CRM_Utils_Array::value('assignee_contact_id', $params)) {
+ if (!empty($params['assignee_contact_id'])) {
$params['assignee_contact_id'] = explode(',', $params['assignee_contact_id']);
}
else {
$params['assignee_contact_id'] = array();
}
// civicrm-10043 - 14/12/13
- if ( CRM_Utils_Array::value( 'followup_assignee_contact_id', $params ) ) {
+ if (!empty($params['followup_assignee_contact_id'])) {
$params['followup_assignee_contact_id'] = explode( ',', $params['followup_assignee_contact_id'] );
}
else {
}
$activity = array();
- if (CRM_Utils_Array::value('is_multi_activity', $params) &&
+ if (!empty($params['is_multi_activity']) &&
!CRM_Utils_Array::crmIsEmptyArray($params['target_contact_id'])
) {
$targetContacts = $params['target_contact_id'];
$this->endPostProcess($params, $activity);
// CRM-9590
- if (CRM_Utils_Array::value('is_multi_activity', $params)) {
+ if (!empty($params['is_multi_activity'])) {
$this->_activityIds[] = $activity->id;
}
else {
// create follow up activity if needed
$followupStatus = '';
$followupActivity = NULL;
- if (CRM_Utils_Array::value('followup_activity_type_id', $params)) {
+ if (!empty($params['followup_activity_type_id'])) {
$followupActivity = CRM_Activity_BAO_Activity::createFollowupActivity($activity->id, $params);
$followupStatus = ts('A followup activity has been scheduled.');
}
// set status message
$subject = '';
- if (CRM_Utils_Array::value('subject', $params)) {
+ if (!empty($params['subject'])) {
$subject = "'" . $params['subject'] . "'";
}
$this->assign('activityTypeName', $activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
- if (CRM_Utils_Array::value('mailingId', $defaults)) {
+ if (!empty($defaults['mailingId'])) {
$this->_mailing_id = CRM_Utils_Array::value('source_record_id', $defaults);
$mailingReport = CRM_Mailing_BAO_Mailing::report($this->_mailing_id, TRUE);
CRM_Mailing_BAO_Mailing::getMailingContent($mailingReport, $this);
$activityTags = $tagList = array();
// check if contact tags exists
- if (CRM_Utils_Array::value('tag', $params)) {
+ if (!empty($params['tag'])) {
$activityTags = $params['tag'];
}
// check if tags are selected from taglists
- if (CRM_Utils_Array::value('activity_taglist', $params)) {
+ if (!empty($params['activity_taglist'])) {
foreach ($params['activity_taglist'] as $val) {
if ($val) {
if (is_numeric($val)) {
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $customFields);
- if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) {
+ if (!empty($customValue['extends_entity_column_value'])) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$customValue['extends_entity_column_value']
);
}
- if (CRM_Utils_Array::value($typeId, $entityColumnValue) ||
+ if (!empty($entityColumnValue[$typeId]) ||
CRM_Utils_System::isNull($entityColumnValue[$typeId])
) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $activityId);
$value['activity_date_time'] = CRM_Utils_Date::processDate($value['activity_date_time'], $value['activity_date_time_time']);
}
- if (CRM_Utils_Array::value('activity_status_id', $value)) {
+ if (!empty($value['activity_status_id'])) {
$value['status_id'] = $value['activity_status_id'];
}
- if (CRM_Utils_Array::value('activity_details', $value)) {
+ if (!empty($value['activity_details'])) {
$value['details'] = $value['activity_details'];
}
- if (CRM_Utils_Array::value('activity_duration', $value)) {
+ if (!empty($value['activity_duration'])) {
$value['duration'] = $value['activity_duration'];
}
- if (CRM_Utils_Array::value('activity_location', $value)) {
+ if (!empty($value['activity_location'])) {
$value['location'] = $value['activity_location'];
}
- if (CRM_Utils_Array::value('activity_subject', $value)) {
+ if (!empty($value['activity_subject'])) {
$value['subject'] = $value['activity_subject'];
}
$activityId = civicrm_api('activity', 'update', $value);
// add custom field values
- if (CRM_Utils_Array::value('custom', $value) &&
+ if (!empty($value['custom']) &&
is_array($value['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($value['custom'], 'civicrm_activity', $activityId['id']);
$activityTags = $tagList = array();
// check if contact tags exists
- if (CRM_Utils_Array::value('tag', $params)) {
+ if (!empty($params['tag'])) {
$activityTags = $params['tag'];
}
// check if tags are selected from taglists
- if (CRM_Utils_Array::value('activity_taglist', $params)) {
+ if (!empty($params['activity_taglist'])) {
foreach ($params['activity_taglist'] as $val) {
if ($val) {
if (is_numeric($val)) {
}
}
- if (CRM_Utils_Array::value('saveMapping', $fields)) {
+ if (!empty($fields['saveMapping'])) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
$this->set('mapper', $mapper);
// store mapping Id to display it in the preview page
- if (CRM_Utils_Array::value('mappingId', $params)) {
+ if (!empty($params['mappingId'])) {
$this->set('loadMappingId', $params['mappingId']);
}
//Updating Mapping Records
- if (CRM_Utils_Array::value('updateMapping', $params)) {
+ if (!empty($params['updateMapping'])) {
$mappingFields = new CRM_Core_DAO_MappingField();
$mappingFields->mapping_id = $params['mappingId'];
}
//Saving Mapping Details and Records
- if (CRM_Utils_Array::value('saveMapping', $params)) {
+ if (!empty($params['saveMapping'])) {
$mappingParams = array(
'name' => $params['saveMappingName'],
'description' => $params['saveMappingDesc'],
foreach ($mapper as $key => $value) {
$mapperKeys[$key] = $mapper[$key][0];
- if (CRM_Utils_Array::value(1, $mapper[$key]) && is_numeric($mapper[$key][1])) {
+ if (!empty($mapper[$key][1]) && is_numeric($mapper[$key][1])) {
$mapperLocType[$key] = $mapper[$key][1];
}
else {
$mapperLocType[$key] = NULL;
}
- if (CRM_Utils_Array::value(2, $mapper[$key]) && (!is_numeric($mapper[$key][2]))) {
+ if (!empty($mapper[$key][2]) && (!is_numeric($mapper[$key][2]))) {
$mapperPhoneType[$key] = $mapper[$key][2];
}
else {
$params['target_contact_id'] = $cid;
$params['version'] = 3;
$newActivity = civicrm_api('activity', 'create', $params);
- if (CRM_Utils_Array::value('is_error', $newActivity)) {
+ if (!empty($newActivity['is_error'])) {
array_unshift($values, $newActivity['error_message']);
return CRM_Import_Parser::ERROR;
}
}
}
- if (CRM_Utils_Array::value('external_identifier', $params)) {
+ if (!empty($params['external_identifier'])) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
}
}
}
else {
- if (CRM_Utils_Array::value('external_identifier', $params)) {
+ if (!empty($params['external_identifier'])) {
$targetContactId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
$params['external_identifier'], 'id', 'external_identifier'
);
- if (CRM_Utils_Array::value('target_contact_id', $params) &&
+ if (!empty($params['target_contact_id']) &&
$params['target_contact_id'] != $targetContactId
) {
array_unshift($values, 'Mismatch of External identifier :' . $params['external_identifier'] . ' and Contact Id:' . $params['target_contact_id']);
$params['version'] = 3;
$newActivity = civicrm_api('activity', 'create', $params);
- if (CRM_Utils_Array::value('is_error', $newActivity)) {
+ if (!empty($newActivity['is_error'])) {
array_unshift($values, $newActivity['error_message']);
return CRM_Import_Parser::ERROR;
}
foreach ($caseRelationships as $key => $value) {
//calculate roles that don't have relationships
- if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) {
+ if (!empty($caseRoles[$value['relation_type']])) {
//keep naming from careRoles array
$caseRelationships[$key]['relation'] = $caseRoles[$value['relation_type']];
unset($caseRoles[$value['relation_type']]);
//CRM-3553
$accessMailingReport = FALSE;
- if (CRM_Utils_Array::value('mailingId', $row)) {
+ if (!empty($row['mailingId'])) {
$accessMailingReport = TRUE;
}
function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
- if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
+ if (!empty($_POST['_qf_' . $formName . '_next_print'])) {
$value = CRM_Activity_Task::PRINT_ACTIVITIES;
}
else {
// its ok if there is no element called is_active
$defaults['is_active'] = ($this->_id) ? CRM_Utils_Array::value('is_active', $defaults) : 1;
- if (CRM_Utils_Array::value('parent_id', $defaults)) {
+ if (!empty($defaults['parent_id'])) {
$this->assign('is_parent', TRUE);
}
return $defaults;
// CRM-10708
// job entity thats shipped with core is all lower case.
// this makes sure camel casing is followed for proper working of default population.
- if (CRM_Utils_Array::value('api_entity', $defaults)) {
+ if (!empty($defaults['api_entity'])) {
$defaults['api_entity'] = ucfirst($defaults['api_entity']);
}
public function setDefaultValues() {
$defaults = $this->_values;
- if (!CRM_Utils_Array::value('pdf_format_id', $defaults)) {
+ if (empty($defaults['pdf_format_id'])) {
$defaults['pdf_format_id'] = 'null';
}
public function setDefaultValues() {
$defaults = $this->_defaults;
if (isset($this->_id)) {
- if (CRM_Utils_Array::value('permission', $this->_defaults)) {
+ if (!empty($this->_defaults['permission'])) {
foreach (explode(',', $this->_defaults['permission']) as $value) {
$components[$value] = $value;
}
$element->freeze();
}
}
- if (CRM_Utils_Array::value('is_reserved', $this->_values)) {
+ if (!empty($this->_values['is_reserved'])) {
$this->freeze(array('name', 'is_active'));
}
}
function setDefaultValues() {
$defaults = array();
$defaults = parent::setDefaultValues();
- if (!CRM_Utils_Array::value('weight', $defaults)) {
+ if (empty($defaults['weight'])) {
$query = "SELECT max( `weight` ) as weight FROM `civicrm_option_value` where option_group_id=" . $this->_gid;
$dao = new CRM_Core_DAO();
$dao->query($query);
}
//set defaultGreeting option in params to save default value as per contactOption-defaultValue mapping
- if (CRM_Utils_Array::value('contactOptions', $params)) {
+ if (!empty($params['contactOptions'])) {
$params['filter'] = CRM_Utils_Array::value('contactOptions', $params);
$params['defaultGreeting'] = 1;
}
$optionValue = CRM_Core_BAO_OptionValue::add($params, $ids);
// CRM-11516
- if (CRM_Utils_Array::value('financial_account_id', $params)) {
+ if (!empty($params['financial_account_id'])) {
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
$params = array(
'entity_table' => 'civicrm_option_value',
}
$formName = explode('"', $fields['label']);
- if (!CRM_Utils_Array::value(1, $formName) || count($formName) != 3) {
+ if (empty($formName[1]) || count($formName) != 3) {
$errors['label'] = ts('Please follow the proper format for From Email Address');
}
}
$optionValue = CRM_Core_OptionValue::addOptionValue($params, $groupParams, $this->_action, $this->_id);
// CRM-11516
- if (CRM_Utils_Array::value('financial_account_id', $params)) {
+ if (!empty($params['financial_account_id'])) {
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
$params = array(
'entity_table' => 'civicrm_option_value',
function setDefaultValues() {
$defaults = parent::setDefaultValues();
- if (!CRM_Utils_Array::value('weight', $defaults)) {
+ if (empty($defaults['weight'])) {
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Event_DAO_ParticipantStatusType');
}
$this->_isReserved = CRM_Utils_Array::value('is_reserved', $defaults);
$this->add('text', "test_{$field['name']}",
$field['label'], $attributes[$field['name']]
);
- if (CRM_Utils_Array::value('rule', $field)) {
+ if (!empty($field['rule'])) {
$this->addRule($field['name'], $field['msg'], $field['rule']);
$this->addRule("test_{$field['name']}", $field['msg'], $field['rule']);
}
$values = $this->controller->exportValues($this->_name);
$domainID = CRM_Core_Config::domainID();
- if (CRM_Utils_Array::value('is_default', $values)) {
+ if (!empty($values['is_default'])) {
$query = "UPDATE civicrm_payment_processor SET is_default = 0 WHERE domain_id = $domainID";
CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}
$this->add('text', $field['name'],
$field['label'], $attributes['name'], $required
);
- if (CRM_Utils_Array::value('rule', $field)) {
+ if (!empty($field['rule'])) {
$this->addRule($field['name'], $field['msg'], $field['rule']);
}
}
$values = $this->controller->exportValues($this->_name);
- if (CRM_Utils_Array::value('is_default', $values)) {
+ if (!empty($values['is_default'])) {
$query = "
UPDATE civicrm_payment_processor SET is_default = 0";
CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
foreach ($groupValues as $settingName => $fieldValue) {
switch ($fieldValue['html_type']) {
case 'checkboxes':
- if (CRM_Utils_Array::value($settingName, $this->_params) &&
+ if (!empty($this->_params[$settingName]) &&
is_array($this->_params[$settingName])
) {
$this->_config->$settingName = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
$this->_params = $this->controller->exportValues($this->_name);
- if (CRM_Utils_Array::value('contact_edit_preferences', $this->_params)) {
+ if (!empty($this->_params['contact_edit_preferences'])) {
$preferenceWeights = explode(',', $this->_params['contact_edit_preferences']);
foreach ($preferenceWeights as $key => $val) {
if (!$val) {
// check if mailing tab is enabled, if not prompt user to enable the tab if "write_activity_record" is disabled
$params = $this->controller->exportValues($this->_name);
- if (!CRM_Utils_Array::value('write_activity_record', $params)) {
+ if (empty($params['write_activity_record'])) {
$existingViewOptions = CRM_Core_BAO_Setting::getItem(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_view_options'
$baoName = $this->_BAOName;
$baoName::retrieve($params, $defaults);
$defaults['contact_types_a'] = CRM_Utils_Array::value('contact_type_a', $defaults);
- if (CRM_Utils_Array::value('contact_sub_type_a', $defaults)) {
+ if (!empty($defaults['contact_sub_type_a'])) {
$defaults['contact_types_a'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_a'];
}
$defaults['contact_types_b'] = $defaults['contact_type_b'];
- if (CRM_Utils_Array::value('contact_sub_type_b', $defaults)) {
+ if (!empty($defaults['contact_sub_type_b'])) {
$defaults['contact_types_b'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_b'];
}
return $defaults;
FALSE, array('onClick' => "showHideByValue('recipient','manual','recipientManual','table-row','select',false); showHideByValue('recipient','group','recipientGroup','table-row','select',false);")
);
- if (CRM_Utils_Array::value('is_recipient_listing', $_POST)) {
+ if (!empty($_POST['is_recipient_listing'])) {
$recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($_POST['entity'][0], $_POST['recipient']);
}
- elseif (CRM_Utils_Array::value('recipient_listing', $this->_values)) {
+ elseif (!empty($this->_values['recipient_listing'])) {
$recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($this->_values['mapping_id'], $this->_values['recipient']);
}
$recipientListing = $this->add('select', 'recipient_listing', ts('Recipient Listing'), $recipientListingOptions);
$errors['entity'] = ts('Please select appropriate value');
}
- if (CRM_Utils_Array::value('is_active', $fields) &&
+ if (!empty($fields['is_active']) &&
CRM_Utils_System::isNull($fields['subject'])
) {
$errors['subject'] = ts('Subject is a required field.');
$defaults['text_message'] = CRM_Utils_Array::value('body_text', $defaults);
$defaults['html_message'] = CRM_Utils_Array::value('body_html', $defaults);
$defaults['template'] = CRM_Utils_Array::value('msg_template_id', $defaults);
- if (CRM_Utils_Array::value('group_id', $defaults)) {
+ if (!empty($defaults['group_id'])) {
$defaults['recipient'] = 'group';
}
- elseif (CRM_Utils_Array::value('recipient_manual', $defaults)) {
+ elseif (!empty($defaults['recipient_manual'])) {
$defaults['recipient'] = 'manual';
$recipients = array();
foreach (explode(',', $defaults['recipient_manual']) as $cid) {
$composeParams = array();
foreach ($composeFields as $key) {
- if (CRM_Utils_Array::value($key, $values)) {
+ if (!empty($values[$key])) {
$composeParams[$key] = $values[$key];
}
}
- if (CRM_Utils_Array::value('updateTemplate', $composeParams)) {
+ if (!empty($composeParams['updateTemplate'])) {
$templateParams = array(
'msg_text' => $params['body_text'],
'msg_html' => $params['body_html'],
$msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
}
- if (CRM_Utils_Array::value('saveTemplate', $composeParams)) {
+ if (!empty($composeParams['saveTemplate'])) {
$templateParams = array(
'msg_text' => $params['body_text'],
'msg_html' => $params['body_html'],
public function commonProcess(&$params) {
// save autocomplete search options
- if (CRM_Utils_Array::value('autocompleteContactSearch', $params)) {
+ if (!empty($params['autocompleteContactSearch'])) {
$value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
array_keys($params['autocompleteContactSearch'])
) . CRM_Core_DAO::VALUE_SEPARATOR;
}
// save autocomplete contact reference options
- if (CRM_Utils_Array::value('autocompleteContactReference', $params)) {
+ if (!empty($params['autocompleteContactReference'])) {
$value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
array_keys($params['autocompleteContactReference'])
) . CRM_Core_DAO::VALUE_SEPARATOR;
}
// save checksum timeout
- if (CRM_Utils_Array::value('checksumTimeout', $params)) {
+ if (!empty($params['checksumTimeout'])) {
CRM_Core_BAO_Setting::setItem($params['checksumTimeout'],
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'checksum_timeout'
}
// update time for date formats when global time is changed
- if (CRM_Utils_Array::value('timeInputFormat', $params)) {
+ if (!empty($params['timeInputFormat'])) {
$query = "
UPDATE civicrm_preferences_date
SET time_format = %1
unset($values['currencyLimit']);
// make the site multi-lang if requested
- if (CRM_Utils_Array::value('makeMultilingual', $values)) {
+ if (!empty($values['makeMultilingual'])) {
CRM_Core_I18n_Schema::makeMultilingual($values['lcMessages']);
$values['languageLimit'][$values['lcMessages']] = 1;
// make the site single-lang if requested
}
- elseif (CRM_Utils_Array::value('makeSinglelingual', $values)) {
+ elseif (!empty($values['makeSinglelingual'])) {
CRM_Core_I18n_Schema::makeSinglelingual($values['lcMessages']);
$values['languageLimit'] = '';
}
*/
static function formRule($fields) {
if ($fields['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_SMTP) {
- if (!CRM_Utils_Array::value('smtpServer', $fields)) {
+ if (empty($fields['smtpServer'])) {
$errors['smtpServer'] = 'SMTP Server name is a required field.';
}
- if (!CRM_Utils_Array::value('smtpPort', $fields)) {
+ if (empty($fields['smtpPort'])) {
$errors['smtpPort'] = 'SMTP Port is a required field.';
}
- if (CRM_Utils_Array::value('smtpAuth', $fields)) {
- if (!CRM_Utils_Array::value('smtpUsername', $fields)) {
+ if (!empty($fields['smtpAuth'])) {
+ if (empty($fields['smtpUsername'])) {
$errors['smtpUsername'] = 'If your SMTP server requires authentication please provide a valid user name.';
}
- if (!CRM_Utils_Array::value('smtpPassword', $fields)) {
+ if (empty($fields['smtpPassword'])) {
$errors['smtpPassword'] = 'If your SMTP server requires authentication, please provide a password.';
}
}
}
function postProcess() {
- if (CRM_Utils_Array::value('_qf_UpdateConfigBackend_next_cleanup', $_POST)) {
+ if (!empty($_POST['_qf_UpdateConfigBackend_next_cleanup'])) {
$config = CRM_Core_Config::singleton();
if ($this->_soInstance) {
$soInstances = array($this->_soInstance);
}
- elseif (CRM_Utils_Array::value('old', $_POST)) {
+ elseif (!empty($_POST['old'])) {
$soInstances = $stringOverrideInstances = array_keys($_POST['old']);
}
elseif (!empty($this->_defaults) && is_array($this->_defaults)) {
$enabled['exactMatch'] = $enabled['wildcardMatch'] = $disabled['exactMatch'] = $disabled['wildcardMatch'] = array();
for ($i = 1; $i <= $this->_numStrings; $i++) {
- if (CRM_Utils_Array::value($i, $params['new']) &&
+ if (!empty($params['new'][$i]) &&
CRM_Utils_Array::value($i, $params['old'])
) {
if (isset($params['enabled']) && CRM_Utils_Array::value($i, $params['enabled'])) {
- if (CRM_Utils_Array::value('cb', $params) &&
+ if (!empty($params['cb']) &&
CRM_Utils_Array::value($i, $params['cb'])
) {
$enabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
$rows = CRM_Contact_BAO_ContactType::contactTypeInfo(TRUE);
foreach ($rows as $key => $value) {
$mask = NULL;
- if (CRM_Utils_Array::value('is_reserved', $value)) {
+ if (!empty($value['is_reserved'])) {
$mask = CRM_Core_Action::UPDATE;
}
else {
$mask -= CRM_Core_Action::DELETE - 2;
- if (CRM_Utils_Array::value('is_active', $value)) {
+ if (!empty($value['is_active'])) {
$mask -= CRM_Core_Action::ENABLE;
}
else {
// Add action links to each of the Label Formats
foreach ($labelFormatList as & $format) {
$action = array_sum(array_keys($this->links()));
- if (CRM_Utils_Array::value('is_reserved', $format)) {
+ if (!empty($format['is_reserved'])) {
$action -= CRM_Core_Action::DELETE;
}
static function formatLabel(&$row, &$layout) {
$formattedRow = array('labelFormat' => $layout['label_format_name']);
- if (CRM_Utils_Array::value('rowElements', $layout['data'])) {
+ if (!empty($layout['data']['rowElements'])) {
foreach ($layout['data']['rowElements'] as $key => $element) {
$value = '';
if ($element) {
}
}
- if (CRM_Utils_Array::value('image_1', $layout['data'])) {
+ if (!empty($layout['data']['image_1'])) {
$formattedRow['image_1'] = $layout['data']['image_1'];
}
- if (CRM_Utils_Array::value('width_image_1', $layout['data'])) {
+ if (!empty($layout['data']['width_image_1'])) {
$formattedRow['width_image_1'] = $layout['data']['width_image_1'];
}
- if (CRM_Utils_Array::value('height_image_1', $layout['data'])) {
+ if (!empty($layout['data']['height_image_1'])) {
$formattedRow['height_image_1'] = $layout['data']['height_image_1'];
}
- if (CRM_Utils_Array::value('image_2', $layout['data'])) {
+ if (!empty($layout['data']['image_2'])) {
$formattedRow['image_2'] = $layout['data']['image_2'];
}
- if (CRM_Utils_Array::value('width_image_2', $layout['data'])) {
+ if (!empty($layout['data']['width_image_2'])) {
$formattedRow['width_image_2'] = $layout['data']['width_image_2'];
}
- if (CRM_Utils_Array::value('height_image_2', $layout['data'])) {
+ if (!empty($layout['data']['height_image_2'])) {
$formattedRow['height_image_2'] = $layout['data']['height_image_2'];
}
- if (CRM_Utils_Array::value('add_barcode', $layout['data'])) {
+ if (!empty($layout['data']['add_barcode'])) {
$formattedRow['barcode'] = array(
'alignment' => $layout['data']['barcode_alignment'],
'type' => $layout['data']['barcode_type'],
$y = $this->pdf->getY();
$startOffset = 0;
- if (CRM_Utils_Array::value('image_1', $formattedRow)) {
+ if (!empty($formattedRow['image_1'])) {
$this->printImage($formattedRow['image_1'], NULL, NULL, CRM_Utils_Array::value('width_image_1', $formattedRow),
CRM_Utils_Array::value('height_image_1', $formattedRow));
}
- if (CRM_Utils_Array::value('image_2', $formattedRow)) {
+ if (!empty($formattedRow['image_2'])) {
$this->printImage($formattedRow['image_2'], $x + 68, NULL, CRM_Utils_Array::value('width_image_2', $formattedRow),
CRM_Utils_Array::value('height_image_2', $formattedRow));
}
CRM_Utils_Array::value('height_image_1', $formattedRow)) {
$startOffset = CRM_Utils_Array::value('height_image_1', $formattedRow);
}
- elseif (CRM_Utils_Array::value('height_image_2', $formattedRow)) {
+ elseif (!empty($formattedRow['height_image_2'])) {
$startOffset = CRM_Utils_Array::value('height_image_2', $formattedRow);
}
}
}
- if (CRM_Utils_Array::value('barcode', $formattedRow)) {
+ if (!empty($formattedRow['barcode'])) {
$data = $formattedRow['values'];
if ($formattedRow['barcode']['type'] == 'barcode') {
* @access public
*/
static function create(&$params, $ids = NULL, $context = NULL) {
- if (!CRM_Utils_Array::value('id', $params)) {
+ if (empty($params['id'])) {
$params['name'] = CRM_Utils_String::titleToVar($params['title']);
}
$batch['total'] = $batch['item_count'] = '';
$batch['payment_instrument'] = $value['payment_instrument'];
$batch['item_count'] = CRM_Utils_Array::value('item_count', $value);
- if (CRM_Utils_Array::value('total', $value)) {
+ if (!empty($value['total'])) {
$batch['total'] = CRM_Utils_Money::format($value['total']);
}
{$limit}";
$object = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Batch_DAO_Batch');
- if (CRM_Utils_Array::value('context', $params)) {
+ if (!empty($params['context'])) {
$links = self::links($params['context']);
}
else {
CRM_Utils_Array::remove($newLinks, 'close', 'edit', 'reopen', 'export');
}
}
- if (CRM_Utils_Array::value('type_id', $values)) {
+ if (!empty($values['type_id'])) {
$values['batch_type'] = $batchTypes[$values['type_id']];
}
$values['batch_status'] = $batchStatus[$values['status_id']];
static function formRule($params, $files, $self) {
$errors = array();
- if (CRM_Utils_Array::value('_qf_Entry_upload_force', $params)) {
+ if (!empty($params['_qf_Entry_upload_force'])) {
return TRUE;
}
$batchTotal += $value['total_amount'];
//validate for soft credit fields
- if (CRM_Utils_Array::value($key, $params['soft_credit_contact_select_id']) && !CRM_Utils_Array::value($key, $params['soft_credit_amount'])) {
+ if (!empty($params['soft_credit_contact_select_id'][$key]) && !CRM_Utils_Array::value($key, $params['soft_credit_amount'])) {
$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'])
//membership type is required for membership batch entry
if ( $self->_batchInfo['type_id'] == 2 ) {
- if ( !CRM_Utils_Array::value( 1, $value['membership_type'] ) ) {
+ if (empty($value['membership_type'][1])) {
$errors["field[$key][membership_type]"] = ts('Membership type is a required field.');
}
}
if (isset($params['field'])) {
foreach ($params['field'] as $key => $value) {
// if contact is not selected we should skip the row
- if (!CRM_Utils_Array::value($key, $params['primary_contact_select_id'])) {
+ if (empty($params['primary_contact_select_id'][$key])) {
continue;
}
$this->updateContactInfo($value);
//build soft credit params
- if (CRM_Utils_Array::value($key, $params['soft_credit_contact_select_id']) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) {
+ if (!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]);
$value['soft_credit'][$key]['soft_credit_type_id'] = $params['field'][$key]['soft_credit_type'];
);
foreach ($dates as $val) {
- if ( CRM_Utils_Array::value( $val, $value ) ) {
+ if (!empty($value[$val])) {
$value[$val] = CRM_Utils_Date::processDate( $value[$val], $value[$val . '_time'], TRUE );
}
}
- if (CRM_Utils_Array::value('send_receipt', $value)) {
+ if (!empty($value['send_receipt'])) {
$value['receipt_date'] = date('Y-m-d His');
}
$value['financial_type_id'] = $value['financial_type'];
}
- if (CRM_Utils_Array::value('payment_instrument', $value)) {
+ if (!empty($value['payment_instrument'])) {
$value['payment_instrument_id'] = $value['payment_instrument'];
}
- if (CRM_Utils_Array::value('contribution_source', $value)) {
+ if (!empty($value['contribution_source'])) {
$value['source'] = $value['contribution_source'];
}
- if (CRM_Utils_Array::value('contribution_note', $value)) {
+ if (!empty($value['contribution_note'])) {
$value['note'] = $value['contribution_note'];
}
//CRM-11529 for backoffice transactions
//when financial_type_id is passed in form, update the
//lineitems with the financial type selected in form
- if (CRM_Utils_Array::value('financial_type_id', $value) && CRM_Utils_Array::value($priceSetId, $lineItem)) {
+ if (!empty($value['financial_type_id']) && CRM_Utils_Array::value($priceSetId, $lineItem)) {
foreach ($lineItem[$priceSetId] as &$values) {
$values['financial_type_id'] = $value['financial_type_id'];
}
$contribution = CRM_Contribute_BAO_Contribution::create($value, CRM_Core_DAO::$_nullArray);
//process premiums
- if (CRM_Utils_Array::value('product_name', $value)) {
+ if (!empty($value['product_name'])) {
if ($value['product_name'][0] > 0) {
list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
$customFields = array();
foreach ($params['field'] as $key => $value) {
// if contact is not selected we should skip the row
- if (!CRM_Utils_Array::value($key, $params['primary_contact_select_id'])) {
+ if (empty($params['primary_contact_select_id'][$key])) {
continue;
}
}
}
- if (CRM_Utils_Array::value('send_receipt', $value)) {
+ if (!empty($value['send_receipt'])) {
$value['receipt_date'] = date('Y-m-d His');
}
- if (CRM_Utils_Array::value('membership_source', $value)) {
+ if (!empty($value['membership_source'])) {
$value['source'] = $value['membership_source'];
}
unset($value['membership_source']);
//Get the membership status
- if ( CRM_Utils_Array::value('membership_status', $value) ) {
+ if (!empty($value['membership_status'])) {
$value['status_id'] = $value['membership_status'];
unset($value['membership_status']);
}
$membershipTypeId
);
- if (CRM_Utils_Array::value('financial_type', $value)) {
+ if (!empty($value['financial_type'])) {
$value['financial_type_id'] = $value['financial_type'];
}
- if (CRM_Utils_Array::value('payment_instrument', $value)) {
+ if (!empty($value['payment_instrument'])) {
$value['payment_instrument_id'] = $value['payment_instrument'];
}
$value['soft_credit'][$key]['amount'] = CRM_Utils_Rule::cleanMoney($params['soft_credit_amount'][$key]);
}
- if ( CRM_Utils_Array::value('receive_date', $value) ) {
+ if (!empty($value['receive_date'])) {
$value['receive_date'] = CRM_Utils_Date::processDate( $value['receive_date'], $value['receive_date_time'] , TRUE );
}
$editedResults = array();
CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults);
$this->_priceSet['fields'][$fid]['options'][$editedResults['id']] = $priceSets['fields'][$fid]['options'][$editedResults['id']];
- if (CRM_Utils_Array::value('total_amount', $value)) {
+ if (!empty($value['total_amount'])) {
$this->_priceSet['fields'][$fid]['options'][$editedResults['id']]['amount'] = $value['total_amount'];
}
//CRM-11529 for backoffice transactions
//when financial_type_id is passed in form, update the
//lineitems with the financial type selected in form
- if (CRM_Utils_Array::value('financial_type_id', $value) && CRM_Utils_Array::value($priceSetId, $lineItem)) {
+ if (!empty($value['financial_type_id']) && CRM_Utils_Array::value($priceSetId, $lineItem)) {
foreach ($lineItem[$priceSetId] as &$values) {
$values['financial_type_id'] = $value['financial_type_id'];
}
unset($value['membership_end_date']);
$value['is_renew'] = false;
- if ( CRM_Utils_Array::value('member_option', $params) && CRM_Utils_Array::value( $key, $params['member_option'] ) == 2 ) {
+ if (!empty($params['member_option']) && CRM_Utils_Array::value( $key, $params['member_option'] ) == 2 ) {
$this->_params = $params;
$value['is_renew'] = true;
$membership = CRM_Member_BAO_Membership::renewMembership(
}
//process premiums
- if (CRM_Utils_Array::value('product_name', $value)) {
+ if (!empty($value['product_name'])) {
if ($value['product_name'][0] > 0) {
list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
}
//store custom data
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_campaign', $campaign->id);
'sortOrder' => 'desc',
);
foreach ($sortParams as $name => $default) {
- if (CRM_Utils_Array::value($name, $params)) {
+ if (!empty($params[$name])) {
$sortParams[$name] = $params[$name];
}
}
//build the where clause.
$queryParams = $where = array();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$where[] = "( campaign.id = %1 )";
$queryParams[1] = array($params['id'], 'Positive');
}
- if (CRM_Utils_Array::value('name', $params)) {
+ if (!empty($params['name'])) {
$where[] = "( campaign.name LIKE %2 )";
$queryParams[2] = array('%' . trim($params['name']) . '%', 'String');
}
- if (CRM_Utils_Array::value('title', $params)) {
+ if (!empty($params['title'])) {
$where[] = "( campaign.title LIKE %3 )";
$queryParams[3] = array('%' . trim($params['title']) . '%', 'String');
}
- if (CRM_Utils_Array::value('start_date', $params)) {
+ if (!empty($params['start_date'])) {
$startDate = CRM_Utils_Date::processDate($params['start_date']);
$where[] = "( campaign.start_date >= %4 OR campaign.start_date IS NULL )";
$queryParams[4] = array($startDate, 'String');
}
- if (CRM_Utils_Array::value('end_date', $params)) {
+ if (!empty($params['end_date'])) {
$endDate = CRM_Utils_Date::processDate($params['end_date'], '235959');
$where[] = "( campaign.end_date <= %5 OR campaign.end_date IS NULL )";
$queryParams[5] = array($endDate, 'String');
}
- if (CRM_Utils_Array::value('description', $params)) {
+ if (!empty($params['description'])) {
$where[] = "( campaign.description LIKE %6 )";
$queryParams[6] = array('%' . trim($params['description']) . '%', 'String');
}
- if (CRM_Utils_Array::value('campaign_type_id', $params)) {
+ if (!empty($params['campaign_type_id'])) {
$typeId = $params['campaign_type_id'];
if (is_array($params['campaign_type_id'])) {
$typeId = implode(' , ', $params['campaign_type_id']);
}
$where[] = "( campaign.campaign_type_id IN ( {$typeId} ) )";
}
- if (CRM_Utils_Array::value('status_id', $params)) {
+ if (!empty($params['status_id'])) {
$statusId = $params['status_id'];
if (is_array($params['status_id'])) {
$statusId = implode(' , ', $params['status_id']);
}
if (array_key_exists('is_active', $params)) {
$active = "( campaign.is_active = 1 )";
- if (CRM_Utils_Array::value('is_active', $params)) {
+ if (!empty($params['is_active'])) {
$active = "( campaign.is_active = 0 OR campaign.is_active IS NULL )";
}
$where[] = $active;
'sortOrder' => 'desc',
);
foreach ($sortParams as $name => $default) {
- if (CRM_Utils_Array::value($name, $params)) {
+ if (!empty($params[$name])) {
$sortParams[$name] = $params[$name];
}
}
$where[] = "( petition.activity_type_id = %1 )";
$queryParams[1] = array($petitionTypeID, 'Positive');
}
- if (CRM_Utils_Array::value('title', $params)) {
+ if (!empty($params['title'])) {
$where[] = "( petition.title LIKE %2 )";
$queryParams[2] = array('%' . trim($params['title']) . '%', 'String');
}
- if (CRM_Utils_Array::value('campaign_id', $params)) {
+ if (!empty($params['campaign_id'])) {
$where[] = '( petition.campaign_id = %3 )';
$queryParams[3] = array($params['campaign_id'], 'Positive');
}
$activity = CRM_Activity_BAO_Activity::create($activityParams);
// save activity custom data
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_activity', $activity->id);
return false;
}
- if (CRM_Utils_Array::value('is_default', $params)) {
+ if (!empty($params['is_default'])) {
$query = "UPDATE civicrm_survey SET is_default = 0";
CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}
$dao->copyValues($params);
$dao->save();
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_survey', $dao->id);
'sortOrder' => 'desc',
);
foreach ($sortParams as $name => $default) {
- if (CRM_Utils_Array::value($name, $params)) {
+ if (!empty($params[$name])) {
$sortParams[$name] = $params[$name];
}
}
$queryParams[1] = array($petitionTypeID, 'Positive');
}
- if (CRM_Utils_Array::value('title', $params)) {
+ if (!empty($params['title'])) {
$where[] = "( survey.title LIKE %2 )";
$queryParams[2] = array('%' . trim($params['title']) . '%', 'String');
}
- if (CRM_Utils_Array::value('campaign_id', $params)) {
+ if (!empty($params['campaign_id'])) {
$where[] = '( survey.campaign_id = %3 )';
$queryParams[3] = array($params['campaign_id'], 'Positive');
}
- if (CRM_Utils_Array::value('activity_type_id', $params)) {
+ if (!empty($params['activity_type_id'])) {
$typeId = $params['activity_type_id'];
if (is_array($params['activity_type_id'])) {
$typeId = implode(' , ', $params['activity_type_id']);
$ids = array('id' => $surveyId);
foreach ($voterLinks as $link) {
- if (CRM_Utils_Array::value('qs', $link) &&
+ if (!empty($link['qs']) &&
!CRM_Utils_System::isNull($link['qs'])
) {
$urlPath = CRM_Utils_System::url(CRM_Core_Action::replace($link['url'], $ids),
}
// when custom data is included in form.
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Campaign');
$this->set('subType', CRM_Utils_Array::value('campaign_type_id', $_POST));
$this->set('entityId', $this->_campaignId);
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
if ($this->_surveyId) {
CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
}
- if (CRM_Utils_Array::value('profile_id', $params)) {
+ if (!empty($params['profile_id'])) {
$ufJoinParams['weight'] = 1;
$ufJoinParams['uf_group_id'] = $params['profile_id'];
CRM_Core_BAO_UFJoin::create($ufJoinParams);
}
- if (CRM_Utils_Array::value('contact_profile_id', $params)) {
+ if (!empty($params['contact_profile_id'])) {
$ufJoinParams['weight'] = 2;
$ufJoinParams['uf_group_id'] = $params['contact_profile_id'];
CRM_Core_BAO_UFJoin::create($ufJoinParams);
$interviewerId = CRM_Utils_Array::value('survey_interviewer_id', $this->_formValues);
if ($interviewerId) {
$this->set('interviewerId', $interviewerId);
- if (!CRM_Utils_Array::value('survey_interviewer_name', $this->_formValues)) {
+ if (empty($this->_formValues['survey_interviewer_name'])) {
$this->_formValues['survey_interviewer_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
$interviewerId,
'sort_name',
}
if ($this->_operation == 'reserve') {
- if (CRM_Utils_Array::value('campaign_survey_id', $this->_formValues)) {
+ if (!empty($this->_formValues['campaign_survey_id'])) {
$campaignId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey',
$this->_formValues['campaign_survey_id'],
'campaign_id'
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
if ($this->_surveyId) {
- if (CRM_Utils_Array::value('result_id', $defaults) &&
+ if (!empty($defaults['result_id']) &&
CRM_Utils_Array::value('recontact_interval', $defaults)
) {
$survey = CRM_Campaign_BAO_Survey::create($params);
$this->_surveyId = $survey->id;
- if (CRM_Utils_Array::value('result_id', $this->_values)) {
+ if (!empty($this->_values['result_id'])) {
$query = "SELECT COUNT(*) FROM civicrm_survey WHERE result_id = %1";
$countSurvey = (int)CRM_Core_DAO::singleValueQuery($query,
array(
if (empty($optionGroups) || !CRM_Utils_Array::value('result_id', $this->_values)) {
$this->setdefaults(array('option_type' => 1));
}
- elseif (CRM_Utils_Array::value('result_id', $this->_values)) {
+ elseif (!empty($this->_values['result_id'])) {
$this->setdefaults(array(
'option_type' => 2,
'option_group_id' => $this->_values['result_id'],
*/
static function formRule($fields, $files, $form) {
$errors = array();
- if (
- CRM_Utils_Array::value('option_label', $fields) &&
+ if (!empty($fields['option_label']) &&
CRM_Utils_Array::value('option_value', $fields) &&
(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 (
- !CRM_Utils_Array::value('option_label', $fields) &&
+ elseif (empty($fields['option_label']) &&
!CRM_Utils_Array::value('option_value', $fields)
) {
return $errors;
}
}
- if (CRM_Utils_Array::value($i, $fields['option_interval']) && !CRM_Utils_Rule::integer($fields['option_interval'][$i])) {
+ if (!empty($fields['option_interval'][$i]) && !CRM_Utils_Rule::integer($fields['option_interval'][$i])) {
$_flagOption = 1;
$errors['option_interval[' . $i . ']'] = ts('Please enter a valid integer.');
}
$optionValue->weight = $params['option_weight'][$k];
$optionValue->is_active = 1;
- if (CRM_Utils_Array::value('default_option', $params) &&
+ if (!empty($params['default_option']) &&
$params['default_option'] == $k
) {
$optionValue->is_default = 1;
$orderBy = array();
if ( !empty($orderByParams) ) {
foreach ( $orderByParams as $key => $val ) {
- if (CRM_Utils_Array::value('column', $val)) {
+ if (!empty($val['column'])) {
$orderBy[] = "{$val['column']} {$val['order']}";
}
}
$activity->activity_date_time = date('YmdHis');
$activity->status_id = $statusId;
- if (CRM_Utils_Array::value('activity_date_time', $params)) {
+ if (!empty($params['activity_date_time'])) {
$activity->activity_date_time = CRM_Utils_Date::processDate($params['activity_date_time'], $params['activity_date_time_time']);
}
'duration' => 'activity_duration'
);
foreach ($activityParams as $key => $field) {
- if (CRM_Utils_Array::value($field, $params)) {
+ if (!empty($params[$field])) {
$activity->$key = $params[$field];
}
}
static function formRule($fields, $files, $self) {
$errors = array();
$invalidGroupName = FALSE;
- if (CRM_Utils_Array::value('newGroupName', $fields)) {
+ if (!empty($fields['newGroupName'])) {
$title = trim($fields['newGroupName']);
$name = CRM_Utils_String::titleToVar($title);
$query = 'select count(*) from civicrm_group where name like %1 OR title like %2';
$params = $searchRows = array();
foreach ($searchParams as $param) {
- if (CRM_Utils_Array::value($param, $_POST)) {
+ if (!empty($_POST[$param])) {
$params[$param] = $_POST[$param];
}
}
$interviewerId = $surveyTypeId = $surveyId = NULL;
$searchVoterFor = $params['campaign_search_voter_for'];
if ($searchVoterFor == 'reserve') {
- if (CRM_Utils_Array::value('campaign_survey_id', $params)) {
+ if (!empty($params['campaign_survey_id'])) {
$survey = new CRM_Campaign_DAO_Survey();
$survey->id = $surveyId = $params['campaign_survey_id'];
$survey->selectAdd('campaign_id, activity_type_id');
);
foreach ($dataTableParams as $pName => $pValues) {
$$pName = $pValues['default'];
- if (CRM_Utils_Array::value($pValues['name'], $_POST)) {
+ if (!empty($_POST[$pValues['name']])) {
$$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']);
if ($pName == 'sort')$$pName = $selectorCols[$$pName];
}
elseif ($operation == 'reserve') {
$activityId = NULL;
$createActivity = TRUE;
- if (CRM_Utils_Array::value('activity_id', $_POST)) {
+ if (!empty($_POST['activity_id'])) {
$activityId = CRM_Utils_Type::escape($_POST['activity_id'], 'Integer');
if ($activityId) {
$createActivity = FALSE;
$params = $searchRows = array();
foreach ($searchParams as $param) {
- if (CRM_Utils_Array::value($param, $_POST)) {
+ if (!empty($_POST[$param])) {
$params[$param] = $_POST[$param];
}
}
);
foreach ($dataTableParams as $pName => $pValues) {
$$pName = $pValues['default'];
- if (CRM_Utils_Array::value($pValues['name'], $_POST)) {
+ if (!empty($_POST[$pValues['name']])) {
$$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']);
if ($pName == 'sort') {
$$pName = $selectorCols[$$pName];
$params = $searchRows = array();
foreach ($searchParams as $param) {
- if (CRM_Utils_Array::value($param, $_POST)) {
+ if (!empty($_POST[$param])) {
$params[$param] = $_POST[$param];
}
}
);
foreach ($dataTableParams as $pName => $pValues) {
$$pName = $pValues['default'];
- if (CRM_Utils_Array::value($pValues['name'], $_POST)) {
+ if (!empty($_POST[$pValues['name']])) {
$$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']);
if ($pName == 'sort') {
$$pName = $selectorCols[$$pName];
$params = $searchRows = array();
foreach ($searchParams as $param) {
- if (CRM_Utils_Array::value($param, $_POST)) {
+ if (!empty($_POST[$param])) {
$params[$param] = $_POST[$param];
}
}
);
foreach ($dataTableParams as $pName => $pValues) {
$$pName = $pValues['default'];
- if (CRM_Utils_Array::value($pValues['name'], $_POST)) {
+ if (!empty($_POST[$pValues['name']])) {
$$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']);
if ($pName == 'sort') {
$$pName = $selectorCols[$$pName];
}
$campaignsData[$cmpid]['isActive'] = $isActive;
- if (CRM_Utils_Array::value('start_date', $campaignsData[$cmpid])) {
+ if (!empty($campaignsData[$cmpid]['start_date'])) {
$campaignsData[$cmpid]['start_date'] = CRM_Utils_Date::customFormat($campaignsData[$cmpid]['start_date'],
$config->dateformatFull
);
}
- if (CRM_Utils_Array::value('end_date', $campaignsData[$cmpid])) {
+ if (!empty($campaignsData[$cmpid]['end_date'])) {
$campaignsData[$cmpid]['end_date'] = CRM_Utils_Date::customFormat($campaignsData[$cmpid]['end_date'],
$config->dateformatFull
);
$campaignId = CRM_Utils_Array::value('campaign_id', $survey);
$surveysData[$sid]['campaign'] = CRM_Utils_Array::value($campaignId, $campaigns);
$surveysData[$sid]['activity_type'] = $surveyType[$survey['activity_type_id']];
- if (CRM_Utils_Array::value('release_frequency', $survey)) {
+ if (!empty($survey['release_frequency'])) {
$surveysData[$sid]['release_frequency'] = $survey['release_frequency'] . ' Day(s)';
}
function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
- if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
+ if (!empty($_POST['_qf_' . $formName . '_next_print'])) {
$value = CRM_Campaign_Task::PRINT_VOTERS;
}
else {
static function &create(&$params) {
$transaction = new CRM_Core_Transaction();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Case', $params['id'], $params);
}
else {
$case = self::add($params);
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_case', $case->id);
return $case;
}
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Case', $case->id, $case);
}
else {
$res = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
while ($res->fetch()) {
- if (CRM_Utils_Array::value($res->case_type, $rows) && CRM_Utils_Array::value($res->case_status, $rows[$res->case_type])) {
+ if (!empty($rows[$res->case_type]) && CRM_Utils_Array::value($res->case_status, $rows[$res->case_type])) {
$rows[$res->case_type][$res->case_status]['count'] = $rows[$res->case_type][$res->case_status]['count'] + 1;
}
else {
$where = 'WHERE cca.case_id= %1
AND ca.is_current_revision = 1';
- if (CRM_Utils_Array::value('reporter_id', $params)) {
+ if (!empty($params['reporter_id'])) {
$where .= " AND cac.contact_id = " . CRM_Utils_Type::escape($params['reporter_id'], 'Integer');
}
- if (CRM_Utils_Array::value('status_id', $params)) {
+ if (!empty($params['status_id'])) {
$where .= " AND ca.status_id = " . CRM_Utils_Type::escape($params['status_id'], 'Integer');
}
- if (CRM_Utils_Array::value('activity_deleted', $params)) {
+ if (!empty($params['activity_deleted'])) {
$where .= " AND ca.is_deleted = 1";
}
else {
$where .= " AND ca.is_deleted = 0";
}
- if (CRM_Utils_Array::value('activity_type_id', $params)) {
+ if (!empty($params['activity_type_id'])) {
$where .= " AND ca.activity_type_id = " . CRM_Utils_Type::escape($params['activity_type_id'], 'Integer');
}
- if (CRM_Utils_Array::value('activity_date_low', $params)) {
+ if (!empty($params['activity_date_low'])) {
$fromActivityDate = CRM_Utils_Type::escape(CRM_Utils_Date::processDate($params['activity_date_low']), 'Date');
}
- if (CRM_Utils_Array::value('activity_date_high', $params)) {
+ if (!empty($params['activity_date_high'])) {
$toActivityDate = CRM_Utils_Type::escape(CRM_Utils_Date::processDate($params['activity_date_high']), 'Date');
$toActivityDate = $toActivityDate ? $toActivityDate + 235959 : NULL;
}
if ($caseId) {
$activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityId, 'activity_type_id');
$nonCaseActivityTypes = CRM_Core_PseudoConstant::activityType();
- if (CRM_Utils_Array::value($activityTypeId, $nonCaseActivityTypes)) {
+ if (!empty($nonCaseActivityTypes[$activityTypeId])) {
$anyActivity = TRUE;
}
else {
// (Or for efficiency call the global one outside the loop and then union with this each time.)
$contactDetails = self::getRelatedContacts($caseId, TRUE);
- if (CRM_Utils_Array::value($result['from']['id'], $contactDetails)) {
+ if (!empty($contactDetails[$result['from']['id']])) {
$params = array();
$params['subject'] = $result['subject'];
$params['activity_date_time'] = $result['date'];
}
if ($latestDate) {
- if (CRM_Utils_Array::value('activity_type_id', $criteriaParams)) {
+ if (!empty($criteriaParams['activity_type_id'])) {
$where .= " AND ca.activity_type_id = " . CRM_Utils_Type::escape($criteriaParams['activity_type_id'], 'Integer');
$where .= " AND ca.is_current_revision = 1";
$groupBy .= " GROUP BY ca.activity_type_id";
}
- if (CRM_Utils_Array::value('newest', $criteriaParams)) {
+ if (!empty($criteriaParams['newest'])) {
$selectDate = " max(ca.activity_date_time) ";
}
else {
'activity_type_id', 'id'
);
- if (CRM_Utils_Array::value('isCaseActivity', $tplParams)) {
+ if (!empty($tplParams['isCaseActivity'])) {
$tplParams['editActURL'] = CRM_Utils_System::url('civicrm/case/activity',
"reset=1&cid={$activityParams['target_id']}&caseid={$activityParams['case_id']}&action=update&id={$activityParams['source_record_id']}", TRUE
);
$query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
}
- if (CRM_Utils_Array::value('case_type_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_type_id'])) {
$query->_select['case_type_id'] = "case_type.id as case_type_id";
$query->_element['case_type_id'] = 1;
$query->_tables['case_type'] = $query->_whereTables['case_type'] = 1;
$query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_type', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_type'])) {
$query->_select['case_type'] = "case_type.label as case_type";
$query->_element['case_type'] = 1;
$query->_tables['case_type'] = $query->_whereTables['case_type'] = 1;
$query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_start_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_start_date'])) {
$query->_select['case_start_date'] = "civicrm_case.start_date as case_start_date";
$query->_element['case_start_date'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_end_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_end_date'])) {
$query->_select['case_end_date'] = "civicrm_case.end_date as case_end_date";
$query->_element['case_end_date'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_status_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_status_id'])) {
$query->_select['case_status_id'] = "case_status.id as case_status_id";
$query->_element['case_status_id'] = 1;
$query->_tables['case_status_id'] = $query->_whereTables['case_status_id'] = 1;
$query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_status'])) {
$query->_select['case_status'] = "case_status.label as case_status";
$query->_element['case_status'] = 1;
$query->_tables['case_status_id'] = $query->_whereTables['case_status_id'] = 1;
$query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_deleted', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_deleted'])) {
$query->_select['case_deleted'] = "civicrm_case.is_deleted as case_deleted";
$query->_element['case_deleted'] = 1;
$query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_role', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_role'])) {
$query->_select['case_role'] = "case_relation_type.label_b_a as case_role";
$query->_element['case_role'] = 1;
$query->_tables['case_relationship'] = $query->_whereTables['case_relationship'] = 1;
$query->_tables['case_relation_type'] = $query->_whereTables['case_relation_type'] = 1;
}
- if (CRM_Utils_Array::value('case_recent_activity_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_recent_activity_date'])) {
$query->_select['case_recent_activity_date'] = "case_activity.activity_date_time as case_recent_activity_date";
$query->_element['case_recent_activity_date'] = 1;
$query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
}
- if (CRM_Utils_Array::value('case_activity_subject', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_activity_subject'])) {
$query->_select['case_activity_subject'] = "case_activity.subject as case_activity_subject";
$query->_element['case_activity_subject'] = 1;
$query->_tables['case_activity'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_subject', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_subject'])) {
$query->_select['case_subject'] = "civicrm_case.subject as case_subject";
$query->_element['case_subject'] = 1;
$query->_tables['civicrm_case_contact'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_source_contact_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_source_contact_id'])) {
$query->_select['case_source_contact_id'] = "civicrm_case_reporter.sort_name as case_source_contact_id";
$query->_element['case_source_contact_id'] = 1;
$query->_tables['civicrm_case_reporter'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_activity_status_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_activity_status_id'])) {
$query->_select['case_activity_status_id'] = "rec_activity_status.id as case_activity_status_id";
$query->_element['case_activity_status_id'] = 1;
$query->_tables['case_activity'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_activity_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_activity_status'])) {
$query->_select['case_activity_status'] = "rec_activity_status.label as case_activity_status";
$query->_element['case_activity_status'] = 1;
$query->_tables['case_activity'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_activity_duration', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_activity_duration'])) {
$query->_select['case_activity_duration'] = "case_activity.duration as case_activity_duration";
$query->_element['case_activity_duration'] = 1;
$query->_tables['case_activity'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_activity_medium_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_activity_medium_id'])) {
$query->_select['case_activity_medium_id'] = "recent_activity_medium.label as case_activity_medium_id";
$query->_element['case_activity_medium_id'] = 1;
$query->_tables['case_activity'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_activity_details', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_activity_details'])) {
$query->_select['case_activity_details'] = "case_activity.details as case_activity_details";
$query->_element['case_activity_details'] = 1;
$query->_tables['case_activity'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_activity_is_auto', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_activity_is_auto'])) {
$query->_select['case_activity_is_auto'] = "case_activity.is_auto as case_activity_is_auto";
$query->_element['case_activity_is_auto'] = 1;
$query->_tables['case_activity'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_scheduled_activity_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_scheduled_activity_date'])) {
$query->_select['case_scheduled_activity_date'] = "case_activity.activity_date_time as case_scheduled_activity_date";
$query->_element['case_scheduled_activity_date'] = 1;
$query->_tables['case_activity'] = 1;
$query->_tables['civicrm_case_contact'] = 1;
$query->_tables['civicrm_case'] = 1;
}
- if (CRM_Utils_Array::value('case_recent_activity_type', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['case_recent_activity_type'])) {
$query->_select['case_recent_activity_type'] = "rec_activity_type.label as case_recent_activity_type";
$query->_element['case_recent_activity_type'] = 1;
$query->_tables['case_activity'] = 1;
}
static function tableNames(&$tables) {
- if (CRM_Utils_Array::value('civicrm_case', $tables)) {
+ if (!empty($tables['civicrm_case'])) {
$tables = array_merge(array('civicrm_case_contact' => 1), $tables);
}
- if (CRM_Utils_Array::value('case_relation_type', $tables)) {
+ if (!empty($tables['case_relation_type'])) {
$tables = array_merge(array('case_relationship' => 1), $tables);
}
}
}
// format activity custom data
- if (CRM_Utils_Array::value('hidden_custom', $params)) {
+ if (!empty($params['hidden_custom'])) {
if ($this->_activityId) {
// unset custom fields-id from params since we want custom
// fields to be saved for new activity.
}
// assigning formatted value
- if (CRM_Utils_Array::value('assignee_contact_id', $params)) {
+ if (!empty($params['assignee_contact_id'])) {
$params['assignee_contact_id'] = explode(',', $params['assignee_contact_id']);
}
else {
// have been modified/created by user
if (isset($newActParams)) {
// set proper original_id
- if (CRM_Utils_Array::value('original_id', $this->_defaults)) {
+ if (!empty($this->_defaults['original_id'])) {
$newActParams['original_id'] = $this->_defaults['original_id'];
}
else {
// copy files attached to old activity if any, to new one,
// as long as users have not selected the 'delete attachment' option.
- if (!CRM_Utils_Array::value('is_delete_attachment', $newActParams)) {
+ if (empty($newActParams['is_delete_attachment'])) {
CRM_Core_BAO_File::copyEntityFile('civicrm_activity', $this->_activityId,
'civicrm_activity', $activity->id
);
$caseParams = $params;
$caseParams['id'] = $this->_caseId;
- if (CRM_Utils_Array::value('case_type_id', $caseParams)) {
+ if (!empty($caseParams['case_type_id'])) {
$caseParams['case_type_id'] = CRM_Core_DAO::VALUE_SEPARATOR . $caseParams['case_type_id'] . CRM_Core_DAO::VALUE_SEPARATOR;
}
- if (CRM_Utils_Array::value('case_status_id', $caseParams)) {
+ if (!empty($caseParams['case_status_id'])) {
$caseParams['status_id'] = $caseParams['case_status_id'];
}
// create follow up activity if needed
$followupStatus = '';
- if (CRM_Utils_Array::value('followup_activity_type_id', $params)) {
+ if (!empty($params['followup_activity_type_id'])) {
$followupActivity = CRM_Activity_BAO_Activity::createFollowupActivity($activity->id, $params);
if ($followupActivity) {
* @return void
*/
static function endPostProcess(&$form, &$params, $activity) {
- if (CRM_Utils_Array::value('start_date', $params)) {
+ if (!empty($params['start_date'])) {
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
}
$caseTypes = CRM_Case_PseudoConstant::caseType('name');
$allCaseTypes = CRM_Case_PseudoConstant::caseType('label', FALSE);
- if (CRM_Utils_Array::value($params['case_type_id'], $caseTypes)) {
+ if (!empty($caseTypes[$params['case_type_id']])) {
$caseType = $caseTypes[$params['case_type_id']];
}
$activityGroupTree = $this->_groupTree;
// for case custom fields to populate with defaults
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
$className::beginPostProcess($this, $params );
}
- if (
- CRM_Utils_Array::value('hidden_custom', $params) &&
+ if (!empty($params['hidden_custom']) &&
!isset($params['custom'])
) {
$customFields = array();
}
// 2. create/edit case
- if (CRM_Utils_Array::value('case_type_id', $params)) {
+ if (!empty($params['case_type_id'])) {
$caseType = CRM_Case_PseudoConstant::caseType('name');
$params['case_type'] = $caseType[$params['case_type_id']];
$params['subject'] = $params['activity_subject'];
$session->pushUserContext($url);
// 3. format activity custom data
- if (CRM_Utils_Array::value('hidden_custom', $params)) {
+ if (!empty($params['hidden_custom'])) {
$customFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, $this->_activityTypeId);
$customFields = CRM_Utils_Array::crmArrayMerge($customFields,
CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE,
}
//calculate roles that don't have relationships
- if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) {
+ if (!empty($caseRoles[$value['relation_type']])) {
unset($caseRoles[$value['relation_type']]);
}
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
- if (CRM_Utils_Array::value('timeline_id', $params) &&
+ if (!empty($params['timeline_id']) &&
CRM_Utils_Array::value('_qf_CaseView_next', $_POST)
) {
$session = CRM_Core_Session::singleton();
$tasks = array('' => ts('- actions -')) + CRM_Case_Task::permissionedTaskTitles($permission);
- if (CRM_Utils_Array::value('case_deleted', $this->_formValues)) {
+ if (!empty($this->_formValues['case_deleted'])) {
unset($tasks[1]);
}
else {
$this->_formValues['case_owner'] = 2;
}
- if (!CRM_Utils_Array::value('case_deleted', $this->_formValues)) {
+ if (empty($this->_formValues['case_deleted'])) {
$this->_formValues['case_deleted'] = 0;
}
CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
- if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
+ if (!empty($_POST['_qf_' . $formName . '_next_print'])) {
$value = CRM_Case_Task::PRINT_CASES;
}
else {
if ($referenceActivityName = (string) $activityTypeXML->reference_activity) {
//we skip open case as reference activity.CRM-4374.
- if (CRM_Utils_Array::value('resetTimeline', $params) && $referenceActivityName == 'Open Case') {
+ if (!empty($params['resetTimeline']) && $referenceActivityName == 'Open Case') {
$activityDate = $params['activity_date_time'];
}
else {
return TRUE;
}
$activityParams['case_id'] = $params['caseID'];
- if (CRM_Utils_Array::value('is_auto', $activityParams)) {
+ if (!empty($activityParams['is_auto'])) {
$activityParams['skipRecentView'] = TRUE;
}
$template->assign('clientID', $clientID);
$template->assign('activitySetName', $activitySetName);
- if (CRM_Utils_Array::value('is_redact', $params)) {
+ if (!empty($params['is_redact'])) {
$form->_isRedact = TRUE;
$template->assign('_isRedact', 'true');
}
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$caseRoles = $xmlProcessor->get($caseType, 'CaseRoles');
foreach ($caseRelationships as $key => & $value) {
- if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) {
+ if (!empty($caseRoles[$value['relation_type']])) {
unset($caseRoles[$value['relation_type']]);
}
if ($isRedact) {
);
}
$value['name'] = self::redact($value['name'], TRUE, $report->_redactionStringRules);
- if (CRM_Utils_Array::value('email', $value) &&
+ if (!empty($value['email']) &&
!array_key_exists($value['email'], $report->_redactionStringRules)
) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules,
$value['email'] = self::redact($value['email'], TRUE, $report->_redactionStringRules);
- if (CRM_Utils_Array::value('phone', $value) &&
+ if (!empty($value['phone']) &&
!array_key_exists($value['phone'], $report->_redactionStringRules)
) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules,
$report->_redactionStringRules[$caseRoles['client']['display_name']] = $report->_redactionStringRules[$caseRoles['client']['sort_name']];
}
$caseRoles['client']['sort_name'] = self::redact($caseRoles['client']['sort_name'], TRUE, $report->_redactionStringRules);
- if (CRM_Utils_Array::value('email', $caseRoles['client']) &&
+ if (!empty($caseRoles['client']['email']) &&
!array_key_exists($caseRoles['client']['email'], $report->_redactionStringRules)
) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules,
}
$caseRoles['client']['email'] = self::redact($caseRoles['client']['email'], TRUE, $report->_redactionStringRules);
- if (CRM_Utils_Array::value('phone', $caseRoles['client']) &&
+ if (!empty($caseRoles['client']['phone']) &&
!array_key_exists($caseRoles['client']['phone'], $report->_redactionStringRules)
) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules,
}
$r['name'] = self::redact($r['name'], TRUE, $report->_redactionStringRules);
- if (CRM_Utils_Array::value('phone', $r) &&
+ if (!empty($r['phone']) &&
!array_key_exists($r['phone'], $report->_redactionStringRules)
) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules,
}
$r['phone'] = self::redact($r['phone'], TRUE, $report->_redactionStringRules);
- if (CRM_Utils_Array::value('email', $r) &&
+ if (!empty($r['email']) &&
!array_key_exists($r['email'], $report->_redactionStringRules)
) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules,
$r['sort_name'] = self::redact($r['sort_name'], TRUE, $report->_redactionStringRules);
- if (CRM_Utils_Array::value('phone', $r) &&
+ if (!empty($r['phone']) &&
!array_key_exists($r['phone'], $report->_redactionStringRules)
) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules,
}
$r['phone'] = self::redact($r['phone'], TRUE, $report->_redactionStringRules);
- if (CRM_Utils_Array::value('email', $r) &&
+ if (!empty($r['email']) &&
!array_key_exists($r['email'], $report->_redactionStringRules)
) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules,
*/
static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
$contact = NULL;
- if (!CRM_Utils_Array::value('contact_type', $params) &&
+ if (empty($params['contact_type']) &&
!CRM_Utils_Array::value('contact_id', $params)
) {
return $contact;
// Enabling multisite causes the contact to be added to the domain group
$domainGroupID = CRM_Core_BAO_Domain::getGroupId();
if(!empty($domainGroupID)){
- if (CRM_Utils_Array::value('group', $params) && is_array($params['group'])) {
+ if (!empty($params['group']) && is_array($params['group'])) {
$params['group'][$domainGroupID] = 1;
}
else {
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
// add notes
- if (CRM_Utils_Array::value('note', $params)) {
+ if (!empty($params['note'])) {
if (is_array($params['note'])) {
foreach ($params['note'] as $note) {
$contactId = $contact->id;
// update the UF user_unique_id if that has changed
CRM_Core_BAO_UFMatch::updateUFName($contact->id);
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contact', $contact->id);
}
// make a civicrm_subscription_history entry only on contact create (CRM-777)
- if (!CRM_Utils_Array::value('contact_id', $params)) {
+ if (empty($params['contact_id'])) {
$subscriptionParams = array(
'contact_id' => $contact->id,
'status' => 'Added',
*/
static function resolveDefaults(&$defaults, $reverse = FALSE) {
// hack for birth_date
- if (CRM_Utils_Array::value('birth_date', $defaults)) {
+ if (!empty($defaults['birth_date'])) {
if (is_array($defaults['birth_date'])) {
$defaults['birth_date'] = CRM_Utils_Date::format($defaults['birth_date'], '-');
}
if ($name == 'address') {
// FIXME: lookupValue doesn't work for vcard_name
- if (CRM_Utils_Array::value('location_type_id', $values)) {
+ if (!empty($values['location_type_id'])) {
$vcardNames = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'vcard_name'));
$values['vcard_name'] = $vcardNames[$values['location_type_id']];
}
}
}
- if (!CRM_Utils_Array::value('location', $returnProperties)) {
+ if (empty($returnProperties['location'])) {
$returnProperties['location'] = array();
}
- if (!CRM_Utils_Array::value($locationTypeName, $returnProperties['location'])) {
+ if (empty($returnProperties['location'][$locationTypeName])) {
$returnProperties['location'][$locationTypeName] = array();
$returnProperties['location'][$locationTypeName]['location_type'] = $id;
}
$entityBlock = array('contact_id' => $contactId);
$blocks = CRM_Core_BAO_Location::getValues($entityBlock);
foreach($blocks[$block] as $key => $value){
- if (CRM_Utils_Array::value('is_primary', $value)){
+ if (!empty($value['is_primary'])){
$locationType = CRM_Utils_Array::value('location_type_id',$value);
}
}
}
// Process group and tag
- if (CRM_Utils_Array::value('group', $fields)) {
+ if (!empty($fields['group'])) {
$method = 'Admin';
// this for sure means we are coming in via profile since i added it to fix
// removing contacts from user groups -- lobo
CRM_Contact_BAO_GroupContact::create($params['group'], $contactID, $visibility, $method);
}
- if (CRM_Utils_Array::value('tag', $fields)) {
+ if (!empty($fields['tag'])) {
CRM_Core_BAO_EntityTag::create($params['tag'], 'civicrm_contact', $contactID);
}
}
$valueId = NULL;
- if (CRM_Utils_Array::value('customRecordValues', $params)) {
+ if (!empty($params['customRecordValues'])) {
if (is_array($params['customRecordValues']) && !empty($params['customRecordValues'])) {
foreach ($params['customRecordValues'] as $recId => $customFields) {
if (is_array($customFields) && !empty($customFields)) {
}
$type = $data['contact_type'];
- if ( CRM_Utils_Array::value('contact_sub_type', $data) ) {
+ if (!empty($data['contact_sub_type'])) {
$type = $data['contact_sub_type'];
$type = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($type, CRM_Core_DAO::VALUE_SEPARATOR));
// generally a contact even if, has multiple subtypes the parent-type is going to be one only
}
if (!$force) {
- if (CRM_Utils_Array::value($userID, $_processed)) {
+ if (!empty($_processed[$userID])) {
return;
}
$params = array('name' => $contactType);
CRM_Contact_BAO_ContactType::retrieve($params, $typeInfo);
- if (CRM_Utils_Array::value('image_URL', $typeInfo)) {
+ if (!empty($typeInfo['image_URL'])) {
$imageUrl = $typeInfo['image_URL'];
$config = CRM_Core_Config::singleton();
$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 (!CRM_Utils_Array::value('master_id', $values) ||
+ if (empty($values['master_id']) ||
!CRM_Utils_Array::value('use_shared_address', $values)
) {
// we should unset master id when use uncheck share address for existing address
// get the list of master id's for address
$masterAddressIds = array();
foreach ($addresses as $key => $addressValue) {
- if (CRM_Utils_Array::value('master_id', $addressValue)) {
+ if (!empty($addressValue['master_id'])) {
$masterAddressIds[] = $addressValue['master_id'];
}
}
static function add($params) {
// label or name
- if (!CRM_Utils_Array::value('label', $params)) {
+ if (empty($params['label'])) {
return;
}
- if (CRM_Utils_Array::value('parent_id', $params) &&
+ if (!empty($params['parent_id']) &&
!CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $params['parent_id'])
) {
return;
$active = $contactType->is_active;
}
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$params = array('name' => "New $contactName");
$newParams = array(
'label' => "New $contact",
*/
public static function &create(&$params) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Group', $params['id'], $params);
}
else {
array_keys($group->parents)
) . CRM_Core_DAO::VALUE_SEPARATOR;
}
- if (!CRM_Utils_Array::value('id', $params) &&
+ if (empty($params['id']) &&
!$nameParam
) {
$group->name .= "_tmp";
return NULL;
}
- if (!CRM_Utils_Array::value('id', $params) &&
+ if (empty($params['id']) &&
!$nameParam
) {
$group->name = substr($group->name, 0, -4) . "_{$group->id}";
$group->save();
// add custom field values
- if (CRM_Utils_Array::value('custom', $params)) {
+ if (!empty($params['custom'])) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_group', $group->id);
}
}
}
- if (CRM_Utils_Array::value('organization_id', $params)) {
+ if (!empty($params['organization_id'])) {
$groupOrg = array();
$groupOrg = $params;
$groupOrg['group_id'] = $group->id;
CRM_Contact_BAO_GroupContactCache::add($group->id);
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Group', $group->id, $group);
}
else {
* @static
*/
public static function createSmartGroup(&$params) {
- if (CRM_Utils_Array::value('formValues', $params)) {
+ if (!empty($params['formValues'])) {
$ssParams = $params;
unset($ssParams['id']);
if (isset($ssParams['saved_search_id'])) {
}
$smartGroupId = NULL;
- if (CRM_Utils_Array::value('saved_search_id', $params)) {
+ if (!empty($params['saved_search_id'])) {
$smartGroupId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $ssId, 'id', 'saved_search_id');
}
else {
$groups = CRM_Contact_BAO_Group::getGroupList($params);
//skip total if we are making call to show only children
- if ( !CRM_Utils_Array::value('parent_id', $params) ) {
+ if (empty($params['parent_id'])) {
// add total
$params['total'] = CRM_Contact_BAO_Group::getGroupCount($params);
$groupList[$id]['class'] = implode(' ', $value['class']);
// append parent names if in search mode
- if ( !CRM_Utils_Array::value('parent_id', $params) &&
+ if (empty($params['parent_id']) &&
CRM_Utils_Array::value( 'parents', $value ) ) {
$groupIds = explode(',', $value['parents']);
$title = array();
}
$groupList[$id]['group_description'] = CRM_Utils_Array::value('description', $value);
- if ( CRM_Utils_Array::value('group_type', $value) ) {
+ if (!empty($value['group_type'])) {
$groupList[$id]['group_type'] = $value['group_type'];
}
else {
$whereClause = self::whereClause($params, FALSE);
$query = "SELECT COUNT(*) FROM civicrm_group groups";
- if (CRM_Utils_Array::value('created_by', $params)) {
+ if (!empty($params['created_by'])) {
$query .= "
INNER JOIN civicrm_contact createdBy
ON createdBy.id = groups.created_id";
// check which values has to be add/remove contact from group
foreach ($allGroup as $key => $varValue) {
- if (CRM_Utils_Array::value($key, $params) && !array_key_exists($key, $contactGroup)) {
+ if (!empty($params[$key]) && !array_key_exists($key, $contactGroup)) {
// add contact to group
CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $key, $method);
}
- elseif (!CRM_Utils_Array::value($key, $params) && array_key_exists($key, $contactGroup)) {
+ elseif (empty($params[$key]) && array_key_exists($key, $contactGroup)) {
// remove contact from group
CRM_Contact_BAO_GroupContact::removeContactsFromGroup($contactIds, $key, $method);
}
* @static
*/
static function formatValues(&$params, &$formatedValues) {
- if (CRM_Utils_Array::value('group_organization', $params)) {
+ if (!empty($params['group_organization'])) {
$formatedValues['id'] = $params['group_organization'];
}
- if (CRM_Utils_Array::value('group_id', $params)) {
+ if (!empty($params['group_id'])) {
$formatedValues['group_id'] = $params['group_id'];
}
- if (CRM_Utils_Array::value('organization_id', $params)) {
+ if (!empty($params['organization_id'])) {
$formatedValues['organization_id'] = $params['organization_id'];
}
}
*/
static function dataExists($params) {
// return if no data present
- if (CRM_Utils_Array::value('organization_id', $params) &&
+ if (!empty($params['organization_id']) &&
CRM_Utils_Array::value('group_id', $params)
) {
return TRUE;
);
// make sure we have all the name fields.
foreach ($nameParams as $name => $value) {
- if (!CRM_Utils_Array::value($name, $formatted) && $value) {
+ if (empty($formatted[$name]) && $value) {
$formatted[$name] = $value;
}
}
//start further check for email.
if (empty($sortName) || empty($displayName)) {
$email = NULL;
- if (CRM_Utils_Array::value('email', $params) &&
+ if (!empty($params['email']) &&
is_array($params['email'])
) {
foreach ($params['email'] as $emailBlock) {
}
foreach ($this->_params as $value) {
- if (!CRM_Utils_Array::value(0, $value)) {
+ if (empty($value[0])) {
continue;
}
$cfID = CRM_Core_BAO_CustomField::getKeyID($value[0]);
function addSpecialFields() {
static $special = array('contact_type', 'contact_sub_type', 'sort_name', 'display_name');
foreach ($special as $name) {
- if (CRM_Utils_Array::value($name, $this->_returnProperties)) {
+ if (!empty($this->_returnProperties[$name])) {
$this->_select[$name] = "contact_a.{$name} as $name";
$this->_element[$name] = 1;
}
}
$cfID = CRM_Core_BAO_CustomField::getKeyID($name);
- if (
- CRM_Utils_Array::value($name, $this->_paramLookup) ||
+ if (!empty($this->_paramLookup[$name]) ||
CRM_Utils_Array::value($name, $this->_returnProperties) ||
$makeException
) {
CRM_Utils_Array::value('is_search_range', $field)
) {
// this is a custom field with range search enabled, so we better check for two/from values
- if (CRM_Utils_Array::value($name . '_from', $this->_paramLookup)) {
+ if (!empty($this->_paramLookup[$name . '_from'])) {
if (!array_key_exists($cfID, $this->_cfIDs)) {
$this->_cfIDs[$cfID] = array();
}
}
}
}
- if (CRM_Utils_Array::value($name . '_to', $this->_paramLookup)) {
+ if (!empty($this->_paramLookup[$name . '_to'])) {
if (!array_key_exists($cfID, $this->_cfIDs)) {
$this->_cfIDs[$cfID] = array();
}
* @access public
*/
function addHierarchicalElements() {
- if (!CRM_Utils_Array::value('location', $this->_returnProperties)) {
+ if (empty($this->_returnProperties['location'])) {
return;
}
if (!is_array($this->_returnProperties['location'])) {
$this->_element["{$name}-{$elementFullName}"] = 1;
}
- if (!CRM_Utils_Array::value("`$tName`", $processed)) {
+ if (empty($processed["`$tName`"])) {
$processed["`$tName`"] = 1;
$newName = $tableName . '_' . $index;
switch ($tableName) {
if ($addWhereCount) {
$locClause = array();
foreach ($this->_whereTables as $tableName => $clause) {
- if (CRM_Utils_Array::value($tableName, $locationTypeJoin)) {
+ if (!empty($locationTypeJoin[$tableName])) {
$locClause[] = $locationTypeJoin[$tableName];
}
}
* @access public
*/
function addMultipleElements() {
- if (!CRM_Utils_Array::value('website', $this->_returnProperties)) {
+ if (empty($this->_returnProperties['website'])) {
return;
}
if (!is_array($this->_returnProperties['website'])) {
$from = $this->_simpleFromClause;
}
else {
- if (CRM_Utils_Array::value('group', $this->_paramLookup)) {
+ if (!empty($this->_paramLookup['group'])) {
// make sure there is only one element
// this is used when we are running under smog and need to know
// how the contact was added (CRM-1203)
$this->includeContactIds();
if (!empty($this->_params)) {
foreach (array_keys($this->_params) as $id) {
- if (!CRM_Utils_Array::value(0, $this->_params[$id])) {
+ if (empty($this->_params[$id][0])) {
continue;
}
// check for both id and contact_id
}
$type = NULL;
- if (CRM_Utils_Array::value('type', $field)) {
+ if (!empty($field['type'])) {
$type = CRM_Utils_Type::typeToString($field['type']);
}
return $from;
}
- if (CRM_Utils_Array::value('civicrm_worldregion', $tables)) {
+ if (!empty($tables['civicrm_worldregion'])) {
$tables = array_merge(array('civicrm_country' => 1), $tables);
}
}
// add group_contact table if group table is present
- if (CRM_Utils_Array::value('civicrm_group', $tables) &&
+ if (!empty($tables['civicrm_group']) &&
!CRM_Utils_Array::value('civicrm_group_contact', $tables)
) {
$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 (CRM_Utils_Array::value('civicrm_subscription_history', $tables)
- && !CRM_Utils_Array::value('civicrm_group', $tables)
+ if (!empty($tables['civicrm_subscription_history']) && !CRM_Utils_Array::value('civicrm_group', $tables)
) {
$tables = array_merge(array(
'civicrm_group' => 1,
continue;
}
- if (CRM_Utils_Array::value($name, $inner)) {
+ if (!empty($inner[$name])) {
$side = 'INNER';
}
- elseif (CRM_Utils_Array::value($name, $right)) {
+ elseif (!empty($right[$name])) {
$side = 'RIGHT';
}
else {
// left join
$groupIDs = array_keys($value);
- if (CRM_Utils_Array::value(0, $groupIDs) &&
+ if (!empty($groupIDs[0]) &&
CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group',
$groupIDs[0],
'saved_search_id'
*/
function postalCode(&$values) {
// skip if the fields dont have anything to do with postal_code
- if (!CRM_Utils_Array::value('postal_code', $this->_fields)) {
+ if (empty($this->_fields['postal_code'])) {
return;
}
}
$values = array();
foreach ($this->_pseudoConstantsSelect as $key => $value) {
- if (CRM_Utils_Array::value('sorting', $this->_pseudoConstantsSelect[$key])) {
+ if (!empty($this->_pseudoConstantsSelect[$key]['sorting'])) {
continue;
}
$present = array();
foreach ($this->_pseudoConstantsSelect as $name => $value) {
- if (CRM_Utils_Array::value('table', $value)) {
+ if (!empty($value['table'])) {
$regex = "/({$value['table']}\.|{$name})/";
if (preg_match($regex, $sort)) {
$this->_elemnt[$value['element']] = 1;
$validContacts = TRUE;
//validate contacts in update mode also.
- if (CRM_Utils_Array::value('contact', $ids) &&
+ if (!empty($ids['contact']) &&
CRM_Utils_Array::value('contactTarget', $ids)
) {
if (self::checkValidRelationship($params, $ids, $ids['contactTarget'])) {
$relationship->save();
// add custom field values
- if (CRM_Utils_Array::value('custom', $params)) {
+ if (!empty($params['custom'])) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_relationship', $relationship->id);
}
$v = array();
// get the specific number of relationship or all relationships.
- if (CRM_Utils_Array::value('numRelationship', $params)) {
+ if (!empty($params['numRelationship'])) {
$v['data'] = &CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], NULL, $params['numRelationship']);
}
else {
$membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($membershipValues['membership_type_id']);
// Check if contact's relationship type exists in membership type
$relTypeDirs = array();
- if (CRM_Utils_Array::value('relationship_type_id', $membershipType)) {
+ if (!empty($membershipType['relationship_type_id'])) {
$relTypeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $membershipType['relationship_type_id']);
}
- if (CRM_Utils_Array::value('relationship_direction', $membershipType)) {
+ if (!empty($membershipType['relationship_direction'])) {
$relDirections = explode(CRM_Core_DAO::VALUE_SEPARATOR, $membershipType['relationship_direction']);
}
foreach ($relTypeIds as $key => $value) {
}
foreach (array(
'join_date', 'start_date', 'end_date') as $dateField) {
- if (CRM_Utils_Array::value($dateField, $membershipValues)) {
+ if (!empty($membershipValues[$dateField])) {
$membershipValues[$dateField] = CRM_Utils_Date::processDate($membershipValues[$dateField]);
}
}
*/
static function add(&$params, &$ids) {
//to change name, CRM-3336
- if (!CRM_Utils_Array::value('label_a_b', $params) && CRM_Utils_Array::value('name_a_b', $params)) {
+ if (empty($params['label_a_b']) && CRM_Utils_Array::value('name_a_b', $params)) {
$params['label_a_b'] = $params['name_a_b'];
}
- if (!CRM_Utils_Array::value('label_b_a', $params) && CRM_Utils_Array::value('name_b_a', $params)) {
+ if (empty($params['label_b_a']) && CRM_Utils_Array::value('name_b_a', $params)) {
$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 (!CRM_Utils_Array::value('relationshipType', $ids)) {
- if (!CRM_Utils_Array::value('name_a_b', $params) && CRM_Utils_Array::value('label_a_b', $params)) {
+ if (empty($ids['relationshipType'])) {
+ if (empty($params['name_a_b']) && CRM_Utils_Array::value('label_a_b', $params)) {
$params['name_a_b'] = $params['label_a_b'];
}
- if (!CRM_Utils_Array::value('name_b_a', $params) && CRM_Utils_Array::value('label_b_a', $params)) {
+ if (empty($params['name_b_a']) && CRM_Utils_Array::value('label_b_a', $params)) {
$params['name_b_a'] = $params['label_b_a'];
}
}
if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $id, 'mapping_id')) {
return CRM_Core_BAO_Mapping::formattedFields($fv);
}
- elseif (CRM_Utils_Array::value('customSearchID', $fv)) {
+ elseif (!empty($fv['customSearchID'])) {
return $fv;
}
else {
static function whereClause($id, &$tables, &$whereTables) {
$params = self::getSearchParams($id);
if ($params) {
- if (CRM_Utils_Array::value('customSearchID', $params)) {
+ if (!empty($params['customSearchID'])) {
// this has not yet been implemented
} else {
return CRM_Contact_BAO_Query::getWhereClause($params, NULL, $tables, $whereTables);
$params = self::getSearchParams($id);
if ($params) {
- if (CRM_Utils_Array::value('customSearchID', $params)) {
+ if (!empty($params['customSearchID'])) {
return CRM_Contact_BAO_SearchCustom::fromWhereEmail(NULL, $id);
}
else {
$returnProperities = array('id', 'contact_type', 'contact_sub_type', 'modified_date');
CRM_Core_DAO::commonRetrieve('CRM_Contact_DAO_Contact', $params, $defaults, $returnProperities);
- if (!CRM_Utils_Array::value('id', $defaults)) {
+ if (empty($defaults['id'])) {
CRM_Core_Error::statusBounce(ts('A Contact with that ID does not exist: %1', array(1 => $this->_contactId)));
}
'address_options'
);
$this->_parseStreetAddress = FALSE;
- if (CRM_Utils_Array::value('street_address', $addressOptions) &&
+ if (!empty($addressOptions['street_address']) &&
CRM_Utils_Array::value('street_address_parsing', $addressOptions)
) {
$this->_parseStreetAddress = TRUE;
CRM_Contact_Form_Location::preProcess($this);
// retain the multiple count custom fields value
- if(CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
$customGroupCount = CRM_Utils_Array::value('hidden_custom_group_count', $_POST);
if ($contactSubType = CRM_Utils_Array::value( 'contact_sub_type', $_POST)) {
else {
$contactSubType = $this->_contactSubType;
// need contact sub type to build related grouptree array during post process
- if (CRM_Utils_Array::value('contact_sub_type', $_POST)) {
+ if (!empty($_POST['contact_sub_type'])) {
$contactSubType = $_POST['contact_sub_type'];
}
//only custom data has preprocess hence directly call it
}
}
- if (CRM_Utils_Array::value('contact_sub_type', $defaults)) {
+ if (!empty($defaults['contact_sub_type'])) {
$defaults['contact_sub_type'] = $this->_oldSubtypes;
}
}
//set address block defaults
CRM_Contact_Form_Edit_Address::setDefaultValues( $defaults, $this );
- if (CRM_Utils_Array::value('image_URL', $defaults)) {
+ if (!empty($defaults['image_URL'])) {
list($imageWidth, $imageHeight) = getimagesize($defaults['image_URL']);
list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight);
$this->assign('imageWidth', $imageWidth);
}
// set defaults for country-state widget
- if (CRM_Utils_Array::value('address', $defaults) && is_array($defaults['address'])) {
+ if (!empty($defaults['address']) && is_array($defaults['address'])) {
foreach ($defaults['address'] as $blockId => $values) {
CRM_Contact_Form_Edit_Address::fixStateSelect($this,
"address[$blockId][country_id]",
foreach ($blocks as $name => $label) {
$hasData = $hasPrimary = array();
$name = strtolower($name);
- if (CRM_Utils_Array::value($name, $fields) && is_array($fields[$name])) {
+ if (!empty($fields[$name]) && is_array($fields[$name])) {
foreach ($fields[$name] as $instance => $blockValues) {
$dataExists = self::blockDataExists($blockValues);
}
$hasData[] = $instance;
- if (CRM_Utils_Array::value('is_primary', $blockValues)) {
+ if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
if (!$primaryID &&
in_array($name, array(
}
}
- if (!CRM_Utils_Array::value('location_type_id', $blockValues)) {
+ if (empty($blockValues['location_type_id'])) {
$errors["{$name}[$instance][location_type_id]"] = ts('The Location Type should be set if there is %1 information.', array(1 => $label));
}
}
foreach ($fields['address'] as $cnt => $address) {
if ($streetNumber = CRM_Utils_Array::value('street_number', $address)) {
$parsedAddress = CRM_Core_BAO_Address::parseStreetAddress($address['street_number']);
- if (!CRM_Utils_Array::value('street_number', $parsedAddress)) {
+ if (empty($parsedAddress['street_number'])) {
$invalidStreetNumbers[] = $cnt;
}
}
),
);
- if (CRM_Utils_Array::value('contact_sub_type', $this->_values)) {
+ if (!empty($this->_values['contact_sub_type'])) {
$this->_oldSubtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR,
trim($this->_values['contact_sub_type'], CRM_Core_DAO::VALUE_SEPARATOR)
);
CRM_Contact_BAO_Contact_Optimizer::edit( $params, $this->_preEditValues );
- if (CRM_Utils_Array::value('image_URL', $params)) {
+ if (!empty($params['image_URL'])) {
CRM_Contact_BAO_Contact::processImageParams($params);
}
unset($params['group']);
}
- if (CRM_Utils_Array::value('contact_id', $params) && ($this->_action & CRM_Core_Action::UPDATE)) {
+ if (!empty($params['contact_id']) && ($this->_action & CRM_Core_Action::UPDATE)) {
// figure out which all groups are intended to be removed
$contactGroupList = CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], 'Added');
if (is_array($contactGroupList)) {
*/
static function checkDuplicateContacts(&$fields, &$errors, $contactID, $contactType) {
// if this is a forced save, ignore find duplicate rule
- if (!CRM_Utils_Array::value('_qf_Contact_upload_duplicate', $fields)) {
+ if (empty($fields['_qf_Contact_upload_duplicate'])) {
$dedupeParams = CRM_Dedupe_Finder::formatParams($fields, $contactType);
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $contactType, 'Supervised', array($contactID));
$template = CRM_Core_Smarty::singleton();
$template->assign('isDuplicate', 1);
}
- elseif (CRM_Utils_Array::value('_qf_Contact_refresh_dedupe', $fields)) {
+ elseif (!empty($fields['_qf_Contact_refresh_dedupe'])) {
// add a session message for no matching contacts
CRM_Core_Session::setStatus(ts('No matching contact found.'), ts('None Found'), 'info');
}
$parseFieldName = 'street_address';
foreach (array(
'street_number', 'street_name', 'street_unit') as $fld) {
- if (CRM_Utils_Array::value($fld, $address)) {
+ if (!empty($address[$fld])) {
$parseFieldName = 'street_number';
$buildStreetAddress = TRUE;
break;
$success = TRUE;
// consider address is automatically parseable,
// when we should found street_number and street_name
- if (!CRM_Utils_Array::value('street_name', $parsedFields) ||
+ if (empty($parsedFields['street_name']) ||
!CRM_Utils_Array::value('street_number', $parsedFields)
) {
$success = FALSE;
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
for ($i = 0; $i <= $_POST['hidden_custom_group_count'][$this->_groupID]; $i++) {
CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, $i);
CRM_Custom_Form_CustomData::buildQuickForm($this);
$this->_contactSubType
);
- if (!CRM_Utils_Array::value('hidden_custom_group_count', $_POST)) {
+ if (empty($_POST['hidden_custom_group_count'])) {
// custom data building in edit mode (required to handle multi-value)
$groupTree = &CRM_Core_BAO_CustomGroup::getTree($this->_contactType, $this, $this->_tableID,
$this->_groupID, $this->_contactSubType
*/
public function postProcess() {
$values = $this->exportValues();
- if (CRM_Utils_Array::value('_qf_DedupeFind_submit', $_POST)) {
+ if (!empty($_POST['_qf_DedupeFind_submit'])) {
//used for cancel button
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/deduperules', 'reset=1'));
return;
$disabled = array();
$reserved = $this->add('checkbox', 'is_reserved', ts('Reserved?'));
- if (CRM_Utils_Array::value('is_reserved', $this->_defaults)) {
+ if (!empty($this->_defaults['is_reserved'])) {
$reserved->freeze();
$disabled = array('disabled' => TRUE);
}
*/
static function formRule($fields, $files, $self) {
$errors = array();
- if (CRM_Utils_Array::value('is_reserved', $fields)) {
+ if (!empty($fields['is_reserved'])) {
return TRUE;
}
$fieldSelected = FALSE;
for ($count = 0; $count < self::RULES_COUNT; $count++) {
- if (CRM_Utils_Array::value("where_$count", $fields)) {
+ if (!empty($fields["where_$count"])) {
$fieldSelected = TRUE;
break;
}
$daoObj = new CRM_Core_DAO();
$database = $daoObj->database();
for ($count = 0; $count < self::RULES_COUNT; $count++) {
- if (!CRM_Utils_Array::value("where_$count", $values)) {
+ if (empty($values["where_$count"])) {
continue;
}
list($table, $field) = explode('.', CRM_Utils_Array::value("where_$count", $values));
list($title, $attributes, $select) = $v;
$nameWithoutID = strpos($name, '_id') !== FALSE ? substr($name, 0, -3) : $name;
- if (!CRM_Utils_Array::value($nameWithoutID, $addressOptions)) {
+ if (empty($addressOptions[$nameWithoutID])) {
$continue = TRUE;
if (in_array($nameWithoutID, array(
'street_number', 'street_name', 'street_unit')) &&
}
// check for state/county match if not report error to user.
- if (CRM_Utils_Array::value('address', $fields) && is_array($fields['address'])) {
+ if (!empty($fields['address']) && is_array($fields['address'])) {
foreach ($fields['address'] as $instance => $addressValues) {
if (CRM_Utils_System::isNull($addressValues)) {
}
}
- if (CRM_Utils_Array::value('use_shared_address', $addressValues) && !CRM_Utils_Array::value('master_id', $addressValues)) {
+ if (!empty($addressValues['use_shared_address']) && !CRM_Utils_Array::value('master_id', $addressValues)) {
$errors["address[$instance][use_shared_address]"] = ts('Please select valid shared contact or a contact with valid address.');
}
}
$shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($defaults['address']);
foreach ($defaults['address'] as $key => $addressValue) {
- if (CRM_Utils_Array::value('master_id', $addressValue) && !$shareAddressContactNames[$addressValue['master_id']]['is_deleted']) {
+ if (!empty($addressValue['master_id']) && !$shareAddressContactNames[$addressValue['master_id']]['is_deleted']) {
$sharedAddresses[$key]['shared_address_display'] = array(
'address' => $addressValue['display'],
'name' => $shareAddressContactNames[$addressValue['master_id']]['name'],
foreach ($_POST['address'] as $cnt => $values) {
$showField = 'streetAddress';
foreach (array('street_number', 'street_name', 'street_unit') as $fld) {
- if (CRM_Utils_Array::value($fld, $values)) {
+ if (!empty($values[$fld])) {
$showField = 'addressElements';
break;
}
//build custom data.
$contactSubType = NULL;
- if (CRM_Utils_Array::value("hidden_custom", $_POST) &&
+ if (!empty($_POST["hidden_custom"]) &&
CRM_Utils_Array::value('contact_sub_type', $_POST)
) {
$contactSubType = $_POST['contact_sub_type'];
$primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID);
// make sure that household name is set
- if (!CRM_Utils_Array::value('household_name', $fields)) {
+ if (empty($fields['household_name'])) {
$errors['household_name'] = 'Household Name should be set.';
}
$primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID);
// make sure that organization name is set
- if (!CRM_Utils_Array::value('organization_name', $fields)) {
+ if (empty($fields['organization_name'])) {
$errors['organization_name'] = 'Organization Name should be set.';
}
'address_options'
);
$this->_parseStreetAddress = FALSE;
- if (CRM_Utils_Array::value('street_address', $addressOptions) &&
+ if (!empty($addressOptions['street_address']) &&
CRM_Utils_Array::value('street_address_parsing', $addressOptions)
) {
$this->_parseStreetAddress = TRUE;
$config = CRM_Core_Config::singleton();
//set address block defaults
- if (CRM_Utils_Array::value('address', $defaults)) {
+ if (!empty($defaults['address'])) {
CRM_Contact_Form_Edit_Address::setDefaultValues($defaults, $this);
}
else {
$params = $this->exportValues();
// Process / save demographics
- if (!CRM_Utils_Array::value('is_deceased', $params)) {
+ if (empty($params['is_deceased'])) {
$params['is_deceased'] = FALSE;
$params['deceased_date'] = NULL;
}
*/
static function formRule($fields, $errors) {
$hasData = $hasPrimary = $errors = array();
- if (CRM_Utils_Array::value('email', $fields) && is_array($fields['email'])) {
+ if (!empty($fields['email']) && is_array($fields['email'])) {
foreach ($fields['email'] as $instance => $blockValues) {
$dataExists = CRM_Contact_Form_Contact::blockDataExists($blockValues);
if ($dataExists) {
$hasData[] = $instance;
- if (CRM_Utils_Array::value('is_primary', $blockValues)) {
+ if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
}
}
*/
static function formRule($fields, $errors) {
$hasData = $hasPrimary = $errors = array();
- if (CRM_Utils_Array::value('im', $fields) && is_array($fields['im'])) {
+ if (!empty($fields['im']) && is_array($fields['im'])) {
foreach ($fields['im'] as $instance => $blockValues) {
$dataExists = CRM_Contact_Form_Contact::blockDataExists($blockValues);
if ($dataExists) {
$hasData[] = $instance;
- if (CRM_Utils_Array::value('is_primary', $blockValues)) {
+ if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
if (!$primaryID &&
CRM_Utils_Array::value('im', $blockValues)) {
*/
static function formRule($fields, $errors) {
$hasData = $hasPrimary = $errors = array();
- if (CRM_Utils_Array::value('openid', $fields) && is_array($fields['openid'])) {
+ if (!empty($fields['openid']) && is_array($fields['openid'])) {
foreach ($fields['openid'] as $instance => $blockValues) {
$dataExists = CRM_Contact_Form_Contact::blockDataExists($blockValues);
if ($dataExists) {
$hasData[] = $instance;
- if (CRM_Utils_Array::value('is_primary', $blockValues)) {
+ if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
if (!$primaryID &&
CRM_Utils_Array::value('openid', $blockValues)) {
*/
static function formRule($fields, $errors) {
$hasData = $hasPrimary = $errors = array();
- if (CRM_Utils_Array::value('phone', $fields) && is_array($fields['phone'])) {
+ if (!empty($fields['phone']) && is_array($fields['phone'])) {
$primaryID = null;
foreach ($fields['phone'] as $instance => $blockValues) {
$dataExists = CRM_Contact_Form_Contact::blockDataExists($blockValues);
if ($dataExists) {
$hasData[] = $instance;
- if (CRM_Utils_Array::value('is_primary', $blockValues)) {
+ if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
if (!$primaryID &&
CRM_Utils_Array::value('phone', $blockValues)) {
$name = strtolower($blockName);
$instances = array(1);
- if (CRM_Utils_Array::value($name, $_POST) && is_array($_POST[$name])) {
+ 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])) {
CRM_Core_Session::setStatus(ts('Contact id %1 has been updated and contact id %2 has been deleted.', array(1 => $this->_cid, 2 => $this->_oid)), ts('Contacts Merged'), 'success');
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_cid}");
- if (CRM_Utils_Array::value('_qf_Merge_submit', $formValues)) {
+ if (!empty($formValues['_qf_Merge_submit'])) {
$listParamsURL = "reset=1&action=update&rgid={$this->_rgid}";
if ($this->_gid) {
$listParamsURL .= "&gid={$this->_gid}";
);
CRM_Utils_System::redirect($lisitingURL);
}
- if (CRM_Utils_Array::value('_qf_Merge_done', $formValues)) {
+ if (!empty($formValues['_qf_Merge_done'])) {
CRM_Utils_System::redirect($url);
}
$this->_allRelationshipNames = CRM_Core_PseudoConstant::relationshipType('name');
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
if ($this->_action & CRM_Core_Action::UPDATE) {
if (!empty($this->_values)) {
$defaults['relationship_type_id'] = $this->_rtypeId;
- if (CRM_Utils_Array::value('start_date', $this->_values)) {
+ if (!empty($this->_values['start_date'])) {
list($defaults['start_date']) = CRM_Utils_Date::setDateDefaults($this->_values['start_date']);
}
- if (CRM_Utils_Array::value('end_date', $this->_values)) {
+ if (!empty($this->_values['end_date'])) {
list($defaults['end_date']) = CRM_Utils_Date::setDateDefaults($this->_values['end_date']);
}
$defaults['description'] = CRM_Utils_Array::value('description', $this->_values);
// store the submitted values in an array
$params = $this->controller->exportValues($this->_name);
$quickSave = FALSE;
- if (CRM_Utils_Array::value('_qf_Relationship_refresh_save', $_POST) ||
+ if (!empty($_POST['_qf_Relationship_refresh_save']) ||
CRM_Utils_Array::value('_qf_Relationship_refresh_savedetails', $_POST)
) {
$quickSave = TRUE;
$this->set('searchDone', 0);
$this->set('callAjax', FALSE);
- if (CRM_Utils_Array::value('_qf_Relationship_refresh', $_POST) || $quickSave) {
+ if (!empty($_POST['_qf_Relationship_refresh']) || $quickSave) {
if (is_numeric($params['contact_select_id'][1])) {
if ($quickSave) {
$params['contact_check'] = array($params['contact_select_id'][1] => 1);
//make sure we has to have employer id before firing queries, CRM-7306
$employerId = CRM_Utils_Array::value('current_employee_id', $this->_values);
$isDisabled = TRUE;
- if (CRM_Utils_Array::value('is_active', $params)) {
+ if (!empty($params['is_active'])) {
$isDisabled = FALSE;
}
$relChanged = TRUE;
$params['is_permission_b_a'] = CRM_Utils_Array::value('is_permission_b_a', $params, FALSE);
}
elseif ($quickSave) {
- if (CRM_Utils_Array::value('add_current_employee', $params) &&
+ if (!empty($params['add_current_employee']) &&
$this->_allRelationshipNames[$relationshipTypeId]['name_a_b'] == 'Employee of'
) {
$params['employee_of'] = $params['contact_select_id'][1];
}
- elseif (CRM_Utils_Array::value('add_current_employer', $params) &&
+ elseif (!empty($params['add_current_employer']) &&
$this->_allRelationshipNames[$relationshipTypeId]['name_b_a'] == 'Employer of'
) {
$params['employer_of'] = array($params['contact_select_id'][1] => 1);
//handle current employee/employer relationship, CRM-3532
if ($this->_allRelationshipNames[$relationshipTypeId]["name_{$this->_rtype}"] == 'Employee of') {
$orgId = NULL;
- if (CRM_Utils_Array::value('employee_of', $params)) {
+ if (!empty($params['employee_of'])) {
$orgId = $params['employee_of'];
}
elseif ($this->_action & CRM_Core_Action::UPDATE) {
- if (CRM_Utils_Array::value('is_current_employer', $params) &&
+ if (!empty($params['is_current_employer']) &&
CRM_Utils_Array::value('is_active', $params)
) {
if (CRM_Utils_Array::value('contactTarget', $ids) !=
}
elseif ($this->_allRelationshipNames[$relationshipTypeId]["name_{$this->_rtype}"] == 'Employer of') {
$individualIds = array();
- if (CRM_Utils_Array::value('employer_of', $params)) {
+ if (!empty($params['employer_of'])) {
$individualIds = array_keys($params['employer_of']);
}
elseif ($this->_action & CRM_Core_Action::UPDATE) {
- if (CRM_Utils_Array::value('is_current_employer', $params)) {
+ if (!empty($params['is_current_employer'])) {
if (CRM_Utils_Array::value('contactTarget', $ids) !=
CRM_Utils_Array::value('current_employee_id', $this->_values)
) {
*/
static function formRule($params, $files, $form) {
// hack, no error check for refresh
- if (CRM_Utils_Array::value('_qf_Relationship_refresh', $_POST) ||
+ if (!empty($_POST['_qf_Relationship_refresh']) ||
CRM_Utils_Array::value('_qf_Relationship_refresh_save', $_POST) ||
CRM_Utils_Array::value('_qf_Relationship_refresh_savedetails', $_POST)
) {
$errors = array();
$employerId = NULL;
- if (CRM_Utils_Array::value('contact_check', $params) && is_array($params['contact_check'])) {
+ if (!empty($params['contact_check']) && is_array($params['contact_check'])) {
foreach ($params['contact_check'] as $cid => $dontCare) {
$message = CRM_Contact_BAO_Relationship::checkValidRelationship($params, $ids, $cid);
if ($message) {
}
}
- if (CRM_Utils_Array::value('employee_of', $params) &&
+ if (!empty($params['employee_of']) &&
!$employerId
) {
if ($form->_callAjax) {
}
}
- if (CRM_Utils_Array::value('employer_of', $params) &&
+ if (!empty($params['employer_of']) &&
CRM_Utils_Array::value('contact_check', $params) &&
array_diff(array_keys($params['employer_of']), array_keys($params['contact_check']))
) {
$errors = array();
// check start and end date
- if (CRM_Utils_Array::value('start_date', $params) &&
+ if (!empty($params['start_date']) &&
CRM_Utils_Array::value('end_date', $params)
) {
$start_date = CRM_Utils_Date::format(CRM_Utils_Array::value('start_date', $params));
return;
}
- if (CRM_Utils_Array::value('store_contacts', $params)) {
+ if (!empty($params['store_contacts'])) {
$storedContacts = array();
foreach (explode(',', $params['store_contacts']) as $value) {
if ($value) {
$params['contact_check'] = $storedContacts;
}
- if (CRM_Utils_Array::value('store_employers', $params)) {
+ if (!empty($params['store_employers'])) {
$employeeContacts = array();
foreach (explode(',', $params['store_employers']) as $value) {
if ($value) {
}
// show the context menu only when we’re not searching for deleted contacts; CRM-5673
- if (!CRM_Utils_Array::value('deleted_contacts', $this->_formValues)) {
+ if (empty($this->_formValues['deleted_contacts'])) {
$menuItems = CRM_Contact_BAO_Contact::contextMenu();
$primaryActions = CRM_Utils_Array::value('primaryActions', $menuItems, array());
$this->_contextMenu = CRM_Utils_Array::value('moreActions', $menuItems, array());
$this->_formValues['operator'] = $this->_operator;
}
- if (!CRM_Utils_Array::value('qfKey', $this->_formValues)) {
+ if (empty($this->_formValues['qfKey'])) {
$this->_formValues['qfKey'] = $this->controller->_key;
}
) {
$allPanes[$name]['open'] = 'true';
- if (CRM_Utils_Array::value($type, $components)) {
+ if (!empty($components[$type])) {
$c = $components[$type];
$this->add('hidden', "hidden_$type", 1);
$c->buildAdvancedSearchPaneForm($this);
) {
foreach (array(
'case_type_id', 'case_status_id', 'case_deleted', 'case_tags') as $caseCriteria) {
- if (CRM_Utils_Array::value($caseCriteria, $this->_formValues)) {
+ if (!empty($this->_formValues[$caseCriteria])) {
$allCases = TRUE;
$this->_formValues['case_owner'] = 1;
continue;
'advanced_search_options'
);
- if (CRM_Utils_Array::value('contactType', $searchOptions)) {
+ if (!empty($searchOptions['contactType'])) {
$contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements();
$this->add('select', 'contact_type',
ts('is...'),
);
}
- if (CRM_Utils_Array::value('groups', $searchOptions)) {
+ if (!empty($searchOptions['groups'])) {
// Arrange groups into hierarchical listing (child groups follow their parents and have indentation spacing in title)
$groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($this->_group, NULL, ' ', TRUE);
$this->_groupElement = &$this->addElement('select', 'group', ts('in'), $group);
}
- if (CRM_Utils_Array::value('tags', $searchOptions)) {
+ if (!empty($searchOptions['tags'])) {
// tag criteria
if (!empty($this->_tag)) {
$tag = array(
$defaults['sort_name'] = CRM_Utils_Array::value('sort_name', $this->_formValues);
foreach (self::$csv as $v) {
- if (CRM_Utils_Array::value($v, $this->_formValues) && is_array($this->_formValues[$v])) {
+ if (!empty($this->_formValues[$v]) && is_array($this->_formValues[$v])) {
$tmpArray = array_keys($this->_formValues[$v]);
$defaults[$v] = array_pop($tmpArray);
}
static function formRule($fields) {
// check actionName and if next, then do not repeat a search, since we are going to the next page
if (array_key_exists('_qf_Search_next', $fields)) {
- if (!CRM_Utils_Array::value('task', $fields)) {
+ if (empty($fields['task'])) {
return array('task' => 'Please select a valid action.');
}
* @access public
*/
static function formRule($values, $files, $self) {
- if (CRM_Utils_Array::value('addMore', $values) || CRM_Utils_Array::value('addBlock', $values)) {
+ if (!empty($values['addMore']) || CRM_Utils_Array::value('addBlock', $values)) {
return TRUE;
}
$fields = self::fields();
$this->_formValues = $this->controller->exportValues($this->_name);
// set the group if group is submitted
- if (CRM_Utils_Array::value('uf_group_id', $this->_formValues)) {
+ if (!empty($this->_formValues['uf_group_id'])) {
$this->set('id', $this->_formValues['uf_group_id']);
}
else {
'county' => 'county',
);
if ($select == 'stateProvince') {
- if (CRM_Utils_Array::value('country', $formValues)) {
+ if (!empty($formValues['country'])) {
$selectElements = array('' => ts('- select -')) + CRM_Core_PseudoConstant::stateProvinceForCountry($formValues['country']);
}
else {
}
foreach ($this->_dates as $name => $title) {
- if (CRM_Utils_Array::value($name, $this->_formValues)) {
+ if (!empty($this->_formValues[$name])) {
$this->{$name} = CRM_Utils_Date::processDate($this->_formValues[$name]);
}
}
// add all the fields for chosen groups
$this->_tables = $this->_options = array();
foreach ($this->_groupTree as $groupID => $group) {
- if (!CRM_Utils_Array::value($groupID, $this->_customGroupIDs)) {
+ if (empty($this->_customGroupIDs[$groupID])) {
continue;
}
function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
//redirect if custom group not select in search criteria
- if (!CRM_Utils_Array::value('custom_group', $this->_formValues)) {
+ if (empty($this->_formValues['custom_group'])) {
CRM_Core_Error::statusBounce(ts("You must select at least one Custom Group as a search criteria."),
CRM_Utils_System::url('civicrm/contact/search/custom',
"reset=1&csid={$this->_formValues['customSearchID']}",
if (!empty($this->_formValues)) {
// add the country and state
- if (CRM_Utils_Array::value('country_id', $this->_formValues)) {
+ if (!empty($this->_formValues['country_id'])) {
$this->_formValues['country'] = CRM_Core_PseudoConstant::country($this->_formValues['country_id']);
}
- if (CRM_Utils_Array::value('state_province_id', $this->_formValues)) {
+ if (!empty($this->_formValues['state_province_id'])) {
$this->_formValues['state_province'] = CRM_Core_PseudoConstant::stateProvince($this->_formValues['state_province_id']);
}
$params = $this->controller->exportValues($this->_name);
$this->set('searchDone', 0);
- if (CRM_Utils_Array::value('_qf_AddToHousehold_refresh', $_POST)) {
+ if (!empty($_POST['_qf_AddToHousehold_refresh'])) {
$searchParams['contact_type'] = array('Household' => 'Household');
$searchParams['rel_contact'] = $params['name'];
self::search($this, $searchParams);
function search(&$form, &$params) {
//max records that will be listed
$searchValues = array();
- if (CRM_Utils_Array::value('rel_contact', $params)) {
+ if (!empty($params['rel_contact'])) {
if (isset($params['rel_contact_id']) &&
is_numeric($params['rel_contact_id'])
) {
$excludedContactIds[] = $form->_contactId;
}
- if (CRM_Utils_Array::value('relationship_type_id', $params)) {
+ if (!empty($params['relationship_type_id'])) {
$relationshipType = new CRM_Contact_DAO_RelationshipType();
list($rid, $direction) = explode('_', $params['relationship_type_id'], 2);
$params = $this->controller->exportValues($this->_name);
$this->set('searchDone', 0);
- if (CRM_Utils_Array::value('_qf_AddToOrganization_refresh', $_POST)) {
+ if (!empty($_POST['_qf_AddToOrganization_refresh'])) {
$searchParams['contact_type'] = array('Organization' => 'Organization');
$searchParams['rel_contact'] = $params['name'];
CRM_Contact_Form_Task_AddToHousehold::search($this, $searchParams);
$contactTags = $tagList = array();
// check if contact tags exists
- if (CRM_Utils_Array::value('tag', $params)) {
+ if (!empty($params['tag'])) {
$contactTags = $params['tag'];
}
// check if tags are selected from taglists
- if (CRM_Utils_Array::value('contact_taglist', $params)) {
+ if (!empty($params['contact_taglist'])) {
foreach ($params['contact_taglist'] as $val) {
if ($val) {
if (is_numeric($val)) {
//CRM-5521
//validate subtype before updating
- if (CRM_Utils_Array::value('contact_sub_type', $value) && !CRM_Contact_BAO_ContactType::isAllowEdit($key)) {
+ if (!empty($value['contact_sub_type']) && !CRM_Contact_BAO_ContactType::isAllowEdit($key)) {
unset($value['contact_sub_type']);
$inValidSubtypeCnt++;
}
//street address consider to be parsed properly,
//If we get street_name and street_number.
- if (!CRM_Utils_Array::value('street_name', $parsedFields) ||
+ if (empty($parsedFields['street_name']) ||
!CRM_Utils_Array::value('street_number', $parsedFields)
) {
$parsedFields = array_fill_keys(array_keys($parsedFields), '');
}
//Added for CRM-1393
- if (CRM_Utils_Array::value('saveTemplate', $fields) && empty($fields['saveTemplateName'])) {
+ if (!empty($fields['saveTemplate']) && empty($fields['saveTemplateName'])) {
$errors['saveTemplateName'] = ts("Enter name to save message template");
}
$additionalDetails = NULL;
$ccValues = $bccValues = array();
foreach ($elements as $element) {
- if (CRM_Utils_Array::value($element, $formValues)) {
+ if (!empty($formValues[$element])) {
$allEmails = explode(',', $formValues[$element]);
foreach ($allEmails as $value) {
list($contactId, $email) = explode('::', $value);
}
// process message template
- if (CRM_Utils_Array::value('saveTemplate', $formValues)
- || CRM_Utils_Array::value('updateTemplate', $formValues)
+ if (!empty($formValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $formValues)
) {
$messageTemplate = array(
'msg_text' => $formValues['text_message'],
'is_active' => TRUE,
);
- if (CRM_Utils_Array::value('saveTemplate', $formValues)) {
+ if (!empty($formValues['saveTemplate'])) {
$messageTemplate['msg_title'] = $formValues['saveTemplateName'];
CRM_Core_BAO_MessageTemplate::add($messageTemplate);
}
- if (CRM_Utils_Array::value('template', $formValues) &&
+ if (!empty($formValues['template']) &&
CRM_Utils_Array::value('updateTemplate', $formValues)
) {
$messageTemplate['id'] = $formValues['template'];
if (stristr($mailingFormat, 'custom_')) {
foreach ($mailingFormatProperties as $token => $true) {
if (substr($token, 0, 7) == 'custom_') {
- if (!CRM_Utils_Array::value($token, $customFormatProperties)) {
+ if (empty($customFormatProperties[$token])) {
$customFormatProperties[$token] = $mailingFormatProperties[$token];
}
}
//get the contacts information
$params = array();
- if (CRM_Utils_Array::value('location_type_id', $fv)) {
+ if (!empty($fv['location_type_id'])) {
$locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$locName = $locType[$fv['location_type_id']];
$location = array('location' => array("{$locName}" => $address));
}
// fix for CRM-2651
- if (CRM_Utils_Array::value('do_not_mail', $fv)) {
+ if (!empty($fv['do_not_mail'])) {
$params[] = array('do_not_mail', '=', 0, 0, 0);
}
// fix for CRM-2613
unset($contact[$locName]);
- if (CRM_Utils_Array::value('county_id', $contact)) {
+ if (!empty($contact['county_id'])) {
unset($contact['county_id']);
}
$valuesothers = array();
$paramsothers = array('contact_id' => $value);
$valuesothers = CRM_Core_BAO_Location::getValues($paramsothers, $valuesothers);
- if (CRM_Utils_Array::value('location_type_id', $fv)) {
+ if (!empty($fv['location_type_id'])) {
foreach ($valuesothers as $vals) {
if ( CRM_Utils_Array::value('location_type_id', $vals) ==
CRM_Utils_Array::value('location_type_id', $fv ) ) {
continue;
}
- if (CRM_Utils_Array::value('addressee_display', $contact)) {
+ if (!empty($contact['addressee_display'])) {
$contact['addressee_display'] = trim($contact['addressee_display']);
}
- if (CRM_Utils_Array::value('addressee', $contact)) {
+ if (!empty($contact['addressee'])) {
$contact['addressee'] = $contact['addressee_display'];
}
*/
function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) {
foreach (array_merge($mailingFormatProperties, array_fill_keys($tokenFields, 1)) as $key => $dontCare) {
- if (CRM_Utils_Array::value($key, $contact)) {
+ if (!empty($contact[$key])) {
return TRUE;
}
}
if (stristr($mailingFormat, 'custom_')) {
foreach ($mailingFormatProperties as $token => $true) {
if (substr($token, 0, 7) == 'custom_') {
- if (!CRM_Utils_Array::value($token, $customFormatProperties)) {
+ if (empty($customFormatProperties[$token])) {
$customFormatProperties[$token] = $mailingFormatProperties[$token];
}
}
}
// fix for CRM-2651
- if (CRM_Utils_Array::value('do_not_mail', $respectDoNotMail)) {
+ if (!empty($respectDoNotMail['do_not_mail'])) {
$params[] = array('do_not_mail', '=', 0, 0, 0);
}
// fix for CRM-2613
unset($contact[$locName]);
- if (CRM_Utils_Array::value('county_id', $contact)) {
+ if (!empty($contact['county_id'])) {
unset($contact['county_id']);
}
continue;
}
- if (CRM_Utils_Array::value('addressee_display', $contact)) {
+ if (!empty($contact['addressee_display'])) {
$contact['addressee_display'] = trim($contact['addressee_display']);
}
- if (CRM_Utils_Array::value('addressee', $contact)) {
+ if (!empty($contact['addressee'])) {
$contact['addressee'] = $contact['addressee_display'];
}
$template = CRM_Core_Smarty::singleton();
//Added for CRM-1393
- if (CRM_Utils_Array::value('saveTemplate', $fields) && empty($fields['saveTemplateName'])) {
+ if (!empty($fields['saveTemplate']) && empty($fields['saveTemplateName'])) {
$errors['saveTemplateName'] = ts("Enter name to save message template");
}
if (!is_numeric($fields['margin_left'])) {
$formValues = $form->controller->exportValues($form->getName());
// process message template
- if (CRM_Utils_Array::value('saveTemplate', $formValues) || CRM_Utils_Array::value('updateTemplate', $formValues)) {
+ if (!empty($formValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $formValues)) {
$messageTemplate = array(
'msg_text' => NULL,
'msg_html' => $formValues['html_message'],
);
$messageTemplate['pdf_format_id'] = 'null';
- if (CRM_Utils_Array::value('bind_format', $formValues) && $formValues['format_id'] > 0) {
+ if (!empty($formValues['bind_format']) && $formValues['format_id'] > 0) {
$messageTemplate['pdf_format_id'] = $formValues['format_id'];
}
- if (CRM_Utils_Array::value('saveTemplate', $formValues) && $formValues['saveTemplate']) {
+ if (!empty($formValues['saveTemplate']) && $formValues['saveTemplate']) {
$messageTemplate['msg_title'] = $formValues['saveTemplateName'];
CRM_Core_BAO_MessageTemplate::add($messageTemplate);
}
- if (CRM_Utils_Array::value('updateTemplate', $formValues) && $formValues['template'] && $formValues['updateTemplate']) {
+ if (!empty($formValues['updateTemplate']) && $formValues['template'] && $formValues['updateTemplate']) {
$messageTemplate['id'] = $formValues['template'];
unset($messageTemplate['msg_title']);
}
}
elseif (CRM_Utils_Array::value('template', $formValues) > 0) {
- if (CRM_Utils_Array::value('bind_format', $formValues) && $formValues['format_id'] > 0) {
+ if (!empty($formValues['bind_format']) && $formValues['format_id'] > 0) {
$query = "UPDATE civicrm_msg_template SET pdf_format_id = {$formValues['format_id']} WHERE id = {$formValues['template']}";
}
else {
}
CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}
- if (CRM_Utils_Array::value('update_format', $formValues)) {
+ if (!empty($formValues['update_format'])) {
$bao = new CRM_Core_BAO_PdfFormat();
$bao->savePdfFormat($formValues, $formValues['format_id']);
}
$form->add('text', 'prox_postal_code', ts('Postal Code'), NULL, FALSE);
$defaults = self::setDefaultValues($form);
- if (CRM_Utils_Array::value('prox_country_id', $defaults)) {
+ if (!empty($defaults['prox_country_id'])) {
$stateProvince = array('' => ts('- select -')) + CRM_Core_PseudoConstant::stateProvinceForCountry($defaults['prox_country_id']);
}
else {
static function formRule($fields, $files, $form) {
$errors = array();
// If Distance is present, make sure state, country and city or postal code are populated.
- if (CRM_Utils_Array::value('prox_distance', $fields)) {
- if (!CRM_Utils_Array::value('prox_state_province_id', $fields) ||
+ if (!empty($fields['prox_distance'])) {
+ if (empty($fields['prox_state_province_id']) ||
!CRM_Utils_Array::value('prox_country_id', $fields)
) {
$errors["prox_state_province_id"] = ts("Country AND State/Province are required to search by distance.");
$contactTags = $tagList = array();
// check if contact tags exists
- if (CRM_Utils_Array::value('tag', $params)) {
+ if (!empty($params['tag'])) {
$contactTags = $params['tag'];
}
// check if tags are selected from taglists
- if (CRM_Utils_Array::value('contact_taglist', $params)) {
+ if (!empty($params['contact_taglist'])) {
foreach ($params['contact_taglist'] as $val) {
if ($val) {
if (is_numeric($val)) {
$template = CRM_Core_Smarty::singleton();
- if (!CRM_Utils_Array::value('text_message', $fields)) {
+ if (empty($fields['text_message'])) {
$errors['text_message'] = ts('Please provide Text message.');
}
else {
- if (CRM_Utils_Array::value('text_message', $fields)) {
+ if (!empty($fields['text_message'])) {
$messageCheck = CRM_Utils_Array::value('text_message', $fields);
$messageCheck = str_replace("\r\n", "\n", $messageCheck);
if ($messageCheck && (strlen($messageCheck) > CRM_SMS_Provider::MAX_SMS_CHAR)) {
}
//Added for CRM-1393
- if (CRM_Utils_Array::value('saveTemplate', $fields) && empty($fields['saveTemplateName'])) {
+ if (!empty($fields['saveTemplate']) && empty($fields['saveTemplateName'])) {
$errors['saveTemplateName'] = ts("Enter name to save message template");
}
$fromSmsProviderId = $thisValues['sms_provider_id'];
// process message template
- if (CRM_Utils_Array::value('saveTemplate', $thisValues)
- || CRM_Utils_Array::value('updateTemplate', $thisValues)
+ if (!empty($thisValues['saveTemplate']) || CRM_Utils_Array::value('updateTemplate', $thisValues)
) {
$messageTemplate = array(
'msg_text' => $thisValues['text_message'],
'is_active' => TRUE,
);
- if (CRM_Utils_Array::value('saveTemplate', $thisValues)) {
+ if (!empty($thisValues['saveTemplate'])) {
$messageTemplate['msg_title'] = $thisValues['saveTemplateName'];
CRM_Core_BAO_MessageTemplate::add($messageTemplate);
}
- if (CRM_Utils_Array::value('template', $thisValues) &&
+ if (!empty($thisValues['template']) &&
CRM_Utils_Array::value('updateTemplate', $thisValues)
) {
$messageTemplate['id'] = $thisValues['template'];
$phoneKey = "{$contactId}::{$phone}";
if (!in_array($phoneKey, $tempPhones)) {
$tempPhones[] = $phoneKey;
- if (CRM_Utils_Array::value($contactId, $form->_contactDetails)) {
+ if (!empty($form->_contactDetails[$contactId])) {
$formattedContactDetails[] = $form->_contactDetails[$contactId];
}
}
//CRM-5125 for contact subtype specific relationshiptypes
$cSubType = NULL;
- if (CRM_Utils_Array::value("contact_sub_type_{$second}", $contactRelationCache[$id])) {
+ if (!empty($contactRelationCache[$id]["contact_sub_type_{$second}"])) {
$cSubType = $contactRelationCache[$id]["contact_sub_type_{$second}"];
}
}
//fix to append custom group name to field name, CRM-2676
- if (!CRM_Utils_Array::value($cType, $this->_formattedFieldNames) || $cType == $this->_contactType) {
+ if (empty($this->_formattedFieldNames[$cType]) || $cType == $this->_contactType) {
$this->_formattedFieldNames[$cType] = $this->formatCustomFieldName($values);
}
*/
static function formRule($fields) {
$errors = array();
- if (CRM_Utils_Array::value('saveMapping', $fields)) {
+ if (!empty($fields['saveMapping'])) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
}
}
$template = CRM_Core_Smarty::singleton();
- if (CRM_Utils_Array::value('saveMapping', $fields)) {
+ if (!empty($fields['saveMapping'])) {
$template->assign('isCheked', TRUE);
}
$this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params));
//Updating Mapping Records
- if (CRM_Utils_Array::value('updateMapping', $params)) {
+ if (!empty($params['updateMapping'])) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
}
//Saving Mapping Details and Records
- if (CRM_Utils_Array::value('saveMapping', $params)) {
+ if (!empty($params['saveMapping'])) {
$mappingParams = array(
'name' => $params['saveMappingName'],
'description' => $params['saveMappingDesc'],
$errors = array();
$invalidTagName = $invalidGroupName = FALSE;
- if (CRM_Utils_Array::value('newTagName', $fields)) {
+ if (!empty($fields['newTagName'])) {
if (!CRM_Utils_Rule::objectExists(trim($fields['newTagName']),
array('CRM_Core_DAO_Tag')
)) {
}
}
- if (CRM_Utils_Array::value('newGroupName', $fields)) {
+ if (!empty($fields['newGroupName'])) {
$title = trim($fields['newGroupName']);
$name = CRM_Utils_String::titleToVar($title);
$query = 'select count(*) from civicrm_group where name like %1 OR title like %2';
}
//check if external identifier exists in database
- if (CRM_Utils_Array::value('external_identifier', $params) && (CRM_Utils_Array::value('id', $params) || in_array($onDuplicate, array(
+ if (!empty($params['external_identifier']) && (CRM_Utils_Array::value('id', $params) || in_array($onDuplicate, array(
CRM_Import_Parser::DUPLICATE_SKIP,
CRM_Import_Parser::DUPLICATE_NOCHECK,
)))) {
// Support Match and Update Via Contact ID
if ($this->_updateWithId) {
$createNewContact = FALSE;
- if (!CRM_Utils_Array::value('id', $params) && CRM_Utils_Array::value('external_identifier', $params)) {
+ if (empty($params['id']) && CRM_Utils_Array::value('external_identifier', $params)) {
if ($cid) {
$params['id'] = $cid;
}
//validation of subtype for update mode
//CRM-5125
$contactSubType = NULL;
- if (CRM_Utils_Array::value('contact_sub_type', $params)) {
+ if (!empty($params['contact_sub_type'])) {
$contactSubType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['id'], 'contact_sub_type');
}
}
else {
$contactType = NULL;
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$contactType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['id'], 'contact_type');
if ($contactType) {
if ($formatted['contact_type'] == $contactType) {
//validation of subtype for update mode
//CRM-5125
$contactSubType = NULL;
- if (CRM_Utils_Array::value('contact_sub_type', $params)) {
+ if (!empty($params['contact_sub_type'])) {
$contactSubType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['id'], 'contact_sub_type');
}
$contactFields = CRM_Contact_DAO_Contact::import();
//Relation on the basis of External Identifier.
- if (!CRM_Utils_Array::value('id', $params[$key]) && !empty($params[$key]['external_identifier'])) {
+ if (empty($params[$key]['id']) && !empty($params[$key]['external_identifier'])) {
$params[$key]['id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$key]['external_identifier'], 'id', 'external_identifier');
}
// check for valid related contact id in update/fill mode, CRM-4424
//validation of related contact subtype for update mode
//CRM-5125
$relatedCsType = NULL;
- if (CRM_Utils_Array::value('contact_sub_type', $formatting)) {
+ if (!empty($formatting['contact_sub_type'])) {
$relatedCsType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$key]['id'], 'contact_sub_type');
}
}
//fixed for CRM-4148
- if (CRM_Utils_Array::value('id', $params[$key])) {
+ if (!empty($params[$key]['id'])) {
$contact = array(
'contact_id' => $params[$key]['id'],
);
//validation of related contact subtype for update mode
//CRM-5125
$relatedCsType = NULL;
- if (CRM_Utils_Array::value('contact_sub_type', $formatting)) {
+ if (!empty($formatting['contact_sub_type'])) {
$relatedCsType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $matchedIDs[0], 'contact_sub_type');
}
}
if (civicrm_error($newContact)) {
- if (!CRM_Utils_Array::value('params', $newContact['error_message'])) {
+ if (empty($newContact['error_message']['params'])) {
// different kind of error other than DUPLICATE
$errorMessage = $newContact['error_message'];
array_unshift($values, $errorMessage);
$session = CRM_Core_Session::singleton();
$dateType = $session->get("dateTypes");
- if (CRM_Utils_Array::value('contact_sub_type', $params)) {
+ if (!empty($params['contact_sub_type'])) {
$csType = CRM_Utils_Array::value('contact_sub_type', $params);
}
- if (!CRM_Utils_Array::value('contact_type', $params)) {
+ if (empty($params['contact_type'])) {
$params['contact_type'] = 'Individual';
}
$customFields = CRM_Core_BAO_CustomField::getFields($params['contact_type'], FALSE, FALSE, $csType);
case 'geo_code_1':
if (!empty($value)) {
foreach ($value as $codeValue) {
- if (CRM_Utils_Array::value('geo_code_1', $codeValue)) {
+ if (!empty($codeValue['geo_code_1'])) {
if (CRM_Utils_Rule::numeric($codeValue['geo_code_1'])) {
continue;
}
case 'geo_code_2':
if (!empty($value)) {
foreach ($value as $codeValue) {
- if (CRM_Utils_Array::value('geo_code_2', $codeValue)) {
+ if (!empty($codeValue['geo_code_2'])) {
if (CRM_Utils_Rule::numeric($codeValue['geo_code_2'])) {
continue;
}
case 'url':
if (is_array($value)) {
foreach ($value as $values) {
- if (CRM_Utils_Array::value('url', $values) && !CRM_Utils_Rule::url($values['url'])) {
+ if (!empty($values['url']) && !CRM_Utils_Rule::url($values['url'])) {
self::addToErrorMsg(ts('Website'), $errorMessage);
break;
}
case 'email':
if (is_array($value)) {
foreach ($value as $values) {
- if (CRM_Utils_Array::value('email', $values) && !CRM_Utils_Rule::email($values['email'])) {
+ if (!empty($values['email']) && !CRM_Utils_Rule::email($values['email'])) {
self::addToErrorMsg($key, $errorMessage);
break;
}
case 'AdvMulti-Select':
case 'Multi-Select':
- if ( CRM_Utils_Array::value( $key, $formatted ) && CRM_Utils_Array::value( $key, $params ) ) {
+ if (!empty($formatted[$key]) && CRM_Utils_Array::value( $key, $params ) ) {
$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 (!CRM_Utils_Array::value('street_name', $parsedFields) || !CRM_Utils_Array::value('street_number', $parsedFields)) {
+ if (empty($parsedFields['street_name']) || !CRM_Utils_Array::value('street_number', $parsedFields)) {
$parsedFields = array_fill_keys(array_keys($parsedFields), '');
}
continue;
}
- if ( CRM_Utils_Array::value($name, $relatedContactFields) && !is_array($relatedContactFields[$name])) {
+ if (!empty($relatedContactFields[$name]) && !is_array($relatedContactFields[$name])) {
$relatedContactFields[$name] = array();
}
$fldName = CRM_Utils_Array::value($key, $this->_mapperRelatedContactDetails);
//validate for passed data.
if (is_array($relatedContactFields[$relKey])) {
foreach ($relatedContactFields[$relKey] as $fld) {
- if (CRM_Utils_Array::value($fld, $params)) {
+ if (!empty($params[$fld])) {
$allowToCreate = TRUE;
break;
}
$config = CRM_Core_Config::singleton();
$limit = 10;
- if (CRM_Utils_Array::value('limit', $_GET)) {
+ if (!empty($_GET['limit'])) {
$limit = CRM_Utils_Type::escape($_GET['limit'], 'Positive');
}
$contact = civicrm_api('Contact', 'Get', $params);
- if (CRM_Utils_Array::value('is_error', $contact)) {
+ if (!empty($contact['is_error'])) {
echo "$name|error\n";
CRM_Utils_System::civiExit();
}
foreach ($contact['values'] as $value) {
$view = array();
foreach ($return as $fld) {
- if (CRM_Utils_Array::value($fld, $value)) {
+ if (!empty($value[$fld])) {
$view[] = $value[$fld];
}
}
$whereClause = " WHERE ( sort_name LIKE '$strSearch' $includeNickName ) {$where} ";
}
- if (CRM_Utils_Array::value('limit', $_GET)) {
+ if (!empty($_GET['limit'])) {
$limit = CRM_Utils_Type::escape($_GET['limit'], 'Positive');
}
$return = CRM_Contact_BAO_Relationship::create($relationParams, $relationIds);
$status = 'process-relationship-fail';
- if (CRM_Utils_Array::value(0, $return[4])) {
+ if (!empty($return[4][0])) {
$relationshipID = $return[4][0];
$status = 'process-relationship-success';
}
$name = CRM_Utils_Type::escape($name, 'String');
$whereIdClause = '';
- if (CRM_Utils_Array::value('id', $_GET)) {
+ if (!empty($_GET['id'])) {
$json = TRUE;
if (is_numeric($_GET['id'])) {
$id = CRM_Utils_Type::escape($_GET['id'], 'Integer');
AND household_name LIKE '%$contactName%' {$addStreet} {$addCity} {$whereIdClause} ORDER BY household_name ";
}
elseif ($relType) {
- if (CRM_Utils_Array::value('case', $_GET)) {
+ if (!empty($_GET['case'])) {
$query = "
SELECT distinct(c.id), c.sort_name
FROM civicrm_contact c
* Function to get email address of a contact
*/
static function getContactEmail() {
- if (CRM_Utils_Array::value('contact_id', $_REQUEST)) {
+ if (!empty($_REQUEST['contact_id'])) {
$contactID = CRM_Utils_Type::escape($_REQUEST['contact_id'], 'Positive');
list($displayName,
$userEmail
$searchRows[$mainId]['dst'] = CRM_Utils_System::href($main['dstName'], 'civicrm/contact/view', "reset=1&cid={$main['dstID']}");
$searchRows[$mainId]['weight'] = CRM_Utils_Array::value('weight', $main);
- if (CRM_Utils_Array::value('canMerge', $main)) {
+ if (!empty($main['canMerge'])) {
$mergeParams = "reset=1&cid={$main['srcID']}&oid={$main['dstID']}&action=update&rgid={$rgid}";
if ($gid) {
$mergeParams .= "&gid={$gid}";
$sharedAddresses = array();
$shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($currentAddressBlock['address']);
foreach ($currentAddressBlock['address'] as $key => $addressValue) {
- if (CRM_Utils_Array::value('master_id', $addressValue) &&
+ if (!empty($addressValue['master_id']) &&
!$shareAddressContactNames[$addressValue['master_id']]['is_deleted']
) {
$sharedAddresses[$key]['shared_address_display'] = array(
$communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id');
if (!empty($communicationStyle)) {
- if (CRM_Utils_Array::value('communication_style_id', $defaults)) {
+ if (!empty($defaults['communication_style_id'])) {
$defaults['communication_style_display'] = $communicationStyle[CRM_Utils_Array::value('communication_style_id', $defaults)];
}
else {
//get the current employer name
if (CRM_Utils_Array::value('contact_type', $defaults) == 'Individual') {
- if (CRM_Utils_Array::value('employer_id', $defaults) &&
+ if (!empty($defaults['employer_id']) &&
CRM_Utils_Array::value('organization_name', $defaults)) {
$defaults['current_employer'] = $defaults['organization_name'];
$defaults['current_employer_id'] = $defaults['employer_id'];
$defaults = array();
CRM_Contact_BAO_Contact::getValues( $params, $defaults );
- if (CRM_Utils_Array::value('gender_id', $defaults)) {
+ if (!empty($defaults['gender_id'])) {
$gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$defaults['gender_display'] = $gender[CRM_Utils_Array::value('gender_id', $defaults)];
}
);
foreach ($communicationType as $key => $value) {
- if (CRM_Utils_Array::value($key, $defaults)) {
+ if (!empty($defaults[$key])) {
foreach ($defaults[$key] as & $val) {
CRM_Utils_Array::lookupValue($val, 'location_type', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name')), FALSE);
- if (!CRM_Utils_Array::value('skip', $value)) {
+ if (empty($value['skip'])) {
$daoName = $value['daoName'];
$pseudoConst = $daoName::buildOptions($value['fieldName'], 'get');
CRM_Utils_Array::lookupValue($val, $value['id'], $pseudoConst, FALSE);
foreach ($defaults[$key] as $blockId => $blockVal) {
$idValue = $blockVal['id'];
if ( $key == 'address' ) {
- if ( CRM_Utils_Array::value( 'master_id', $blockVal ) ) {
+ if (!empty($blockVal['master_id'])) {
$idValue = $blockVal['master_id'];
}
}
}
}
- if (CRM_Utils_Array::value('gender_id', $defaults)) {
+ if (!empty($defaults['gender_id'])) {
$defaults['gender_display'] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'gender_id', $defaults['gender_id']);
}
$communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id');
if (!empty($communicationStyle)) {
- if (CRM_Utils_Array::value('communication_style_id', $defaults)) {
+ if (!empty($defaults['communication_style_id'])) {
$defaults['communication_style_display'] = $communicationStyle[CRM_Utils_Array::value('communication_style_id', $defaults)];
}
else {
$sharedAddresses = array();
$shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($defaults['address']);
foreach ($defaults['address'] as $key => $addressValue) {
- if (CRM_Utils_Array::value('master_id', $addressValue) &&
+ if (!empty($addressValue['master_id']) &&
!$shareAddressContactNames[$addressValue['master_id']]['is_deleted']
) {
$sharedAddresses[$key]['shared_address_display'] = array(
$components = CRM_Core_Component::getEnabledComponents();
foreach ($components as $name => $component) {
- if (
- CRM_Utils_Array::value($name, $this->_viewOptions) &&
+ if (!empty($this->_viewOptions[$name]) &&
CRM_Core_Permission::access($component->name)
) {
$elem = $component->registerTab();
continue;
}
- if (CRM_Utils_Array::value($name, $this->_userOptions) &&
+ if (!empty($this->_userOptions[$name]) &&
(CRM_Core_Permission::access($component->name) ||
CRM_Core_Permission::check($elem['perm'][0])
)
}
}
- if (CRM_Utils_Array::value('Permissioned Orgs', $this->_userOptions)) {
+ if (!empty($this->_userOptions['Permissioned Orgs'])) {
$dashboardElements[] = array(
'class' => 'crm-dashboard-permissionedOrgs',
'templatePath' => 'CRM/Contact/Page/View/Relationship.tpl',
$this->assign('currentRelationships', $currentRelationships);
}
- if (CRM_Utils_Array::value('PCP', $this->_userOptions)) {
+ if (!empty($this->_userOptions['PCP'])) {
$dashboardElements[] = array(
'class' => 'crm-dashboard-pcp',
'templatePath' => 'CRM/Contribute/Page/PcpUserDashboard.tpl',
$this->assign('pcpInfo', $pcpInfo);
}
- if (CRM_Utils_Array::value('Assigned Activities', $this->_userOptions)) {
+ if (!empty($this->_userOptions['Assigned Activities'])) {
// Assigned Activities section
$dashboardElements[] = array(
'class' => 'crm-dashboard-assignedActivities',
usort($dashboardElements, array('CRM_Utils_Sort', 'cmpFunc'));
$this->assign('dashboardElements', $dashboardElements);
- if (CRM_Utils_Array::value('Groups', $this->_userOptions)) {
+ if (!empty($this->_userOptions['Groups'])) {
$this->assign('showGroup', TRUE);
//build group selector
$gContact = new CRM_Contact_Page_View_UserDashBoard_GroupContact();
$vcard->setFormattedName($defaults['display_name']);
$vcard->setSortString($defaults['sort_name']);
- if (CRM_Utils_Array::value('nick_name', $defaults)) {
+ if (!empty($defaults['nick_name'])) {
$vcard->addNickname($defaults['nick_name']);
}
- if (CRM_Utils_Array::value('job_title', $defaults)) {
+ if (!empty($defaults['job_title'])) {
$vcard->setTitle($defaults['job_title']);
}
- if (CRM_Utils_Array::value('birth_date_display', $defaults)) {
+ if (!empty($defaults['birth_date_display'])) {
$vcard->setBirthday(CRM_Utils_Array::value('birth_date_display', $defaults));
}
- if (CRM_Utils_Array::value('home_URL', $defaults)) {
+ if (!empty($defaults['home_URL'])) {
$vcard->setURL($defaults['home_URL']);
}
// TODO: $vcard->setGeo($lat, $lon);
- if (CRM_Utils_Array::value('address', $defaults)) {
+ if (!empty($defaults['address'])) {
$stateProvices = CRM_Core_PseudoConstant::stateProvince();
$countries = CRM_Core_PseudoConstant::country();
foreach ($defaults['address'] as $location) {
// we don't keep PO boxes in separate fields
$pob = '';
$extend = CRM_Utils_Array::value('supplemental_address_1', $location);
- if (CRM_Utils_Array::value('supplemental_address_2', $location)) {
+ if (!empty($location['supplemental_address_2'])) {
$extend .= ', ' . $location['supplemental_address_2'];
}
$street = CRM_Utils_Array::value('street_address', $location);
$locality = CRM_Utils_Array::value('city', $location);
$region = NULL;
- if (CRM_Utils_Array::value('state_province_id', $location)) {
+ if (!empty($location['state_province_id'])) {
$region = $stateProvices[CRM_Utils_Array::value('state_province_id', $location)];
}
$country = NULL;
- if (CRM_Utils_Array::value('country_id', $location)) {
+ if (!empty($location['country_id'])) {
$country = $countries[CRM_Utils_Array::value('country_id', $location)];
}
$postcode = CRM_Utils_Array::value('postal_code', $location);
- if (CRM_Utils_Array::value('postal_code_suffix', $location)) {
+ if (!empty($location['postal_code_suffix'])) {
$postcode .= '-' . $location['postal_code_suffix'];
}
if ($vcardName) {
$vcard->addParam('TYPE', $vcardName);
}
- if (CRM_Utils_Array::value('is_primary', $location)) {
+ if (!empty($location['is_primary'])) {
$vcard->addParam('TYPE', 'PREF');
}
}
}
- if (CRM_Utils_Array::value('phone', $defaults)) {
+ if (!empty($defaults['phone'])) {
foreach ($defaults['phone'] as $phone) {
$vcard->addTelephone($phone['phone']);
$vcardName = $vcardNames[$phone['location_type_id']];
}
}
- if (CRM_Utils_Array::value('email', $defaults)) {
+ if (!empty($defaults['email'])) {
foreach ($defaults['email'] as $email) {
$vcard->addEmail($email['email']);
$vcardName = $vcardNames[$email['location_type_id']];
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
foreach ($this->_fields as $name => $field) {
- if (CRM_Utils_Array::value('in_selector', $field) &&
+ if (!empty($field['in_selector']) &&
!in_array($name, $skipFields)
) {
if (strpos($name, '-') !== FALSE) {
$names = array();
static $skipFields = array('group', 'tag');
foreach ($this->_fields as $key => $field) {
- if (
- CRM_Utils_Array::value('in_selector', $field) &&
+ if (!empty($field['in_selector']) &&
!in_array($key, $skipFields)
) {
if (strpos($key, '-') !== FALSE) {
if ($output != CRM_Core_Selector_Controller::EXPORT) {
$row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->contact_id;
- if (CRM_Utils_Array::value('deleted_contacts', $this->_formValues)
- && CRM_Core_Permission::check('access deleted contacts')
+ if (!empty($this->_formValues['deleted_contacts']) && CRM_Core_Permission::check('access deleted contacts')
) {
$links = array(
array(
foreach ($rows as $id => & $row) {
- if (CRM_Utils_Array::value('deleted_contacts', $this->_formValues)
- && CRM_Core_Permission::check('access deleted contacts')
+ if (!empty($this->_formValues['deleted_contacts']) && CRM_Core_Permission::check('access deleted contacts')
) {
$links = array(
array(
);
foreach ($defaultAddress as $columnName => $column) {
- if (CRM_Utils_Array::value($columnName, $addressOptions)) {
+ if (!empty($addressOptions[$columnName])) {
self::$_columnHeaders[$columnName] = $column;
}
}
);
//if priceset is used, no need to cleanup money
- if (CRM_Utils_Array::value('skipCleanMoney', $params)) {
+ if (!empty($params['skipCleanMoney'])) {
unset($moneyFields[0]);
}
FALSE, FALSE, FALSE, 'AND is_default = 1'));
}
- if (CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ if (!empty($params['payment_instrument_id'])) {
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument('name');
if ($params['payment_instrument_id'] != array_search('Check', $paymentInstruments)) {
$params['check_number'] = 'null';
// contribution status is missing, choose Completed as default status
// do this for create mode only
- if (!CRM_Utils_Array::value('contribution', $ids) && !CRM_Utils_Array::value('contribution_status_id', $params)) {
+ if (empty($ids['contribution']) && !CRM_Utils_Array::value('contribution_status_id', $params)) {
$params['contribution_status_id'] = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
}
$params['contribution_id'] = $contribution->id;
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contribution', $contribution->id);
$session = CRM_Core_Session::singleton();
- if (CRM_Utils_Array::value('note', $params)) {
+ if (!empty($params['note'])) {
$noteParams = array(
'entity_table' => 'civicrm_contribution',
'note' => $params['note'],
}
// make entry in batch entity batch table
- if (CRM_Utils_Array::value('batch_id', $params)) {
+ if (!empty($params['batch_id'])) {
// in some update cases we need to get extra fields - ie an update that doesn't pass in all these params
$titleFields = array(
'contact_id',
$softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
CRM_Contribute_BAO_ContributionSoft::add($softParams);
}
- elseif (CRM_Utils_Array::value('soft_credit', $params)) {
+ elseif (!empty($params['soft_credit'])) {
$softParams = $params['soft_credit'];
if (!empty($softIDs)) {
$transaction->commit();
// do not add to recent items for import, CRM-4399
- if (!CRM_Utils_Array::value('skipRecentView', $params)) {
+ if (empty($params['skipRecentView'])) {
$url = CRM_Utils_System::url('civicrm/contact/view/contribution',
"action=view&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home"
);
}
}
- if (CRM_Utils_Array::value('contact_id', $componentDetails)) {
+ if (!empty($componentDetails['contact_id'])) {
$componentDetails['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution',
$contributionId,
'contact_id'
}
// do check for required ids.
- if (!CRM_Utils_Array::value('membership', $componentDetails) &&
+ if (empty($componentDetails['membership']) &&
!CRM_Utils_Array::value('participant', $componentDetails) &&
!CRM_Utils_Array::value('pledge_payment', $componentDetails) ||
!CRM_Utils_Array::value('contact_id', $componentDetails)
'contribution_status_id', 'non_deductible_amount', 'receipt_date', 'check_number',
);
foreach ($fields as $field) {
- if (!CRM_Utils_Array::value($field, $params)) {
+ if (empty($params[$field])) {
continue;
}
$contributionParams[$field] = $params[$field];
);
}
//fail to load payment processor id.
- elseif (!CRM_Utils_Array::value('pledge_payment', $ids)) {
+ elseif (empty($ids['pledge_payment'])) {
$loadObjectSuccess = TRUE;
if ($required) {
throw new Exception("Could not find contribution page for contribution record: " . $this->id);
}
else {
$values['contribution_id'] = $this->id;
- if (CRM_Utils_Array::value('related_contact', $ids)) {
+ if (!empty($ids['related_contact'])) {
$values['related_contact'] = $ids['related_contact'];
if (isset($ids['onbehalf_dupe_alert'])) {
$values['onbehalf_dupe_alert'] = $ids['onbehalf_dupe_alert'];
$this->contact_id
);
// if this is onbehalf of contribution then set related contact
- if (CRM_Utils_Array::value('individual_id', $relatedContact)) {
+ if (!empty($relatedContact['individual_id'])) {
$values['related_contact'] = $ids['related_contact'] = $relatedContact['individual_id'];
}
}
$honorType = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
$template->assign('honor_block_is_active', 1);
- if (CRM_Utils_Array::value('prefix_id', $honorDefault)) {
+ if (!empty($honorDefault['prefix_id'])) {
$prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
$template->assign('honor_prefix', $prefix[$honorDefault['prefix_id']]);
}
$entityID += $additionalParticipantId;
}
// prevContribution appears to mean - original contribution object- ie copy of contribution from before the update started that is being updated
- if (!CRM_Utils_Array::value('prevContribution', $params)) {
+ if (empty($params['prevContribution'])) {
$entityID = NULL;
}
else {
$balanceTrxnParams['status_id'] = $statusId;
$balanceTrxnParams['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
$balanceTrxnParams['check_number'] = CRM_Utils_Array::value('check_number', $params);
- if (CRM_Utils_Array::value('payment_processor', $params)) {
+ if (!empty($params['payment_processor'])) {
$balanceTrxnParams['payment_processor_id'] = $params['payment_processor'];
}
CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams);
}
// build line item array if its not set in $params
- if (!CRM_Utils_Array::value('line_item', $params) || $additionalParticipantId) {
+ if (empty($params['line_item']) || $additionalParticipantId) {
CRM_Price_BAO_LineItem::getLineItemArray($params, $entityID, str_replace('civicrm_', '', $entityTable));
}
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
}
- elseif (CRM_Utils_Array::value('payment_processor', $params)) {
+ elseif (!empty($params['payment_processor'])) {
$params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($params['payment_processor'], 'civicrm_payment_processor', 'financial_account_id');
}
- elseif (CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ elseif (!empty($params['payment_instrument_id'])) {
$params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($params['payment_instrument_id']);
}
else {
'check_number' => CRM_Utils_Array::value('check_number', $params),
);
- if (CRM_Utils_Array::value('payment_processor', $params)) {
+ if (!empty($params['payment_processor'])) {
$trxnParams['payment_processor_id'] = $params['payment_processor'];
}
$params['trxnParams'] = $trxnParams;
- if (CRM_Utils_Array::value('prevContribution', $params)) {
+ if (!empty($params['prevContribution'])) {
$params['trxnParams']['total_amount'] = $trxnParams['total_amount'] = $params['total_amount'] = $params['prevContribution']->total_amount;
$params['trxnParams']['fee_amount'] = $params['prevContribution']->fee_amount;
$params['trxnParams']['net_amount'] = $params['prevContribution']->net_amount;
$params['trxnParams']['check_number'] = $params['prevContribution']->check_number;
//if financial type is changed
- if (CRM_Utils_Array::value('financial_type_id', $params) &&
+ if (!empty($params['financial_type_id']) &&
$params['contribution']->financial_type_id != $params['prevContribution']->financial_type_id) {
$incomeTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
$oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $incomeTypeId);
}
else {
$lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC');
- if (CRM_Utils_Array::value('financialTrxnId', $lastFinancialTrxnId)) {
+ if (!empty($lastFinancialTrxnId['financialTrxnId'])) {
$params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id');
}
}
//Update contribution status
$params['trxnParams']['status_id'] = $params['contribution']->contribution_status_id;
- if (CRM_Utils_Array::value('contribution_status_id', $params) &&
+ if (!empty($params['contribution_status_id']) &&
$params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id) {
//Update Financial Records
self::updateFinancialAccounts($params, 'changedStatus');
}
}
// record line items and finacial items
- if (!CRM_Utils_Array::value('skipLineItem', $params)) {
+ if (empty($params['skipLineItem'])) {
CRM_Price_BAO_LineItem::processPriceSet($entityId, CRM_Utils_Array::value('line_item', $params), $params['contribution'], $entityTable, $update);
}
// create batch entry if batch_id is passed
- if (CRM_Utils_Array::value('batch_id', $params)) {
+ if (!empty($params['batch_id'])) {
$entityParams = array(
'batch_id' => $params['batch_id'],
'entity_table' => 'civicrm_financial_trxn',
}
// when a fee is charged
- if (CRM_Utils_Array::value('fee_amount', $params) && (!CRM_Utils_Array::value('prevContribution', $params)
+ if (!empty($params['fee_amount']) && (!CRM_Utils_Array::value('prevContribution', $params)
|| $params['contribution']->fee_amount != $params['prevContribution']->fee_amount) && $skipRecords) {
CRM_Core_BAO_FinancialTrxn::recordFees($params);
}
- if (CRM_Utils_Array::value('prevContribution', $params) && $entityTable == 'civicrm_participant'
+ if (!empty($params['prevContribution']) && $entityTable == 'civicrm_participant'
&& $params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id) {
$eventID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $entityId, 'event_id');
$feeLevel[] = str_replace('\ 1', '', $params['prevContribution']->amount_level);
elseif ($context == 'changePaymentInstrument') {
if ($params['trxnParams']['total_amount'] < 0) {
$lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC');
- if (CRM_Utils_Array::value('financialTrxnId', $lastFinancialTrxnId)) {
+ if (!empty($lastFinancialTrxnId['financialTrxnId'])) {
$params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id');
$params['trxnParams']['payment_instrument_id'] = $params['prevContribution']->payment_instrument_id;
}
}
$financialAccount = $prevfinancialItem->financial_account_id;
- if (CRM_Utils_Array::value('financial_account_id', $params)) {
+ if (!empty($params['financial_account_id'])) {
$financialAccount = $params['financial_account_id'];
}
if ($params['contribution']->currency) {
$currency = $params['contribution']->currency;
}
- if (CRM_Utils_Array::value('is_quick_config', $params)) {
+ if (!empty($params['is_quick_config'])) {
$amount = $itemAmount;
if (!$amount) {
$amount = $params['total_amount'];
if (isset($paymentParams['financial_type'])) {
$contributionType->id = $paymentParams['financial_type'];
}
- elseif (CRM_Utils_Array::value('pledge_id', $form->_values)) {
+ elseif (!empty($form->_values['pledge_id'])) {
$contributionType->id = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_Pledge',
$form->_values['pledge_id'],
'financial_type_id'
}
}
elseif ($form->_values['is_monetary'] && $form->_amount > 0.0) {
- if (CRM_Utils_Array::value('is_recur', $paymentParams) &&
+ if (!empty($paymentParams['is_recur']) &&
$form->_contributeMode == 'direct'
) {
if (is_a($result, 'CRM_Core_Error')) {
//make sure to cleanup db for recurring case.
- if (CRM_Utils_Array::value('contributionID', $paymentParams)) {
+ if (!empty($paymentParams['contributionID'])) {
CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']);
}
- if (CRM_Utils_Array::value('contributionRecurID', $paymentParams)) {
+ if (!empty($paymentParams['contributionRecurID'])) {
CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
}
// check if pending was set to true by payment processor
$pending = FALSE;
- if (CRM_Utils_Array::value('contribution_status_pending',
- $form->_params
- )) {
+ if (!empty($form->_params
+['contribution_status_pending'])) {
$pending = TRUE;
}
if (!(!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct')) {
}
$created = TRUE;
- if (CRM_Utils_Array::value('cms_create_account', $params)) {
+ if (!empty($params['cms_create_account'])) {
$params['contactID'] = $contactID;
if (!CRM_Core_BAO_CMSUser::create($params, $mail)) {
CRM_Core_Error::statusBounce(ts('Your profile is not saved and Account is not created.'));
if ($riskInfo['google-order-number']['VALUE'] == $apiParams[2]['google-order-number']['VALUE']) {
foreach ($riskInfo['risk-information']['billing-address'] as $field => $info) {
- if (CRM_Utils_Array::value($field, $mapper['location'])) {
+ if (!empty($mapper['location'][$field])) {
$params['address'][1][$mapper['location'][$field]] = $info['VALUE'];
}
- elseif (CRM_Utils_Array::value($field, $mapper['contact'])) {
+ elseif (!empty($mapper['contact'][$field])) {
if ($newOrder && CRM_Utils_Array::value('structured-name', $newOrder['buyer-billing-address'])) {
foreach ($newOrder['buyer-billing-address']['structured-name'] as $namePart => $nameValue) {
$params[$mapper['contact'][$namePart]] = $nameValue['VALUE'];
$params[$mapper['contact'][$field]] = $info['VALUE'];
}
}
- elseif (CRM_Utils_Array::value($field, $mapper['transaction'])) {
+ elseif (!empty($mapper['transaction'][$field])) {
$transaction[$mapper['transaction'][$field]] = $info['VALUE'];
}
}
}
foreach ($localMapper as $localKey => $localVal) {
- if (CRM_Utils_Array::value($localKey, $mapper['transaction'])) {
+ if (!empty($mapper['transaction'][$localKey])) {
$transaction[$mapper['transaction'][$localKey]] = $localVal;
}
}
$dedupeParams['check_permission'] = FALSE;
$dupeIds = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual');
// if we find more than one contact, use the first one
- if (CRM_Utils_Array::value(0, $dupeIds)) {
+ if (!empty($dupeIds[0])) {
$params['contact_id'] = $dupeIds[0];
}
$contact = CRM_Contact_BAO_Contact::create($params);
*/
public static function &create(&$params) {
$financialTypeId = NULL;
- if (CRM_Utils_Array::value('id', $params) && !CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $params['id'], NULL, 1)) {
+ if (!empty($params['id']) && !CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $params['id'], NULL, 1)) {
$financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $params['id'], 'financial_type_id');
}
$dao = new CRM_Contribute_DAO_ContributionPage();
$gIds['custom_post_id'] = $values['custom_post_id'];
}
- if (CRM_Utils_Array::value('is_for_organization', $values)) {
- if (CRM_Utils_Array::value('membership_id', $values)) {
+ if (!empty($values['is_for_organization'])) {
+ if (!empty($values['membership_id'])) {
$params['onbehalf_profile'] = array(
array(
'member_id',
),
);
}
- elseif (CRM_Utils_Array::value('contribution_id', $values)) {
+ elseif (!empty($values['contribution_id'])) {
$params['onbehalf_profile'] = array(
array(
'contribution_id',
}
}
- if ( CRM_Utils_Array::value('is_email_receipt', $values) ||
+ if (!empty($values['is_email_receipt']) ||
CRM_Utils_Array::value('onbehalf_dupe_alert', $values) ||
$returnMessageText
) {
//IF Individual type not present in profile then it is consider as Organization data.
$userID = $contactID;
if ($preID = CRM_Utils_Array::value('custom_pre_id', $values)) {
- if (CRM_Utils_Array::value('related_contact', $values)) {
+ if (!empty($values['related_contact'])) {
$preProfileTypes = CRM_Core_BAO_UFGroup::profileGroups($preID);
if (in_array('Individual', $preProfileTypes) || in_array('Contact', $postProfileTypes)) {
//Take Individual contact ID
}
$userID = $contactID;
if ($postID = CRM_Utils_Array::value('custom_post_id', $values)) {
- if (CRM_Utils_Array::value('related_contact', $values)) {
+ if (!empty($values['related_contact'])) {
$postProfileTypes = CRM_Core_BAO_UFGroup::profileGroups($postID);
if (in_array('Individual', $postProfileTypes) || in_array('Contact', $postProfileTypes)) {
//Take Individual contact ID
}
// send duplicate alert, if dupe match found during on-behalf-of processing.
- if (CRM_Utils_Array::value('onbehalf_dupe_alert', $values)) {
+ if (!empty($values['onbehalf_dupe_alert'])) {
$sendTemplateParams['groupName'] = 'msg_tpl_workflow_contribution';
$sendTemplateParams['valueName'] = 'contribution_dupalert';
$sendTemplateParams['from'] = ts('Automatically Generated') . " <{$values['receipt_from_email']}>";
* @todo move hook calls / extended logic to create - requires changing calls to call create not add
*/
static function add(&$params) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'ContributionRecur', $params['id'], $params);
}
else {
}
$result = $recurring->save();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'ContributionRecur', $recurring->id, $recurring);
}
else {
}
// get financial_type
- if (CRM_Utils_Array::value('financial_type', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['financial_type'])) {
$query->_select['financial_type'] = "civicrm_financial_type.name as financial_type";
$query->_element['financial_type'] = 1;
$query->_tables['civicrm_contribution'] = 1;
}
// get accounting code
- if (CRM_Utils_Array::value( 'accounting_code', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['accounting_code'])) {
$query->_select['accounting_code'] = "civicrm_financial_account.accounting_code as accounting_code";
$query->_element['accounting_code'] = 1;
$query->_tables['civicrm_accounting_code'] = 1;
$query->_tables['civicrm_financial_account'] = 1;
}
- if (CRM_Utils_Array::value('contribution_note', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['contribution_note'])) {
$query->_select['contribution_note'] = "civicrm_note.note as contribution_note";
$query->_element['contribution_note'] = 1;
$query->_tables['contribution_note'] = 1;
}
- if (CRM_Utils_Array::value('contribution_batch', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['contribution_batch'])) {
$query->_select['contribution_batch'] = "civicrm_batch.title as contribution_batch";
$query->_element['contribution_batch'] = 1;
$query->_tables['contribution_batch'] = 1;
}
// get contribution_status
- if (CRM_Utils_Array::value('contribution_status_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['contribution_status_id'])) {
$query->_select['contribution_status_id'] = "contribution_status.value as contribution_status_id";
$query->_element['contribution_status_id'] = 1;
$query->_tables['civicrm_contribution'] = 1;
}
// get contribution_status label
- if (CRM_Utils_Array::value('contribution_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['contribution_status'])) {
$query->_select['contribution_status'] = "contribution_status.label as contribution_status";
$query->_element['contribution_status'] = 1;
$query->_tables['civicrm_contribution'] = 1;
}
// get payment instruments
- if (CRM_Utils_Array::value('payment_instrument', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['payment_instrument'])) {
$query->_select['contribution_payment_instrument'] = "payment_instrument.name as contribution_payment_instrument";
$query->_element['contribution_payment_instrument'] = 1;
$query->_tables['civicrm_contribution'] = 1;
$query->_tables['contribution_payment_instrument'] = 1;
}
- if (CRM_Utils_Array::value('check_number', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['check_number'])) {
$query->_select['contribution_check_number'] = "civicrm_contribution.check_number as contribution_check_number";
$query->_element['contribution_check_number'] = 1;
$query->_tables['civicrm_contribution'] = 1;
}
- if (CRM_Utils_Array::value('contribution_campaign_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['contribution_campaign_id'])) {
$query->_select['contribution_campaign_id'] = 'civicrm_contribution.campaign_id as contribution_campaign_id';
$query->_element['contribution_campaign_id'] = 1;
$query->_tables['civicrm_contribution'] = 1;
}
// LCD 716
- if (CRM_Utils_Array::value('soft_credit_name', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['soft_credit_name'])) {
$query->_select['contribution_soft_credit_name'] = "civicrm_contact_d.display_name as contribution_soft_credit_name";
$query->_element['contribution_soft_credit_name'] = 1;
$query->_tables['civicrm_contribution'] = 1;
$query->_tables['civicrm_contribution_soft_contact'] = 1;
}
- if (CRM_Utils_Array::value('soft_credit_email', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['soft_credit_email'])) {
$query->_select['contribution_soft_credit_email'] = "soft_email.email as contribution_soft_credit_email";
$query->_element['contribution_soft_credit_email'] = 1;
$query->_tables['civicrm_contribution'] = 1;
$query->_tables['civicrm_contribution_soft_email'] = 1;
}
- if (CRM_Utils_Array::value('soft_credit_phone', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['soft_credit_phone'])) {
$query->_select['contribution_soft_credit_email'] = "soft_phone.phone as contribution_soft_credit_phone";
$query->_element['contribution_soft_credit_phone'] = 1;
$query->_tables['civicrm_contribution'] = 1;
static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
- if (!CRM_Utils_Array::value(0, $query->_params[$id])) {
+ if (empty($query->_params[$id][0])) {
continue;
}
if (substr($query->_params[$id][0], 0, 13) == 'contribution_' || substr($query->_params[$id][0], 0, 10) == 'financial_') {
static function tableNames(&$tables) {
// Add contribution table
- if (CRM_Utils_Array::value('civicrm_product', $tables)) {
+ if (!empty($tables['civicrm_product'])) {
$tables = array_merge(array('civicrm_contribution' => 1), $tables);
}
- if (CRM_Utils_Array::value('civicrm_contribution_product', $tables) &&
+ if (!empty($tables['civicrm_contribution_product']) &&
!CRM_Utils_Array::value('civicrm_product', $tables)) {
$tables['civicrm_product'] = 1;
}
}
elseif ($this->_action & CRM_Core_Action::UPDATE) {
- if (CRM_Utils_Array::value('contact_id', $defaults) || CRM_Utils_Array::value('created_id', $defaults)) {
+ if (!empty($defaults['contact_id']) || CRM_Utils_Array::value('created_id', $defaults)) {
$contactID = !empty($defaults['created_id']) ? $defaults['created_id'] : $defaults['contact_id'];
$this->assign('created_id', $contactID);
$this->assign('organisationId', $contactID);
//Check if this is an online transaction (financial_trxn.payment_processor_id NOT NULL)
$this->_online = FALSE;
$fids = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($id);
- if (CRM_Utils_Array::value('financialTrxnId', $fids)) {
+ if (!empty($fids['financialTrxnId'])) {
$this->_online = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $fids['financialTrxnId'], 'payment_processor_id');
}
//unset the honor type id:when delete the honor_contact_id
//and edit the contribution, honoree infomation pane open
//since honor_type_id is present
- if (!CRM_Utils_Array::value('honor_contact_id', $values)) {
+ if (empty($values['honor_contact_id'])) {
unset($values['honor_type_id']);
}
//to get note id
$productDetails = array();
CRM_Contribute_BAO_ManagePremiums::retrieve($premiumParams, $productDetails);
$dao->financial_type_id = CRM_Utils_Array::value('financial_type_id', $productDetails);
- if (CRM_Utils_Array::value($params['product_name'][0], $options)) {
+ if (!empty($options[$params['product_name'][0]])) {
$dao->product_option = $options[$params['product_name'][0]][$params['product_name'][1]];
}
if ($premiumID) {
$formatted[$f] = CRM_Utils_Array::value($f, $params);
}
- if (CRM_Utils_Array::value('thankyou_date', $params) && !CRM_Utils_System::isNull($params['thankyou_date'])) {
+ if (!empty($params['thankyou_date']) && !CRM_Utils_System::isNull($params['thankyou_date'])) {
$formatted['thankyou_date'] = CRM_Utils_Date::processDate($params['thankyou_date'], $params['thankyou_date_time']);
}
else {
$formatted['thankyou_date'] = 'null';
}
- if (CRM_Utils_Array::value('is_email_receipt', $params)) {
+ if (!empty($params['is_email_receipt'])) {
$params['receipt_date'] = $formatted['receipt_date'] = date('YmdHis');
}
// Retrieve Financial Type Name from financial_type_id
$params['contributionType_name'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType',
$params['financial_type_id']);
- if (CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ if (!empty($params['payment_instrument_id'])) {
$paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
$params['paidBy'] = $paymentInstrument[$params['payment_instrument_id']];
}
// retrieve individual prefix value for honoree
- if (CRM_Utils_Array::value('hidden_Honoree', $params)) {
+ if (!empty($params['hidden_Honoree'])) {
$individualPrefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
$honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
$params['honor_prefix'] = CRM_Utils_Array::value(CRM_Utils_Array::value('honor_prefix_id',
// retrieve premium product name and assigned fulfilled
// date to template
- if (CRM_Utils_Array::value('hidden_Premium', $params)) {
+ if (!empty($params['hidden_Premium'])) {
if (isset($params['product_name']) &&
is_array($params['product_name']) &&
!empty($params['product_name'])
$params['product_name'] = $productDAO->name;
$params['product_sku'] = $productDAO->sku;
- if (!CRM_Utils_Array::value('product_option', $params) &&
+ if (empty($params['product_option']) &&
CRM_Utils_Array::value($params['product_name'][0],
$form->_options
)
}
}
- if (CRM_Utils_Array::value('fulfilled_date', $params)) {
+ if (!empty($params['fulfilled_date'])) {
$form->assign('fulfilled_date', CRM_Utils_Date::processDate($params['fulfilled_date']));
}
}
if ($ccContribution) {
//build the name.
$name = CRM_Utils_Array::value('billing_first_name', $params);
- if (CRM_Utils_Array::value('billing_middle_name', $params)) {
+ if (!empty($params['billing_middle_name'])) {
$name .= " {$params['billing_middle_name']}";
}
$name .= ' ' . CRM_Utils_Array::value('billing_last_name', $params);
// assigned various dates to the templates
$form->assign('receipt_date', CRM_Utils_Date::processDate($params['receipt_date']));
- if (CRM_Utils_Array::value('cancel_date', $params)) {
+ if (!empty($params['cancel_date'])) {
$form->assign('cancel_date', CRM_Utils_Date::processDate($params['cancel_date']));
}
- if (CRM_Utils_Array::value('thankyou_date', $params)) {
+ if (!empty($params['thankyou_date'])) {
$form->assign('thankyou_date', CRM_Utils_Date::processDate($params['thankyou_date']));
}
if ($form->_action & CRM_Core_Action::UPDATE) {
}
//handle custom data
- if (CRM_Utils_Array::value('hidden_custom', $params)) {
+ if (!empty($params['hidden_custom'])) {
$contribParams = array(array('contribution_id', '=', $params['contribution_id'], 0, 0));
if ($form->_mode == 'test') {
$contribParams[] = array('contribution_test', '=', 1, 0, 0);
$form->assign('contactID', $params['contact_id']);
$form->assign('contributionID', $params['contribution_id']);
- if (CRM_Utils_Array::value('currency', $params)) {
+ if (!empty($params['currency'])) {
$form->assign('currency', $params['currency']);
}
- if (CRM_Utils_Array::value('receive_date', $params)) {
+ if (!empty($params['receive_date'])) {
$form->assign('receive_date', CRM_Utils_Date::processDate($params['receive_date']));
}
$config = CRM_Core_Config::singleton();
// set default country from config if no country set
- if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $defaults)) {
+ if (empty($defaults["billing_country_id-{$this->_bltID}"])) {
$defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
}
- if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $defaults)) {
+ if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) {
$defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
}
}
$statusMsg = ts('The payment record has been processed.');
- if (CRM_Utils_Array::value('is_email_receipt', $submittedValues) && $sendReceipt) {
+ if (!empty($submittedValues['is_email_receipt']) && $sendReceipt) {
$statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.');
}
CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
}
}
- if (CRM_Utils_Array::value('source', $params)) {
+ if (!empty($params['source'])) {
unset($params['source']);
}
$contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields,
$config->defaultCurrency
);
$this->_params['payment_action'] = 'Sale';
- if (CRM_Utils_Array::value('trxn_date', $this->_params)) {
+ if (!empty($this->_params['trxn_date'])) {
$this->_params['receive_date'] = CRM_Utils_Date::processDate($this->_params['trxn_date'], $this->_params['receive_date_time']);
}
// if folks need to use it
$paymentParams['contributionType_name'] = $this->_params['contributionType_name'] = $contributionType->name;
$paymentParams['contributionPageID'] = NULL;
- if (CRM_Utils_Array::value('is_email_receipt', $this->_params)) {
+ if (!empty($this->_params['is_email_receipt'])) {
$paymentParams['email'] = $this->_contributorEmail;
$paymentParams['is_email_receipt'] = 1;
}
$paymentParams['is_email_receipt'] = 0;
$this->_params['is_email_receipt'] = 0;
}
- if (CRM_Utils_Array::value('receive_date', $this->_params)) {
+ if (!empty($this->_params['receive_date'])) {
$paymentParams['receive_date'] = $this->_params['receive_date'];
}
- if (CRM_Utils_Array::value('receive_date', $this->_params)) {
+ if (!empty($this->_params['receive_date'])) {
$paymentParams['receive_date'] = $this->_params['receive_date'];
}
if ($trxnRecord->id) {
$statusMsg = ts('The payment record has been processed.');
- if (CRM_Utils_Array::value('is_email_receipt', $this->_params) && $sendReceipt) {
+ if (!empty($this->_params['is_email_receipt']) && $sendReceipt) {
$statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.');
}
CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
static function emailReceipt(&$form, &$params) {
// email receipt sending
}
-}
\ No newline at end of file
+}
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
$this->applyCustomData('Contribution', CRM_Utils_Array::value('financial_type_id', $_POST), $this->_id);
}
if ($this->_mode) {
$config = CRM_Core_Config::singleton();
// set default country from config if no country set
- if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $defaults)) {
+ if (empty($defaults["billing_country_id-{$this->_bltID}"])) {
$defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
}
- if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $defaults)) {
+ if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) {
$defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
}
$defaults['financial_type_id'] = $this->_contributionType;
}
- if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ if (empty($defaults['payment_instrument_id'])) {
$defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
}
- if (CRM_Utils_Array::value('is_test', $defaults)) {
+ if (!empty($defaults['is_test'])) {
$this->assign('is_test', TRUE);
}
$this->assign('email', $this->userEmail);
}
- if (CRM_Utils_Array::value('is_pay_later', $defaults)) {
+ if (!empty($defaults['is_pay_later'])) {
$this->assign('is_pay_later', TRUE);
}
$this->assign('contribution_status_id', CRM_Utils_Array::value('contribution_status_id', $defaults));
$dates = array('receive_date', 'receipt_date', 'cancel_date', 'thankyou_date');
foreach ($dates as $key) {
- if (CRM_Utils_Array::value($key, $defaults)) {
+ if (!empty($defaults[$key])) {
list($defaults[$key],
$defaults[$key . '_time']
) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value($key, $defaults),
}
// do the amount validations.
- if (!CRM_Utils_Array::value('total_amount', $fields) && empty($self->_lineItems)) {
+ if (empty($fields['total_amount']) && empty($self->_lineItems)) {
if ($priceSetId = CRM_Utils_Array::value('price_set_id', $fields)) {
CRM_Price_BAO_PriceField::priceSetValidation($priceSetId, $fields, $errors);
}
$softErrors = CRM_Contribute_Form_SoftCredit::formRule($fields, $errors, $self);
- if (CRM_Utils_Array::value('total_amount', $fields) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) {
+ if (!empty($fields['total_amount']) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) {
$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');
}
//FIXME FOR NEW DATA FLOW http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow
- if (CRM_Utils_Array::value('fee_amount', $fields)
- && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($fields['financial_type_id'])) {
+ if (!empty($fields['fee_amount']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($fields['financial_type_id'])) {
$errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType;
}
// get the submitted form values.
$submittedValues = $this->controller->exportValues($this->_name);
- if (CRM_Utils_Array::value('price_set_id', $submittedValues) && $this->_action & CRM_Core_Action::UPDATE) {
+ if (!empty($submittedValues['price_set_id']) && $this->_action & CRM_Core_Action::UPDATE) {
$line = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution');
$lineID = key($line);
$priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('price_field_id', $line[$lineID]), 'price_set_id');
}
$this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
- if (CRM_Utils_Array::value('pcp_made_through_id', $submittedValues)) {
+ if (!empty($submittedValues['pcp_made_through_id'])) {
$pcp = array();
$fields = array(
'pcp_made_through_id',
}
// set the contact, when contact is selected
- if (CRM_Utils_Array::value('contact_select_id', $submittedValues)) {
+ if (!empty($submittedValues['contact_select_id'])) {
$this->_contactID = $submittedValues['contact_select_id'][1];
}
$params[$d] = CRM_Utils_Date::processDate($formValues[$d], $formValues[$d . '_time'], TRUE);
}
- if (CRM_Utils_Array::value('is_email_receipt', $formValues)) {
+ if (!empty($formValues['is_email_receipt'])) {
$params['receipt_date'] = date("Y-m-d");
}
}
$statusMsg = ts('The contribution record has been saved.');
- if (CRM_Utils_Array::value('is_email_receipt', $formValues) && $sendReceipt) {
+ if (!empty($formValues['is_email_receipt']) && $sendReceipt) {
$statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.');
}
}
}
- if (CRM_Utils_Array::value('source', $params)) {
+ if (!empty($params['source'])) {
unset($params['source']);
}
$contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields,
$config->defaultCurrency
);
$this->_params['payment_action'] = 'Sale';
- if (CRM_Utils_Array::value('receive_date', $this->_params)) {
+ if (!empty($this->_params['receive_date'])) {
$this->_params['receive_date'] = CRM_Utils_Date::processDate($this->_params['receive_date'], $this->_params['receive_date_time']);
}
- if (CRM_Utils_Array::value('soft_credit_to', $params)) {
+ if (!empty($params['soft_credit_to'])) {
$this->_params['soft_credit_to'] = $params['soft_credit_to'];
$this->_params['pcp_made_through_id'] = $params['pcp_made_through_id'];
}
// if folks need to use it
$paymentParams['contributionType_name'] = $this->_params['contributionType_name'] = $contributionType->name;
$paymentParams['contributionPageID'] = NULL;
- if (CRM_Utils_Array::value('is_email_receipt', $this->_params)) {
+ if (!empty($this->_params['is_email_receipt'])) {
$paymentParams['email'] = $this->userEmail;
$paymentParams['is_email_receipt'] = 1;
}
$paymentParams['is_email_receipt'] = 0;
$this->_params['is_email_receipt'] = 0;
}
- if (CRM_Utils_Array::value('receive_date', $this->_params)) {
+ if (!empty($this->_params['receive_date'])) {
$paymentParams['receive_date'] = $this->_params['receive_date'];
}
- if (CRM_Utils_Array::value('receive_date', $this->_params)) {
+ if (!empty($this->_params['receive_date'])) {
$paymentParams['receive_date'] = $this->_params['receive_date'];
}
// For recurring contribution, create Contribution Record first.
// Contribution ID, Recurring ID and Contact ID needed
// When we get a callback from the payment processor, CRM-7115
- if (CRM_Utils_Array::value('is_recur', $paymentParams)) {
+ if (!empty($paymentParams['is_recur'])) {
$contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($this,
$this->_params,
$result,
if (is_a($result, 'CRM_Core_Error')) {
//make sure to cleanup db for recurring case.
- if (CRM_Utils_Array::value('contributionID', $paymentParams)) {
+ if (!empty($paymentParams['contributionID'])) {
CRM_Core_Error::debug_log_message(CRM_Core_Error::getMessages($result) . "contact id={$this->_contactID} (deleting contribution {$paymentParams['contributionID']}");
CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']);
}
- if (CRM_Utils_Array::value('contributionRecurID', $paymentParams)) {
+ if (!empty($paymentParams['contributionRecurID'])) {
CRM_Core_Error::debug_log_message(CRM_Core_Error::getMessages($result) . "contact id={$this->_contactID} (deleting recurring contribution {$paymentParams['contributionRecurID']}");
CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
}
$this->_params['receive_date'] = $now;
- if (CRM_Utils_Array::value('is_email_receipt', $this->_params)) {
+ if (!empty($this->_params['is_email_receipt'])) {
$this->_params['receipt_date'] = $now;
}
else {
);
- if (!CRM_Utils_Array::value('is_recur', $paymentParams)) {
+ if (empty($paymentParams['is_recur'])) {
$contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($this,
$this->_params,
$result,
if ($contribution->id) {
$statusMsg = ts('The contribution record has been processed.');
- if (CRM_Utils_Array::value('is_email_receipt', $this->_params) && $sendReceipt) {
+ if (!empty($this->_params['is_email_receipt']) && $sendReceipt) {
$statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.');
}
CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
$this->assign('pay_later_receipt', $this->_values['pay_later_receipt']);
}
// if onbehalf-of-organization
- if (CRM_Utils_Array::value('hidden_onbehalf_profile', $this->_params)) {
- if (CRM_Utils_Array::value('org_option', $this->_params) &&
+ if (!empty($this->_params['hidden_onbehalf_profile'])) {
+ if (!empty($this->_params['org_option']) &&
CRM_Utils_Array::value('organization_id', $this->_params)
) {
- if (CRM_Utils_Array::value('onbehalfof_id', $this->_params)) {
+ if (!empty($this->_params['onbehalfof_id'])) {
$this->_params['organization_id'] = $this->_params['onbehalfof_id'];
}
}
}
$this->_params['onbehalf_location']['address'][$locType][$field] = $value;
- if (!CRM_Utils_Array::value('is_primary', $this->_params['onbehalf_location']['address'][$locType])) {
+ if (empty($this->_params['onbehalf_location']['address'][$locType]['is_primary'])) {
$this->_params['onbehalf_location']['address'][$locType]['is_primary'] = $isPrimary;
}
$this->_params['onbehalf_location']['address'][$locType]['location_type_id'] = $locType;
}
}
}
- elseif (CRM_Utils_Array::value('is_for_organization', $this->_values)) {
+ elseif (!empty($this->_values['is_for_organization'])) {
// no on behalf of an organization, CRM-5519
// so reset loc blocks from main params.
foreach (array(
$this->_params['is_recur'] = $this->_values['is_recur'] = 1;
// check if price set is not quick config
- if (CRM_Utils_Array::value('priceSetId', $this->_params) && !$isQuickConfig) {
+ if (!empty($this->_params['priceSetId']) && !$isQuickConfig) {
list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_PriceSet::getRecurDetails($this->_params['priceSetId']);
}
else {
$amount_block_is_active = $this->get('amount_block_is_active');
$this->assign('amount_block_is_active', $amount_block_is_active);
- if (CRM_Utils_Array::value('selectProduct', $params) && $params['selectProduct'] != 'no_thanks') {
+ if (!empty($params['selectProduct']) && $params['selectProduct'] != 'no_thanks') {
$option = CRM_Utils_Array::value('options_' . $params['selectProduct'], $params);
$productID = $params['selectProduct'];
CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, FALSE,
$this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE);
$this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE);
- if (CRM_Utils_Array::value('hidden_onbehalf_profile', $params)) {
+ if (!empty($params['hidden_onbehalf_profile'])) {
$ufJoinParams = array(
'module' => 'onBehalf',
'entity_table' => 'civicrm_contribution_page',
$fields = array();
- if (CRM_Utils_Array::value('image_URL', $params)) {
+ if (!empty($params['image_URL'])) {
CRM_Contact_BAO_Contact::processImageParams($params);
}
$fields[$name] = 1;
// get the add to groups for uf fields
- if (CRM_Utils_Array::value('add_to_group_id', $value)) {
+ if (!empty($value['add_to_group_id'])) {
$addToGroups[$value['add_to_group_id']] = $value['add_to_group_id'];
}
}
// organization params in a separate variable, to make sure
// normal behavior is continued. And use that variable to
// process on-behalf-of functionality.
- if (CRM_Utils_Array::value('hidden_onbehalf_profile', $this->_params)) {
+ if (!empty($this->_params['hidden_onbehalf_profile'])) {
$behalfOrganization = array();
$orgFields = array('organization_name', 'organization_id', 'org_option');
foreach ($orgFields as $fld) {
}
unset($params['onbehalf_location']);
}
- if (CRM_Utils_Array::value('onbehalf[image_URL]', $params)) {
+ if (!empty($params['onbehalf[image_URL]'])) {
$behalfOrganization['image_URL'] = $params['onbehalf[image_URL]'];
}
}
if (empty($contactID)) {
$dupeParams = $params;
- if (CRM_Utils_Array::value('onbehalf', $dupeParams)) {
+ if (!empty($dupeParams['onbehalf'])) {
unset($dupeParams['onbehalf']);
}
$membershipParams['financial_type_id'] = $contributionTypeID;
$membershipParams['types_terms'] = $membershipTypeTerms;
}
- if (CRM_Utils_Array::value('selectMembership', $membershipParams)) {
+ if (!empty($membershipParams['selectMembership'])) {
// CRM-12233
if ($this->_separateMembershipPayment && $this->_values['amount_block_is_active']) {
foreach ($this->_values['fee'] as $key => $feeValues) {
'start_date' => CRM_Utils_Date::customFormat($startDate, '%Y%m%d'),
'end_date' => CRM_Utils_Date::customFormat($endDate, '%Y%m%d'),
);
- if( CRM_Utils_Array::value( 'selectProduct', $premiumParams ) ){
+ if (!empty($premiumParams['selectProduct'])){
$daoPremiumsProduct = new CRM_Contribute_DAO_PremiumsProduct();
$daoPremiumsProduct->product_id = $premiumParams['selectProduct'];
$daoPremiumsProduct->premiums_id = $dao->id;
$now = date('YmdHis');
$receiptDate = CRM_Utils_Array::value('receipt_date', $params);
- if (CRM_Utils_Array::value('is_email_receipt', $form->_values)) {
+ if (!empty($form->_values['is_email_receipt'])) {
$receiptDate = $now;
}
}
if (!$online || $form->_values['is_monetary']) {
- if (!CRM_Utils_Array::value('is_pay_later', $params)) {
+ if (empty($params['is_pay_later'])) {
$contribParams['payment_instrument_id'] = 1;
}
}
$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 (
- CRM_Utils_Array::value('pcp_made_through_id', $params) ||
+ if (!empty($params['pcp_made_through_id']) ||
CRM_Utils_Array::value('soft_credit_to', $params)
) {
// if its due to pcp
- if (CRM_Utils_Array::value('pcp_made_through_id', $params)) {
+ if (!empty($params['pcp_made_through_id'])) {
$contribSoftContactId = CRM_Core_DAO::getFieldValue(
'CRM_PCP_DAO_PCP',
$params['pcp_made_through_id'],
CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution);
//handle pledge stuff.
- if (
- !CRM_Utils_Array::value('separate_membership_payment', $form->_params) &&
+ 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 (CRM_Utils_Array::value('pledge_id', $form->_values)) {
+ if (!empty($form->_values['pledge_id'])) {
//when user doing pledge payments.
//update the schedule when payment(s) are made
elseif ($contribution) {
//handle custom data.
$params['contribution_id'] = $contribution->id;
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom']) &&
!is_a($contribution, 'CRM_Core_Error')
) {
//create contribution activity w/ individual and target
//activity w/ organisation contact id when onbelf, CRM-4027
$targetContactID = NULL;
- if (CRM_Utils_Array::value('hidden_onbehalf_profile', $params)) {
+ if (!empty($params['hidden_onbehalf_profile'])) {
$targetContactID = $contribution->contact_id;
$contribution->contact_id = $contactID;
}
}
$recurParams['start_date'] = $recurParams['create_date'] = $recurParams['modified_date'] = date('YmdHis');
- if (CRM_Utils_Array::value('receive_date', $params)) {
+ if (!empty($params['receive_date'])) {
$recurParams['start_date'] = $params['receive_date'];
}
$recurParams['invoice_id'] = CRM_Utils_Array::value('invoiceID', $params);
static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) {
$isCurrentEmployer = FALSE;
$orgID = NULL;
- if (CRM_Utils_Array::value('organization_id', $behalfOrganization) &&
+ if (!empty($behalfOrganization['organization_id']) &&
CRM_Utils_Array::value('org_option', $behalfOrganization)
) {
$orgID = $behalfOrganization['organization_id'];
}
// handling for image url
- if (CRM_Utils_Array::value('image_URL', $behalfOrganization)) {
+ if (!empty($behalfOrganization['image_URL'])) {
CRM_Contact_BAO_Contact::processImageParams($behalfOrganization);
}
*/
static function processPcpSoft(&$params, &$contribution) {
//add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
- if (CRM_Utils_Array::value('soft_credit_to', $params)) {
+ if (!empty($params['soft_credit_to'])) {
$contribSoftParams = array();
foreach (array(
'pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note', 'amount') as $val) {
- if (CRM_Utils_Array::value($val, $params)) {
+ if (!empty($params[$val])) {
$contribSoftParams[$val] = $params[$val];
}
}
static function processPcp(&$page, $params) {
$params['pcp_made_through_id'] = $page->_pcpId;
$page->assign('pcpBlock', TRUE);
- if (CRM_Utils_Array::value('pcp_display_in_roll', $params) &&
+ if (!empty($params['pcp_display_in_roll']) &&
!CRM_Utils_Array::value('pcp_roll_nickname', $params)
) {
$params['pcp_roll_nickname'] = ts('Anonymous');
'pcp_roll_nickname',
'pcp_personal_note'
) as $val) {
- if (CRM_Utils_Array::value($val, $params)) {
+ if (!empty($params[$val])) {
$page->assign($val, $params[$val]);
}
}
}
$this->assign('onBehalfRequired', $this->_onBehalfRequired);
- if (CRM_Utils_Array::value('honor_block_is_active', $this->_values)) {
+ if (!empty($this->_values['honor_block_is_active'])) {
CRM_Contact_Form_ProfileContact::preprocess($this);
}
}
//CRM-5001
- if (CRM_Utils_Array::value('is_for_organization', $this->_values)) {
+ if (!empty($this->_values['is_for_organization'])) {
$msg = ts('Mixed profile not allowed for on behalf of registration/sign up.');
if ($preID = CRM_Utils_Array::value('custom_pre_id', $this->_values)) {
$preProfile = CRM_Core_BAO_UFGroup::profileGroups($preID);
// $this->_defaults['bank_name'] = 'Bankname';
//build set default for pledge overdue payment.
- if (CRM_Utils_Array::value('pledge_id', $this->_values)) {
+ if (!empty($this->_values['pledge_id'])) {
//get all pledge payment records of current pledge id.
$pledgePayments = array();
}
}
- if (CRM_Utils_Array::value('honor_block_is_active', $this->_values) && count($completedContributionIds)) {
+ if (!empty($this->_values['honor_block_is_active']) && count($completedContributionIds)) {
$softCredit = array();
foreach ($completedContributionIds as $id) {
$softCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($id);
}
}
}
- elseif (CRM_Utils_Array::value('pledge_block_id', $this->_values)) {
+ elseif (!empty($this->_values['pledge_block_id'])) {
//set default to one time contribution.
$this->_defaults['is_pledge'] = 0;
}
$config = CRM_Core_Config::singleton();
// set default country from config if no country set
- if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $this->_defaults)) {
+ if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) {
$this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
}
// set default state/province from config if no state/province set
- if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $this->_defaults)) {
+ if (empty($this->_defaults["billing_state_province_id-{$this->_bltID}"])) {
$this->_defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
}
}
$selectedCurrentMemTypes[] = $values['membership_type_id'];
}
- elseif (CRM_Utils_Array::value('is_default', $values) &&
+ elseif (!empty($values['is_default']) &&
!$opMemTypeId &&
(!isset($this->_defaults["price_{$key}"]) ||
($val['html_type'] == 'CheckBox' && !isset($this->_defaults["price_{$key}"][$keys]))
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $pid => $value) {
- if (CRM_Utils_Array::value('is_default', $value)) {
+ if (!empty($value['is_default'])) {
$this->_defaults['payment_processor'] = $pid;
}
}
$pps[$key] = $name['name'];
}
}
- if (CRM_Utils_Array::value('is_pay_later', $this->_values)) {
+ if (!empty($this->_values['is_pay_later'])) {
$pps[0] = $this->_values['pay_later_text'];
}
//build pledge block.
$this->_useForMember = 0;
//don't build membership block when pledge_id is passed
- if (!CRM_Utils_Array::value('pledge_id', $this->_values)) {
+ if (empty($this->_values['pledge_id'])) {
$this->_separateMembershipPayment = FALSE;
if (in_array('CiviMember', $config->enableComponents)) {
$isTest = 0;
}
//we allow premium for pledge during pledge creation only.
- if (!CRM_Utils_Array::value('pledge_id', $this->_values)) {
+ if (empty($this->_values['pledge_id'])) {
CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, TRUE);
}
$form->add('checkbox', 'is_recur', ts('I want to contribute this amount'), NULL);
- if (CRM_Utils_Array::value('is_recur_interval', $form->_values) || $className == 'CRM_Contribute_Form_Contribution') {
+ if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') {
$form->add('text', 'frequency_interval', ts('Every'), $attributes['frequency_interval']);
$form->addRule('frequency_interval', ts('Frequency must be a whole number (EXAMPLE: Every 3 months).'), 'integer');
}
$form->assign('one_frequency_unit', true);
$unit = $unitVals[0];
$form->add('hidden', 'frequency_unit', $unit);
- if (CRM_Utils_Array::value('is_recur_interval', $form->_values) || $className == 'CRM_Contribute_Form_Contribution') {
+ if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') {
$unit .= "(s)";
}
$form->assign('frequency_unit', $unit);
foreach ($unitVals as $key => $val) {
if (array_key_exists($val, $frequencyUnits)) {
$units[$val] = $frequencyUnits[$val];
- if (CRM_Utils_Array::value('is_recur_interval', $form->_values) || $className == 'CRM_Contribute_Form_Contribution') {
+ if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') {
$units[$val] = "{$frequencyUnits[$val]}(s)";
}
}
}
//check for atleast one pricefields should be selected
- if (CRM_Utils_Array::value('priceSetId', $fields)) {
+ if (!empty($fields['priceSetId'])) {
$priceField = new CRM_Price_DAO_PriceField();
$priceField->price_set_id = $fields['priceSetId'];
$priceField->orderBy('weight');
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 (CRM_Utils_Array::value('price_' . $priceId, $fields) && is_array($fields['price_' . $priceId])) {
+ if (!empty($fields['price_' . $priceId]) && is_array($fields['price_' . $priceId])) {
foreach ($fields['price_' . $priceId] as $priceFldVal => $isSet) {
if ($isSet) {
$priceFieldIDS[] = $priceFldVal;
$priceFieldIDS[] = $fields['price_' . $priceId];
}
- if (CRM_Utils_Array::value('options', $value)) {
+ if (!empty($value['options'])) {
foreach ($value['options'] as $val) {
- if (CRM_Utils_Array::value('membership_type_id', $val)) {
+ if (!empty($val['membership_type_id'])) {
$priceFieldMemTypes[] = $val['membership_type_id'];
}
}
}
}
- if ( CRM_Utils_Array::value( 'is_recur', $fields ) ) {
+ if (!empty($fields['is_recur'])) {
if ($fields['frequency_interval'] <= 0) {
$errors['frequency_interval'] = ts('Please enter a number for how often you want to make this recurring contribution (EXAMPLE: Every 3 months).');
}
}
}
- if (CRM_Utils_Array::value('is_recur', $fields) &&
+ if (!empty($fields['is_recur']) &&
CRM_Utils_Array::value('payment_processor', $fields) == 0) {
$errors['_qf_default'] = ts('You cannot set up a recurring contribution if you are not paying online by credit card.');
}
- if (CRM_Utils_Array::value('is_for_organization', $fields) &&
+ if (!empty($fields['is_for_organization']) &&
!property_exists($self, 'organizationName')
) {
- if (!CRM_Utils_Array::value('organization_name', $fields['onbehalf'])) {
- if (CRM_Utils_Array::value('org_option', $fields) && !$fields['onbehalfof_id']) {
+ if (empty($fields['onbehalf']['organization_name'])) {
+ if (!empty($fields['org_option']) && !$fields['onbehalfof_id']) {
$errors['organization_id'] = ts('Please select an organization or enter a new one.');
}
- elseif (!CRM_Utils_Array::value('org_option', $fields)) {
+ elseif (empty($fields['org_option'])) {
$errors['onbehalf']['organization_name'] = ts('Please enter the organization name.');
}
}
$emailLocType = explode('-', $key);
}
}
- if (!CRM_Utils_Array::value("email-{$emailLocType[1]}", $fields['onbehalf'])) {
+ if (empty($fields['onbehalf']["email-{$emailLocType[1]}"])) {
$errors['onbehalf']["email-{$emailLocType[1]}"] = ts('Organization email is required.');
}
}
if ($self->_paymentProcessor &&
$self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
) {
- if (CRM_Utils_Array::value($self->_expressButtonName . '_x', $fields) ||
+ if (!empty($fields[$self->_expressButtonName . '_x']) ||
CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) ||
CRM_Utils_Array::value($self->_expressButtonName, $fields)
) {
}
//validate the pledge fields.
- if (CRM_Utils_Array::value('pledge_block_id', $self->_values)) {
+ if (!empty($self->_values['pledge_block_id'])) {
//validation for pledge payment.
- if (CRM_Utils_Array::value('pledge_id', $self->_values)) {
+ if (!empty($self->_values['pledge_id'])) {
if (empty($fields['pledge_amount'])) {
$errors['pledge_amount'] = ts('At least one payment option needs to be checked.');
}
}
- elseif (CRM_Utils_Array::value('is_pledge', $fields)) {
+ elseif (!empty($fields['is_pledge'])) {
if (CRM_Utils_Rule::positiveInteger(CRM_Utils_Array::value('pledge_installments', $fields)) == FALSE) {
$errors['pledge_installments'] = ts('Please enter a valid number of pledge installments.');
}
}
}
else {
- if (CRM_Utils_Array::value('amount', $form->_values)) {
+ if (!empty($form->_values['amount'])) {
$amountID = CRM_Utils_Array::value('amount', $params);
if ($amountID) {
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
- if (CRM_Utils_Array::value('priceSetId', $params)) {
+ if (!empty($params['priceSetId'])) {
$is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config');
$formValue = array();
if ($is_quick_config) {
$params['campaign_id'] = $params['contribution_campaign_id'];
}
- if (CRM_Utils_Array::value('onbehalfof_id', $params)) {
+ if (!empty($params['onbehalfof_id'])) {
$params['organization_id'] = $params['onbehalfof_id'];
}
$params['amount'] = self::computeAmount($params, $this);
$params['separate_amount'] = $params['amount'];
$memFee = NULL;
- if (CRM_Utils_Array::value('selectMembership', $params)) {
+ if (!empty($params['selectMembership'])) {
if (!empty($this->_membershipTypeValues)) {
$membershipTypeValues = $this->_membershipTypeValues[$params['selectMembership']];
}
$memPresent = TRUE;
}
else {
- if (CRM_Utils_Array::value('price_' . $fieldKey, $params) && $memPresent && ($fieldVal['name'] == 'other_amount' || $fieldVal['name'] == 'contribution_amount')) {
+ if (!empty($params['price_' . $fieldKey]) && $memPresent && ($fieldVal['name'] == 'other_amount' || $fieldVal['name'] == 'contribution_amount')) {
$fieldId = $fieldVal['id'];
if ($fieldVal['name'] == 'other_amount') {
$proceFieldAmount += $this->_submitValues['price_' . $fieldId];
}
// should we skip the confirm page?
- if (!CRM_Utils_Array::value('is_confirm_enabled', $this->_values)) {
+ if (empty($this->_values['is_confirm_enabled'])) {
// call the post process hook for the main page before we switch to confirm
$this->postProcessHook();
$this->assign('pcpBlock', TRUE);
foreach (array(
'pcp_display_in_roll', 'pcp_is_anonymous', 'pcp_roll_nickname', 'pcp_personal_note') as $val) {
- if (CRM_Utils_Array::value($val, $this->_params)) {
+ if (!empty($this->_params[$val])) {
$this->assign($val, $this->_params[$val]);
}
}
$this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE);
$this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE);
- if (CRM_Utils_Array::value('hidden_onbehalf_profile', $params)) {
+ if (!empty($params['hidden_onbehalf_profile'])) {
$ufJoinParams = array(
'module' => 'onBehalf',
'entity_table' => 'civicrm_contribution_page',
$tellAFriend = TRUE;
}
}
- elseif (CRM_Utils_Array::value('is_active', $data)) {
+ elseif (!empty($data['is_active'])) {
$friendText = $data['title'];
$this->assign('friendText', $friendText);
$subUrl = "eid={$this->_id}&pcomponent=contribute";
CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values);
// check if form is active
- if (!CRM_Utils_Array::value('is_active', $this->_values)) {
+ if (empty($this->_values['is_active'])) {
// form is inactive, die a fatal death
CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
}
}
//set pledge block if block id is set
- if (CRM_Utils_Array::value('pledge_block_id', $this->_values)) {
+ if (!empty($this->_values['pledge_block_id'])) {
$this->assign('pledgeBlock', TRUE);
}
*/
function assignToTemplate() {
$name = CRM_Utils_Array::value('billing_first_name', $this->_params);
- if (CRM_Utils_Array::value('billing_middle_name', $this->_params)) {
+ if (!empty($this->_params['billing_middle_name'])) {
$name .= " {$this->_params['billing_middle_name']}";
}
$name .= ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params);
$this->assign('address', CRM_Utils_Address::format($addressFields));
- if (CRM_Utils_Array::value('hidden_onbehalf_profile', $this->_params)) {
+ if (!empty($this->_params['hidden_onbehalf_profile'])) {
$this->assign('onBehalfName', $this->_params['organization_name']);
$locTypeId = array_keys($this->_params['onbehalf_location']['email']);
$this->assign('onBehalfEmail', $this->_params['onbehalf_location']['email'][$locTypeId[0]]['email']);
if ($this->_amount > 0.0) {
$assignCCInfo = TRUE;
}
- elseif (CRM_Utils_array::value('selectMembership', $this->_params)) {
+ elseif (!empty($this->_params['selectMembership'])) {
$memFee = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_params['selectMembership'], 'minimum_fee');
if ($memFee > 0.0) {
$assignCCInfo = TRUE;
foreach ($pledgeBlock as $key) {
$defaults[$key] = CRM_Utils_Array::value($key, $pledgeBlockDefaults);
}
- if (CRM_Utils_Array::value('pledge_frequency_unit', $pledgeBlockDefaults)) {
+ if (!empty($pledgeBlockDefaults['pledge_frequency_unit'])) {
$defaults['pledge_frequency_unit'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
$pledgeBlockDefaults['pledge_frequency_unit']
), '1');
$defaults['price_set_id'] = $this->_priceSetID;
}
- if (CRM_Utils_Array::value('end_date', $defaults)) {
+ if (!empty($defaults['end_date'])) {
list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['end_date']);
}
- if (CRM_Utils_Array::value('start_date', $defaults)) {
+ if (!empty($defaults['start_date'])) {
list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['start_date']);
}
}
$defaults['for_organization'] = ts('I am contributing on behalf of an organization.');
}
- if (CRM_Utils_Array::value('recur_frequency_unit', $defaults)) {
+ if (!empty($defaults['recur_frequency_unit'])) {
$defaults['recur_frequency_unit'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
$defaults['recur_frequency_unit']
), '1');
$defaults['recur_frequency_unit'] = array('month' => 1);
}
- if (CRM_Utils_Array::value('is_for_organization', $defaults)) {
+ if (!empty($defaults['is_for_organization'])) {
$defaults['is_organization'] = 1;
}
else {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Contribution Amounts (%1)', array(1 => $title)));
- if (!CRM_Utils_Array::value('pay_later_text', $defaults)) {
+ if (empty($defaults['pay_later_text'])) {
$defaults['pay_later_text'] = ts('I will send payment by check');
}
- if (CRM_Utils_Array::value('amount_block_is_active', $defaults)) {
+ if (!empty($defaults['amount_block_is_active'])) {
if ($priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, NULL)) {
if ($isQuick = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) {
}
}
- if (!CRM_Utils_Array::value('amount_label', $defaults)) {
+ if (empty($defaults['amount_label'])) {
$defaults['amount_label'] = ts('Contribution Amount');
}
- if (CRM_Utils_Array::value('value', $defaults) && is_array($defaults['value'])) {
+ if (!empty($defaults['value']) && is_array($defaults['value'])) {
// CRM-4038: fix value display
foreach ($defaults['value'] as & $amount) {
$defaults['max_amount'] = CRM_Utils_Money::format($defaults['max_amount'], NULL, '%a');
}
- if (CRM_Utils_Array::value('payment_processor', $defaults)) {
+ if (!empty($defaults['payment_processor'])) {
$defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
$defaults['payment_processor']
), '1');
$membershipBlock->is_active = 1;
$hasMembershipBlk = FALSE;
if ($membershipBlock->find(TRUE)) {
- if (CRM_Utils_Array::value('amount_block_is_active', $fields) &&
+ if (!empty($fields['amount_block_is_active']) &&
($setID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $self->_id, NULL, 1))
) {
$extends = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'extends');
}
//check for the amount label (mandatory)
- if (CRM_Utils_Array::value('amount_block_is_active', $fields) && empty($fields['amount_label'])) {
+ if (!empty($fields['amount_block_is_active']) && empty($fields['amount_label'])) {
$errors['amount_label'] = ts('Please enter the contribution amount label.');
}
$minAmount = CRM_Utils_Array::value('min_amount', $fields);
}
// validation for pledge fields.
- if (CRM_Utils_array::value('is_pledge_active', $fields)) {
+ if (!empty($fields['is_pledge_active'])) {
if (empty($fields['pledge_frequency_unit'])) {
$errors['pledge_frequency_unit'] = ts('At least one pledge frequency option needs to be checked.');
}
- if (CRM_Utils_array::value('is_recur', $fields)) {
+ if (!empty($fields['is_recur'])) {
$errors['is_recur'] = ts('You cannot enable both Recurring Contributions AND Pledges on the same online contribution page.');
}
}
// If Contribution amount section is enabled, then
// Allow other amounts must be enabeld OR the Fixed Contribution
// Contribution options must contain at least one set of values.
- if (CRM_Utils_Array::value('amount_block_is_active', $fields)) {
- if (!CRM_Utils_Array::value('is_allow_other_amount', $fields) &&
+ if (!empty($fields['amount_block_is_active'])) {
+ if (empty($fields['is_allow_other_amount']) &&
!$priceSetId
) {
//get the values of amount block
}
}
- if (CRM_Utils_Array::value('payment_processor', $fields)
- && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($self->_defaultValues['financial_type_id'])) {
+ if (!empty($fields['payment_processor']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($self->_defaultValues['financial_type_id'])) {
$errors['payment_processor'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType;
}
- if (CRM_Utils_Array::value('is_recur_interval', $fields)) {
+ if (!empty($fields['is_recur_interval'])) {
foreach(array_keys($fields['payment_processor']) as $paymentProcessorID) {
$paymentProcessorTypeId = CRM_Core_DAO::getFieldValue(
'CRM_Financial_DAO_PaymentProcessor',
$resetFields = array('min_amount', 'max_amount', 'is_allow_other_amount');
}
- if (!CRM_Utils_Array::value('is_recur', $params)) {
+ if (empty($params['is_recur'])) {
$resetFields = array_merge($resetFields, array('is_recur_interval', 'recur_frequency_unit'));
}
if ($contributionPageID) {
- if (CRM_Utils_Array::value('amount_block_is_active', $params)) {
+ if (!empty($params['amount_block_is_active'])) {
// handle price set.
if ($priceSetID) {
// add/update price set.
$deletePriceSet = FALSE;
- if (CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params) ) {
+ if (!empty($params['price_field_id']) || CRM_Utils_Array::value('price_field_other', $params) ) {
$deleteAmountBlk = TRUE;
}
);
}
}
- /* || CRM_Utils_Array::value( 'price_field_value', $params )|| CRM_Utils_Array::value( 'price_field_other', $params )*/
+ /* || 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)) {
$fieldParams['is_quick_config'] = 1;
$noContriAmount = NULL;
$editedResults = array();
$noContriAmount = 1;
CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
- if (!CRM_Utils_Array::value('id', $editedResults)) {
+ if (empty($editedResults['id'])) {
$fieldParams['name'] = strtolower(CRM_Utils_String::munge("Contribution Amount", '_', 245));
}
else {
$fieldParams['is_active'] = 1;
$fieldParams['weight'] = 2;
- if (CRM_Utils_Array::value('is_allow_other_amount', $params)) {
+ if (!empty($params['is_allow_other_amount'])) {
$fieldParams['is_required'] = 0;
}
else {
$fieldParams['default_option'] = $params['default'];
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
}
- if (CRM_Utils_Array::value('is_allow_other_amount', $params) && !CRM_Utils_Array::value('price_field_other', $params)) {
+ if (!empty($params['is_allow_other_amount']) && !CRM_Utils_Array::value('price_field_other', $params)) {
$editedFieldParams = array(
'price_set_id' => $priceSetId,
'name' => 'other_amount',
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
}
else {
- if (!CRM_Utils_Array::value('is_active', $editedResults)) {
+ if (empty($editedResults['is_active'])) {
if (!$noContriAmount) {
$priceFieldValueID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldID, 'id', 'price_field_id');
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', $params['amount_label']);
}
}
}
- elseif (!CRM_Utils_Array::value('is_allow_other_amount', $params) && CRM_Utils_Array::value('price_field_other', $params)) {
+ elseif (empty($params['is_allow_other_amount']) && CRM_Utils_Array::value('price_field_other', $params)) {
CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0');
}
elseif ($priceFieldID = CRM_Utils_Array::value('price_field_other', $params)) {
}
}
- if (CRM_Utils_Array::value('is_pledge_active', $params)) {
+ if (!empty($params['is_pledge_active'])) {
$deletePledgeBlk = FALSE;
$pledgeBlockParams = array(
'entity_id' => $contributionPageID,
}
}
else {
- if (CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params)) {
+ if (!empty($params['price_field_id']) || CRM_Utils_Array::value('price_field_other', $params)) {
$usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3);
if ($usedPriceSetId) {
- if (CRM_Utils_Array::value('price_field_id', $params)) {
+ if (!empty($params['price_field_id'])) {
CRM_Price_BAO_PriceField::setIsActive($params['price_field_id'], '0');
}
- if (CRM_Utils_Array::value('price_field_other', $params)) {
+ if (!empty($params['price_field_other'])) {
CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0');
}
}
*/
public static function formRule($params) {
$errors = array();
- if (CRM_Utils_Array::value('premiums_active', $params)) {
- if (!CRM_Utils_Array::value('premiums_nothankyou_label', $params)) {
+ if (!empty($params['premiums_active'])) {
+ if (empty($params['premiums_nothankyou_label'])) {
$errors['premiums_nothankyou_label'] = ts('No Thank-you Label is a required field.');
}
}
CRM_Utils_System::setTitle(ts('Title and Settings'));
}
- if (!CRM_Utils_Array::value('soft_credit_types', $defaults)) {
+ if (empty($defaults['soft_credit_types'])) {
$defaults['soft_credit_types'] = array(1, 2);
}
$this->addProfileSelector('honoree_profile', ts('Honoree Profile'), $allowCoreTypes, $allowSubTypes, $entities);
- if (CRM_Utils_Array::value('honor_block_is_active', $this->_submitValues)) {
+ if (!empty($this->_submitValues['honor_block_is_active'])) {
$this->addRule('soft_credit_types', ts('At least one value must be selected if Honor Section is active'), 'required');
$this->addRule('honoree_profile', ts('Please select a profile used for honoree'), 'required');
}
$errors['title'] = ts("Please do not use '/' in Title");
}
- if (CRM_Utils_Array::value('is_organization', $values) &&
+ if (!empty($values['is_organization']) &&
!CRM_Utils_Array::value('onbehalf_profile_id', $values)
) {
$errors['onbehalf_profile_id'] = ts('Please select a profile to collect organization information on this contribution page.');
$errors['end_date'] = ts('End date should be after Start date.');
}
- if (CRM_Utils_Array::value('payment_processor', $self->_values)
- && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($values['financial_type_id'])) {
+ if (!empty($self->_values['payment_processor']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($values['financial_type_id'])) {
$errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType;
}
foreach ($ufJoinParams as $index => $ufJoinParam) {
- if (CRM_Utils_Array::value($index, $params)) {
+ if (!empty($params[$index])) {
$ufJoinParam['weight'] = 1;
if ($index == 'honor_block_is_active') {
$ufJoinParam['is_active'] = 1;
$errors = array();
// if is_email_receipt is set, the receipt message must be non-empty
- if (CRM_Utils_Array::value('is_email_receipt', $fields)) {
+ if (!empty($fields['is_email_receipt'])) {
//added for CRM-1348
$email = trim(CRM_Utils_Array::value('receipt_from_email', $fields));
if (empty($email) || !CRM_Utils_Rule::email($email)) {
*/
public static function formRule($params, $files, $self) {
$errors = array();
- if (CRM_Utils_Array::value('is_active', $params)) {
- if (!CRM_Utils_Array::value('title', $params)) {
+ if (!empty($params['is_active'])) {
+ if (empty($params['title'])) {
$errors['title'] = ts('Title is a required field.');
}
- if (!CRM_Utils_Array::value('about', $params)) {
+ if (empty($params['about'])) {
$errors['about'] = ts('About is a required field.');
}
CRM_Contribute_BAO_Contribution::getValues($params, $values, $ids);
CRM_Contribute_BAO_Contribution::resolveDefaults($values);
- if (CRM_Utils_Array::value('contribution_page_id', $values)) {
+ if (!empty($values['contribution_page_id'])) {
$contribPages = CRM_Contribute_PseudoConstant::contributionPage(NULL, TRUE);
$values['contribution_page_title'] = CRM_Utils_Array::value(CRM_Utils_Array::value('contribution_page_id', $values), $contribPages);
}
// get recieved into i.e to_financial_account_id from last trxn
$financialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($values['contribution_id'], 'DESC');
$values['to_financial_account'] = '';
- if (CRM_Utils_Array::value('financialTrxnId', $financialTrxnId)) {
+ if (!empty($financialTrxnId['financialTrxnId'])) {
$values['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $financialTrxnId['financialTrxnId'], 'to_financial_account_id');
if ($values['to_financial_account_id']) {
$values['to_financial_account'] = CRM_Contribute_PseudoConstant::financialAccount($values['to_financial_account_id']);
}
}
- if (CRM_Utils_Array::value('honor_contact_id', $values)) {
+ if (!empty($values['honor_contact_id'])) {
$sql = "SELECT display_name FROM civicrm_contact WHERE id = %1";
$params = array(1 => array($values['honor_contact_id'], 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$values['honor_type'] = CRM_Utils_Array::value(CRM_Utils_Array::value('honor_type_id', $values), $honor);
}
- if (CRM_Utils_Array::value('contribution_recur_id', $values)) {
+ if (!empty($values['contribution_recur_id'])) {
$sql = "SELECT installments, frequency_interval, frequency_unit FROM civicrm_contribution_recur WHERE id = %1";
$params = array(1 => array($values['contribution_recur_id'], 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$values['note'] = array_values($noteValue);
// show billing address location details, if exists
- if (CRM_Utils_Array::value('address_id', $values)) {
+ if (!empty($values['address_id'])) {
$addressParams = array('id' => CRM_Utils_Array::value('address_id', $values));
$addressDetails = CRM_Core_BAO_Address::getValues($addressParams, FALSE, 'id');
$addressDetails = array_values($addressDetails);
}
}
// CRM-13231 financial type required if product has cost
- if (CRM_Utils_Array::value('cost', $params) && !CRM_Utils_Array::value('financial_type_id', $params)) {
+ if (!empty($params['cost']) && !CRM_Utils_Array::value('financial_type_id', $params)) {
$errors['financial_type_id'] = ts('Financial Type is required for product having cost.');
}
$fileLocation = $files['uploadFile']['tmp_name'];
}
function setDefaultValues() {
- if (!CRM_Utils_Array::value('contribution_status',
- $this->_defaults
- )) {
+ if (empty($this->_defaults
+['contribution_status'])) {
$this->_defaults['contribution_status'][1] = 1;
}
return $this->_defaults;
);
// Tell tpl to hide soft credit field if contribution is linked directly to a PCP Page
- if (CRM_Utils_Array::value('pcp_made_through_id', $form->_values)) {
+ if (!empty($form->_values['pcp_made_through_id'])) {
$form->assign('pcpLinked', 1);
}
}
$defaults["soft_credit_type[$key]"] = $value['soft_credit_type'];
}
}
- elseif (CRM_Utils_Array::value('pcp_id', $form->_softCreditInfo)) {
+ elseif (!empty($form->_softCreditInfo['pcp_id'])) {
$pcpInfo = $form->_softCreditInfo;
$pcpId = CRM_Utils_Array::value('pcp_id', $pcpInfo);
$pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'title');
$errors = array();
// if honor roll fields are populated but no PCP is selected
- if (!CRM_Utils_Array::value('pcp_made_through_id', $fields)) {
- if (CRM_Utils_Array::value('pcp_display_in_roll', $fields) ||
+ if (empty($fields['pcp_made_through_id'])) {
+ if (!empty($fields['pcp_display_in_roll']) ||
CRM_Utils_Array::value('pcp_roll_nickname', $fields) ||
CRM_Utils_Array::value('pcp_personal_note', $fields)
) {
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $customFields);
- if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) {
+ if (!empty($customValue['extends_entity_column_value'])) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$customValue['extends_entity_column_value']
);
}
- if (CRM_Utils_Array::value($typeId, $entityColumnValue) ||
+ if (!empty($entityColumnValue[$typeId]) ||
CRM_Utils_System::isNull($entityColumnValue[$typeId])
) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $contributionId);
$value[$val] = CRM_Utils_Date::processDate($value[$val]);
}
}
- if (CRM_Utils_Array::value('financial_type', $value)) {
+ if (!empty($value['financial_type'])) {
$value['financial_type_id'] = $value['financial_type'];
}
- if (CRM_Utils_Array::value('payment_instrument', $value)) {
+ if (!empty($value['payment_instrument'])) {
$value['payment_instrument_id'] = $value['payment_instrument'];
}
- if (CRM_Utils_Array::value('contribution_source', $value)) {
+ if (!empty($value['contribution_source'])) {
$value['source'] = $value['contribution_source'];
}
$contribution = CRM_Contribute_BAO_Contribution::add($value, $ids);
// add custom field values
- if (CRM_Utils_Array::value('custom', $value) &&
+ if (!empty($value['custom']) &&
is_array($value['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($value['custom'], 'civicrm_contribution', $contribution->id);
$config = CRM_Core_Config::singleton();
// set default country from config if no country set
- if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $this->_defaults)) {
+ if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) {
$this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
}
// format new billing name
$name = $processorParams['first_name'];
- if (CRM_Utils_Array::value('middle_name', $processorParams)) {
+ if (!empty($processorParams['middle_name'])) {
$name .= " {$processorParams['middle_name']}";
}
$name .= ' ' . $processorParams['last_name'];
// format old billing name
$name = $this->_defaults['first_name'];
- if (CRM_Utils_Array::value('middle_name', $this->_defaults)) {
+ if (!empty($this->_defaults['middle_name'])) {
$name .= " {$this->_defaults['middle_name']}";
}
$name .= ' ' . $this->_defaults['last_name'];
}
CRM_Activity_BAO_Activity::create($activityParams);
- if (CRM_Utils_Array::value('is_notify', $params)) {
+ if (!empty($params['is_notify'])) {
// send notification
if ($this->_subscriptionDetails->contribution_page_id) {
CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id',
}
}
- if (CRM_Utils_Array::value('saveMapping', $fields)) {
+ if (!empty($fields['saveMapping'])) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
$this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params));
//Updating Mapping Records
- if (CRM_Utils_Array::value('updateMapping', $params)) {
+ if (!empty($params['updateMapping'])) {
$mappingFields = new CRM_Core_DAO_MappingField();
$mappingFields->mapping_id = $params['mappingId'];
$mappingFields->find();
}
//Saving Mapping Details and Records
- if (CRM_Utils_Array::value('saveMapping', $params)) {
+ if (!empty($params['saveMapping'])) {
$mappingParams = array(
'name' => $params['saveMappingName'],
'description' => $params['saveMappingDesc'],
elseif (!empty($params['soft_credit'])) {
$paramValues['contact_type'] = $this->_contactType;
}
- elseif (CRM_Utils_Array::value('pledge_payment', $paramValues)) {
+ elseif (!empty($paramValues['pledge_payment'])) {
$paramValues['contact_type'] = $this->_contactType;
}
//need to pass $onDuplicate to check import mode.
- if (CRM_Utils_Array::value('pledge_payment', $paramValues)) {
+ if (!empty($paramValues['pledge_payment'])) {
$paramValues['onDuplicate'] = $onDuplicate;
}
require_once 'CRM/Utils/DeprecatedUtils.php';
else {
//fix for CRM-2219 - Update Contribution
// onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE
- if (CRM_Utils_Array::value('invoice_id',$paramValues) ||
+ if (!empty($paramValues['invoice_id']) ||
CRM_Utils_Array::value('trxn_id', $paramValues) || $paramValues['contribution_id']) {
$dupeIds = array(
'id' => CRM_Utils_Array::value('contribution_id', $paramValues),
'Contribution'
);
//process note
- if (CRM_Utils_Array::value('note', $paramValues)) {
+ if (!empty($paramValues['note'])) {
$noteID = array();
$contactID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $ids['contribution'], 'contact_id');
$daoNote = new CRM_Core_BAO_Note();
}
//need to check existing soft credit contribution, CRM-3968
- if (CRM_Utils_Array::value('soft_credit_to', $formatted)) {
+ if (!empty($formatted['soft_credit_to'])) {
$dupeSoftCredit = array(
'contact_id' => $formatted['soft_credit_to'],
'contribution_id' => $ids['contribution'],
//FIX ME: Need to fix this logic
$existingSoftCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($dupeSoftCredit['contribution_id']);
- if (CRM_Utils_Array::value('soft_credit_id', $existingSoftCredit)) {
+ if (!empty($existingSoftCredit['soft_credit_id'])) {
$formatted['softID'] = $existingSoftCredit['soft_credit_id'];
}
}
$this->_newContributions[] = $newContribution->id;
//return soft valid since we need to show how soft credits were added
- if (CRM_Utils_Array::value('soft_credit_to', $formatted)) {
+ if (!empty($formatted['soft_credit_to'])) {
return CRM_Contribute_Import_Parser::SOFT_CREDIT;
}
$formatted['contribution_id'] = $newContribution['id'];
//return soft valid since we need to show how soft credits were added
- if (CRM_Utils_Array::value('soft_credit_to', $formatted)) {
+ if (!empty($formatted['soft_credit_to'])) {
return CRM_Contribute_Import_Parser::SOFT_CREDIT;
}
}
}
- if (CRM_Utils_Array::value('external_identifier', $params)) {
+ if (!empty($params['external_identifier'])) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
}
}
}
else {
- if (CRM_Utils_Array::value('external_identifier', $paramValues)) {
+ if (!empty($paramValues['external_identifier'])) {
$checkCid = new CRM_Contact_DAO_Contact();
$checkCid->external_identifier = $paramValues['external_identifier'];
$checkCid->find(TRUE);
$formatted['contribution_id'] = $newContribution['id'];
//return soft valid since we need to show how soft credits were added
- if (CRM_Utils_Array::value('soft_credit_to', $formatted)) {
+ if (!empty($formatted['soft_credit_to'])) {
return CRM_Contribute_Import_Parser::SOFT_CREDIT;
}
* Function to process pledge payments
*/
function processPledgePayments(&$formatted) {
- if (CRM_Utils_Array::value('pledge_payment_id', $formatted) &&
+ if (!empty($formatted['pledge_payment_id']) &&
CRM_Utils_Array::value('pledge_id', $formatted)
) {
//get completed status
$classes = $link['class'];
}
- if (!CRM_Utils_Array::value($sectionName, $sectionsInfo)) {
+ if (empty($sectionsInfo[$sectionName])) {
$classes = array();
if (isset($link['class'])) {
$classes = $link['class'];
$values = array();
CRM_Core_DAO::storeValues($recur, $values);
// if there is a payment processor ID, get the name of the payment processor
- if (CRM_Utils_Array::value('payment_processor_id', $values)) {
+ if (!empty($values['payment_processor_id'])) {
$values['payment_processor'] = CRM_Core_DAO::getFieldValue(
'CRM_Financial_DAO_PaymentProcessor',
$values['payment_processor_id'],
);
}
// get contribution status label
- if (CRM_Utils_Array::value('contribution_status_id', $values)) {
+ if (!empty($values['contribution_status_id'])) {
$values['contribution_status'] = CRM_Core_OptionGroup::getLabel('contribution_status', $values['contribution_status_id']);
}
$result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
);
- if (CRM_Utils_Array::value('amount_level', $row)) {
+ if (!empty($row['amount_level'])) {
CRM_Event_BAO_Participant::fixEventLevel($row['amount_level']);
}
function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
- if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
+ if (!empty($_POST['_qf_' . $formName . '_next_print'])) {
$value = CRM_Contribute_Task::PRINT_CONTRIBUTIONS;
}
else {
switch ($mapping['entity']) {
case 'civicrm_participant':
$eventContacts = CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'name');
- if (!CRM_Utils_Array::value($recipientType, $eventContacts)) {
+ if (empty($eventContacts[$recipientType])) {
return $options;
}
if ($eventContacts[$recipientType] == 'participant_role') {
}
$addressExists = self::dataExists($value);
- if ( !CRM_Utils_Array::value('id', $value) ) {
+ if (empty($value['id'])) {
if ($updateBlankLocInfo) {
if ((!empty($addresses) || !$addressExists) && array_key_exists($key, $addresses)) {
$value['id'] = $addresses[$key];
$value['is_billing'] = 0;
}
- if (!CRM_Utils_Array::value('manual_geo_code', $value)) {
+ if (empty($value['manual_geo_code'])) {
$value['manual_geo_code'] = 0;
}
$value['contact_id'] = $contactId;
* @static
*/
static function fixAddress(&$params) {
- if (CRM_Utils_Array::value('billing_street_address', $params)) {
+ if (!empty($params['billing_street_address'])) {
//Check address is comming from online contribution / registration page
//Fixed :CRM-5076
$billing = array(
foreach ($billing as $key => $val) {
if ($value = CRM_Utils_Array::value($val, $params)) {
- if (CRM_Utils_Array::value($key, $params)) {
+ if (!empty($params[$key])) {
unset($params[$val]);
}
else {
}
/* Split the zip and +4, if it's in US format */
- if (CRM_Utils_Array::value('postal_code', $params) &&
+ if (!empty($params['postal_code']) &&
preg_match('/^(\d{4,5})[+-](\d{4})$/',
$params['postal_code'],
$match
$addresses = array();
$address = new CRM_Core_BAO_Address();
- if (!CRM_Utils_Array::value('entity_table', $entityBlock)) {
+ if (empty($entityBlock['entity_table'])) {
$address->$fieldName = CRM_Utils_Array::value($fieldName, $entityBlock);
}
else {
$nameVal = explode('-', $values['name']);
$fldName = CRM_Utils_Array::value(0, $nameVal);
$locType = CRM_Utils_Array::value(1, $nameVal);
- if (CRM_Utils_Array::value('location_type_id', $values)) {
+ if (!empty($values['location_type_id'])) {
$locType = $values['location_type_id'];
}
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
-}
\ No newline at end of file
+}
*/
static function blockExists($blockName, &$params) {
// return if no data present
- if (!CRM_Utils_Array::value($blockName, $params) || !is_array($params[$blockName])) {
+ if (empty($params[$blockName]) || !is_array($params[$blockName])) {
return FALSE;
}
$primaryId = TRUE;
if (is_array($blockIds)) {
foreach ($blockIds as $blockId => $blockValue) {
- if (CRM_Utils_Array::value('is_primary', $blockValue)) {
+ if (!empty($blockValue['is_primary'])) {
$resetPrimaryId = $blockId;
break;
}
);
//check for update
- if (!CRM_Utils_Array::value('id', $value) &&
+ if (empty($value['id']) &&
is_array($blockIds) && !empty($blockIds)
) {
foreach ($blockIds as $blockId => $blockValue) {
if ($updateBlankLocInfo) {
- if (CRM_Utils_Array::value($count, $blockIds)) {
+ if (!empty($blockIds[$count])) {
$value['id'] = $blockIds[$count]['id'];
unset($blockIds[$count]);
}
// Note there could be cases when block info already exist ($value[id] is set) for a contact/entity
// BUT info is not present at this time, and therefore we should be really careful when deleting the block.
// $updateBlankLocInfo will help take appropriate decision. CRM-5969
- if (CRM_Utils_Array::value('id', $value) && !$dataExits && $updateBlankLocInfo) {
+ if (!empty($value['id']) && !$dataExits && $updateBlankLocInfo) {
//delete the existing record
self::blockDelete($blockName, array('id' => $value['id']));
continue;
// we need to delete blocks that were deleted during update
if ($updateBlankLocInfo && !empty($blockIds)) {
foreach ($blockIds as $deleteBlock) {
- if (!CRM_Utils_Array::value('id', $deleteBlock)) {
+ if (empty($deleteBlock['id'])) {
continue;
}
self::blockDelete($blockName, array('id' => $deleteBlock['id']));
}
// if params is_primary then set all others to not be primary & exit out
- if (CRM_Utils_Array::value('is_primary', $params)) {
+ if (!empty($params['is_primary'])) {
$sql = "UPDATE $table SET is_primary = 0 WHERE contact_id = %1";
$sqlParams = array(1 => array($contactId, 'Integer'));
// we don't want to create unecessary entries in the log_ tables so exclude the one we are working on
*
*/
static function formRule($fields, $files, $self) {
- if (!CRM_Utils_Array::value('cms_create_account', $fields)) {
+ if (empty($fields['cms_create_account'])) {
return TRUE;
}
global $dbLocale;
// try to inherit the language from the hosting CMS
- if (CRM_Utils_Array::value('inheritLocale', $defaults)) {
+ if (!empty($defaults['inheritLocale'])) {
// FIXME: On multilanguage installs, CRM_Utils_System::getUFLocale() in many cases returns nothing if $dbLocale is not set
$dbLocale = $multiLang ? "_{$defaults['lcMessages']}" : '';
$lcMessages = CRM_Utils_System::getUFLocale();
$indexExist = FALSE;
//as during create if field is_searchable we had created index.
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$indexExist = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $params['id'], 'is_searchable');
}
}
}
else {
- if (CRM_Utils_Array::value('default_option', $params)
- && isset($params['option_value'][$params['default_option']])
+ if (!empty($params['default_option']) && isset($params['option_value'][$params['default_option']])
) {
$params['default_value'] = $params['option_value'][$params['default_option']];
}
}
// check for orphan option groups
- if (CRM_Utils_Array::value('option_group_id', $params)) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['option_group_id'])) {
+ if (!empty($params['id'])) {
self::fixOptionGroups($params['id'], $params['option_group_id']);
}
// if we dont have a default value
// retrive it from one of the other custom fields which use this option group
- if (!CRM_Utils_Array::value('default_value', $params)) {
+ if (empty($params['default_value'])) {
//don't insert only value separator as default value, CRM-4579
$defaultValue = self::getOptionGroupDefault($params['option_group_id'],
$params['html_type']
$customField->find(TRUE);
//create/drop the index when we toggle the is_searchable flag
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
self::createField($customField, 'modify', $indexExist);
}
else {
}
// return if field is a 'code' field
- if (CRM_Utils_Array::value('is_view', $customFields[$customFieldId])) {
+ if (!empty($customFields[$customFieldId]['is_view'])) {
return;
}
$customOptionGroup[$cacheKey] = NULL;
}
- if (!CRM_Utils_Array::value($cacheKey, $customOptionGroup)) {
+ if (empty($customOptionGroup[$cacheKey])) {
$whereClause = '( g.is_active = 1 AND f.is_active = 1 )';
//support for single as well as array format.
//this is format when form get submit.
$extendsChildType = CRM_Utils_Array::value(1, $params['extends']);
//lets allow user to pass direct child type value, CRM-6893
- if (CRM_Utils_Array::value('extends_entity_column_value', $params)) {
+ if (!empty($params['extends_entity_column_value'])) {
$extendsChildType = $params['extends_entity_column_value'];
}
if (!CRM_Utils_System::isNull($extendsChildType)) {
elseif ($field['data_type'] == 'Date') {
if (!empty($value)) {
$time = NULL;
- if (CRM_Utils_Array::value('time_format', $field)) {
+ if (!empty($field['time_format'])) {
$time = CRM_Utils_Request::retrieve($fieldName . '_time', 'String', $form, FALSE, NULL, 'GET');
}
list($value, $time) = CRM_Utils_Date::setDateDefaults($value . ' ' . $time);
- if (CRM_Utils_Array::value('time_format', $field)) {
+ if (!empty($field['time_format'])) {
$customValue[$fieldName . '_time'] = $time;
}
}
break;
case 'ContactReference':
- if (CRM_Utils_Array::value('data', $values)) {
+ if (!empty($values['data'])) {
$retValue = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $values['data'], 'display_name');
}
break;
CRM_Utils_Array::lookupValue($states, 'state_province',
CRM_Core_PseudoConstant::stateProvince(), TRUE
);
- if (!CRM_Utils_Array::value('state_province_id', $states)) {
+ if (empty($states['state_province_id'])) {
CRM_Utils_Array::lookupValue($states, 'state_province',
CRM_Core_PseudoConstant::stateProvinceAbbreviation(), TRUE
);
CRM_Utils_Array::lookupValue($countries, 'country',
CRM_Core_PseudoConstant::country(), TRUE
);
- if (!CRM_Utils_Array::value('country_id', $countries)) {
+ if (empty($countries['country_id'])) {
CRM_Utils_Array::lookupValue($countries, 'country',
CRM_Core_PseudoConstant::countryIsoCode(), TRUE
);
$cvParam['type'] = 'Timestamp';
}
- if (CRM_Utils_Array::value('id', $customValue)) {
+ if (!empty($customValue['id'])) {
$cvParam['id'] = $customValue['id'];
}
if (!array_key_exists($customValue['table_name'], $cvParams)) {
// special case to handle duplicate entires for report instances
$dashboardID = CRM_Utils_Array::value('id', $params);
- if (CRM_Utils_Array::value('instanceURL', $params)) {
+ if (!empty($params['instanceURL'])) {
$query = "SELECT id
FROM `civicrm_dashboard`
WHERE url LIKE '" . CRM_Utils_Array::value('instanceURL', $params) . "&%'";
if (!$dashboardID) {
// check url is same as exiting entries, if yes just update existing
- if (CRM_Utils_Array::value('name', $params)) {
+ if (!empty($params['name'])) {
$dashlet->name = CRM_Utils_Array::value('name', $params);
$dashlet->find(TRUE);
}
$fromEmail = "$fromDisplayName <$email>";
$fromEmailHtml = htmlspecialchars($fromEmail) . ' ' . $emailVal['locationType'];
- if (CRM_Utils_Array::value('is_primary', $emailVal)) {
+ if (!empty($emailVal['is_primary'])) {
$fromEmailHtml .= ' ' . ts('(preferred)');
}
$fromEmailValues[$fromEmail] = $fromEmailHtml;
return;
}
- if (CRM_Utils_Array::value('cost', $params)) {
+ if (!empty($params['cost'])) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$financialAccountType = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id']);
$accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND label IN ('Premiums Inventory Account is', 'Cost of Sales Account is')");
CRM_Core_BAO_FinancialTrxn::create($financialtrxn, $trxnEntityTable);
}
- if (CRM_Utils_Array::value('oldPremium', $params)) {
+ if (!empty($params['oldPremium'])) {
$premiumParams = array(
'id' => $params['oldPremium']['product_id']
);
$expenseTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' "));
$domainId = CRM_Core_Config::domainID();
$amount = 0;
- if (CRM_Utils_Array::value('prevContribution', $params)) {
+ if (!empty($params['prevContribution'])) {
$amount = $params['prevContribution']->fee_amount;
}
$amount = $params['fee_amount'] - $amount;
$params['trxnParams']['status_id'] = CRM_Core_OptionGroup::getValue('contribution_status','Completed','name');
$params['trxnParams']['contribution_id'] = isset($params['contribution']->id) ? $params['contribution']->id : $params['contribution_id'];
$trxn = self::create($params['trxnParams']);
- if (!CRM_Utils_Array::value('entity_id', $params)) {
+ if (empty($params['entity_id'])) {
$financialTrxnID = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['trxnParams']['contribution_id'], 'DESC');
$params['entity_id'] = $financialTrxnID['financialTrxnId'];
}
//build the common contact fields array.
$fields['Contact'] = array();
foreach ($fields['Individual'] as $key => $value) {
- if (CRM_Utils_Array::value($key, $fields['Household']) &&
+ if (!empty($fields['Household'][$key]) &&
CRM_Utils_Array::value($key, $fields['Organization'])
) {
$fields['Contact'][$key] = $value;
}
$contactType = $v[0];
}
- if (CRM_Utils_Array::value('1', $v)) {
+ if (!empty($v['1'])) {
$fldName = $v[1];
$v2 = CRM_Utils_Array::value('2', $v);
if ($v2 && trim($v2)) {
$colCnt = 0;
foreach ($value as $k => $v) {
- if (CRM_Utils_Array::value('1', $v)) {
+ if (!empty($v['1'])) {
$saveMappingFields = new CRM_Core_DAO_MappingField();
$saveMappingFields->mapping_id = $mappingId;
$saveMappingFields->im_provider_id = CRM_Utils_Array::value('3', $v);
}
- if (CRM_Utils_Array::value('operator', $params)) {
+ if (!empty($params['operator'])) {
$saveMappingFields->operator = CRM_Utils_Array::value($k, $params['operator'][$key]);
}
- if (CRM_Utils_Array::value('value', $params)) {
+ if (!empty($params['value'])) {
$saveMappingFields->value = CRM_Utils_Array::value($k, $params['value'][$key]);
}
// Handle mapping for 'related contact' fields
list($id, $first, $second) = explode('_', CRM_Utils_Array::value('1', $v));
if (($first == 'a' && $second == 'b') || ($first == 'b' && $second == 'a')) {
- if (CRM_Utils_Array::value('2', $v)) {
+ if (!empty($v['2'])) {
$saveMappingFields->name = CRM_Utils_Array::value('2', $v);
}
- elseif (CRM_Utils_Array::value('4', $v)) {
+ elseif (!empty($v['4'])) {
$saveMappingFields->name = CRM_Utils_Array::value('4', $v);
}
}
$note->copyValues($params);
- if (!CRM_Utils_Array::value('contact_id', $params)) {
+ if (empty($params['contact_id'])) {
if ($params['entity_table'] == 'civicrm_contact') {
$note->contact_id = $params['entity_id'];
}
self::setDefaults($params);
}
$ids = array();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$ids = array('optionValue' => $params['id']);
}
return CRM_Core_BAO_OptionValue::add($params, $ids);
// these would be usefully set @ the api layer so they are visible to api users
// complex defaults like the domain id below would make sense in the setDefauls function
// but unclear what other ways this function is being used
- if (!CRM_Utils_Array::value('optionValue', $ids)) {
+ if (empty($ids['optionValue'])) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
$params['is_optgroup'] = CRM_Utils_Array::value('is_optgroup', $params, FALSE);
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->copyValues($params);
- if (CRM_Utils_Array::value('is_default', $params)) {
+ if (!empty($params['is_default'])) {
$query = 'UPDATE civicrm_option_value SET is_default = 0 WHERE option_group_id = %1';
// tweak default reset, and allow multiple default within group.
$sql .= $prefix;
$sql .= "`{$params['name']}` {$params['type']}";
- if (CRM_Utils_Array::value('required', $params)) {
+ if (!empty($params['required'])) {
$sql .= " NOT NULL";
}
- if (CRM_Utils_Array::value('attributes', $params)) {
+ if (!empty($params['attributes'])) {
$sql .= " {$params['attributes']}";
}
- if (CRM_Utils_Array::value('default', $params) &&
+ if (!empty($params['default']) &&
$params['type'] != 'text'
) {
$sql .= " DEFAULT {$params['default']}";
}
- if (CRM_Utils_Array::value('comment', $params)) {
+ if (!empty($params['comment'])) {
$sql .= " COMMENT '{$params['comment']}'";
}
static function buildPrimaryKeySQL(&$params, $separator, $prefix) {
$sql = NULL;
- if (CRM_Utils_Array::value('primary', $params)) {
+ if (!empty($params['primary'])) {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= $prefix;
//create index only for searchable fields during ADD,
//create index only if field is become searchable during MODIFY,
//drop index only if field is no more searchable and index was exist.
- if (CRM_Utils_Array::value('searchable', $params) && !$indexExist) {
+ if (!empty($params['searchable']) && !$indexExist) {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= $prefix;
$sql .= "INDEX_{$params['name']} ( {$params['name']} )";
}
- elseif (!CRM_Utils_Array::value('searchable', $params) && $indexExist) {
+ elseif (empty($params['searchable']) && $indexExist) {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= "DROP INDEX INDEX_{$params['name']}";
static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) {
$sql = NULL;
- if (CRM_Utils_Array::value('fk_table_name', $params) &&
+ if (!empty($params['fk_table_name']) &&
CRM_Utils_Array::value('fk_field_name', $params)
) {
$sql .= $separator;
case 'delete':
$sql .= " DROP COLUMN `{$params['name']}`";
- if (CRM_Utils_Array::value('primary', $params)) {
+ if (!empty($params['primary'])) {
$sql .= ", DROP PRIMARY KEY";
}
- if (CRM_Utils_Array::value('fk_table_name', $params)) {
+ if (!empty($params['fk_table_name'])) {
$sql .= ", DROP FOREIGN KEY FK_{$params['fkName']}";
}
break;
$cbValues = array();
foreach ($groupValues as $key => $val) {
- if (CRM_Utils_Array::value($val, $value)) {
+ if (!empty($value[$val])) {
$cbValues[$key] = 1;
}
}
$tag = new CRM_Core_DAO_Tag();
// if parent id is set then inherit used for and is hidden properties
- if (CRM_Utils_Array::value('parent_id', $params)) {
+ if (!empty($params['parent_id'])) {
// get parent details
$params['used_for'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $params['parent_id'], 'used_for');
}
$ufField->location_type_id = (CRM_Utils_Array::value(2, $params['field_name'])) ? $params['field_name'][2] : 'NULL';
$ufField->phone_type_id = CRM_Utils_Array::value(3, $params['field_name']);
- if (CRM_Utils_Array::value('uf_field', $ids)) {
+ if (!empty($ids['uf_field'])) {
$ufField->whereAdd("id <> " . CRM_Utils_Array::value('uf_field', $ids));
}
// fix for CRM-316
$oldWeight = NULL;
- if (CRM_Utils_Array::value('field_id', $params)) {
+ if (!empty($params['field_id'])) {
$oldWeight = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $params['field_id'], 'weight', 'id');
}
$fieldValues = array('uf_group_id' => $params['group_id']);
// we do not allow duplicates. the first field is the winner
foreach ($subset as $name => $field) {
- if (!CRM_Utils_Array::value($name, $fields)) {
+ if (empty($fields[$name])) {
$fields[$name] = $field;
}
}
}
// skip fields that should not be displayed separately
- if (CRM_Utils_Array::value('skipDisplay', $field)) {
+ if (!empty($field['skipDisplay'])) {
continue;
}
}
//handle the case to avoid re-write where the profile field labels are the same
- if (CRM_Utils_Array::value($index, $values)) {
+ if (!empty($values[$index])) {
$index .= $nullValueIndex;
$nullValueIndex .= $nullValueIndex;
}
);
}
elseif ($fieldName == 'participant_role') {
- if (CRM_Utils_Array::value('is_multiple', $field)) {
+ if (!empty($field['is_multiple'])) {
$form->addCheckBox($name, $title, CRM_Event_PseudoConstant::participantRole(), NULL, NULL, NULL, NULL, ' ', TRUE);
}
else {
CRM_Contact_Form_Edit_TagsAndGroups::setDefaults($contactId, $defaults, CRM_Contact_Form_Edit_TagsAndGroups::TAG, $fldName);
}
- if (CRM_Utils_Array::value($name, $details) || isset($details[$name])) {
+ if (!empty($details[$name]) || isset($details[$name])) {
//to handle custom data (checkbox) to be written
// to handle birth/deceased date, greeting_type and few other fields
if (($name == 'birth_date') || ($name == 'deceased_date')) {
case 'Select Date':
// CRM-6681, set defult values according to date and time format (if any).
$dateFormat = NULL;
- if (CRM_Utils_Array::value('date_format', $customFields[$customFieldId])) {
+ if (!empty($customFields[$customFieldId]['date_format'])) {
$dateFormat = $customFields[$customFieldId]['date_format'];
}
- if (!CRM_Utils_Array::value('time_format', $customFields[$customFieldId])) {
+ if (empty($customFields[$customFieldId]['time_format'])) {
list($defaults[$fldName]) = CRM_Utils_Date::setDateDefaults($details[$name], NULL,
$dateFormat
);
// fixed for CRM-665
if (is_numeric($locTypeId)) {
if ($primaryLocationType || $locTypeId == CRM_Utils_Array::value('location_type_id', $value)) {
- if (CRM_Utils_Array::value($fieldName, $value)) {
+ if (!empty($value[$fieldName])) {
//to handle stateprovince and country
if ($fieldName == 'state_province') {
$defaults[$fldName] = $value['state_province_id'];
// if we are getting in a new primary email, dont overwrite the new one
if ($locTypeId == $primaryLocationType) {
- if (CRM_Utils_Array::value('email-' . $primaryLocationType, $params)) {
+ if (!empty($params['email-' . $primaryLocationType])) {
$data['location'][$loc]['email'][$loc]['email'] = $fields['email-' . $primaryLocationType];
}
elseif (isset($primaryEmail)) {
$fldName = $isStandalone ? $name : "field[$componentId][$name]";
if (in_array($name, $dateTimeFields)) {
$timefldName = $isStandalone ? "{$name}_time" : "field[$componentId][{$name}_time]";
- if (CRM_Utils_Array::value($name, $values)) {
+ if (!empty($values[$name])) {
list($defaults[$fldName], $defaults[$timefldName]) = CRM_Utils_Date::setDateDefaults($values[$name]);
}
}
// CRM-6681, $default contains formatted date, time values.
$defaults[$fldName] = $customValue;
- if (CRM_Utils_Array::value($customKey . '_time', $defaults)) {
+ if (!empty($defaults[$customKey . '_time'])) {
$defaults['field'][$componentId][$name . '_time'] = $defaults[$customKey . '_time'];
}
}
$groupTypes = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileId, 'group_type');
$groupTypeParts = explode(CRM_Core_DAO::VALUE_SEPARATOR, $groupTypes);
- if (!CRM_Utils_Array::value(1, $groupTypeParts)) {
+ if (empty($groupTypeParts[1])) {
return $groupTypeValue;
}
$participantExtends = array('ParticipantRole', 'ParticipantEventName', 'ParticipantEventType');
* @static
*/
public static function findJoinEntryId(&$params) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
return $params['id'];
}
}
}
- if (!CRM_Utils_Array::value('id', $values) &&
+ if (empty($values['id']) &&
is_array($ids) && !empty($ids)
) {
foreach ($ids as $id => $value) {
}
}
$values['contact_id'] = $contactID;
- if ( CRM_Utils_Array::value('url', $values) ) {
+ if (!empty($values['url'])) {
self::add($values);
}
}
// also set the smarty variables to the current component
$template = CRM_Core_Smarty::singleton();
$template->assign('activeComponent', $name);
- if (CRM_Utils_Array::value('formTpl', $comp->info[$name])) {
+ if (!empty($comp->info[$name]['formTpl'])) {
$template->assign('formTpl', $comp->info[$name]['formTpl']);
}
- if (CRM_Utils_Array::value('css', $comp->info[$name])) {
+ if (!empty($comp->info[$name]['css'])) {
$styleSheets = '<style type="text/css">@import url(' . "{$config->resourceBase}css/{$comp->info[$name]['css']});</style>";
CRM_Utils_System::addHTMLHead($styleSheet);
}
$tasks = array();
foreach ($info as $name => $value) {
- if (CRM_Utils_Array::value('task', $info[$name])) {
+ if (!empty($info[$name]['task'])) {
$tasks += $info[$name]['task'];
}
}
}
// if the request has a reset value, initialize the controller session
- if (CRM_Utils_Array::value('reset', $_GET)) {
+ if (!empty($_GET['reset'])) {
$this->reset();
// in this case we'll also cache the url as a hidden form variable, this allows us to
$title = CRM_Utils_Array::value('title', $value);
$options = CRM_Utils_Array::value('options', $value);
$stateName = CRM_Utils_String::getClassName($className);
- if (CRM_Utils_Array::value('className', $value)) {
+ if (!empty($value['className'])) {
$formName = $name;
}
else {
if ($fields) {
foreach ($fields as $name => $value) {
$table[$value['name']] = $value['type'];
- if (CRM_Utils_Array::value('required', $value)) {
+ if (!empty($value['required'])) {
$table[$value['name']] += self::DB_DAO_NOTNULL;
}
}
$fieldsToSuffix = array();
$fieldsToReplace = array();
}
- if (CRM_Utils_Array::value('prefix', $fieldsFix)) {
+ if (!empty($fieldsFix['prefix'])) {
$fieldsToPrefix = $fieldsFix['prefix'];
}
- if (CRM_Utils_Array::value('suffix', $fieldsFix)) {
+ if (!empty($fieldsFix['suffix'])) {
$fieldsToSuffix = $fieldsFix['suffix'];
}
- if (CRM_Utils_Array::value('replace', $fieldsFix)) {
+ if (!empty($fieldsFix['replace'])) {
$fieldsToReplace = $fieldsFix['replace'];
}
$prevnext[] = $this->createElement($button['type'], 'reset', $button['name'], $attrs);
}
else {
- if (CRM_Utils_Array::value('subName', $button)) {
+ if (!empty($button['subName'])) {
$buttonName = $this->getButtonName($button['type'], $button['subName']);
}
else {
}
$prevnext[] = $this->createElement('submit', $buttonName, $button['name'], $attrs);
}
- if (CRM_Utils_Array::value('isDefault', $button)) {
+ if (!empty($button['isDefault'])) {
$this->setDefaultAction($button['type']);
}
*
*/
function addDate($name, $label, $required = FALSE, $attributes = NULL) {
- if (CRM_Utils_Array::value('formatType', $attributes)) {
+ if (!empty($attributes['formatType'])) {
// get actual format
$params = array('name' => $attributes['formatType']);
$values = array();
// cache date information
static $dateFormat;
$key = "dateFormat_" . str_replace(' ', '_', $attributes['formatType']);
- if (!CRM_Utils_Array::value($key, $dateFormat)) {
+ if (empty($dateFormat[$key])) {
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_PreferencesDate', $params, $values);
$dateFormat[$key] = $values;
}
$attributes['format'] = $values['date_format'];
}
- if (CRM_Utils_Array::value('time_format', $values)) {
+ if (!empty($values['time_format'])) {
$attributes['timeFormat'] = $values['time_format'];
}
$attributes['startOffset'] = $values['start'];
}
$config = CRM_Core_Config::singleton();
- if (!CRM_Utils_Array::value('format', $attributes)) {
+ if (empty($attributes['format'])) {
$attributes['format'] = $config->dateInputFormat;
}
$this->add('text', $name, $label, $attributes);
- if (CRM_Utils_Array::value('addTime', $attributes) ||
+ if (!empty($attributes['addTime']) ||
CRM_Utils_Array::value('timeFormat', $attributes)
) {
if ($required) {
$this->addRule($name, ts('Please select %1', array(1 => $label)), 'required');
- if (CRM_Utils_Array::value('addTime', $attributes) && CRM_Utils_Array::value('addTimeRequired', $attributes)) {
+ if (!empty($attributes['addTime']) && CRM_Utils_Array::value('addTimeRequired', $attributes)) {
$this->addRule($elementName, ts('Please enter a time.'), 'required');
}
}
$contactTags = CRM_Core_BAO_Tag::getTagsUsedFor('civicrm_contact', TRUE, FALSE, $parentId);
foreach (array_keys($form->_formValues['contact_tags']) as $tagId) {
- if (CRM_Utils_Array::value($tagId, $contactTags)) {
+ if (!empty($contactTags[$tagId])) {
$tagName = $tagId;
if (is_numeric($tagId)) {
$tagName = $contactTags[$tagId];
}
// check if ssl is set
- if (CRM_Utils_Array::value('is_ssl', $item)) {
+ if (!empty($item['is_ssl'])) {
CRM_Utils_System::redirectToSSL();
}
}
$pageArgs = NULL;
- if (CRM_Utils_Array::value('page_arguments', $item)) {
+ if (!empty($item['page_arguments'])) {
$pageArgs = CRM_Core_Menu::getArrayForPathArgs($item['page_arguments']);
}
$values = array();
foreach ($menu as $path => $item) {
- if (!CRM_Utils_Array::value('adminGroup', $item)) {
+ if (empty($item['adminGroup'])) {
continue;
}
$dao->id
);
- if (CRM_Utils_Array::value('component_id', $optionValue[$dao->id])) {
+ if (!empty($optionValue[$dao->id]['component_id'])) {
$optionValue[$dao->id]['component_name'] = $componentNames[$optionValue[$dao->id]['component_id']];
}
else {
$optionValue[$dao->id]['component_name'] = 'Contact';
}
- if (CRM_Utils_Array::value('visibility_id', $optionValue[$dao->id])) {
+ if (!empty($optionValue[$dao->id]['visibility_id'])) {
$optionValue[$dao->id]['visibility_label'] = $visibilityLabels[$optionValue[$dao->id]['visibility_id']];
}
}
if (!empty($query->_params) || !empty($query->_returnProperties)) {
$field = self::getFields();
foreach ($field as $name => $values) {
- if (CRM_Utils_Array::value('pseudoconstant', $values)) {
+ if (!empty($values['pseudoconstant'])) {
continue;
}
list($tableName, $fieldName) = explode('.', $values['where']);
- if (CRM_Utils_Array::value($name, $query->_returnProperties)) {
+ if (!empty($query->_returnProperties[$name])) {
$query->_select["{$name}_id"] = "{$name}.value as {$name}_id";
$query->_element["{$name}_id"] = 1;
$query->_select[$name] = "{$name}.{$fieldName} as $name";
}
// if the request has a reset value, initialize the controller session
- if (CRM_Utils_Array::value('reset', $_REQUEST)) {
+ if (!empty($_REQUEST['reset'])) {
$this->reset();
}
}
*/
static function setIsQuickConfig() {
$id = $context = NULL;
- if (CRM_Utils_Array::value('id', $_REQUEST)) {
+ if (!empty($_REQUEST['id'])) {
$id = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
}
- if (CRM_Utils_Array::value('context', $_REQUEST)) {
+ if (!empty($_REQUEST['context'])) {
$context = CRM_Utils_Type::escape($_REQUEST['context'], 'String');
}
// return false if $id is null and
$fields = &$object->fields();
$key = '';
- if (CRM_Utils_Array::value('title', $fields)) {
+ if (!empty($fields['title'])) {
$key = 'title';
}
- elseif (CRM_Utils_Array::value('label', $fields)) {
+ elseif (!empty($fields['label'])) {
$key = 'label';
}
- elseif (CRM_Utils_Array::value('name', $fields)) {
+ elseif (!empty($fields['name'])) {
$key = 'name';
}
$newAction = $action;
$hasDelete = $hasDisable = TRUE;
- if (CRM_Utils_Array::value('name', $values) && in_array($values['name'], array(
+ if (!empty($values['name']) && in_array($values['name'], array(
'encounter_medium', 'case_type', 'case_status'))) {
static $caseCount = NULL;
if (!isset($caseCount)) {
* & giving it a change to act on the params array
*/
$newParams = $params;
- if (CRM_Utils_Array::value('is_recur', $params) &&
+ if (!empty($params['is_recur']) &&
$params['contributionRecurID']
) {
CRM_Utils_Hook::alterPaymentProcessorParams($this,
$this->_setParam($field, $value);
}
- if (CRM_Utils_Array::value('is_recur', $params) &&
+ if (!empty($params['is_recur']) &&
$params['contributionRecurID']
) {
$result = $this->doRecurPayment();
);
//only impact of assigning this here is is can be used to cancel the subscription in an automated test
// if it isn't cancelled a duplicate transaction error occurs
- if (CRM_Utils_Array::value('subscriptionId', $responseFields)) {
+ if (!empty($responseFields['subscriptionId'])) {
$this->_setParam('subscriptionId', $responseFields['subscriptionId']);
}
}
}
catch(Exception $e) {
$success = FALSE;
- if (CRM_Utils_Array::value('log_error', $error_handling)) {
+ if (!empty($error_handling['log_error'])) {
CRM_Core_Error::debug_log_message($e->getMessage());
}
- if (CRM_Utils_Array::value('echo_error', $error_handling)) {
+ if (!empty($error_handling['echo_error'])) {
echo ($e->getMessage());
}
- if (CRM_Utils_Array::value('return_error', $error_handling)) {
+ if (!empty($error_handling['return_error'])) {
return array(
'is_error' => 1,
'error_message' => ($e->getMessage()),
function failed(&$objects, &$transaction, $input = array()) {
$contribution = &$objects['contribution'];
$memberships = array();
- if (CRM_Utils_Array::value('membership', $objects)) {
+ if (!empty($objects['membership'])) {
$memberships = &$objects['membership'];
if (is_numeric($memberships)) {
$memberships = array($objects['membership']);
$contribution->save();
//add lineitems for recurring payments
- if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id && $addLineItems) {
+ if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) {
$this->addrecurLineItems($objects['contributionRecur']->id, $contribution->id, CRM_Core_DAO::$_nullArray);
}
//copy initial contribution custom fields for recurring contributions
- if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) {
+ if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) {
$this->copyCustomValues($objects['contributionRecur']->id, $contribution->id);
}
- if (!CRM_Utils_Array::value('skipComponentSync', $input)) {
+ if (empty($input['skipComponentSync'])) {
if (!empty($memberships)) {
// if transaction is failed then set "Cancelled" as membership status
$cancelStatusId = array_search('Cancelled', CRM_Member_PseudoConstant::membershipStatus());
$contribution->save();
//add lineitems for recurring payments
- if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id && $addLineItems) {
+ if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) {
$this->addrecurLineItems($objects['contributionRecur']->id, $contribution->id, CRM_Core_DAO::$_nullArray);
}
//copy initial contribution custom fields for recurring contributions
- if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) {
+ if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) {
$this->copyCustomValues($objects['contributionRecur']->id, $contribution->id);
}
- if (!CRM_Utils_Array::value('skipComponentSync', $input)) {
+ if (empty($input['skipComponentSync'])) {
if (!empty($memberships)) {
foreach ($memberships as $membership) {
if ($membership) {
}
$contribution->source = $source;
- if (CRM_Utils_Array::value('is_email_receipt', $values)) {
+ if (!empty($values['is_email_receipt'])) {
$contribution->receipt_date = self::$_now;
}
$membershipLog = $formatedParams;
$logStartDate = $formatedParams['start_date'];
- if (CRM_Utils_Array::value('log_start_date', $dates)) {
+ if (!empty($dates['log_start_date'])) {
$logStartDate = CRM_Utils_Date::customFormat($dates['log_start_date'], $format);
$logStartDate = CRM_Utils_Date::isoToMysql($logStartDate);
}
$contribution->receipt_date = self::$_now;
$values['is_email_receipt'] = 1;
}
- if (!CRM_Utils_Array::value('skipComponentSync', $input)) {
+ if (empty($input['skipComponentSync'])) {
$participant->status_id = 1;
}
$participant->save();
$contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date);
$contribution->cancel_date = 'null';
- if (CRM_Utils_Array::value('check_number', $input)) {
+ if (!empty($input['check_number'])) {
$contribution->check_number = $input['check_number'];
}
- if (CRM_Utils_Array::value('payment_instrument_id', $input)) {
+ if (!empty($input['payment_instrument_id'])) {
$contribution->payment_instrument_id = $input['payment_instrument_id'];
}
$contribution->save();
//add lineitems for recurring payments
- if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id && $addLineItems) {
+ if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) {
$this->addrecurLineItems($objects['contributionRecur']->id, $contribution->id, $input);
}
$input['contribution'] = $contribution;
$input['financial_type_id'] = $contribution->financial_type_id;
- if (CRM_Utils_Array::value('participant', $contribution->_relatedObjects)) {
+ if (!empty($contribution->_relatedObjects['participant'])) {
$input['contribution_mode'] = 'participant';
$input['participant_id'] = $contribution->_relatedObjects['participant']->id;
$input['skipLineItem'] = 1;
if ($input['component'] == 'contribute') {
//CRM-4027
$targetContactID = NULL;
- if (CRM_Utils_Array::value('related_contact', $ids)) {
+ if (!empty($ids['related_contact'])) {
$targetContactID = $contribution->contact_id;
$contribution->contact_id = $ids['related_contact'];
}
}
$input['is_test'] = $contribution->is_test;
$input['net_amount'] = $contribution->net_amount;
- if (CRM_Utils_Array::value('fee_amount', $input) && CRM_Utils_Array::value('amount', $input)) {
+ if (!empty($input['fee_amount']) && CRM_Utils_Array::value('amount', $input)) {
$input['net_amount'] = $input['amount'] - $input['fee_amount'];
}
function doTransferCheckout(&$params, $component) {
$component = strtolower($component);
- if (CRM_Utils_Array::value('is_recur', $params) &&
+ if (!empty($params['is_recur']) &&
$params['contributionRecurID']
) {
return $this->doRecurCheckout($params, $component);
* lets make use of it by passing the eventID/membershipTypeID to next level.
* And change trxn_id to google-order-number before finishing db update */
- if (CRM_Utils_Array::value('event', $ids)) {
+ if (!empty($ids['event'])) {
$contribution->trxn_id = $ids['event'] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['participant'];
}
- elseif (CRM_Utils_Array::value('membership', $ids)) {
+ elseif (!empty($ids['membership'])) {
$contribution->trxn_id = $ids['membership'][0] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['related_contact'] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['onbehalf_dupe_alert'];
}
}
$args['version'] = '56.0';
//LCD if recurring, collect additional data and set some values
- if (CRM_Utils_Array::value('is_recur',$params)) {
+ if (!empty($params['is_recur'])) {
$args['L_BILLINGTYPE0'] = 'RecurringPayments';
//$args['L_BILLINGAGREEMENTDESCRIPTION0'] = 'Recurring Contribution';
$args['L_BILLINGAGREEMENTDESCRIPTION0'] = $params['amount'] . " Per " . $params['frequency_interval'] . " " . $params['frequency_unit'];
);
$cancelUrlString = "$cancel=1&cancel=1&qfKey={$params['qfKey']}";
- if (CRM_Utils_Array::value('is_recur', $params)) {
+ if (!empty($params['is_recur'])) {
$cancelUrlString .= "&isRecur=1&recurId={$params['contributionRecurID']}&contribId={$params['contributionID']}";
}
$form->set('paymentProcessor', $form->_paymentProcessor);
// also set cancel subscription url
- if (CRM_Utils_Array::value('is_recur', $form->_paymentProcessor) &&
+ if (!empty($form->_paymentProcessor['is_recur']) &&
CRM_Utils_Array::value('is_recur', $form->_values)
) {
$form->_paymentObject = &CRM_Core_Payment::singleton($mode, $form->_paymentProcessor, $form);
}
// make sure we have a valid payment class, else abort
- if (CRM_Utils_Array::value('is_monetary', $form->_values) &&
+ if (!empty($form->_values['is_monetary']) &&
!$form->_paymentProcessor['class_name'] &&
!CRM_Utils_Array::value('is_pay_later', $form->_values)
) {
$date['emptyOptionValue'] = '';
}
- if (!CRM_Utils_Array::value('format', $date)) {
+ if (empty($date['format'])) {
$date['format'] = 'M d';
}
}
return;
}
- if (!CRM_Utils_Array::value($prefix, $this->_session[$this->_key])) {
+ if (empty($this->_session[$this->_key][$prefix])) {
$this->_session[$this->_key][$prefix] = array();
}
}
$this->_pageNames = array();
foreach ($pages as $tempName => $value) {
- if (CRM_Utils_Array::value('className', $value)) {
+ if (!empty($value['className'])) {
$this->_pageNames[] = $tempName;
}
else {
$defaults['filter_selected'] = $contactRefFilter;
}
- if (CRM_Utils_Array::value('data_type', $defaults)) {
+ if (!empty($defaults['data_type'])) {
$defaultDataType = array_search($defaults['data_type'],
self::$_dataTypeKeys
);
$defaults['is_view'] = 0;
}
- if (CRM_Utils_Array::value('html_type', $defaults)) {
+ if (!empty($defaults['html_type'])) {
$dontShowLink = substr($defaults['html_type'], -14) == 'State/Province' || substr($defaults['html_type'], -7) == 'Country' ? 1 : 0;
}
}
// we can not set require and view at the same time.
- if (CRM_Utils_Array::value('is_required', $fields) &&
+ if (!empty($fields['is_required']) &&
CRM_Utils_Array::value('is_view', $fields)
) {
$errors['is_view'] = ts('Can not set this field Required and View Only at the same time.');
//fix for 'is_search_range' field.
if (in_array($dataTypeKey, array(
1, 2, 3, 5))) {
- if (!CRM_Utils_Array::value('is_searchable', $params)) {
+ if (empty($params['is_searchable'])) {
$params['is_search_range'] = 0;
}
}
$errors['title'] = ts('Custom group \'%1\' already exists in Database.', array(1 => $title));
}
- if (CRM_Utils_Array::value(1, $fields['extends'])) {
+ if (!empty($fields['extends'][1])) {
if (in_array('', $fields['extends'][1]) && count($fields['extends'][1]) > 1) {
$errors['extends'] = ts("Cannot combine other option with 'Any'.");
}
$self->assign('showStyle', TRUE);
}
- if (CRM_Utils_Array::value('is_multiple', $fields)) {
+ if (!empty($fields['is_multiple'])) {
$self->assign('showMultiple', TRUE);
}
$defaults['is_active'] = $defaults['collapse_display'] = 1;
$defaults['style'] = 'Inline';
}
- elseif (!CRM_Utils_Array::value('max_multiple', $defaults) && !$this->_isGroupEmpty) {
+ elseif (empty($defaults['max_multiple']) && !$this->_isGroupEmpty) {
$this->assign('showMaxMultiple', FALSE);
}
|| $fieldDefaults['html_type'] == 'Multi-Select'
|| $fieldDefaults['html_type'] == 'AdvMulti-Select'
) {
- if (CRM_Utils_Array::value('default_value', $fieldDefaults)) {
+ if (!empty($fieldDefaults['default_value'])) {
$defaultCheckValues = explode(CRM_Core_DAO::VALUE_SEPARATOR,
substr($fieldDefaults['default_value'], 1, -1)
);
CRM_Core_DAO::VALUE_SEPARATOR,
substr($customField->default_value, 1, -1)
);
- if (CRM_Utils_Array::value('default_value', $params)) {
+ if (!empty($params['default_value'])) {
if (!in_array($customOption->value, $defVal)) {
if (empty($defVal[0])) {
$defVal = array($customOption->value);
break;
}
- if (CRM_Utils_Array::value('default_value', $params)) {
+ if (!empty($params['default_value'])) {
$customField->default_value = $customOption->value;
$customField->save();
}
$fieldDAO = new CRM_Core_DAO_CustomField();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults);
- if (CRM_Utils_Array::value('is_view', $defaults)) {
+ if (!empty($defaults['is_view'])) {
CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.'));
}
elseif (CRM_Utils_Array::value('is_active', $defaults) == 0) {
}
}
- if (CRM_Utils_Array::value('saveMapping', $fields)) {
+ if (!empty($fields['saveMapping'])) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
$this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params));
//Updating Mapping Records
- if (CRM_Utils_Array::value('updateMapping', $params)) {
+ if (!empty($params['updateMapping'])) {
$mappingFields = new CRM_Core_DAO_MappingField();
$mappingFields->mapping_id = $params['mappingId'];
}
//Saving Mapping Details and Records
- if (CRM_Utils_Array::value('saveMapping', $params)) {
+ if (!empty($params['saveMapping'])) {
$mappingParams = array(
'name' => $params['saveMappingName'],
'description' => $params['saveMappingDesc'],
// add all the necessary variables to the form
$parser->set($this);
}
-}
\ No newline at end of file
+}
'gender' => 'gender_id',
);
foreach (array('individual_suffix', 'individual_prefix', 'gender') as $name) {
- if (CRM_Utils_Array::value($name, $fields)) {
+ if (!empty($fields[$name])) {
$flat[$replace_these[$name]] = $flat[$name];
unset($flat[$name]);
}
// handle {birth,deceased}_date
foreach (array(
'birth_date', 'deceased_date') as $date) {
- if (CRM_Utils_Array::value($date, $fields)) {
+ if (!empty($fields[$date])) {
$flat[$date] = $fields[$date];
if (is_array($flat[$date])) {
$flat[$date] = CRM_Utils_Date::format($flat[$date]);
}
}
- if (CRM_Utils_Array::value('contact_source', $flat)) {
+ if (!empty($flat['contact_source'])) {
$flat['source'] = $flat['contact_source'];
unset($flat['contact_source']);
}
'state_province' => 'state_province_id', 'county' => 'county_id',
);
foreach ($fixes as $orig => $target) {
- if (CRM_Utils_Array::value($orig, $flat)) {
+ if (!empty($flat[$orig])) {
$params[$table][$target] = $flat[$orig];
}
}
}
foreach ($fields as $field => $title) {
- if (CRM_Utils_Array::value($field, $flat)) {
+ if (!empty($flat[$field])) {
$params[$table][$field] = $flat[$field];
}
}
// Rule: resolve address conflict if any -
if ($fieldName == 'address') {
$mainNewLocTypeId = $migrationInfo['location'][$fieldName][$fieldCount]['locTypeId'];
- if (CRM_Utils_Array::value('main_loc_address', $migrationInfo) &&
+ if (!empty($migrationInfo['main_loc_address']) &&
array_key_exists("main_{$mainNewLocTypeId}", $migrationInfo['main_loc_address'])) {
// main loc already has some address for the loc-type. Its a overwrite situation.
'preferred_communication_method' => $value,
);
- if (CRM_Utils_array::value('preferred_communication_method', $contact)){
+ if (!empty($contact['preferred_communication_method'])){
// api 3 returns pref_comm_method as an array, which breaks the lookup; so we reconstruct
$prefCommList = is_array($specialValues[$moniker]['preferred_communication_method']) ?
implode(CRM_Core_DAO::VALUE_SEPARATOR, $specialValues[$moniker]['preferred_communication_method']) :
$value = CRM_Core_DAO::VALUE_SEPARATOR . trim($specialValues[$moniker][$field], CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
}
$label = isset($specialValues[$moniker]["{$field}_display"]) ? $specialValues[$moniker]["{$field}_display"] : $value;
- if (CRM_Utils_Array::value('type', $fields[$field]) && $fields[$field]['type'] == CRM_Utils_Type::T_DATE) {
+ if (!empty($fields[$field]['type']) && $fields[$field]['type'] == CRM_Utils_Type::T_DATE) {
if ($value) {
$value = str_replace('-', '', $value);
$label = CRM_Utils_Date::customFormat($label);
$value = "null";
}
}
- elseif (CRM_Utils_Array::value('type', $fields[$field]) && $fields[$field]['type'] == CRM_Utils_Type::T_BOOLEAN) {
+ elseif (!empty($fields[$field]['type']) && $fields[$field]['type'] == CRM_Utils_Type::T_BOOLEAN) {
if ($label === '0') {
$label = ts('[ ]');
}
$rows["custom_group_$gid"]['title'] = $group['title'];
$foundField = TRUE;
}
- if (CRM_Utils_Array::value('customValue', $mainTree[$gid]['fields'][$fid])) {
+ if (!empty($mainTree[$gid]['fields'][$fid]['customValue'])) {
foreach ($mainTree[$gid]['fields'][$fid]['customValue'] as $valueId => $values) {
$rows["move_custom_$fid"]['main'] = CRM_Core_BAO_CustomGroup::formatCustomValues($values,
$field, TRUE
}
}
$value = "null";
- if (CRM_Utils_Array::value('customValue', $otherTree[$gid]['fields'][$fid])) {
+ if (!empty($otherTree[$gid]['fields'][$fid]['customValue'])) {
foreach ($otherTree[$gid]['fields'][$fid]['customValue'] as $valueId => $values) {
$rows["move_custom_$fid"]['other'] = CRM_Core_BAO_CustomGroup::formatCustomValues($values,
$field, TRUE
// get the existing custom values from db.
$customParams = array('entityID' => $mainId, $key => TRUE);
$customfieldValues = CRM_Core_BAO_CustomValueTable::getValues($customParams);
- if (CRM_Utils_array::value($key, $customfieldValues)) {
+ if (!empty($customfieldValues[$key])) {
$existingValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customfieldValues[$key]);
if (is_array($existingValue) && !empty($existingValue)) {
$mergeValue = $submmtedCustomValue = array();
CRM_Core_Permission::check('delete contacts')
) {
// if ext id is submitted then set it null for contact to be deleted
- if (CRM_Utils_Array::value('external_identifier', $submitted)) {
+ if (!empty($submitted['external_identifier'])) {
$query = "UPDATE civicrm_contact SET external_identifier = null WHERE id = {$otherId}";
CRM_Core_DAO::executeQuery($query);
}
static function add(&$params) {
CRM_Utils_System::flushCache();
$financialTypeId = NULL;
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Event', $params['id'], $params);
- if (!CRM_Utils_Array::value('skipFinancialType', $params)) {
+ if (empty($params['skipFinancialType'])) {
$financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['id'], 'financial_type_id');
}
}
$event->copyValues($params);
$result = $event->save();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Event', $event->id, $event);
}
else {
CRM_Core_BAO_Log::add($logParams);
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_event', $event->id);
$baseURL = parse_url($config->userFrameworkBaseURL);
$url = "@" . $baseURL['host'];
- if (CRM_Utils_Array::value('path', $baseURL)) {
+ if (!empty($baseURL['path'])) {
$url .= substr($baseURL['path'], 0, -1);
}
$locBlockId = CRM_Utils_Array::value('loc_block_id', $eventValues);
$fieldsFix = ($afterCreate) ? array( ) : array('prefix' => array('title' => ts('Copy of') . ' '));
- if (!CRM_Utils_Array::value('is_show_location', $eventValues)) {
+ if (empty($eventValues['is_show_location'])) {
$fieldsFix['prefix']['is_show_location'] = 0;
}
$preProfileID = CRM_Utils_Array::value('custom_pre_id', $values);
$postProfileID = CRM_Utils_Array::value('custom_post_id', $values);
- if (CRM_Utils_Array::value('additionalParticipant', $values['params'])) {
+ if (!empty($values['params']['additionalParticipant'])) {
$preProfileID = CRM_Utils_Array::value('additional_custom_pre_id', $values, $preProfileID );
$postProfileID = CRM_Utils_Array::value('additional_custom_post_id', $values, $postProfileID );
}
if ($lineItem = CRM_Utils_Array::value('lineItem', $values)) {
// check if additional prticipant, if so filter only to relevant ones
// CRM-9902
- if (CRM_Utils_Array::value('additionalParticipant', $values['params'])) {
+ if (!empty($values['params']['additionalParticipant'])) {
$ownLineItems = array( );
foreach ( $lineItem as $liKey => $liValue ) {
$firstElement = array_pop( $liValue );
}
foreach ($fields as $v) {
- if (CRM_Utils_Array::value('groupTitle', $v)) {
+ if (!empty($v['groupTitle'])) {
$groupTitle['groupTitle'] = $v['groupTitle'];
break;
}
$alreadyRegistered = self::checkRegistration($params);
}
- if (CRM_Utils_Array::value('allow_same_participant_emails', $values['event']) ||
+ if (!empty($values['event']['allow_same_participant_emails']) ||
!$alreadyRegistered
) {
return TRUE;
*/
static function checkRegistration($params) {
$alreadyRegistered = FALSE;
- if (!CRM_Utils_Array::value('contact_id', $params)) {
+ if (empty($params['contact_id'])) {
return $alreadyRegistered;
}
$eventEmail = array();
CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $params, $eventEmail, $returnProperties);
- if (CRM_Utils_Array::value('confirm_from_name', $eventEmail)
- && CRM_Utils_Array::value('confirm_from_email', $eventEmail)
+ if (!empty($eventEmail['confirm_from_name']) && CRM_Utils_Array::value('confirm_from_email', $eventEmail)
) {
$eventEmailId = "{$eventEmail['confirm_from_name']} <{$eventEmail['confirm_from_email']}>";
*/
static function &add(&$params) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Participant', $params['id'], $params);
}
else {
}
// converting dates to mysql format
- if (CRM_Utils_Array::value('register_date', $params)) {
+ if (!empty($params['register_date'])) {
$params['register_date'] = CRM_Utils_Date::isoToMysql($params['register_date']);
}
- if (CRM_Utils_Array::value('participant_fee_amount', $params)) {
+ if (!empty($params['participant_fee_amount'])) {
$params['participant_fee_amount'] = CRM_Utils_Rule::cleanMoney($params['participant_fee_amount']);
}
- if (CRM_Utils_Array::value('fee_amount', $params)) {
+ if (!empty($params['fee_amount'])) {
$params['fee_amount'] = CRM_Utils_Rule::cleanMoney($params['fee_amount']);
}
}
$participantBAO = new CRM_Event_BAO_Participant;
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$participantBAO->id = CRM_Utils_Array::value('id', $params);
$participantBAO->find(TRUE);
$participantBAO->register_date = CRM_Utils_Date::isoToMysql($participantBAO->register_date);
// reset the group contact cache for this group
CRM_Contact_BAO_GroupContactCache::remove();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Participant', $participantBAO->id, $participantBAO);
}
else {
$transaction = new CRM_Core_Transaction();
$status = NULL;
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$status = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $params['id'], 'status_id');
}
}
// add custom field values
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_participant', $participant->id);
//process note, CRM-7634
$noteId = NULL;
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$note = CRM_Core_BAO_Note::getNote($params['id'], 'civicrm_participant');
$noteId = key($note);
}
$transaction->commit();
// do not add to recent items for import, CRM-4399
- if (!CRM_Utils_Array::value('skipRecentView', $params)) {
+ if (empty($params['skipRecentView'])) {
$url = CRM_Utils_System::url('civicrm/contact/view/participant',
"action=view&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home"
//don't send confirmation mail to additional
//since only primary able to confirm registration.
- if (CRM_Utils_Array::value('registered_by_id', $participantValues) &&
+ if (!empty($participantValues['registered_by_id']) &&
$mailType == 'Confirm'
) {
return $mailSent;
//take a receipt from as event else domain.
$receiptFrom = $domainValues['name'] . ' <' . $domainValues['email'] . '>';
- if (CRM_Utils_Array::value('confirm_from_name', $eventDetails) &&
+ if (!empty($eventDetails['confirm_from_name']) &&
CRM_Utils_Array::value('confirm_from_email', $eventDetails)
) {
$receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>';
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Discounts Account is' "));
$contributionParams['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
$contributionParams['contribution']->financial_type_id, $relationTypeId);
- if (CRM_Utils_Array::value('from_financial_account_id', $contributionParams['trxnParams'])) {
+ if (!empty($contributionParams['trxnParams']['from_financial_account_id'])) {
$contributionParams['trxnParams']['total_amount'] = $mainAmount - $contributionParams['total_amount'];
$contributionParams['trxnParams']['payment_processor_id'] = $contributionParams['trxnParams']['payment_instrument_id'] =
$contributionParams['trxnParams']['check_number'] = $contributionParams['trxnParams']['trxn_id'] =
foreach ($participantDetails as $participantId => $values) {
//process the additional participant at the time of
//primary participant, don't process separately.
- if (CRM_Utils_Array::value('registered_by_id', $values)) {
+ if (!empty($values['registered_by_id'])) {
continue;
}
foreach ($participantDetails as $participantId => $values) {
//process the additional participant at the time of
//primary participant, don't process separately.
- if (CRM_Utils_Array::value('registered_by_id', $values)) {
+ if (!empty($values['registered_by_id'])) {
continue;
}
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
//add fee level
- if (CRM_Utils_Array::value('participant_fee_level', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_fee_level'])) {
$query->_select['participant_fee_level'] = "civicrm_participant.fee_level as participant_fee_level";
$query->_element['participant_fee_level'] = 1;
}
//add fee amount
- if (CRM_Utils_Array::value('participant_fee_amount', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_fee_amount'])) {
$query->_select['participant_fee_amount'] = "civicrm_participant.fee_amount as participant_fee_amount";
$query->_element['participant_fee_amount'] = 1;
}
//add fee currency
- if (CRM_Utils_Array::value('participant_fee_currency', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_fee_currency'])) {
$query->_select['participant_fee_currency'] = "civicrm_participant.fee_currency as participant_fee_currency";
$query->_element['participant_fee_currency'] = 1;
}
//add event title also if event id is select
- if (CRM_Utils_Array::value('event_id', $query->_returnProperties) ||
+ if (!empty($query->_returnProperties['event_id']) ||
CRM_Utils_Array::value('event_title', $query->_returnProperties)
) {
$query->_select['event_id'] = "civicrm_event.id as event_id";
}
//add start date / end date
- if (CRM_Utils_Array::value('event_start_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['event_start_date'])) {
$query->_select['event_start_date'] = "civicrm_event.start_date as event_start_date";
$query->_element['event_start_date'] = 1;
}
- if (CRM_Utils_Array::value('event_end_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['event_end_date'])) {
$query->_select['event_end_date'] = "civicrm_event.end_date as event_end_date";
$query->_element['event_end_date'] = 1;
}
//event type
- if (CRM_Utils_Array::value('event_type', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['event_type'])) {
$query->_select['event_type'] = "event_type.label as event_type";
$query->_element['event_type'] = 1;
$query->_tables['event_type'] = 1;
$query->_whereTables['event_type'] = 1;
}
- if (CRM_Utils_Array::value('event_type_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['event_type_id'])) {
$query->_select['event_type_id'] = "event_type.id as event_type_id";
$query->_element['event_type_id'] = 1;
$query->_tables['event_type'] = 1;
}
//add status and status_id
- if (CRM_Utils_Array::value('participant_status', $query->_returnProperties) ||
+ if (!empty($query->_returnProperties['participant_status']) ||
CRM_Utils_Array::value('participant_status_id', $query->_returnProperties)
) {
$query->_select['participant_status'] = "participant_status.label as participant_status";
}
//add role
- if (CRM_Utils_Array::value('participant_role', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_role'])) {
$query->_select['participant_role'] = "participant_role.label as participant_role";
$query->_element['participant_role'] = 1;
$query->_tables['civicrm_participant'] = 1;
$query->_whereTables['participant_role'] = 1;
}
- if (CRM_Utils_Array::value('participant_role_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_role_id'])) {
$query->_select['participant_role_id'] = "civicrm_participant.role_id as participant_role_id";
$query->_element['participant_role_id'] = 1;
$query->_tables['civicrm_participant'] = 1;
}
//add register date
- if (CRM_Utils_Array::value('participant_register_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_register_date'])) {
$query->_select['participant_register_date'] = "civicrm_participant.register_date as participant_register_date";
$query->_element['participant_register_date'] = 1;
}
//add source
- if (CRM_Utils_Array::value('participant_source', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_source'])) {
$query->_select['participant_source'] = "civicrm_participant.source as participant_source";
$query->_element['participant_source'] = 1;
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
}
//participant note
- if (CRM_Utils_Array::value('participant_note', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_note'])) {
$query->_select['participant_note'] = "civicrm_note.note as participant_note";
$query->_element['participant_note'] = 1;
$query->_tables['participant_note'] = 1;
$query->_whereTables['civicrm_note'] = 1;
}
- if (CRM_Utils_Array::value('participant_is_pay_later', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_is_pay_later'])) {
$query->_select['participant_is_pay_later'] = "civicrm_participant.is_pay_later as participant_is_pay_later";
$query->_element['participant_is_pay_later'] = 1;
}
- if (CRM_Utils_Array::value('participant_is_test', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_is_test'])) {
$query->_select['participant_is_test'] = "civicrm_participant.is_test as participant_is_test";
$query->_element['participant_is_test'] = 1;
}
- if (CRM_Utils_Array::value('participant_registered_by_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_registered_by_id'])) {
$query->_select['participant_registered_by_id'] = "civicrm_participant.registered_by_id as participant_registered_by_id";
$query->_element['participant_registered_by_id'] = 1;
}
// get discount name
- if (CRM_Utils_Array::value('participant_discount_name', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_discount_name'])) {
$query->_select['participant_discount_name'] = "discount_name.title as participant_discount_name";
$query->_element['participant_discount_name'] = 1;
$query->_tables['civicrm_discount'] = 1;
}
//carry campaign id to selectors.
- if (CRM_Utils_Array::value('participant_campaign_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['participant_campaign_id'])) {
$query->_select['participant_campaign_id'] = 'civicrm_participant.campaign_id as participant_campaign_id';
$query->_element['participant_campaign_id'] = 1;
}
static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
- if (!CRM_Utils_Array::value(0, $query->_params[$id])) {
+ if (empty($query->_params[$id][0])) {
continue;
}
if (substr($query->_params[$id][0], 0, 6) == 'event_' ||
static function tableNames(&$tables) {
//add participant table
- if (CRM_Utils_Array::value('civicrm_event', $tables)) {
+ if (!empty($tables['civicrm_event'])) {
$tables = array_merge(array('civicrm_participant' => 1), $tables);
}
}
}
if (self::is_administrator()) {
- if (CRM_Utils_Array::value('note', $params)) {
+ if (!empty($params['note'])) {
$note_params = array(
'participant_id' => $participant->id,
'contact_id' => self::getContactID(),
$participant->copyValues($participantParams);
$participant->save();
- if (CRM_Utils_Array::value('contributionID', $params)) {
+ if (!empty($params['contributionID'])) {
$payment_params = array(
'participant_id' => $participant->id,
'contribution_id' => $params['contributionID'],
$contribution_statuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$params['payment_instrument_id'] = NULL;
- if (CRM_Utils_Array::value('is_pay_later', $params)) {
+ if (!empty($params['is_pay_later'])) {
$params['payment_instrument_id'] = CRM_Core_OptionGroup::getValue('payment_instrument', 'Check', 'name');
$trxn_prefix = 'CK';
}
$mer_participant->contribution_id = $contribution->id;
$params['contributionID'] = $contribution->id;
$params['receive_date'] = $contribution->receive_date;
- if (CRM_Utils_Array::value('financial_trxn_id', $params)) {
+ if (!empty($params['financial_trxn_id'])) {
$entity_financial_trxn_params = array(
'entity_table' => "civicrm_contribution",
'entity_id' => $contribution->id,
$defaults["billing_contact_email"] = $email['email'];
}
}
- if (!CRM_Utils_Array::value('billing_contact_email', $defaults)) {
+ if (empty($defaults['billing_contact_email'])) {
foreach ($contact->email as $email) {
if ($email['is_primary']) {
$defaults["billing_contact_email"] = $email['email'];
$returnProperities = array( 'confirm_email_text', 'financial_type_id', 'campaign_id', 'start_date' );
$details = array();
CRM_Core_DAO::commonRetrieveAll('CRM_Event_DAO_Event', 'id', $form->_eventId, $details, $returnProperities);
- if ( CRM_Utils_Array::value( 'financial_type_id', $details[$form->_eventId] ) ) {
+ if (!empty($details[$form->_eventId]['financial_type_id'])) {
$defaults[$form->_pId]['financial_type_id'] = $details[$form->_eventId]['financial_type_id'];
}
}
}
//CRM-13420
- if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ if (empty($defaults['payment_instrument_id'])) {
$defaults[$form->_pId]['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
}
if ($form->_mode) {
$config = CRM_Core_Config::singleton();
// set default country from config if no country set
- if (!CRM_Utils_Array::value("billing_country_id-{$form->_bltID}", $defaults[$form->_pId])) {
+ if (empty($defaults[$form->_pId]["billing_country_id-{$form->_bltID}"])) {
$defaults[$form->_pId]["billing_country_id-{$form->_bltID}"] = $config->defaultContactCountry;
}
- if (!CRM_Utils_Array::value("billing_state_province_id-{$form->_bltID}", $defaults)) {
+ if (empty($defaults["billing_state_province_id-{$form->_bltID}"])) {
$defaults[$form->_pId]["billing_state_province_id-{$form->_bltID}"] = $config->defaultContactStateProvince;
}
}
//CRM-4453
- if (CRM_Utils_Array::value('participant_fee_currency', $defaults[$form->_pId])) {
+ if (!empty($defaults[$form->_pId]['participant_fee_currency'])) {
$form->assign('fee_currency', $defaults[$form->_pId]['participant_fee_currency']);
}
$showLocation = FALSE;
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Event');
$this->set('subType', CRM_Utils_Array::value('event_type_id', $_POST));
$this->set('entityId', $this->_id);
$defaults = parent::setDefaultValues();
// in update mode, we need to set custom data subtype to tpl
- if (CRM_Utils_Array::value('event_type_id', $defaults)) {
+ if (!empty($defaults['event_type_id'])) {
$this->assign('customDataSubType', $defaults['event_type_id']);
}
$this->_showHide = new CRM_Core_ShowHideBlocks();
// Show waitlist features or event_full_text if max participants set
- if (CRM_Utils_Array::value('max_participants', $defaults)) {
+ if (!empty($defaults['max_participants'])) {
$this->_showHide->addShow('id-waitlist');
- if (CRM_Utils_Array::value('has_waitlist', $defaults)) {
+ if (!empty($defaults['has_waitlist'])) {
$this->_showHide->addShow('id-waitlist-text');
$this->_showHide->addHide('id-event_full');
}
$defaults['waitlist_text'] = CRM_Utils_Array::value('waitlist_text', $defaults, ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.'));
list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value('start_date', $defaults), 'activityDateTime');
- if (CRM_Utils_Array::value('end_date', $defaults)) {
+ if (!empty($defaults['end_date'])) {
list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['end_date'], 'activityDateTime');
}
return $defaults;
);
//merge params with defaults from templates
- if (CRM_Utils_Array::value('template_id', $params)) {
+ if (!empty($params['template_id'])) {
$params = array_merge(CRM_Event_BAO_Event::getTemplateDefaultValues($params['template_id']), $params);
}
$event = CRM_Event_BAO_Event::create($params);
// now that we have the event’s id, do some more template-based stuff
- if (CRM_Utils_Array::value('template_id', $params)) {
+ if (!empty($params['template_id'])) {
CRM_Event_BAO_Event::copy($params['template_id'], $event, TRUE);
}
$defaults['discounted_value'][$discountFieldsval['weight']][$rowCount] =
CRM_Utils_Money::format($discountFieldsval['amount'], NULL, '%a');
$defaults['discount_option_id'][$rowCount][$discountFieldsval['weight']]= $discountFieldsval['id'];
- if (CRM_Utils_Array::value('is_default', $discountFieldsval)) {
+ if (!empty($discountFieldsval['is_default'])) {
$defaults['discounted_default'] = $discountFieldsval['weight'];
}
}
//if Regular Fees are present in DB and event fee page is in update mode
$defaults['discounted_label'] = $defaults['label'];
}
- elseif (CRM_Utils_Array::value('label', $this->_submitValues)) {
+ elseif (!empty($this->_submitValues['label'])) {
//if event is newly created, use submitted values for
//discount labels
if (is_array($this->_submitValues['label'])) {
$this->_showHide->addToTemplate();
$this->assign('inDate', $this->_inDate);
- if (CRM_Utils_Array::value('payment_processor', $defaults)) {
+ if (!empty($defaults['payment_processor'])) {
$defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
$defaults['payment_processor']
), '1');
*/
static function formRule($values) {
$errors = array();
- if (CRM_Utils_Array::value('is_discount', $values)) {
+ if (!empty($values['is_discount'])) {
$occurDiscount = array_count_values($values['discount_name']);
$countemptyrows = 0;
$countemptyvalue = 0;
for ($i = 1; $i <= self::NUM_DISCOUNT; $i++) {
$start_date = $end_date = NULL;
- if (CRM_Utils_Array::value($i, $values['discount_name'])) {
- if (CRM_Utils_Array::value($i, $values['discount_start_date'])) {
+ if (!empty($values['discount_name'][$i])) {
+ if (!empty($values['discount_start_date'][$i])) {
$start_date = ($values['discount_start_date'][$i]) ? CRM_Utils_Date::processDate($values['discount_start_date'][$i]) : 0;
}
- if (CRM_Utils_Array::value($i, $values['discount_end_date'])) {
+ if (!empty($values['discount_end_date'][$i])) {
$end_date = ($values['discount_end_date'][$i]) ? CRM_Utils_Date::processDate($values['discount_end_date'][$i]) : 0;
}
$countemptyvalue++;
}
}
- if (CRM_Utils_Array::value('_qf_Fee_next', $values) && ($countemptyrows == 11 || $countemptyvalue == 11)) {
+ if (!empty($values['_qf_Fee_next']) && ($countemptyrows == 11 || $countemptyvalue == 11)) {
$errors["discounted_label[1]"] = $errors["discounted_value[1][$i]"] = ts('At least one fee should be entered for your Discount Set. If you do not see the table to enter discount fees, click the "Add Discount Set to Fee Table" button.');
}
}
$errors['fee_label'] = ts('Please enter the fee label for the paid event.');
}
- if (!CRM_Utils_Array::value('price_set_id', $values)) {
+ if (empty($values['price_set_id'])) {
//check fee label and amount
$check = 0;
$optionKeys = array();
$this->set('discountSection', 0);
- if (CRM_Utils_Array::value('_qf_Fee_submit', $_POST)) {
+ if (!empty($_POST['_qf_Fee_submit'])) {
$this->buildAmountLabel();
$this->set('discountSection', 2);
return;
}
if ($params['is_monetary']) {
- if (CRM_Utils_Array::value('price_set_id', $params)) {
+ if (!empty($params['price_set_id'])) {
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $params['price_set_id']);
- if (CRM_Utils_Array::value('price_field_id', $params)) {
+ if (!empty($params['price_field_id'])) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id');
CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0);
}
}
if (!empty($options)) {
$params['default_fee_id'] = NULL;
- if (!CRM_Utils_Array::value('price_set_id', $params)) {
- if (!CRM_Utils_Array::value('price_field_id', $params)) {
+ if (empty($params['price_set_id'])) {
+ if (empty($params['price_field_id'])) {
$setParams['title'] = $eventTitle = ($this->_isTemplate) ? $this->_defaultValues['template_title'] : $this->_defaultValues['title'];
$eventTitle = strtolower(CRM_Utils_String::munge($eventTitle, '_', 245));
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle, 'id', 'name')) {
$params['default_discount_fee_id'] = NULL;
$keyCheck = $j-1;
$setParams = array();
- if (!CRM_Utils_Array::value($keyCheck, $discountPriceSets)) {
+ if (empty($discountPriceSets[$keyCheck])) {
if (!$eventTitle) {
$eventTitle = strtolower(CRM_Utils_String::munge($this->_defaultValues['title'], '_', 200));
}
$fieldParams['option_label'][$value['weight']] = $value['label'];
$fieldParams['option_amount'][$value['weight']] = $value['value'];
$fieldParams['option_weight'][$value['weight']] = $value['weight'];
- if (CRM_Utils_Array::value('is_default', $value)) {
+ if (!empty($value['is_default'])) {
$fieldParams['default_option'] = $value['weight'];
}
- if (CRM_Utils_Array::value($j, $discountFieldIDs) && CRM_Utils_Array::value($value['weight'], $discountFieldIDs[$j])) {
+ if (!empty($discountFieldIDs[$j]) && CRM_Utils_Array::value($value['weight'], $discountFieldIDs[$j])) {
$fieldParams['option_id'][$value['weight']] = $discountFieldIDs[$j][$value['weight']];
unset($discountFieldIDs[$j][$value['weight']]);
}
}
}
else {
- if (CRM_Utils_Array::value('price_field_id', $params)) {
+ if (!empty($params['price_field_id'])) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id');
CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0);
}
$locationEvents = CRM_Event_BAO_Event::getLocationEvents();
// remove duplicates and make sure that the duplicate entry with key as
// loc_block_id of this event (this->_id) is preserved
- if (CRM_Utils_Array::value($this->_oldLocBlockId, $locationEvents)) {
+ if (!empty($locationEvents[$this->_oldLocBlockId])) {
$possibleDuplicate = $locationEvents[$this->_oldLocBlockId];
$locationEvents = array_flip(array_unique($locationEvents));
- if (CRM_Utils_Array::value($possibleDuplicate, $locationEvents)) {
+ if (!empty($locationEvents[$possibleDuplicate])) {
$locationEvents[$possibleDuplicate] = $this->_oldLocBlockId;
}
$locationEvents = array_flip($locationEvents);
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
foreach (array(
'address', 'phone', 'email') as $block) {
- if (!CRM_Utils_Array::value($block, $params) || !is_array($params[$block])) {
+ if (empty($params[$block]) || !is_array($params[$block])) {
continue;
}
foreach ($params[$block] as $count => & $values) {
$this->assign('profilePostMultiple', CRM_Utils_Array::value('custom_post', $defaults));
- if (CRM_Utils_Array::value('is_multiple_registrations', $defaults)) {
+ if (!empty($defaults['is_multiple_registrations'])) {
// CRM-4377: set additional participants’ profiles – set to ‘none’ if explicitly unset (non-active)
$ufJoinAddParams = array(
$defaults['thankyou_title'] = CRM_Utils_Array::value('thankyou_title', $defaults, ts('Thank You for Registering'));
$defaults['approval_req_text'] = CRM_Utils_Array::value('approval_req_text', $defaults, ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.'));
- if (CRM_Utils_Array::value('registration_start_date', $defaults)) {
+ if (!empty($defaults['registration_start_date'])) {
list($defaults['registration_start_date'],
$defaults['registration_start_date_time']
) = CRM_Utils_Date::setDateDefaults($defaults['registration_start_date'],
);
}
- if (CRM_Utils_Array::value('registration_end_date', $defaults)) {
+ if (!empty($defaults['registration_end_date'])) {
list($defaults['registration_end_date'],
$defaults['registration_end_date_time']
) = CRM_Utils_Date::setDateDefaults($defaults['registration_end_date'],
$this->_showHide->addHide('id-approval-text');
}
else {
- if (!CRM_Utils_Array::value('is_multiple_registrations', $defaults)) {
+ if (empty($defaults['is_multiple_registrations'])) {
$this->_showHide->addHide('additional_profile_pre');
$this->_showHide->addHide('additional_profile_post');
}
- if (!CRM_Utils_Array::value('requires_approval', $defaults)) {
+ if (empty($defaults['requires_approval'])) {
$this->_showHide->addHide('id-approval-text');
}
}
* @access public
*/
static function formRule($values, $files, $form) {
- if (CRM_Utils_Array::value('is_online_registration', $values)) {
+ if (!empty($values['is_online_registration'])) {
if (!$values['confirm_title']) {
$errorMsg['confirm_title'] = ts('Please enter a Title for the registration Confirmation Page');
}
$additionalCustomPreId = $additionalCustomPostId = NULL;
$isPreError = $isPostError = TRUE;
- if (CRM_Utils_Array::value('allow_same_participant_emails', $values) &&
+ if (!empty($values['allow_same_participant_emails']) &&
CRM_Utils_Array::value('is_multiple_registrations', $values)
) {
$types = array_merge(array('Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
// // CRM-8485
// $config = CRM_Core_Config::singleton();
// if ( $config->doNotAttachPDFReceipt ) {
- // if ( CRM_Utils_Array::value('custom_post_id_multiple', $values) ) {
+ // if (!empty($values['custom_post_id_multiple'])) {
// foreach( $values['custom_post_id_multiple'] as $count => $customPostMultiple ) {
// if ( $customPostMultiple ) {
// $errorMsg["custom_post_id_multiple[{$count}]"] = ts('Please disable PDF receipt as an attachment in <a href="%1">Miscellaneous Settings</a> if you want to add additional profiles.', array( 1 => CRM_Utils_System::url( 'civicrm/admin/setting/misc', 'reset=1' ) ) );
// }
// }
//
- // if ( CRM_Utils_Array::value('is_multiple_registrations', $values) &&
+ // if (!empty($values['is_multiple_registrations']) &&
// CRM_Utils_Array::value('additional_custom_post_id_multiple', $values) ) {
// foreach( $values['additional_custom_post_id_multiple'] as $count => $customPostMultiple ) {
// if ( $customPostMultiple ) {
// }
if (!empty($errorMsg)) {
- if (CRM_Utils_Array::value('custom_post_id_multiple', $values)) {
+ if (!empty($values['custom_post_id_multiple'])) {
foreach ($values['custom_post_id_multiple'] as $count => $customPostMultiple) {
self::buildMultipleProfileBottom($form, $count);
}
$form->assign('profilePostMultiple', $values['custom_post_id_multiple']);
}
- if (CRM_Utils_Array::value('additional_custom_post_id_multiple', $values)) {
+ if (!empty($values['additional_custom_post_id_multiple'])) {
foreach ($values['additional_custom_post_id_multiple'] as $count => $customPostMultiple) {
self::buildMultipleProfileBottom($form, $count, 'additional_', ts('Profile for Additional Participants'));
}
$uf[2] = $params['custom_post_id'];
}
- if (CRM_Utils_Array::value('custom_post_id_multiple', $params)) {
+ if (!empty($params['custom_post_id_multiple'])) {
$uf = array_merge($uf, $params['custom_post_id_multiple']);
}
$uf = array_values($uf);
// first delete all past entries
CRM_Core_BAO_UFJoin::deleteAll($ufJoinParamsAdd);
- if (CRM_Utils_Array::value('is_multiple_registrations', $params)) {
+ if (!empty($params['is_multiple_registrations'])) {
$ufAdd = array();
$wtAdd = 2;
if (array_key_exists('additional_custom_pre_id', $params)) {
- if (!CRM_Utils_Array::value('additional_custom_pre_id', $params)) {
+ if (empty($params['additional_custom_pre_id'])) {
$ufAdd[1] = $params['custom_pre_id'];
$wtAdd = 1;
}
}
if (array_key_exists('additional_custom_post_id', $params)) {
- if (!CRM_Utils_Array::value('additional_custom_post_id', $params)) {
+ if (empty($params['additional_custom_post_id'])) {
$ufAdd[2] = $params['custom_post_id'];
}
elseif (CRM_Utils_Array::value('additional_custom_post_id', $params) == 'none') {}
}
}
- if (CRM_Utils_Array::value('additional_custom_post_id_multiple', $params)) {
+ 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)) {
*/
static function formRule($fields) {
$errors = array();
- if (CRM_Utils_Array::value('is_active', $fields) &&
+ if (!empty($fields['is_active']) &&
CRM_Utils_System::isNull($fields['subject'])
) {
$errors['subject'] = ts('Subject is a required field.');
//mail template is composed
$composeParams = array();
foreach ($composeFields as $key) {
- if (CRM_Utils_Array::value($key, $values)) {
+ if (!empty($values[$key])) {
$composeParams[$key] = $values[$key];
}
}
- if (CRM_Utils_Array::value('updateTemplate', $composeParams)) {
+ if (!empty($composeParams['updateTemplate'])) {
$templateParams = array(
'msg_text' => $params['body_text'],
'msg_html' => $params['body_html'],
$msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
}
- if (CRM_Utils_Array::value('saveTemplate', $composeParams)) {
+ if (!empty($composeParams['saveTemplate'])) {
$templateParams = array(
'msg_text' => $params['body_text'],
'msg_html' => $params['body_html'],
}
// when fee amount is included in form
- if (CRM_Utils_Array::value('hidden_feeblock', $_POST)
- || CRM_Utils_Array::value('send_receipt', $_POST)
+ if (!empty($_POST['hidden_feeblock']) || CRM_Utils_Array::value('send_receipt', $_POST)
) {
CRM_Event_Form_EventFees::preProcess($this);
CRM_Event_Form_EventFees::buildQuickForm($this);
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
//custom data of type participant role
- if (CRM_Utils_Array::value('role_id', $_POST)) {
+ if (!empty($_POST['role_id'])) {
foreach ($_POST['role_id'] as $k => $val) {
$roleID = $val;
CRM_Custom_Form_CustomData::preProcess($this, $this->_roleCustomDataTypeID, $k, 1, 'Participant', $this->_id);
}
// Get registered_by contact ID and display_name if participant was registered by someone else (CRM-4859)
- if (CRM_Utils_Array::value('participant_registered_by_id', $defaults[$this->_id])) {
+ if (!empty($defaults[$this->_id]['participant_registered_by_id'])) {
$registered_by_contact_id = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant',
$defaults[$this->_id]['participant_registered_by_id'],
'contact_id', 'id'
if ($this->_action == CRM_Core_Action::ADD) {
$statuses = array_flip($this->_participantStatuses);
$defaults[$this->_id]['status_id'] = CRM_Utils_Array::value(ts('Registered'), $statuses);
- if (CRM_Utils_Array::value('event_id', $defaults[$this->_id])) {
+ if (!empty($defaults[$this->_id]['event_id'])) {
$contributionTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event',
$defaults[$this->_id]['event_id'],
'financial_type_id'
}
$submittedRole = $this->getElementValue('role_id');
- if (CRM_Utils_Array::value(0, $submittedRole)) {
+ if (!empty($submittedRole[0])) {
$roleID = $submittedRole[0];
}
$submittedEvent = $this->getElementValue('event_id');
//assign event and role id, this is needed for Custom data building
$sep = CRM_Core_DAO::VALUE_SEPARATOR;
- if (CRM_Utils_Array::value('participant_role_id', $defaults[$this->_id])) {
+ if (!empty($defaults[$this->_id]['participant_role_id'])) {
$roleIDs = explode($sep, $defaults[$this->_id]['participant_role_id']);
}
if (isset($roleIDs)) {
// but we do the same for the onChange element and this form is complex
// and i did not want to break it late in the 3.2 cycle
$preloadJSSnippet = NULL;
- if (CRM_Utils_Array::value('reset', $_GET) && $this->_eID) {
+ if (!empty($_GET['reset']) && $this->_eID) {
$preloadJSSnippet = "
cj(function() {
cj('#event_id').val( '{$this->_eID}' );
$errorMsg['contact[1]'] = ts('Please select a contact or create new contact');
}
- if (CRM_Utils_Array::value('payment_processor_id', $values)) {
+ if (!empty($values['payment_processor_id'])) {
// make sure that credit card number and cvv are valid
CRM_Core_Payment_Form::validateCreditCard($values, $errorMsg);
}
- if (CRM_Utils_Array::value('record_contribution', $values)) {
- if (!CRM_Utils_Array::value('financial_type_id', $values)) {
+ if (!empty($values['record_contribution'])) {
+ if (empty($values['financial_type_id'])) {
$errorMsg['financial_type_id'] = ts('Please enter the associated Financial Type');
}
- if (!CRM_Utils_Array::value('payment_instrument_id', $values)) {
+ if (empty($values['payment_instrument_id'])) {
$errorMsg['payment_instrument_id'] = ts('Paid By is a required field.');
}
}
$participantStatus = CRM_Event_PseudoConstant::participantStatus();
// set the contact, when contact is selected
- if (CRM_Utils_Array::value('contact_select_id', $params)) {
+ if (!empty($params['contact_select_id'])) {
$this->_contactId = $params['contact_select_id'][1];
}
if ($this->_priceSetId && $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) {
else {
//check if discount is selected
- if (CRM_Utils_Array::value('discount_id', $params)) {
+ if (!empty($params['discount_id'])) {
$discountId = $params['discount_id'];
}
else {
$params['contact_id'] = $this->_contactId;
// overwrite actual payment amount if entered
- if (CRM_Utils_Array::value('total_amount', $params)) {
+ if (!empty($params['total_amount'])) {
$contributionParams['total_amount'] = CRM_Utils_Array::value('total_amount', $params);
}
// all the payment processors expect the name and address to be in the
// so we copy stuff over to first_name etc.
$paymentParams = $this->_params;
- if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
+ if (!empty($this->_params['send_receipt'])) {
$paymentParams['email'] = $this->_contributorEmail;
}
CRM_Core_Payment_Form::mapParams($this->_bltID, $this->_params, $paymentParams, TRUE);
$this->_params['receive_date'] = $now;
- if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
+ if (!empty($this->_params['send_receipt'])) {
$this->_params['receipt_date'] = $now;
}
else {
// add participant record
$participants = array();
- if (CRM_Utils_Array::value('participant_role_id', $this->_params) && is_array($this->_params['participant_role_id'])) {
+ if (!empty($this->_params['participant_role_id']) && is_array($this->_params['participant_role_id'])) {
$this->_params['participant_role_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR,
array_keys($this->_params['participant_role_id'])
);
}
$contributions = array();
- if (CRM_Utils_Array::value('record_contribution', $params)) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['record_contribution'])) {
+ if (!empty($params['id'])) {
if ($this->_onlinePendingContributionId) {
$ids['contribution'] = $this->_onlinePendingContributionId;
}
// CRM-11124
if ($this->_quickConfig) {
- if (CRM_Utils_Array::value('amount_priceset_level_radio', $this->_params)) {
+ if (!empty($this->_params['amount_priceset_level_radio'])) {
$feeLevel = $this->_params['amount_priceset_level_radio'];
}
else {
$sent = array();
$notSent = array();
- if (CRM_Utils_Array::value('send_receipt', $params)) {
+ if (!empty($params['send_receipt'])) {
if (array_key_exists($params['from_email_address'], $this->_fromEmails['from_email_id'])) {
$receiptFrom = $params['from_email_address'];
}
$this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
}
if ($this->_mode) {
- if (CRM_Utils_Array::value('billing_first_name', $params)) {
+ if (!empty($params['billing_first_name'])) {
$name = $params['billing_first_name'];
}
- if (CRM_Utils_Array::value('billing_middle_name', $params)) {
+ if (!empty($params['billing_middle_name'])) {
$name .= " {$params['billing_middle_name']}";
}
- if (CRM_Utils_Array::value('billing_last_name', $params)) {
+ if (!empty($params['billing_last_name'])) {
$name .= " {$params['billing_last_name']}";
}
$this->assign('billingName', $name);
$participant = array(array('participant_id', '=', $participants[0]->id, 0, 0));
// check whether its a test drive ref CRM-3075
- if (CRM_Utils_Array::value('is_test', $this->_defaultValues)) {
+ if (!empty($this->_defaultValues['is_test'])) {
$participant[] = array('participant_test', '=', 1, 0, 0);
}
if (($this->_action & CRM_Core_Action::UPDATE)) {
$statusMsg = ts('Event registration information for %1 has been updated.', array(1 => $this->_contributorDisplayName));
- if (CRM_Utils_Array::value('send_receipt', $params) && count($sent)) {
+ if (!empty($params['send_receipt']) && count($sent)) {
$statusMsg .= ' ' . ts('A confirmation email has been sent to %1', array(1 => $this->_contributorEmail));
}
elseif ($this->_action & CRM_Core_Action::ADD) {
if ($this->_single) {
$statusMsg = ts('Event registration for %1 has been added.', array(1 => $this->_contributorDisplayName));
- if (CRM_Utils_Array::value('send_receipt', $params) && count($sent)) {
+ if (!empty($params['send_receipt']) && count($sent)) {
$statusMsg .= ' ' . ts('A confirmation email has been sent to %1.', array(1 => $this->_contributorEmail));
}
}
CRM_Event_BAO_Participant::resolveDefaults($values[$participantID]);
- if (CRM_Utils_Array::value('fee_level', $values[$participantID])) {
+ if (!empty($values[$participantID]['fee_level'])) {
CRM_Event_BAO_Participant::fixEventLevel($values[$participantID]['fee_level']);
}
$values[$participantID]['totalAmount'] = CRM_Utils_Array::value('fee_amount', $values[$participantID]);
// Get registered_by contact ID and display_name if participant was registered by someone else (CRM-4859)
- if (CRM_Utils_Array::value('participant_registered_by_id', $values[$participantID])) {
+ if (!empty($values[$participantID]['participant_registered_by_id'])) {
$values[$participantID]['registered_by_contact_id'] = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant",
$values[$participantID]['participant_registered_by_id'],
'contact_id', 'id'
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $finalTree);
$eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $values[$participantID]['event_id'], 'title');
//CRM-7150, show event name on participant view even if the event is disabled
- if (!CRM_Utils_Array::value('event', $values[$participantID])) {
+ if (empty($values[$participantID]['event'])) {
$values[$participantID]['event'] = $eventTitle;
}
//check for require requires approval.
$this->_requireApproval = FALSE;
- if (CRM_Utils_Array::value('requires_approval', $this->_values['event']) && !$this->_allowConfirmation) {
+ if (!empty($this->_values['event']['requires_approval']) && !$this->_allowConfirmation) {
$this->_requireApproval = TRUE;
}
$this->set('requireApproval', $this->_requireApproval);
$params = $this->_params[0];
}
$name = '';
- if (CRM_Utils_Array::value('billing_first_name', $params)) {
+ if (!empty($params['billing_first_name'])) {
$name = $params['billing_first_name'];
}
- if (CRM_Utils_Array::value('billing_middle_name', $params)) {
+ if (!empty($params['billing_middle_name'])) {
$name .= " {$params['billing_middle_name']}";
}
- if (CRM_Utils_Array::value('billing_last_name', $params)) {
+ if (!empty($params['billing_last_name'])) {
$name .= " {$params['billing_last_name']}";
}
$this->assign('billingName', $name);
);
foreach ($vars as $v) {
- if (CRM_Utils_Array::value($v, $params)) {
+ if (!empty($params[$v])) {
if ($v == 'receive_date') {
$this->assign($v, CRM_Utils_Date::mysqlToIso($params[$v]));
}
$fields = @array_diff_assoc($fields, $this->_fields);
}
- if (!CRM_Utils_Array::value('additional_participants', $this->_params[0]) &&
+ if (empty($this->_params[0]['additional_participants']) &&
is_null($cid)
) {
CRM_Core_BAO_Address::checkContactSharedAddressFields($fields, $contactID);
$this->_params = $this->get('value');
//get the amount of primary participant
- if (CRM_Utils_Array::value('is_primary', $this->_params)) {
+ if (!empty($this->_params['is_primary'])) {
$this->_params['fee_amount'] = $this->get('primaryParticipantAmount');
}
$this->_participantIDS[] = $participant->id;
//setting register_by_id field and primaryContactId
- if (CRM_Utils_Array::value('is_primary', $this->_params)) {
+ if (!empty($this->_params['is_primary'])) {
$this->set('registerByID', $participant->id);
$this->set('primaryContactId', $contactID);
$this->assign('action', $this->_action);
// create CMS user
- if (CRM_Utils_Array::value('cms_create_account', $this->_params)) {
+ if (!empty($this->_params['cms_create_account'])) {
$this->_params['contactID'] = $contactID;
if (array_key_exists('email-5', $this->_params)) {
// 2. pay later participant.
// 3. waiting list participant.
// 4. require approval participant.
- if (CRM_Utils_Array::value('is_pay_later', $this->_params) ||
+ if (!empty($this->_params['is_pay_later']) ||
$this->_allowWaitlist || $this->_requireApproval ||
!CRM_Utils_Array::value('is_monetary', $this->_values['event'])
) {
if ($this->_allowConfirmation && $this->_participantId) {
$registerDate = $params['participant_register_date'];
}
- elseif (CRM_Utils_Array::value('participant_register_date', $params) &&
+ elseif (!empty($params['participant_register_date']) &&
is_array($params['participant_register_date']) &&
!empty($params['participant_register_date'])
) {
$participantParams['is_test'] = 0;
}
- if (CRM_Utils_Array::value('note', $this->_params)) {
+ if (!empty($this->_params['note'])) {
$participantParams['note'] = $this->_params['note'];
}
- elseif (CRM_Utils_Array::value('participant_note', $this->_params)) {
+ elseif (!empty($this->_params['participant_note'])) {
$participantParams['note'] = $this->_params['participant_note'];
}
}
$priceSetFields = $priceMaxFieldDetails = array();
- if (CRM_Utils_Array::value('optionsCountTotal', $priceSet)) {
+ if (!empty($priceSet['optionsCountTotal'])) {
$priceSetFields = $priceSet['optionsCountDetails']['fields'];
}
- if (CRM_Utils_Array::value('optionsMaxValueTotal', $priceSet)) {
+ if (!empty($priceSet['optionsMaxValueTotal'])) {
$priceMaxFieldDetails = $priceSet['optionsMaxValueDetails']['fields'];
}
if (!is_array($values) || $values == 'skip') {
continue;
}
- if (!CRM_Utils_Array::value($pNum, $fieldSelected)) {
+ if (empty($fieldSelected[$pNum])) {
$errors[$pNum]['_qf_default'] = ts('Select at least one option from Event Fee(s).');
}
}
}
// is this an event template ?
- if (CRM_Utils_Array::value('is_template', $this->_values['event'])) {
+ if (!empty($this->_values['event']['is_template'])) {
CRM_Core_Error::statusBounce(ts('Event templates are not meant to be registered.'), $redirect);
}
}
if ($this->_priceSetId) {
foreach ($this->_feeBlock as $key => $val) {
- if (!CRM_Utils_Array::value('options', $val)) {
+ if (empty($val['options'])) {
continue;
}
}
foreach (array(
'first_name', 'last_name') as $name) {
- if (CRM_Utils_Array::value($name, $$keys) &&
+ if (!empty($$keys[$name]) &&
CRM_Utils_Array::value('is_required', CRM_Utils_Array::value($name, $$keys))
) {
$$name = 1;
}
//we might did reset allow waiting in case of dynamic calculation
- if (CRM_Utils_Array::value('bypass_payment', $this->_params[0]) &&
+ if (!empty($this->_params[0]['bypass_payment']) &&
is_numeric($spaces) &&
$processedCnt > $spaces
) {
//lets allow to become a part of runtime waiting list, if primary selected pay later.
$realPayLater = FALSE;
- if (CRM_Utils_Array::value('is_monetary', $this->_values['event']) &&
+ if (!empty($this->_values['event']['is_monetary']) &&
CRM_Utils_Array::value('is_pay_later', $this->_values['event'])
) {
$realPayLater = CRM_Utils_Array::value('is_pay_later', $this->_params[0]);
$this->assign('allowGroupOnWaitlist', TRUE);
$paymentBypassed = NULL;
- if (CRM_Utils_Array::value('bypass_payment', $this->_params[0]) &&
+ if (!empty($this->_params[0]['bypass_payment']) &&
!$this->_allowWaitlist &&
!$realPayLater &&
!$this->_requireApproval &&
$button = substr($self->controller->getButtonName(), -4);
$realPayLater = FALSE;
- if (CRM_Utils_Array::value('is_monetary', $self->_values['event']) &&
+ if (!empty($self->_values['event']['is_monetary']) &&
CRM_Utils_Array::value('is_pay_later', $self->_values['event'])
) {
$realPayLater = CRM_Utils_Array::value('is_pay_later', $self->_params[0]);
}
//check for atleast one pricefields should be selected
- if (CRM_Utils_Array::value('priceSetId', $fields)) {
+ if (!empty($fields['priceSetId'])) {
$allParticipantParams = $params;
//format current participant params.
if (!$self->_allowConfirmation &&
is_numeric($self->_availableRegistrations)
) {
- if (CRM_Utils_Array::value('bypass_payment', $self->_params[0]) &&
+ if (!empty($self->_params[0]['bypass_payment']) &&
!$self->_allowWaitlist &&
!$realPayLater &&
!$self->_requireApproval &&
return $errors;
}
- if (CRM_Utils_Array::value('has_waitlist', $self->_values['event']) &&
+ if (!empty($self->_values['event']['has_waitlist']) &&
CRM_Utils_Array::value('bypass_payment', $self->_params[0]) &&
!$self->_allowWaitlist &&
!$realPayLater &&
function validatePaymentValues($self, $fields) {
- if (CRM_Utils_Array::value('bypass_payment', $self->_params[0]) ||
+ if (!empty($self->_params[0]['bypass_payment']) ||
$self->_allowWaitlist ||
empty($self->_fields) ||
CRM_Utils_Array::value('amount', $self->_params[0]) > 0
}
$validatePayement = FALSE;
- if (CRM_Utils_Array::value('priceSetId', $fields)) {
+ if (!empty($fields['priceSetId'])) {
$lineItem = array();
CRM_Price_BAO_PriceSet::processAmount($self->_values['fee'], $fields, $lineItem);
if ($fields['amount'] > 0) {
// return false;
}
}
- elseif (CRM_Utils_Array::value('amount', $fields) &&
+ elseif (!empty($fields['amount']) &&
(CRM_Utils_Array::value('value', $self->_values['fee'][$fields['amount']]) > 0)
) {
$validatePayement = TRUE;
if (is_numeric($currentCount)) {
$totalParticipants += $currentCount;
}
- if (CRM_Utils_Array::value('has_waitlist', $this->_values['event']) &&
+ if (!empty($this->_values['event']['has_waitlist']) &&
$totalParticipants > $this->_availableRegistrations
) {
$this->_allowWaitlist = TRUE;
$params['participant_role_id'] = $params['participant_role'];
}
- if (!CRM_Utils_Array::value('participant_role_id', $params) && $this->_values['event']['default_role_id']) {
+ if (empty($params['participant_role_id']) && $this->_values['event']['default_role_id']) {
$params['participant_role_id'] = $this->_values['event']['default_role_id'];
}
- if (CRM_Utils_Array::value('is_pay_later', $this->_params[0])) {
+ if (!empty($this->_params[0]['is_pay_later'])) {
$params['is_pay_later'] = 1;
}
CRM_Utils_Hook::eventDiscount($this, $this->_params);
- if (CRM_Utils_Array::value('discount', $this->_params[0]) &&
+ if (!empty($this->_params[0]['discount']) &&
CRM_Utils_Array::value('applied', $this->_params[0]['discount'])
) {
$this->set('hookDiscount', $this->_params[0]['discount']);
// set a few other parameters for PayPal
$params['token'] = $this->get('token');
$params['amount'] = $this->_params[0]['amount'];
- if (CRM_Utils_Array::value('discount', $this->_params[0])) {
+ if (!empty($this->_params[0]['discount'])) {
$params['discount'] = $this->_params[0]['discount'];
$params['discountAmount'] = $this->_params[0]['discountAmount'];
$params['discountMessage'] = $this->_params[0]['discountMessage'];
$this->assign('defaultRole', TRUE);
}
- if (!CRM_Utils_Array::value('participant_role_id', $this->_params[0]) &&
+ if (empty($this->_params[0]['participant_role_id']) &&
$this->_values['event']['default_role_id']
) {
$this->_params[0]['participant_role_id'] = $this->_values['event']['default_role_id'];
}
}
- if (CRM_Utils_Array::value('first_name', $v) && CRM_Utils_Array::value('last_name', $v)) {
+ if (!empty($v['first_name']) && CRM_Utils_Array::value('last_name', $v)) {
$append = $v['first_name'] . ' ' . $v['last_name'];
}
else {
}
$this->_amount[$k]['amount'] = $v['amount'];
- if (CRM_Utils_Array::value('discountAmount', $v)) {
+ if (!empty($v['discountAmount'])) {
$this->_amount[$k]['amount'] -= $v['discountAmount'];
}
$this->_amount[$k]['label'] = preg_replace('/\ 1/', '', $v['amount_level']) . ' - ' . $append;
$this->_part[$k]['info'] = CRM_Utils_Array::value('first_name', $v) . ' ' . CRM_Utils_Array::value('last_name', $v);
- if (!CRM_Utils_Array::value('first_name', $v)) {
+ if (empty($v['first_name'])) {
$this->_part[$k]['info'] = $append;
}
$this->_totalAmount = $this->_totalAmount + $this->_amount[$k]['amount'];
- if (CRM_Utils_Array::value('is_primary', $v)) {
+ if (!empty($v['is_primary'])) {
$this->set('primaryParticipantAmount', $this->_amount[$k]['amount']);
}
}
}
if ($participantValue != 'skip') {
//get the customPre profile info
- if (CRM_Utils_Array::value( $prefix2 . 'custom_pre_id', $this->_values)) {
+ if (!empty($this->_values[$prefix2 . 'custom_pre_id'])) {
$values = $groupName = array();
CRM_Event_BAO_Event::displayProfile($participantValue,
$this->_values[ $prefix2 . 'custom_pre_id'],
$formattedValues[$count][$prefix1 . 'CustomPreGroupTitle'] = CRM_Utils_Array::value('groupTitle', $groupName);
}
//get the customPost profile info
- if (CRM_Utils_Array::value( $prefix2 . 'custom_post_id', $this->_values)) {
+ if (!empty($this->_values[$prefix2 . 'custom_post_id'])) {
$values = $groupName = array();
foreach ($this->_values[$prefix2 . 'custom_post_id'] as $gids) {
$val = array();
$now = date('YmdHis');
$this->_params = $this->get('params');
- if (CRM_Utils_Array::value('contact_id', $this->_params[0])) {
+ if (!empty($this->_params[0]['contact_id'])) {
// unclear when this would be set & whether it could be checked in getContactID.
// perhaps it relates to when cid is in the url
//@todo someone who knows add comments on the various contactIDs in this form
// if a discount has been applied, lets now deduct it from the amount
// and fix the fee level
- if (CRM_Utils_Array::value('discount', $this->_params[0]) &&
+ if (!empty($this->_params[0]['discount']) &&
CRM_Utils_Array::value('applied', $this->_params[0]['discount'])
) {
foreach ($this->_params as $k => $v) {
foreach ($billingFields as $field) {
unset($value[$field]);
}
- if (CRM_Utils_Array::value('is_pay_later', $value)) {
+ if (!empty($value['is_pay_later'])) {
$this->_values['params']['is_pay_later'] = TRUE;
}
}
//Unset ContactID for additional participants and set RegisterBy Id.
- if (!CRM_Utils_Array::value('is_primary', $value)) {
+ if (empty($value['is_primary'])) {
$contactID = CRM_Utils_Array::value('contact_id', $value);
$registerByID = $this->get('registerByID');
if ($registerByID) {
//now becomes part of run time waiting list.
$value['is_pay_later'] = FALSE;
}
- elseif (CRM_Utils_Array::value('is_pay_later', $value) ||
+ elseif (!empty($value['is_pay_later']) ||
$value['amount'] == 0 ||
$this->_contributeMode == 'checkout' ||
$this->_contributeMode == 'notify'
else
CRM_Core_Error::fatal($paymentObjError);
}
- elseif (CRM_Utils_Array::value('is_primary', $value)) {
+ elseif (!empty($value['is_primary'])) {
CRM_Core_Payment_Form::mapParams($this->_bltID, $value, $value, TRUE);
// payment email param can be empty for _bltID mapping
// thus provide mapping for it with a different email value
}
//CRM-4453.
- if (CRM_Utils_Array::value('is_primary', $value)) {
+ if (!empty($value['is_primary'])) {
$primaryCurrencyID = CRM_Utils_Array::value('currencyID', $value);
}
- if (!CRM_Utils_Array::value('currencyID', $value)) {
+ if (empty($value['currencyID'])) {
$value['currencyID'] = $primaryCurrencyID;
}
if ($this->_allowConfirmation) {
$registerDate = CRM_Utils_Array::value( 'participant_register_date', $params );
}
- elseif (CRM_Utils_Array::value('participant_register_date', $params) &&
+ elseif (!empty($params['participant_register_date']) &&
is_array($params['participant_register_date']) &&
!empty($params['participant_register_date'])
) {
$primaryParticipant = $this->get('primaryParticipant');
- if (!CRM_Utils_Array::value('participantID', $primaryParticipant)) {
+ if (empty($primaryParticipant['participantID'])) {
$primaryParticipant['participantID'] = $registerByID;
}
'campaign_id' => CRM_Utils_Array::value('campaign_id', $params),
);
- if (!CRM_Utils_Array::value('is_pay_later', $params)) {
+ if (empty($params['is_pay_later'])) {
$contribParams['payment_instrument_id'] = 1;
}
}
$contribID = NULL;
- if (CRM_Utils_Array::value('invoice_id', $contribParams)) {
+ if (!empty($contribParams['invoice_id'])) {
$contribID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution',
$contribParams['invoice_id'],
'id',
}
// Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
- if (CRM_Utils_Array::value('pcp_made_through_id', $params) ||
+ if (!empty($params['pcp_made_through_id']) ||
CRM_Utils_Array::value('soft_credit_to', $params)
) {
// if its due to pcp
- if (CRM_Utils_Array::value('pcp_made_through_id', $params)) {
+ if (!empty($params['pcp_made_through_id'])) {
$contribSoftContactId = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP',
$params['pcp_made_through_id'],
'contact_id'
if (!empty($this->_fields)) {
foreach ($this->_fields as $key => $value) {
- if (CRM_Utils_Array::value('add_to_group_id', $value)) {
+ if (!empty($value['add_to_group_id'])) {
$addToGroups[$value['add_to_group_id']] = $value['add_to_group_id'];
}
}
$statusMessage = ts("Your event registration has been cancelled.");
}
- if (CRM_Utils_Array::value('mailedParticipants', $results)) {
+ if (!empty($results['mailedParticipants'])) {
foreach ($results['mailedParticipants'] as $key => $displayName) {
$statusMessage .= "<br />" . ts("Email has been sent to : %1", array(1 => $displayName));
}
// country if the person has an address but no country (for anonymous country is set above)
// this could have implications if the billing profile is filled but hidden.
// this behaviour has been in place for a while but the use of js to hide things has increased
- if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $this->_defaults)) {
+ if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) {
$this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
}
// set default state/province from config if no state/province set
- if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $this->_defaults)) {
+ if (empty($this->_defaults["billing_state_province_id-{$this->_bltID}"])) {
$this->_defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
}
// Set default payment processor as default payment_processor radio button value
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $pid => $value) {
- if (CRM_Utils_Array::value('is_default', $value)) {
+ if (!empty($value['is_default'])) {
$this->_defaults['payment_processor'] = $pid;
}
}
//if event is monetary and pay later is enabled and payment
//processor is not available then freeze the pay later checkbox with
//default check
- if (CRM_Utils_Array::value('is_pay_later', $this->_values['event']) &&
+ if (!empty($this->_values['event']['is_pay_later']) &&
!is_array($this->_paymentProcessor)
) {
$this->_defaults['is_pay_later'] = 1;
//@todo we are blocking for multiple registrations because we haven't tested
$this->addCidZeroOptions($onlinePaymentProcessorEnabled);
}
- if (CRM_Utils_Array::value('is_pay_later', $this->_values['event']) &&
+ if (!empty($this->_values['event']['is_pay_later']) &&
($this->_allowConfirmation || (!$this->_requireApproval && !$this->_allowWaitlist))
) {
$pps[0] = $this->_values['event']['pay_later_text'];
//freeze button to avoid multiple calls.
$js = NULL;
- if (!CRM_Utils_Array::value('is_monetary', $this->_values['event'])) {
+ if (empty($this->_values['event']['is_monetary'])) {
$js = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');");
}
$this->addButtons(array(
//format price set fields across option full.
self::formatFieldsForOptionFull($form);
- if (CRM_Utils_Array::value('is_quick_config', $form->_priceSet)) {
+ if (!empty($form->_priceSet['is_quick_config'])) {
$form->_quickConfig = $form->_priceSet['is_quick_config'];
}
$form->add('hidden', 'priceSetId', $form->_priceSetId);
$form->_allowConfirmation &&
!empty($formattedPriceSetDefaults)
) {
- if (!CRM_Utils_Array::value("price_{$field}", $formattedPriceSetDefaults) ||
+ if (empty($formattedPriceSetDefaults["price_{$field}"]) ||
!CRM_Utils_Array::value($opId, $formattedPriceSetDefaults["price_{$fieldId}"])
) {
$optionFullIds[$optId] = $optId;
}
//don't allow to register w/ waiting if enough spaces available.
- if (CRM_Utils_Array::value('bypass_payment', $fields)) {
+ 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)
) {
}
}
- if (CRM_Utils_Array::value('additional_participants', $fields) &&
+ if (!empty($fields['additional_participants']) &&
!CRM_Utils_Rule::positiveInteger($fields['additional_participants'])
) {
$errors['additional_participants'] = ts('Please enter a whole number for Number of additional people.');
}
// priceset validations
- if (CRM_Utils_Array::value('priceSetId', $fields)) {
+ if (!empty($fields['priceSetId'])) {
//format params.
$formatted = self::formatPriceSetParams($self, $fields);
$ppParams = array($formatted);
$errors = array_merge($errors, CRM_Utils_Array::value(0, $priceSetErrors, array()));
$totalParticipants = $primaryParticipantCount;
- if (CRM_Utils_Array::value('additional_participants', $fields)) {
+ if (!empty($fields['additional_participants'])) {
$totalParticipants += $fields['additional_participants'];
}
- if (!CRM_Utils_Array::value('bypass_payment', $fields) &&
+ if (empty($fields['bypass_payment']) &&
!$self->_allowConfirmation &&
is_numeric($self->_availableRegistrations) &&
$self->_availableRegistrations < $totalParticipants
if ($self->_paymentProcessor &&
$self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
) {
- if (CRM_Utils_Array::value($self->_expressButtonName . '_x', $fields) ||
+ if (!empty($fields[$self->_expressButtonName . '_x']) ||
CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) ||
CRM_Utils_Array::value($self->_expressButtonName, $fields)
) {
}
$isZeroAmount = $skipPaymentValidation = FALSE;
- if (CRM_Utils_Array::value('priceSetId', $fields)) {
+ if (!empty($fields['priceSetId'])) {
if (CRM_Utils_Array::value('amount', $fields) == 0) {
$isZeroAmount = TRUE;
}
}
- elseif (CRM_Utils_Array::value('amount', $fields) &&
+ elseif (!empty($fields['amount']) &&
(isset($self->_values['discount'][$fields['amount']])
&& CRM_Utils_Array::value('value', $self->_values['discount'][$fields['amount']]) == 0
)
) {
$isZeroAmount = TRUE;
}
- elseif (CRM_Utils_Array::value('amount', $fields) &&
+ elseif (!empty($fields['amount']) &&
(isset($self->_values['fee'][$fields['amount']])
&& CRM_Utils_Array::value('value', $self->_values['fee'][$fields['amount']]) == 0
)
}
// also return if paylater mode or zero fees for valid members
- if (CRM_Utils_Array::value('is_pay_later', $fields) ||
+ if (!empty($fields['is_pay_later']) ||
CRM_Utils_Array::value('bypass_payment', $fields) ||
$skipPaymentValidation ||
(!$self->_allowConfirmation && ($self->_requireApproval || $self->_allowWaitlist))
}
}
- if (CRM_Utils_Array::value('image_URL', $params)) {
+ if (!empty($params['image_URL'])) {
CRM_Contact_BAO_Contact::processImageParams($params);
}
$primaryParticipantCount = self::getParticipantCount($this, $params);
$totalParticipants = $primaryParticipantCount;
- if (CRM_Utils_Array::value('additional_participants', $params)) {
+ if (!empty($params['additional_participants'])) {
$totalParticipants += $params['additional_participants'];
}
if (!$this->_allowConfirmation &&
if (array_key_exists('participant_role_id', $params)) {
$params['defaultRole'] = 0;
}
- if (!CRM_Utils_Array::value('participant_role_id', $params) &&
+ if (empty($params['participant_role_id']) &&
$this->_values['event']['default_role_id']
) {
$params['participant_role_id'] = $this->_values['event']['default_role_id'];
$this->_params[] = $params;
$this->set('params', $this->_params);
- if (!CRM_Utils_Array::value('additional_participants', $params)) {
+ if (empty($params['additional_participants'])) {
self::processRegistration($this->_params);
}
}
$fields = NULL;
// setting register by Id and unset contactId.
- if (!CRM_Utils_Array::value('is_primary', $value)) {
+ if (empty($value['is_primary'])) {
$contactID = NULL;
$registerByID = $this->get('registerByID');
if ($registerByID) {
$this->_participantInfo[] = $value['first_name'] . ' ' . $value['last_name'];
}
}
- elseif (CRM_Utils_Array::value('contact_id', $value)) {
+ elseif (!empty($value['contact_id'])) {
$contactID = $value['contact_id'];
}
else {
CRM_Event_Form_Registration_Confirm::fixLocationFields($value, $fields);
//for free event or additional participant, dont create billing email address.
- if (!CRM_Utils_Array::value('is_primary', $value) || !$this->_values['event']['is_monetary']) {
+ if (empty($value['is_primary']) || !$this->_values['event']['is_monetary']) {
unset($value["email-{$this->_bltID}"]);
}
$params['entity_table'] = 'civicrm_event';
$data = array();
CRM_Friend_BAO_Friend::retrieve($params, $data);
- if (CRM_Utils_Array::value('is_active', $data)) {
+ if (!empty($data['is_active'])) {
$friendText = $data['title'];
$this->assign('friendText', $friendText);
if ($this->_action & CRM_Core_Action::PREVIEW) {
if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0' ) {
$seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )";
}
- if (CRM_Utils_Array::value('participant_status_id', $this->_formValues)) {
+ if (!empty($this->_formValues['participant_status_id'])) {
$statuses = array_keys($this->_formValues['participant_status_id']);
$seatClause[] = '( participant.status_id IN ( ' . implode(' , ', $statuses) . ' ) )';
}
- if (CRM_Utils_Array::value('participant_role_id', $this->_formValues)) {
+ if (!empty($this->_formValues['participant_role_id'])) {
$roles = array_keys($this->_formValues['participant_role_id']);
$seatClause[] = '( participant.role_id IN ( ' . implode(' , ', $roles) . ' ) )';
}
$defaults['eventsByDates'] = 0;
$this->_showHide = new CRM_Core_ShowHideBlocks();
- if (!CRM_Utils_Array::value('eventsByDates', $defaults)) {
+ if (empty($defaults['eventsByDates'])) {
$this->_showHide->addHide('id_fromToDates');
}
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $this->_customFields);
$entityColumnValue = array();
- if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) {
+ if (!empty($customValue['extends_entity_column_value'])) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$customValue['extends_entity_column_value']
);
);
$value['id'] = $key;
- if (CRM_Utils_Array::value('participant_register_date', $value)) {
+ if (!empty($value['participant_register_date'])) {
$value['register_date'] = CRM_Utils_Date::processDate($value['participant_register_date'], $value['participant_register_date_time']);
}
- if (CRM_Utils_Array::value('participant_role', $value)) {
+ if (!empty($value['participant_role'])) {
$participantRoles = CRM_Event_PseudoConstant::participantRole();
if (is_array($value['participant_role'])) {
$value['role_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($value['participant_role']));
//need to send mail when status change
$statusChange = FALSE;
$relatedStatusChange = FALSE;
- if (CRM_Utils_Array::value('participant_status', $value)) {
+ if (!empty($value['participant_status'])) {
$value['status_id'] = $value['participant_status'];
$fromStatusId = CRM_Utils_Array::value($key, $this->_fromStatusIds);
if (!$fromStatusId) {
}
}
- if (CRM_Utils_Array::value('participant_source', $value)) {
+ if (!empty($value['participant_source'])) {
$value['source'] = $value['participant_source'];
}
unset($value['participant_register_date']);
}
}
- if (CRM_Utils_Array::value('saveMapping', $fields)) {
+ if (!empty($fields['saveMapping'])) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
$this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params));
//Updating Mapping Records
- if (CRM_Utils_Array::value('updateMapping', $params)) {
+ if (!empty($params['updateMapping'])) {
$mappingFields = new CRM_Core_DAO_MappingField();
$mappingFields->mapping_id = $params['mappingId'];
}
//Saving Mapping Details and Records
- if (CRM_Utils_Array::value('saveMapping', $params)) {
+ if (!empty($params['saveMapping'])) {
$mappingParams = array(
'name' => $params['saveMappingName'],
'description' => $params['saveMappingDesc'],
if (!(($index < 0) || ($this->_participantStatusIndex < 0))) {
$errorRequired = !CRM_Utils_Array::value($this->_participantStatusIndex, $values);
- if (!CRM_Utils_Array::value('event_id', $params) && !CRM_Utils_Array::value('event_title', $params)) {
+ if (empty($params['event_id']) && !CRM_Utils_Array::value('event_title', $params)) {
CRM_Contact_Import_Parser_Contact::addToErrorMsg('Event', $missingField);
}
- if (!CRM_Utils_Array::value('participant_status_id', $params)) {
+ if (empty($params['participant_status_id'])) {
CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Status', $missingField);
}
}
}
if (!(CRM_Utils_Array::value('participant_role_id', $params) || CRM_Utils_Array::value('participant_role', $params))) {
- if (CRM_Utils_Array::value('event_id', $params)) {
+ if (!empty($params['event_id'])) {
$params['participant_role_id'] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'default_role_id');
}
else {
return CRM_Import_Parser::ERROR;
}
$newParticipant = CRM_Event_BAO_Participant::create($formatted, $ids);
- if( CRM_Utils_Array::value('fee_level', $formatted)) {
+ if (!empty($formatted['fee_level'])) {
$otherParams = array(
'fee_label' => $formatted['fee_level'],
'event_id' => $newParticipant->event_id
}
}
- if (CRM_Utils_Array::value('external_identifier', $params)) {
+ if (!empty($params['external_identifier'])) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
}
}
}
else {
- if (CRM_Utils_Array::value('external_identifier', $formatValues)) {
+ if (!empty($formatValues['external_identifier'])) {
$checkCid = new CRM_Contact_DAO_Contact();
$checkCid->external_identifier = $formatValues['external_identifier'];
$checkCid->find(TRUE);
);
$allowRegistration = FALSE;
- if (CRM_Utils_Array::value('is_online_registration', $values['event'])) {
+ if (!empty($values['event']['is_online_registration'])) {
if (CRM_Event_BAO_Event::validRegistrationRequest($values['event'], $this->_id)) {
// we always generate urls for the front end in joomla
$action_query = $action === CRM_Core_Action::PREVIEW ? "&action=$action" : '';
);
if (!$eventFullMessage || $hasWaitingList) {
$registerText = ts('Register Now');
- if (CRM_Utils_Array::value('registration_link_text', $values['event'])) {
+ if (!empty($values['event']['registration_link_text'])) {
$registerText = $values['event']['registration_link_text'];
}
$row['showConfirmUrl'] = ($statusClass == 'Pending') ? TRUE : FALSE;
- if (CRM_Utils_Array::value('participant_is_test', $row)) {
+ if (!empty($row['participant_is_test'])) {
$row['participant_status'] .= ' (' . ts('test') . ')';
}
$row['paid'] = CRM_Event_BAO_Event::isMonetary($row['event_id']);
- if (CRM_Utils_Array::value('participant_fee_level', $row)) {
+ if (!empty($row['participant_fee_level'])) {
CRM_Event_BAO_Participant::fixEventLevel($row['participant_fee_level']);
}
function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
- if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
+ if (!empty($_POST['_qf_' . $formName . '_next_print'])) {
$value = CRM_Event_Task::PRINT_EVENTS;
}
else {
}
if (array_key_exists($relationshipTypes, $contactRelationshipTypes)) {
- if (CRM_Utils_Array::value(2, $value)) {
+ if (!empty($value[2])) {
$relationField = CRM_Utils_Array::value(2, $value);
if (trim(CRM_Utils_Array::value(3, $value))) {
$relLocTypeId = CRM_Utils_Array::value(3, $value);
$relIMProviderId = CRM_Utils_Array::value(4, $value);
}
}
- elseif (CRM_Utils_Array::value(4, $value)) {
+ elseif (!empty($value[4])) {
$relationField = CRM_Utils_Array::value(4, $value);
$relLocTypeId = CRM_Utils_Array::value(5, $value);
if ($relationField == 'phone') {
}
elseif ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
$returnProperties['participant_id'] = 1;
- if (CRM_Utils_Array::value('participant_role', $returnProperties)) {
+ if (!empty($returnProperties['participant_role'])) {
unset($returnProperties['participant_role']);
$returnProperties['participant_role_id'] = 1;
}
if ($moreReturnProperties) {
// fix for CRM-7066
- if (CRM_Utils_Array::value('group', $moreReturnProperties)) {
+ if (!empty($moreReturnProperties['group'])) {
unset($moreReturnProperties['group']);
$moreReturnProperties['groups'] = 1;
}
// make sure the groups stuff is included only if specifically specified
// by the fields param (CRM-1969), else we limit the contacts outputted to only
// ones that are part of a group
- if (CRM_Utils_Array::value('groups', $returnProperties)) {
+ if (!empty($returnProperties['groups'])) {
$oldClause = "( contact_a.id = civicrm_group_contact.contact_id )";
$newClause = " ( $oldClause AND ( civicrm_group_contact.status = 'Added' OR civicrm_group_contact.status IS NULL ) )";
// total hack for export, CRM-3618
$queryString = "$select $from $where $having";
$groupBy = "";
- if (CRM_Utils_Array::value('tags', $returnProperties) ||
+ if (!empty($returnProperties['tags']) ||
CRM_Utils_Array::value('groups', $returnProperties) ||
CRM_Utils_Array::value('notes', $returnProperties) ||
// CRM-9552
if ($order) {
list($field, $dir) = explode(' ', $order, 2);
$field = trim($field);
- if (CRM_Utils_Array::value($field, $returnProperties)) {
+ if (!empty($returnProperties[$field])) {
// $queryString .= " ORDER BY $order";
}
}
$type = explode('-', $fld);
$hdr = "{$ltype}-" . $query->_fields[$type[0]]['title'];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
if (CRM_Utils_Array::value(0, $type) == 'phone') {
$hdr .= "-" . CRM_Utils_Array::value($type[1], $phoneTypes);
}
$hdr = "{$ltype}-" . $relationQuery[$field]->_fields[$type[0]]['title'];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
if (CRM_Utils_Array::value(0, $type) == 'phone') {
$hdr .= "-" . CRM_Utils_Array::value($type[1], $phoneTypes);
}
// FIXME: We should not be using labels as keys!
$daoField = CRM_Utils_String::munge($ltype) . '-' . $type[0];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
$fldValue .= "-" . $type[1];
}
foreach (array_keys($val) as $fld) {
$type = explode('-', $fld);
$fldValue = "{$ltype}-" . $type[0];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
$fldValue .= "-" . $type[1];
}
// CRM-3157: localise country, region (both have ‘country’ context)
}
}
//remove organization name for individuals if it is set for current employer
- if (CRM_Utils_Array::value('contact_type', $row) &&
+ if (!empty($row['contact_type']) &&
$row['contact_type'] == 'Individual' && array_key_exists('organization_name', $row)
) {
$row['organization_name'] = '';
'addressee',
);
foreach ($greetingFields as $greeting) {
- if (CRM_Utils_Array::value($greeting, $exportParams)) {
+ if (!empty($exportParams[$greeting])) {
$greetingLabel = $exportParams[$greeting];
if (empty($contact)) {
$values = array(
);
$contact = civicrm_api('contact', 'get', $values);
- if (CRM_Utils_Array::value('is_error', $contact)) {
+ if (!empty($contact['is_error'])) {
return $greetings;
}
$contact = $contact['values'][$contact['id']];
static function _trimNonTokens(&$parsedString, $defaultGreeting,
$addressMergeGreetings, $greetingType = 'postal_greeting'
) {
- if (CRM_Utils_Array::value($greetingType, $addressMergeGreetings)) {
+ if (!empty($addressMergeGreetings[$greetingType])) {
$greetingLabel = $addressMergeGreetings[$greetingType];
}
$greetingLabel = empty($greetingLabel) ? $defaultGreeting : $greetingLabel;
if (!$sharedAddress && !array_key_exists($copyID, $merge[$masterID]['copy'])) {
- if (CRM_Utils_Array::value('postal_greeting_other', $exportParams) &&
+ if (!empty($exportParams['postal_greeting_other']) &&
count($merge[$masterID]['copy']) >= 1
) {
// use static greetings specified if no of contacts > 2
$merge[$masterID]['postalGreeting'] = str_replace(" {$copyPostalGreeting},", "", $merge[$masterID]['postalGreeting']);
}
- if (CRM_Utils_Array::value('addressee_other', $exportParams) &&
+ if (!empty($exportParams['addressee_other']) &&
count($merge[$masterID]['copy']) >= 1
) {
// use static greetings specified if no of contacts > 2
else {
$householdColName = CRM_Utils_String::munge($prefixColumn . $columnNames, '_', 64);
- if (CRM_Utils_Array::value($householdColName, $sqlColumns)) {
+ if (!empty($sqlColumns[$householdColName])) {
$replaced[$columnNames] = $householdColName;
}
}
$addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'address_options', TRUE, NULL, TRUE
);
- if (CRM_Utils_Array::value('supplemental_address_1', $addressOptions)) {
+ if (!empty($addressOptions['supplemental_address_1'])) {
$addressWhereClause .= " AND ( (supplemental_address_1 IS NULL) OR (supplemental_address_1 = '') ) ";
// enclose it again, since we are doing an AND in between a set of ORs
$addressWhereClause = "( $addressWhereClause )";
static function formRule($fields, $values, $mappingTypeId) {
$errors = array();
- if (CRM_Utils_Array::value('saveMapping', $fields) && CRM_Utils_Array::value('_qf_Map_next', $fields)) {
+ if (!empty($fields['saveMapping']) && CRM_Utils_Array::value('_qf_Map_next', $fields)) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Export Mapping');
}
if ($buttonName1 == '_qf_Map_next') {
- if (CRM_Utils_Array::value('updateMapping', $params)) {
+ if (!empty($params['updateMapping'])) {
//save mapping fields
CRM_Core_BAO_Mapping::saveMappingFields($params, $params['mappingId']);
}
- if (CRM_Utils_Array::value('saveMapping', $params)) {
+ if (!empty($params['saveMapping'])) {
$mappingParams = array(
'name' => $params['saveMappingName'],
'description' => $params['saveMappingDesc'],
}
$details = '<p>' . ts('Record: ') . $values['title'] . '</p><p>' . ts('Description: ') . '</p><p>' . ts('Created By: ') . $createdBy . '</p><p>' . ts('Created Date: ') . $values['created_date'] . '</p><p>' . ts('Last Modified By: ') . $modifiedBy . '</p><p>' . ts('Payment Instrument: ') . $values['payment_instrument_id'] . '</p>';
$subject = '';
- if (CRM_Utils_Array::value('total', $values)) {
+ if (!empty($values['total'])) {
$subject .= ts('Total') . '['. CRM_Utils_Money::format($values['total']) .'],';
}
- if (CRM_Utils_Array::value('item_count', $values)) {
+ if (!empty($values['item_count'])) {
$subject .= ' ' . ts('Count') . '['. $values['item_count'] .'],';
}
$params['is_tax'] = CRM_Utils_Array::value('is_tax', $params, FALSE);
$params['is_header_account'] = CRM_Utils_Array::value('is_header_account', $params, FALSE);
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
- if (CRM_Utils_Array::value('is_default', $params)) {
+ if (!empty($params['is_default'])) {
$query = 'UPDATE civicrm_financial_account SET is_default = 0 WHERE financial_account_type_id = %1';
$queryParams = array(1 => array($params['financial_account_type_id'], 'Integer'));
CRM_Core_DAO::executeQuery($query, $queryParams);
static function create(&$params, $ids = NULL, $trxnIds = NULL) {
$financialItem = new CRM_Financial_DAO_FinancialItem();
$financialItem->copyValues($params);
- if (CRM_Utils_Array::value('id', $ids)) {
+ if (!empty($ids['id'])) {
$financialItem->id = $ids['id'];
}
$financialItem->save();
- if (CRM_Utils_Array::value('id', $trxnIds)) {
+ if (!empty($trxnIds['id'])) {
$entity_financial_trxn_params = array(
'entity_table' => "civicrm_financial_item",
'entity_id' => $financialItem->id,
$entity_trxn = new CRM_Financial_DAO_EntityFinancialTrxn();
$entity_trxn->copyValues($entity_financial_trxn_params);
- if (CRM_Utils_Array::value('entityFinancialTrxnId', $ids)) {
+ if (!empty($ids['entityFinancialTrxnId'])) {
$entity_trxn->id = $ids['entityFinancialTrxnId'];
}
$entity_trxn->save();
// action is taken depending upon the mode
$financialType = new CRM_Financial_DAO_FinancialType();
$financialType->copyValues($params);
- if (CRM_Utils_Array::value('financialType', $ids)) {
+ if (!empty($ids['financialType'])) {
$financialType->id = CRM_Utils_Array::value('financialType', $ids);
}
$financialType->save();
// CRM-12470
- if (!CRM_Utils_Array::value('financialType', $ids)) {
+ if (empty($ids['financialType'])) {
$titles = CRM_Financial_BAO_FinancialTypeAccount::createDefaultFinancialAccounts($financialType);
$financialType->titles = $titles;
}
else {
$financialTypeAccount->id = CRM_Utils_Array::value('entityFinancialAccount', $ids);
}
- if (CRM_Utils_Array::value('entityFinancialAccount', $ids)) {
+ if (!empty($ids['entityFinancialAccount'])) {
$financialTypeAccount->id = $ids['entityFinancialAccount'];
}
$financialTypeAccount->copyValues($params);
$processor->save();
// CRM-11826, add entry in civicrm_entity_financial_account
// if financial_account_id is not NULL
- if (CRM_Utils_Array::value('financial_account_id', $params)) {
+ if (!empty($params['financial_account_id'])) {
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
$values = array(
'entity_table' => 'civicrm_payment_processor',
);
$createdID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'created_id');
- if (CRM_Utils_Array::value($this->_action, $permissions)) {
+ if (!empty($permissions[$this->_action])) {
$this->checkPermissions($this->_action, $permissions[$this->_action]['permission'], $createdID, $session->get('userID'), $permissions[$this->_action]['actionName'] );
}
}
*/
static function formRule($values, $files, $self) {
$errors = array();
- if (CRM_Utils_Array::value('contact_name', $values) && !is_numeric($values['created_id'])) {
+ if (!empty($values['contact_name']) && !is_numeric($values['created_id'])) {
$errors['contact_name'] = ts('Please select a valid contact.');
}
if ($values['item_count'] && (!is_numeric($values['item_count']) || $values['item_count'] < 1)) {
if ($values['total'] && (!is_numeric($values['total']) || $values['total'] <= 0)) {
$errors['total'] = ts('Total Amount should be a positive number');
}
- if (CRM_Utils_Array::value('created_date', $values) && date('Y-m-d') < date('Y-m-d', strtotime($values['created_date']))) {
+ if (!empty($values['created_date']) && date('Y-m-d') < date('Y-m-d', strtotime($values['created_date']))) {
$errors['created_date'] = ts('Created date cannot be greater than current date');
}
$batchName = $values['title'];
// store the submitted values in an array
$params['modified_date'] = date('YmdHis');
$params['modified_id'] = $session->get('userID');
- if (CRM_Utils_Array::value('created_date', $params)) {
+ if (!empty($params['created_date'])) {
$params['created_date'] = CRM_Utils_Date::processDate($params['created_date']);
}
}
if ($this->_action == CRM_Core_Action::ADD) {
- if (CRM_Utils_Array::value('account_relationship', $this->_submitValues) || CRM_Utils_Array::value('financial_account_id', $this->_submitValues)) {
+ if (!empty($this->_submitValues['account_relationship']) || CRM_Utils_Array::value('financial_account_id', $this->_submitValues)) {
$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 (CRM_Utils_Array::value('account_relationship', $values) && CRM_Utils_Array::value('financial_account_id', $values)) {
+ if (!empty($values['account_relationship']) && CRM_Utils_Array::value('financial_account_id', $values)) {
$params = array(
'account_relationship' => $values['account_relationship'],
'entity_id' => $self->_aid
$batchIds[] = $batch[1];
}
}
- if (CRM_Utils_Array::value('batch_update', $_POST)) {
+ if (!empty($_POST['batch_update'])) {
CRM_Batch_BAO_Batch::closeReOpen($batchIds, $_POST['batch_update']);
}
}
CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, CRM_Core_DAO::$_nullArray, $financialAccountIds);
foreach( $financialAccountIds as $key => $values){
- if (CRM_Utils_Array::value($values['financial_account_id'], $financialAccounts)) {
+ if (!empty($financialAccounts[$values['financial_account_id']])) {
$financialAccountId[$values['financial_account_id']] = CRM_Utils_Array::value(
$values['financial_account_id'], $financialAccounts );
}
);
//if is_email_receipt is set then take receipt_from_email
//as from_email
- if (CRM_Utils_Array::value('is_email_receipt', $default) && CRM_Utils_Array::value('receipt_from_email', $default)) {
+ if (!empty($default['is_email_receipt']) && CRM_Utils_Array::value('receipt_from_email', $default)) {
$mailParams['email_from'] = $default['receipt_from_email'];
}
//if is_email_confirm is set then take confirm_from_email
//as from_email
- if (CRM_Utils_Array::value('is_email_confirm', $default) && CRM_Utils_Array::value('confirm_from_email', $default)) {
+ if (!empty($default['is_email_confirm']) && CRM_Utils_Array::value('confirm_from_email', $default)) {
$mailParams['email_from'] = $default['confirm_from_email'];
}
}
// use contact email, CRM-4963
- if (!CRM_Utils_Array::value('email_from', $values)) {
+ if (empty($values['email_from'])) {
$values['email_from'] = $email;
}
$params, $values, array('is_tellfriend_enabled', 'tellfriend_limit')
);
- if (!CRM_Utils_Array::value('is_tellfriend_enabled', $values)) {
+ if (empty($values['is_tellfriend_enabled'])) {
CRM_Core_Error::fatal(ts('Tell Friend is disable for this Personal Campaign Page'));
}
$defaults['entity_table'] = 'civicrm_event';
$defaults['entity_id'] = $this->_id;
CRM_Friend_BAO_Friend::getValues($defaults);
- if (CRM_Utils_Array::value('id', $defaults)) {
+ if (!empty($defaults['id'])) {
$defaults['tf_id'] = CRM_Utils_Array::value('id', $defaults);
$this->_friendId = $defaults['tf_id'];
// lets unset the 'id' since it conflicts with eventID (or contribID)
*/
static function add(&$params, &$ids) {
- if (CRM_Utils_Array::value('grant_id', $ids)) {
+ if (!empty($ids['grant_id'])) {
CRM_Utils_Hook::pre('edit', 'Grant', $ids['grant_id'], $params);
}
else {
);
$grantTypes = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id');
- if (!CRM_Utils_Array::value('skipRecentView', $params)) {
+ if (empty($params['skipRecentView'])) {
if(!isset($grant->contact_id) || !isset($grant->grant_type_id)){
$grant->find(TRUE);
}
);
}
- if (CRM_Utils_Array::value('grant', $ids)) {
+ if (!empty($ids['grant'])) {
CRM_Utils_Hook::post('edit', 'Grant', $grant->id, $grant);
}
else {
if (!$id) {
$id = CRM_Utils_Array::value('contact_id', $params);
}
- if (CRM_Utils_Array::value('note', $params) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note',$ids))) {
+ if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note',$ids))) {
$noteParams = array(
'entity_table' => 'civicrm_grant',
'note' => $params['note'] = $params['note'] ? $params['note'] : "null",
CRM_Core_BAO_Log::add($logParams);
// add custom field values
- if (CRM_Utils_Array::value('custom', $params) && is_array($params['custom'])) {
+ if (!empty($params['custom']) && is_array($params['custom'])) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_grant', $grant->id);
}
*/
static function select(&$query) {
if ($query->_mode & CRM_Contact_BAO_Query::MODE_GRANT) {
- if (CRM_Utils_Array::value('grant_status_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['grant_status_id'])) {
$query->_select['grant_status_id'] = 'grant_status.id as grant_status_id';
$query->_element['grant_status'] = 1;
$query->_tables['grant_status'] = $query->_whereTables['grant_status'] = 1;
$query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1;
}
- if (CRM_Utils_Array::value('grant_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['grant_status'])) {
$query->_select['grant_status'] = 'grant_status.label as grant_status';
$query->_element['grant_status'] = 1;
$query->_tables['grant_status'] = $query->_whereTables['grant_status'] = 1;
$query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1;
}
- if (CRM_Utils_Array::value('grant_type_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['grant_type_id'])) {
$query->_select['grant_type_id'] = 'grant_type.id as grant_type_id';
$query->_element['grant_type'] = 1;
$query->_tables['grant_type'] = $query->_whereTables['grant_type'] = 1;
$query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1;
}
- if (CRM_Utils_Array::value('grant_type', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['grant_type'])) {
$query->_select['grant_type'] = 'grant_type.label as grant_type';
$query->_element['grant_type'] = 1;
$query->_tables['grant_type'] = $query->_whereTables['grant_type'] = 1;
$query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1;
}
- if (CRM_Utils_Array::value('grant_note', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['grant_note'])) {
$query->_select['grant_note'] = "civicrm_note.note as grant_note";
$query->_element['grant_note'] = 1;
$query->_tables['grant_note'] = 1;
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Grant');
$this->set('subType', CRM_Utils_Array::value('grant_type_id', $_POST));
$this->set('entityId', $this->_id);
);
foreach ($dates as $key) {
- if (CRM_Utils_Array::value($key, $defaults)) {
+ if (!empty($defaults[$key])) {
list($defaults[$key]) = CRM_Utils_Date::setDateDefaults($defaults[$key]);
}
}
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
- if (!CRM_Utils_Array::value('grant_report_received', $params)) {
+ if (empty($params['grant_report_received'])) {
$params['grant_report_received'] = "null";
}
// set the contact, when contact is selected
- if (CRM_Utils_Array::value('contact_select_id', $params)) {
+ if (!empty($params['contact_select_id'])) {
$this->_contactID = $params['contact_select_id'][1];
}
function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
- if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
+ if (!empty($_POST['_qf_' . $formName . '_next_print'])) {
$value = CRM_Grant_Task::PRINT_GRANTS;
}
else {
'search_custom_id'
);
}
- if (CRM_Utils_Array::value('created_id', $this->_groupValues))
+ if (!empty($this->_groupValues['created_id']))
$groupValues['created_by'] =
CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['created_id'] , 'sort_name', 'id');
- if (CRM_Utils_Array::value('modified_id', $this->_groupValues)) {
+ if (!empty($this->_groupValues['modified_id'])) {
$groupValues['modified_by'] =
CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['modified_id'] , 'sort_name', 'id');
}
if (isset($this->_id)) {
$defaults = $this->_groupValues;
- if (CRM_Utils_Array::value('group_type', $defaults)) {
+ if (!empty($defaults['group_type'])) {
$types = explode(CRM_Core_DAO::VALUE_SEPARATOR,
substr($defaults['group_type'], 1, -1)
);
) {
CRM_Contact_BAO_GroupOrganization::retrieve($this->_id, $defaults);
- if (CRM_Utils_Array::value('group_organization', $defaults)) {
+ if (!empty($defaults['group_organization'])) {
//used in edit mode
$this->_groupOrganizationID = $defaults['group_organization'];
}
}
}
- if (!CRM_Utils_Array::value('parents', $defaults)) {
+ if (empty($defaults['parents'])) {
$defaults['parents'] = CRM_Core_BAO_Domain::getGroupId();
}
}
$grpAdd = 0;
- if (CRM_Utils_Array::value('parents', $fields)) {
+ if (!empty($fields['parents'])) {
$grpAdd++;
}
}
// do check for both name and title uniqueness
- if (CRM_Utils_Array::value('title', $fields)) {
+ if (!empty($fields['title'])) {
$title = trim($fields['title']);
$query = "
SELECT count(*)
* Remove any parent groups requested to be removed
*/
- if (CRM_Utils_Array::value('parents', $this->_groupValues)) {
+ if (!empty($this->_groupValues['parents'])) {
$parentGroupIds = explode(',', $this->_groupValues['parents']);
foreach ($parentGroupIds as $parentGroupId) {
if (isset($params["remove_parent_group_$parentGroupId"])) {
'group_type', 'visibility', 'org_info', 'links', 'class',
);
- if (!CRM_Utils_Array::value('showOrgInfo', $params)) {
+ if (empty($params['showOrgInfo'])) {
unset($selectorElements[6]);
}
// we need to make sure separators are trimmed
if ($diff == 'case_type_id') {
foreach (array('original', 'changed') as $var) {
- if (CRM_Utils_Array::value($diff, $$var)) {
+ if (!empty($$var[$diff])) {
$holder =& $$var;
$val = explode(CRM_Case_BAO_Case::VALUE_SEPARATOR, $holder[$diff]);
$holder[$diff] = CRM_Utils_Array::value(1, $val);
$rows = array();
$tempColumns = "id int(10)";
- if (CRM_Utils_Array::value('log_action', $this->_params['fields'])) {
+ if (!empty($this->_params['fields']['log_action'])) {
$tempColumns .= ", log_action varchar(64)";
}
$tempColumns .= ", log_type varchar(64), log_user_id int(10), log_date timestamp";
- if (CRM_Utils_Array::value('altered_contact', $this->_params['fields'])) {
+ if (!empty($this->_params['fields']['altered_contact'])) {
$tempColumns .= ", altered_contact varchar(128)";
}
$tempColumns .= ", altered_contact_id int(10), log_conn_id int(11), is_deleted tinyint(4)";
- if (CRM_Utils_Array::value('display_name', $this->_params['fields'])) {
+ if (!empty($this->_params['fields']['display_name'])) {
$tempColumns .= ", display_name varchar(128)";
}
}
function getLogType($entity) {
- if (CRM_Utils_Array::value('log_type', $this->_logTables[$entity])) {
+ if (!empty($this->_logTables[$entity]['log_type'])) {
return $this->_logTables[$entity]['log_type'];
}
$logType = ucfirst(substr($entity, strrpos($entity, '_') + 1));
}
function getEntityValue($id, $entity, $logDate) {
- if (CRM_Utils_Array::value('bracket_info', $this->_logTables[$entity])) {
- if (CRM_Utils_Array::value('entity_column', $this->_logTables[$entity]['bracket_info'])) {
+ if (!empty($this->_logTables[$entity]['bracket_info'])) {
+ if (!empty($this->_logTables[$entity]['bracket_info']['entity_column'])) {
$logTable = !empty($this->_logTables[$entity]['table_name']) ? $this->_logTables[$entity]['table_name'] : $entity;
$sql = "
SELECT {$this->_logTables[$entity]['bracket_info']['entity_column']}
}
function getEntityAction($id, $connId, $entity, $oldAction) {
- if (CRM_Utils_Array::value('action_column', $this->_logTables[$entity])) {
+ if (!empty($this->_logTables[$entity]['action_column'])) {
$sql = "select {$this->_logTables[$entity]['action_column']} from `{$this->loggingDB}`.{$entity} where id = %1 AND log_conn_id = %2";
$newAction = CRM_Core_DAO::singleValueQuery($sql, array(
1 => array($id, 'Integer'),
CRM_Utils_Hook::alterMailParams($mailParams, 'civimail');
// CRM-10699 support custom email headers
- if (CRM_Utils_Array::value('headers', $mailParams)) {
+ if (!empty($mailParams['headers'])) {
$headers = array_merge($headers, $mailParams['headers']);
}
//cycle through mailParams and set headers array
$result = $mailing->save();
- if (CRM_Utils_Array::value('mailing', $ids)) {
+ if (!empty($ids['mailing'])) {
CRM_Utils_Hook::post('edit', 'Mailing', $mailing->id, $mailing);
}
else {
$report['event_totals']['queue'] = self::getRecipientsCount($mailing_id, $mailing_id);
}
- if (CRM_Utils_Array::value('queue', $report['event_totals'])) {
+ if (!empty($report['event_totals']['queue'])) {
$report['event_totals']['delivered_rate'] = (100.0 * $report['event_totals']['delivered']) / $report['event_totals']['queue'];
$report['event_totals']['bounce_rate'] = (100.0 * $report['event_totals']['bounce']) / $report['event_totals']['queue'];
$report['event_totals']['unsubscribe_rate'] = (100.0 * $report['event_totals']['unsubscribe']) / $report['event_totals']['queue'];
$query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
// get mailing name
- if (CRM_Utils_Array::value('mailing_name', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['mailing_name'])) {
$query->_select['mailing_name'] = "civicrm_mailing.name as mailing_name";
$query->_element['mailing_name'] = 1;
}
// get mailing subject
- if (CRM_Utils_Array::value('mailing_subject', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['mailing_subject'])) {
$query->_select['mailing_subject'] = "civicrm_mailing.subject as mailing_subject";
$query->_element['mailing_subject'] = 1;
}
// get mailing status
- if (CRM_Utils_Array::value('mailing_job_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['mailing_job_status'])) {
$query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] =
" LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
$query->_select['mailing_job_status'] = "civicrm_mailing_job.status as mailing_job_status";
}
// get email on hold
- if (CRM_Utils_Array::value('email_on_hold', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['email_on_hold'])) {
$query->_select['email_on_hold'] = "recipient_email.on_hold as email_on_hold";
$query->_element['email_on_hold'] = 1;
$query->_tables['recipient_email'] = $query->_whereTables['recipient_email'] = 1;
}
// get recipient email
- if (CRM_Utils_Array::value('email', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['email'])) {
$query->_select['email'] = "recipient_email.email as email";
$query->_element['email'] = 1;
$query->_tables['recipient_email'] = $query->_whereTables['recipient_email'] = 1;
}
// get user opt out
- if (CRM_Utils_Array::value('contact_opt_out', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['contact_opt_out'])) {
$query->_select['contact_opt_out'] = "contact_a.is_opt_out as contact_opt_out";
$query->_element['contact_opt_out'] = 1;
}
// mailing job end date / completed date
- if (CRM_Utils_Array::value('mailing_job_end_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['mailing_job_end_date'])) {
$query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] =
" LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
$query->_select['mailing_job_end_date'] = "civicrm_mailing_job.end_date as mailing_job_end_date";
$query->_element['mailing_job_end_date'] = 1;
}
- if (CRM_Utils_Array::value('mailing_recipients_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['mailing_recipients_id'])) {
$query->_select['mailing_recipients_id'] = " civicrm_mailing_recipients.id as mailing_recipients_id";
$query->_element['mailing_recipients_id'] = 1;
}
static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
- if (!CRM_Utils_Array::value(0, $query->_params[$id])) {
+ if (empty($query->_params[$id][0])) {
continue;
}
if (substr($query->_params[$id][0], 0, 8) == 'mailing_') {
//append comment if added while forwarding.
if (count($comment)) {
$message->_txtbody = CRM_Utils_Array::value('body_text', $comment) . $message->_txtbody;
- if (CRM_Utils_Array::value('body_html', $comment)) {
+ if (!empty($comment['body_html'])) {
$message->_htmlbody = $comment['body_html'] . '<br />---------------Original message---------------------<br />' . $message->_htmlbody;
}
}
foreach (
array('name', 'group_id', 'search_id', 'search_args', 'campaign_id', 'dedupe_email') as $n
) {
- if (CRM_Utils_Array::value($n, $values)) {
+ if (!empty($values[$n])) {
$params[$n] = $values[$n];
}
}
$urlString = 'civicrm/contact/' . $fragment;
}
$emails = NULL;
- if (CRM_Utils_Array::value('sendtest', $testParams)) {
+ if (!empty($testParams['sendtest'])) {
if (!($testParams['test_group'] || $testParams['test_email'])) {
CRM_Core_Session::setStatus(ts('You did not provide an email address or select a group.'), ts('Test not sent.'), 'error');
$error = TRUE;
}
}
- if (CRM_Utils_Array::value('_qf_Test_submit', $testParams)) {
+ if (!empty($testParams['_qf_Test_submit'])) {
//when user perform mailing from search context
//redirect it to search result CRM-3711.
if ($ssID && $self->_searchBasedMailing) {
}
}
- if (CRM_Utils_Array::value('_qf_Test_next', $testParams) &&
+ if (!empty($testParams['_qf_Test_next']) &&
$self->get('count') <= 0) {
return array(
'_qf_default' =>
);
}
- if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST) ||
+ if (!empty($_POST['_qf_Import_refresh']) ||
CRM_Utils_Array::value('_qf_Test_next', $testParams) ||
!CRM_Utils_Array::value('sendtest', $testParams)
) {
$isComplete = CRM_Mailing_BAO_MailingJob::runJobs($testParams);
}
- if (CRM_Utils_Array::value('sendtest', $testParams)) {
+ if (!empty($testParams['sendtest'])) {
$status = NULL;
if (CRM_Mailing_Info::workflowEnabled()) {
if ((
}
//set default from email address.
- if (CRM_Utils_Array::value('from_name', $defaults) && CRM_Utils_Array::value('from_email', $defaults)) {
+ if (!empty($defaults['from_name']) && CRM_Utils_Array::value('from_email', $defaults)) {
$defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>',
CRM_Core_OptionGroup::values('from_email_address')
);
}
}
- if (CRM_Utils_Array::value('replyto_email', $defaults)) {
+ if (!empty($defaults['replyto_email'])) {
$replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
foreach ($replyToEmail as $value) {
if (strstr($value, $defaults['replyto_email'])) {
array('' => '- select -') + $fromEmailAddress
);
}
- elseif (CRM_Utils_Array::value('override_verp', $options)) {
+ elseif (!empty($options['override_verp'])) {
$trackReplies = TRUE;
$this->assign('trackReplies', $trackReplies);
}
$formValues = $this->controller->exportValues($this->_name);
foreach ($uploadParams as $key) {
- if (CRM_Utils_Array::value($key, $formValues) ||
+ if (!empty($formValues[$key]) ||
in_array($key, array('header_id', 'footer_id'))
) {
$params[$key] = $formValues[$key];
$composeParams = array();
foreach ($composeFields as $key) {
- if (CRM_Utils_Array::value($key, $formValues)) {
+ if (!empty($formValues[$key])) {
$composeParams[$key] = $formValues[$key];
$this->set($key, $formValues[$key]);
}
}
- if (CRM_Utils_Array::value('updateTemplate', $composeParams)) {
+ if (!empty($composeParams['updateTemplate'])) {
$templateParams = array(
'msg_text' => $text_message,
'msg_html' => $html_message,
$msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
}
- if (CRM_Utils_Array::value('saveTemplate', $composeParams)) {
+ if (!empty($composeParams['saveTemplate'])) {
$templateParams = array(
'msg_text' => $text_message,
'msg_html' => $html_message,
$params['from_name'] = CRM_Utils_Array::value(1, explode('"', $fromEmailAddress));
//Add Reply-To to headers
- if (CRM_Utils_Array::value('reply_to_address', $formValues)) {
+ if (!empty($formValues['reply_to_address'])) {
$replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
$params['replyto_email'] = CRM_Utils_Array::value($formValues['reply_to_address'], $replyToEmail);
}
* @static
*/
static function formRule($params, $files, $self) {
- if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST)) {
+ if (!empty($_POST['_qf_Import_refresh'])) {
return TRUE;
}
$errors = array();
}
}
else {
- if (!CRM_Utils_Array::value('text_message', $params) && !CRM_Utils_Array::value('html_message', $params)) {
+ if (empty($params['text_message']) && !CRM_Utils_Array::value('html_message', $params)) {
$errors['html_message'] = ts('Please provide either a Text or HTML formatted message - or both.');
}
- if (CRM_Utils_Array::value('saveTemplate', $params) && !CRM_Utils_Array::value('saveTemplateName', $params)) {
+ if (!empty($params['saveTemplate']) && !CRM_Utils_Array::value('saveTemplateName', $params)) {
$errors['saveTemplateName'] = ts('Please provide a Template Name.');
}
}
}
$templateName = CRM_Core_BAO_MessageTemplate::getMessageTemplates();
- if (CRM_Utils_Array::value('saveTemplate', $params)
- && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName)
+ if (!empty($params['saveTemplate']) && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName)
) {
$errors['saveTemplate'] = ts('Duplicate Template Name.');
}
*/
static function &add(&$params, &$ids) {
- if (CRM_Utils_Array::value('membership', $ids)) {
+ if (!empty($ids['membership'])) {
CRM_Utils_Hook::pre('edit', 'Membership', $ids['membership'], $params);
$oldStatus = NULL;
$oldType = NULL;
// reset the group contact cache since smart groups might be affected due to this
CRM_Contact_BAO_GroupContactCache::remove();
- if (CRM_Utils_Array::value('membership', $ids)) {
+ if (!empty($ids['membership'])) {
if ($membership->status_id != $oldStatus) {
$allStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'get');
$activityParam = array(
// To skip status calculation we should use 'skipStatusCal'.
// eg pay later membership, membership update cron CRM-3984
- if (!CRM_Utils_Array::value('is_override', $params) &&
+ if (empty($params['is_override']) &&
!CRM_Utils_Array::value('skipStatusCal', $params)
) {
$dates = array('start_date', 'end_date', 'join_date');
}
// add custom field values
- if (CRM_Utils_Array::value('custom', $params)
- && is_array($params['custom'])
+ if (!empty($params['custom']) && is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_membership', $membership->id);
}
}
//record contribution for this membership
- if (CRM_Utils_Array::value('contribution_status_id', $params) && !CRM_Utils_Array::value('relate_contribution_id', $params)) {
+ if (!empty($params['contribution_status_id']) && !CRM_Utils_Array::value('relate_contribution_id', $params)) {
$memInfo = array_merge($params, array('membership_id' => $membership->id));
$params['contribution'] = self::recordMembershipContribution($memInfo, $ids);
}
//insert payment record for this membership
- if (CRM_Utils_Array::value('relate_contribution_id', $params)) {
+ if (!empty($params['relate_contribution_id'])) {
$mpDAO = new CRM_Member_DAO_MembershipPayment();
$mpDAO->membership_id = $membership->id;
$mpDAO->contribution_id = $params['relate_contribution_id'];
// add activity record only during create mode and renew mode
// also add activity if status changed CRM-3984 and CRM-2521
- if (!CRM_Utils_Array::value('membership', $ids) ||
+ if (empty($ids['membership']) ||
$activityType == 'Membership Renewal' ||
CRM_Utils_Array::value('createActivity', $params)
) {
- if (CRM_Utils_Array::value('membership', $ids)) {
+ if (!empty($ids['membership'])) {
$data = array();
CRM_Core_DAO::commonRetrieveAll('CRM_Member_DAO_Membership',
'id',
// create activity source = individual, target = org CRM-4027
$targetContactID = NULL;
- if (CRM_Utils_Array::value('is_for_organization', $params)) {
+ if (!empty($params['is_for_organization'])) {
$targetContactID = $membership->contact_id;
$membership->contact_id = CRM_Utils_Array::value('userId', $ids);
}
$membership->contact_id = $realMembershipContactId;
}
- if (CRM_Utils_Array::value('membership', $ids) && $activityType != 'Membership Signup') {
+ if (!empty($ids['membership']) && $activityType != 'Membership Signup') {
CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $targetContactID);
- } elseif (!CRM_Utils_Array::value('membership', $ids)) {
+ } elseif (empty($ids['membership'])) {
CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $targetContactID);
}
self::createRelatedMemberships($params, $membership);
// do not add to recent items for import, CRM-4399
- if (!CRM_Utils_Array::value('skipRecentView', $params)) {
+ if (empty($params['skipRecentView'])) {
$url = CRM_Utils_System::url('civicrm/contact/view/membership',
"action=view&reset=1&id={$membership->id}&cid={$membership->contact_id}&context=home"
);
'status', 'membership_type') as $fld) {
$defaults[$fld] = CRM_Utils_Array::value($fld, $statusANDType[$membership->id]);
}
- if (CRM_Utils_Array::value('is_current_member', $statusANDType[$membership->id])) {
+ if (!empty($statusANDType[$membership->id]['is_current_member'])) {
$defaults['active'] = TRUE;
}
$actives = array();
if ($status == 'active') {
foreach ($memberships as $f => $v) {
- if (CRM_Utils_Array::value('active', $v)) {
+ if (!empty($v['active'])) {
$actives[$f] = $v;
}
}
}
elseif ($status == 'inactive') {
foreach ($memberships as $f => $v) {
- if (!CRM_Utils_Array::value('active', $v)) {
+ if (empty($v['active'])) {
$actives[$f] = $v;
}
}
continue;
}
foreach ($pField['options'] as $opId => $opValues) {
- if (!CRM_Utils_Array::value('membership_type_id', $opValues)) {
+ if (empty($opValues['membership_type_id'])) {
continue;
}
$membershipTypeIds[$opValues['membership_type_id']] = $opValues['membership_type_id'];
}
}
}
- elseif (CRM_Utils_Array::value('membership_types', $membershipBlock)) {
+ elseif (!empty($membershipBlock['membership_types'])) {
$membershipTypeIds = explode(',', $membershipBlock['membership_types']);
}
$dao->is_active = 1;
if ($dao->find(TRUE)) {
CRM_Core_DAO::storeValues($dao, $membershipBlock);
- if (CRM_Utils_Array::value('membership_types', $membershipBlock)) {
+ if (!empty($membershipBlock['membership_types'])) {
$membershipTypes = unserialize($membershipBlock['membership_types']);
if (!is_array($membershipTypes)) {
return $membershipBlock;
if (is_a($result[1], 'CRM_Core_Error')) {
$errors[1] = CRM_Core_Error::getMessages($result[1]);
}
- elseif (CRM_Utils_Array::value(1, $result)) {
+ elseif (!empty($result[1])) {
// Save the contribution ID so that I can be used in email receipts
// For example, if you need to generate a tax receipt for the donation only.
$form->_values['contribution_other_id'] = $result[1]->id;
$memBlockDetails = CRM_Member_BAO_Membership::getMembershipBlock($form->_id);
- if (CRM_Utils_Array::value('is_separate_payment', $memBlockDetails) && !$paymentDone) {
+ if (!empty($memBlockDetails['is_separate_payment']) && !$paymentDone) {
$form->_lineItem = $form->_memLineItem;
$contributionType = new CRM_Financial_DAO_FinancialType( );
$contributionType->id = CRM_Utils_Array::value('financial_type_id', $membershipDetails);
$tempParams['invoiceID'] = $invoiceID;
//we don't allow recurring membership.CRM-3781.
- if (CRM_Utils_Array::value('is_recur', $tempParams)) {
+ if (!empty($tempParams['is_recur'])) {
$tempParams['is_recur'] = 0;
}
$result = NULL;
$index = !empty($memBlockDetails['is_separate_payment']) ? 2 : 1;
- if (!CRM_Utils_Array::value($index, $errors)) {
+ if (empty($errors[$index])) {
if (isset($membershipParams['onbehalf']) &&
CRM_Utils_Array::value('member_campaign_id', $membershipParams['onbehalf'])) {
$form->_params['campaign_id'] = $membershipParams['onbehalf']['member_campaign_id'];
}
if ($form->_priceSetId && !empty($form->_useForMember) && !empty($form->_lineItem)) {
foreach ($form->_lineItem[$form->_priceSetId] as & $priceFieldOp) {
- if (CRM_Utils_Array::value('membership_type_id', $priceFieldOp) &&
+ if (!empty($priceFieldOp['membership_type_id']) &&
isset($createdMemberships[$priceFieldOp['membership_type_id']])
) {
$membershipOb = $createdMemberships[$priceFieldOp['membership_type_id']];
// Do not send an email if Recurring transaction is done via Direct Mode
// Email will we sent when the IPN is received.
- if (CRM_Utils_Array::value('is_recur', $form->_params) && $form->_contributeMode == 'direct') {
+ if (!empty($form->_params['is_recur']) && $form->_contributeMode == 'direct') {
return TRUE;
}
}
CRM_Member_BAO_MembershipLog::add($logParams, CRM_Core_DAO::$_nullArray);
- if (CRM_Utils_Array::value('contributionRecurID', $form->_params)) {
+ if (!empty($form->_params['contributionRecurID'])) {
CRM_Core_DAO::setFieldValue('CRM_Member_DAO_Membership', $membership->id,
'contribution_recur_id', $form->_params['contributionRecurID']
);
$currentMembership['end_date'] = CRM_Utils_Array::value('end_date', $dates);
$currentMembership['is_test'] = $is_test;
- if (CRM_Utils_Array::value('membership_source', $form->_params)) {
+ if (!empty($form->_params['membership_source'])) {
$currentMembership['source'] = $form->_params['membership_source'];
}
elseif (isset($form->_values['title']) && !empty($form->_values['title'])) {
);
}
- if (CRM_Utils_Array::value('id', $currentMembership)) {
+ if (!empty($currentMembership['id'])) {
$ids['membership'] = $currentMembership['id'];
}
$memParams = $currentMembership;
//set the log start date.
$memParams['log_start_date'] = CRM_Utils_Date::customFormat($dates['log_start_date'], $format);
if (empty($membership->source)) {
- if (CRM_Utils_Array::value('membership_source', $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)) {
}
}
- if (CRM_Utils_Array::value('id', $currentMembership)) {
+ if (!empty($currentMembership['id'])) {
$ids['membership'] = $currentMembership['id'];
}
}
$updateStatusId = array_search('Pending', $allStatus);
}
- if (CRM_Utils_Array::value('membership_source', $form->_params)) {
+ if (!empty($form->_params['membership_source'])) {
$memParams['source'] = $form->_params['membership_source'];
}
- elseif (CRM_Utils_Array::value('title', $form->_values)) {
+ elseif (!empty($form->_values['title'])) {
$memParams['source'] = ts('Online Contribution:') . ' ' . $form->_values['title'];
}
$memParams['contribution_recur_id'] = CRM_Utils_Array::value('contributionRecurID', $form->_params);
// remove repeated related contacts, which already inherited membership.
$relatedContactIds[$membership->contact_id] = TRUE;
foreach ($allRelatedContacts as $cid => $status) {
- if (!CRM_Utils_Array::value($cid, $relatedContactIds)) {
+ if (empty($relatedContactIds[$cid])) {
$relatedContactIds[$cid] = TRUE;
//don't create membership again for owner contact.
}
// make entry in batch entity batch table
- if (CRM_Utils_Array::value('batch_id', $params)) {
+ if (!empty($params['batch_id'])) {
$contributionParams['batch_id'] = $params['batch_id'];
}
- if ( CRM_Utils_Array::value('contribution_contact_id', $params) ) {
+ if (!empty($params['contribution_contact_id'])) {
// deal with possibility of a different person paying for contribution
$contributionParams['contact_id'] = $params['contribution_contact_id'];
}
- if (CRM_Utils_Array::value('processPriceSet', $params) &&
+ if (!empty($params['processPriceSet']) &&
!empty($params['lineItems'])
) {
$contributionParams['line_item'] = CRM_Utils_Array::value('lineItems', $params, NULL);
//insert payment record for this membership
- if (!CRM_Utils_Array::value('contribution', $ids) ||
+ if (empty($ids['contribution']) ||
CRM_Utils_Array::value('is_recur', $params)
) {
$mpDAO = new CRM_Member_DAO_MembershipPayment();
$mpDAO->membership_id = $membershipId;
$mpDAO->contribution_id = $contribution->id;
- if (CRM_Utils_Array::value('is_recur', $params)) {
+ if (!empty($params['is_recur'])) {
$mpDAO->find();
}
$editedResults = array();
CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults);
$qf->_priceSet['fields'][$fid]['options'][$editedResults['id']] = $priceSets['fields'][$fid]['options'][$editedResults['id']];
- if (CRM_Utils_Array::value('total_amount', $qf->_params)) {
+ if (!empty($qf->_params['total_amount'])) {
$qf->_priceSet['fields'][$fid]['options'][$editedResults['id']]['amount'] = $qf->_params['total_amount'];
}
}
}
//copy name to label when not passed.
- if (!CRM_Utils_Array::value('label', $params) &&
+ if (empty($params['label']) &&
CRM_Utils_Array::value('name', $params)
) {
$params['label'] = $params['name'];
self::createMembershipPriceField($params, $ids, $previousID, $membershipType->id);
// update all price field value for quick config when membership type is set CRM-11718
- if (CRM_Utils_Array::value('membershipType', $ids)) {
+ if (!empty($ids['membershipType'])) {
self::updateAllPriceFieldValue($ids['membershipType'], $params);
}
);
foreach ($membershipType as $id => $details) {
foreach ($periodDays as $pDay) {
- if (CRM_Utils_Array::value($pDay, $details)) {
+ if (!empty($details[$pDay])) {
if ($details[$pDay] > 31) {
$month = substr($details[$pDay], 0, strlen($details[$pDay]) - 2);
$day = substr($details[$pDay], -2);
$priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name');
- if (CRM_Utils_Array::value('member_of_contact_id', $params)) {
+ if (!empty($params['member_of_contact_id'])) {
$fieldName = $params['member_of_contact_id'];
}
else {
if ($previousID) {
CRM_Member_Form_MembershipType::checkPreviousPriceField($previousID, $priceSetId, $membershipTypeId, $optionsIds);
- if (CRM_Utils_Array::value('option_id', $optionsIds)) {
+ if (!empty($optionsIds['option_id'])) {
$optionsIds['id'] = current(CRM_Utils_Array::value('option_id', $optionsIds));
}
}
* @param integer financial type id
*/
static function updateAllPriceFieldValue($membershipTypeId, $params) {
- if (CRM_Utils_Array::value('minimum_fee', $params)){
+ if (!empty($params['minimum_fee'])){
$amount = $params['minimum_fee'];
}
else {
$query->_whereTables['civicrm_membership'] = 1;
//add membership type
- if (CRM_Utils_Array::value('membership_type', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['membership_type'])) {
$query->_select['membership_type'] = "civicrm_membership_type.name as membership_type";
$query->_element['membership_type'] = 1;
$query->_tables['civicrm_membership_type'] = 1;
}
//add join date
- if (CRM_Utils_Array::value('join_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['join_date'])) {
$query->_select['join_date'] = "civicrm_membership.join_date as join_date";
$query->_element['join_date'] = 1;
}
//add source
- if (CRM_Utils_Array::value('membership_source', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['membership_source'])) {
$query->_select['membership_source'] = "civicrm_membership.source as membership_source";
$query->_element['membership_source'] = 1;
}
//add status
- if (CRM_Utils_Array::value('membership_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['membership_status'])) {
$query->_select['membership_status'] = "civicrm_membership_status.label as membership_status";
$query->_element['membership_status'] = 1;
$query->_tables['civicrm_membership_status'] = 1;
$query->_whereTables['civicrm_membership_status'] = 1;
}
- if (CRM_Utils_Array::value('status_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['status_id'])) {
$query->_select['status_id'] = "civicrm_membership_status.id as status_id";
$query->_element['status_id'] = 1;
$query->_tables['civicrm_membership_status'] = 1;
}
//add start date / end date
- if (CRM_Utils_Array::value('membership_start_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['membership_start_date'])) {
$query->_select['membership_start_date'] = "civicrm_membership.start_date as membership_start_date";
$query->_element['membership_start_date'] = 1;
}
- if (CRM_Utils_Array::value('membership_end_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['membership_end_date'])) {
$query->_select['membership_end_date'] = "civicrm_membership.end_date as membership_end_date";
$query->_element['membership_end_date'] = 1;
}
//add owner_membership_id
- if (CRM_Utils_Array::value('owner_membership_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['owner_membership_id'])) {
$query->_select['owner_membership_id'] = "civicrm_membership.owner_membership_id as owner_membership_id";
$query->_element['owner_membership_id'] = 1;
}
//add max_related
- if (CRM_Utils_Array::value('max_related', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['max_related'])) {
$query->_select['max_related'] = "civicrm_membership.max_related as max_related";
$query->_element['max_related'] = 1;
}
//add recur id w/o taking contribution table in join.
- if (CRM_Utils_Array::value('membership_recur_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['membership_recur_id'])) {
$query->_select['membership_recur_id'] = "civicrm_membership.contribution_recur_id as membership_recur_id";
$query->_element['membership_recur_id'] = 1;
}
//add campaign id.
- if (CRM_Utils_Array::value('member_campaign_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['member_campaign_id'])) {
$query->_select['member_campaign_id'] = 'civicrm_membership.campaign_id as member_campaign_id';
$query->_element['member_campaign_id'] = 1;
}
static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
- if (!CRM_Utils_Array::value(0, $query->_params[$id])) {
+ if (empty($query->_params[$id][0])) {
continue;
}
if (substr($query->_params[$id][0], 0, 7) == 'member_' || substr($query->_params[$id][0], 0, 11) == 'membership_') {
static function tableNames(&$tables) {
//add membership table
- if (CRM_Utils_Array::value('civicrm_membership_log', $tables) || CRM_Utils_Array::value('civicrm_membership_status', $tables) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) {
+ if (!empty($tables['civicrm_membership_log']) || CRM_Utils_Array::value('civicrm_membership_status', $tables) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) {
$tables = array_merge(array('civicrm_membership' => 1), $tables);
}
}
*/
function storeContactFields($formValues){
// in a 'standalone form' (contact id not in the url) the contact will be in the form values
- if (CRM_Utils_Array::value('contact_select_id', $formValues)) {
+ if (!empty($formValues['contact_select_id'])) {
$this->_contactID = $formValues['contact_select_id'][1];
}
//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 (CRM_Utils_Array::value('contribution_contact_select_id', $formValues) && CRM_Utils_Array::value('1', $formValues['contribution_contact_select_id'])) {
+ if (!empty($formValues['contribution_contact_select_id']) && CRM_Utils_Array::value('1', $formValues['contribution_contact_select_id'])) {
$this->_receiptContactId = $this->_contributorContactID = $formValues['contribution_contact_select_id'][1];
list( $this->_contributorDisplayName,
$this->_contributorEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails( $this->_contributorContactID );
$mems_by_org = array();
foreach ($contactMemberships as $memid => $mem) {
$mem['member_of_contact_id'] = CRM_Utils_Array::value($mem['membership_type_id'], $memberorgs);
- if (CRM_Utils_Array::value('membership_end_date', $mem)) {
+ if (!empty($mem['membership_end_date'])) {
$mem['membership_end_date'] = CRM_Utils_Date::customformat($mem['membership_end_date']);
}
$mem['membership_type'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
$defaults['num_terms'] = 1;
- if (CRM_Utils_Array::value('id', $defaults)) {
+ if (!empty($defaults['id'])) {
if ($this->_onlinePendingContributionId) {
$defaults['record_contribution'] = $this->_onlinePendingContributionId;
}
}
}
- if (CRM_Utils_Array::value('record_contribution', $defaults) && !$this->_mode) {
+ if (!empty($defaults['record_contribution']) && !$this->_mode) {
$contributionParams = array('id' => $defaults['record_contribution']);
$contributionIds = array();
//get back original object campaign id.
$defaults['campaign_id'] = $memberCampaignId;
- if (CRM_Utils_Array::value('receive_date', $defaults)) {
+ if (!empty($defaults['receive_date'])) {
list($defaults['receive_date']) = CRM_Utils_Date::setDateDefaults($defaults['receive_date']);
}
// Contribution::getValues() over-writes the membership record's source field value - so we need to restore it.
- if (CRM_Utils_Array::value('membership_source', $defaults)) {
+ if (!empty($defaults['membership_source'])) {
$defaults['source'] = $defaults['membership_source'];
}
}
//CRM-13420
- if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ if (empty($defaults['payment_instrument_id'])) {
$defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
}
unset($defaults['record_contribution']);
}
- if (CRM_Utils_Array::value('id', $defaults)) {
+ if (!empty($defaults['id'])) {
$subscriptionCancelled = CRM_Member_BAO_Membership::isSubscriptionCancelled($this->_id);
}
$alreadyAutoRenew = FALSE;
- if (CRM_Utils_Array::value('contribution_recur_id', $defaults) && !$subscriptionCancelled) {
+ if (!empty($defaults['contribution_recur_id']) && !$subscriptionCancelled) {
$defaults['auto_renew'] = 1;
$alreadyAutoRenew = TRUE;
}
$this->assign('membership_status_id', CRM_Utils_Array::value('status_id', $defaults));
- if (CRM_Utils_Array::value('is_pay_later', $defaults)) {
+ if (!empty($defaults['is_pay_later'])) {
$this->assign('is_pay_later', TRUE);
}
if ($this->_mode) {
// set default country from config if no country set
$config = CRM_Core_Config::singleton();
- if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $defaults)) {
+ if (empty($defaults["billing_country_id-{$this->_bltID}"])) {
$defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
}
- if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $defaults)) {
+ if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) {
$defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
}
$dates = array('join_date', 'start_date', 'end_date');
foreach ($dates as $key) {
- if (CRM_Utils_Array::value($key, $defaults)) {
+ if (!empty($defaults[$key])) {
list($defaults[$key]) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value($key, $defaults));
}
}
//setting default join date if there is no join date
- if (!CRM_Utils_Array::value('join_date', $defaults)) {
+ if (empty($defaults['join_date'])) {
$defaults['join_date'] = $now;
}
- if (CRM_Utils_Array::value('membership_end_date', $defaults)) {
+ if (!empty($defaults['membership_end_date'])) {
$this->assign('endDate', $defaults['membership_end_date']);
}
// build price set form.
$buildPriceSet = FALSE;
if ($this->_priceSetId || CRM_Utils_Array::value('price_set_id', $_POST)) {
- if (CRM_Utils_Array::value('price_set_id', $_POST)) {
+ if (!empty($_POST['price_set_id'])) {
$buildPriceSet = TRUE;
}
$getOnlyPriceSetElements = TRUE;
$allMembershipInfo = $membershipType = array();
foreach ($allMemberships as $key => $values) {
- if (CRM_Utils_Array::value('is_active', $values)) {
+ if (!empty($values['is_active'])) {
$membershipType[$key] = CRM_Utils_Array::value('name', $values);
if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) {
continue;
}
else {
$memberOfContactId = CRM_Utils_Array::value('member_of_contact_id', $values);
- if (!CRM_Utils_Array::value($memberOfContactId, $selMemTypeOrg)) {
+ if (empty($selMemTypeOrg[$memberOfContactId])) {
$selMemTypeOrg[$memberOfContactId] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
$memberOfContactId,
'display_name',
$selOrgMemType[$memberOfContactId][0] = ts('- select -');
}
- if (!CRM_Utils_Array::value($key, $selOrgMemType[$memberOfContactId])) {
+ if (empty($selOrgMemType[$memberOfContactId][$key])) {
$selOrgMemType[$memberOfContactId][$key] = CRM_Utils_Array::value('name', $values);
}
}
}
}
}
- elseif (!CRM_Utils_Array::value(1, $params['membership_type_id'])) {
+ elseif (empty($params['membership_type_id'][1])) {
$errors['membership_type_id'] = ts('Please select a membership type.');
}
else {
$errors['financial_type_id'] = ts('Please enter the financial Type.');
}
- if (CRM_Utils_Array::value('record_contribution', $params) && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ if (!empty($params['record_contribution']) && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
$errors['payment_instrument_id'] = ts('Paid By is a required field.');
}
- if (CRM_Utils_Array::value('is_different_contribution_contact', $params)) {
- if (!CRM_Utils_Array::value('soft_credit_type_id', $params)) {
+ if (!empty($params['is_different_contribution_contact'])) {
+ if (empty($params['soft_credit_type_id'])) {
$errors['soft_credit_type_id'] = ts('Please Select a Soft Credit Type');
}
- if (!CRM_Utils_Array::value(1, $params['contribution_contact'])) {
+ if (empty($params['contribution_contact'][1])) {
$errors['contribution_contact[1]'] = ts('Please select a contact');
}
}
- if (CRM_Utils_Array::value('payment_processor_id', $params)) {
+ if (!empty($params['payment_processor_id'])) {
// make sure that credit card number and cvv are valid
CRM_Core_Payment_Form::validateCreditCard($params, $errors);
}
$joinDate = NULL;
- if (CRM_Utils_Array::value('join_date', $params)) {
+ if (!empty($params['join_date'])) {
$joinDate = CRM_Utils_Date::processDate($params['join_date']);
foreach ($self->_memTypeSelected as $memType) {
$startDate = NULL;
- if (CRM_Utils_Array::value('start_date', $params)) {
+ if (!empty($params['start_date'])) {
$startDate = CRM_Utils_Date::processDate($params['start_date']);
}
// If selected membership type has duration unit as 'lifetime'
// and end date is set, then give error
$endDate = NULL;
- if (CRM_Utils_Array::value('end_date', $params)) {
+ if (!empty($params['end_date'])) {
$endDate = CRM_Utils_Date::processDate($params['end_date']);
}
}
//CRM-3724, check for availability of valid membership status.
- if (!CRM_Utils_Array::value('is_override', $params) && !isset($errors['_qf_default'])) {
+ if (empty($params['is_override']) && !isset($errors['_qf_default'])) {
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate,
$endDate,
$joinDate,
$submittedFinancialType = CRM_Utils_Array::value('financial_type_id', $formValues);
if (!empty($lineItem[$priceSetId])) {
foreach ($lineItem[$priceSetId] as &$li) {
- if (CRM_Utils_Array::value('membership_type_id', $li)) {
- if (CRM_Utils_Array::value('membership_num_terms', $li)) {
+ if (!empty($li['membership_type_id'])) {
+ if (!empty($li['membership_num_terms'])) {
$termsByType[$li['membership_type_id']] = $li['membership_num_terms'];
}
}
// fix for CRM-3724
// when is_override false ignore is_admin statuses during membership
// status calculation. similarly we did fix for import in CRM-3570.
- if (!CRM_Utils_Array::value('is_override', $params)) {
+ if (empty($params['is_override'])) {
$params['exclude_is_admin'] = TRUE;
}
//CRM-10223 - allow contribution to be recorded against different contact
if ($this->_contributorContactID != $this->_contactID) {
$params['contribution_contact_id'] = $this->_contributorContactID;
- if (CRM_Utils_Array::value('soft_credit_type_id', $this->_params)) {
+ if (!empty($this->_params['soft_credit_type_id'])) {
$softParams['soft_credit_type_id'] = $this->_params['soft_credit_type_id'];
$softParams['contact_id'] = $params['contact_id'];
}
}
- if (CRM_Utils_Array::value('record_contribution', $formValues)) {
+ if (!empty($formValues['record_contribution'])) {
$recordContribution = array(
'total_amount',
'financial_type_id',
);
}
- if (!CRM_Utils_Array::value('is_override', $params) &&
+ if (empty($params['is_override']) &&
CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'))
) {
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
$this->assign('is_pay_later', 1);
}
- if (CRM_Utils_Array::value('send_receipt', $formValues)) {
+ if (!empty($formValues['send_receipt'])) {
$params['receipt_date'] = CRM_Utils_Array::value('receive_date', $formValues);
}
//CRM-10377 if payment is by an alternate contact then we need to set that person
// as the contact in the payment params
if ($this->_contributorContactID != $this->_contactID) {
- if (CRM_Utils_Array::value('soft_credit_type_id', $this->_params)) {
+ if (!empty($this->_params['soft_credit_type_id'])) {
$softParams['contact_id'] = $params['contact_id'];
$softParams['soft_credit_type_id'] = $this->_params['soft_credit_type_id'];
}
}
- if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
+ if (!empty($this->_params['send_receipt'])) {
$paymentParams['email'] = $this->_contributorEmail;
}
// CRM-7137 -for recurring membership,
// we do need contribution and recuring records.
$result = NULL;
- if (CRM_Utils_Array::value('is_recur', $paymentParams)) {
+ if (!empty($paymentParams['is_recur'])) {
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
$contributionType = new CRM_Financial_DAO_FinancialType();
if (is_a($result, 'CRM_Core_Error')) {
//make sure to cleanup db for recurring case.
- if (CRM_Utils_Array::value('contributionID', $paymentParams)) {
+ if (!empty($paymentParams['contributionID'])) {
CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']);
}
- if (CRM_Utils_Array::value('contributionRecurID', $paymentParams)) {
+ if (!empty($paymentParams['contributionRecurID'])) {
CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
}
$params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result);
$params['payment_instrument_id'] = 1;
$params['is_test'] = ($this->_mode == 'live') ? 0 : 1;
- if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
+ if (!empty($this->_params['send_receipt'])) {
$params['receipt_date'] = $now;
}
else {
}
$membershipParams = array_merge($params, $membershipTypeValues[$memType]);
- if (CRM_Utils_Array::value('int_amount', $formValues)) {
+ if (!empty($formValues['int_amount'])) {
$init_amount = array();
foreach ($formValues as $key => $value) {
if (strstr($key, 'txt-price')) {
if (!empty($lineItem[$priceSetId])) {
foreach ($lineItem[$priceSetId] as & $priceFieldOp) {
- if (CRM_Utils_Array::value('membership_type_id', $priceFieldOp)) {
+ if (!empty($priceFieldOp['membership_type_id'])) {
$priceFieldOp['start_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'], '%d%f %b, %Y') : '-';
$priceFieldOp['end_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'], '%d%f %b, %Y') : '-';
$this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
$receiptSend = FALSE;
- if (CRM_Utils_Array::value('send_receipt', $formValues)) {
+ if (!empty($formValues['send_receipt'])) {
$receiptSend = TRUE;
$formValues['contact_id'] = $this->_contactID;
// retrieve 'from email id' for acknowledgement
$receiptFrom = $formValues['from_email_address'];
- if (CRM_Utils_Array::value('payment_instrument_id', $formValues)) {
+ if (!empty($formValues['payment_instrument_id'])) {
$paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
$formValues['paidBy'] = $paymentInstrument[$formValues['payment_instrument_id']];
}
CRM_Core_BAO_UFGroup::getValues($formValues['contact_id'], $customFields, $customValues, FALSE, $members);
if ($form->_mode) {
- if (CRM_Utils_Array::value('billing_first_name', $form->_params)) {
+ if (!empty($form->_params['billing_first_name'])) {
$name = $form->_params['billing_first_name'];
}
- if (CRM_Utils_Array::value('billing_middle_name', $form->_params)) {
+ if (!empty($form->_params['billing_middle_name'])) {
$name .= " {$form->_params['billing_middle_name']}";
}
- if (CRM_Utils_Array::value('billing_last_name', $form->_params)) {
+ if (!empty($form->_params['billing_last_name'])) {
$name .= " {$form->_params['billing_last_name']}";
}
$form->assign('membershipID', CRM_Utils_Array::value('membership_id', $form->_params, CRM_Utils_Array::value('membership_id', $form->_defaultValues)));
- if (CRM_Utils_Array::value('contribution_id', $formValues)) {
+ if (!empty($formValues['contribution_id'])) {
$form->assign('contributionID', $formValues['contribution_id']);
}
elseif (isset($form->_onlinePendingContributionId)) {
$form->assign('contributionID', $form->_onlinePendingContributionId);
}
- if (CRM_Utils_Array::value('contribution_status_id', $formValues)) {
+ if (!empty($formValues['contribution_status_id'])) {
$form->assign('contributionStatusID', $formValues['contribution_status_id']);
$form->assign('contributionStatus', CRM_Contribute_PseudoConstant::contributionStatus($formValues['contribution_status_id'], 'name'));
}
- if (CRM_Utils_Array::value('is_renew', $formValues)) {
+ if (!empty($formValues['is_renew'])) {
$form->assign('receiptType', 'membership renewal');
}
else {
}
}
- if (CRM_Utils_Array::value('mem_price_field_id', $defaults)) {
+ if (!empty($defaults['mem_price_field_id'])) {
$options = array();
$priceFieldOptions = CRM_Price_BAO_PriceFieldValue::getValues($defaults['mem_price_field_id'], $options, 'id', 1);
foreach ($options as $k => $v) {
static function formRule($params, $files, $contributionPageId = NULL) {
$errors = array();
- if (CRM_Utils_Array::value('member_price_set_id', $params)) {
+ if (!empty($params['member_price_set_id'])) {
//check if this price set has membership type both auto-renew and non-auto-renew memberships.
$bothTypes = CRM_Price_BAO_PriceSet::checkMembershipPriceSet($params['member_price_set_id']);
}
}
}
- if (CRM_Utils_Array::value('member_is_active', $params)) {
+ if (!empty($params['member_is_active'])) {
// don't allow price set w/ membership signup, CRM-5095
if ($contributionPageId && ($setID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $contributionPageId, NULL, 1))) {
$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 (CRM_Utils_Array::value('member_price_set_id', $params)) {
+ if (!empty($params['member_price_set_id'])) {
return $errors;
}
// check for price set.
$priceSetID = CRM_Utils_Array::value('member_price_set_id', $params);
- if (CRM_Utils_Array::value('member_is_active', $params) && is_array($membershipTypes) && !$priceSetID) {
+ if (!empty($params['member_is_active']) && is_array($membershipTypes) && !$priceSetID) {
$usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 2);
- if (!CRM_Utils_Array::value('mem_price_field_id', $params) && !$usedPriceSetId) {
+ if (empty($params['mem_price_field_id']) && !$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')) {
);
$editedResults = array();
CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
- if (!CRM_Utils_Array::value('id', $editedResults)) {
+ if (empty($editedResults['id'])) {
$fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245));
$fieldParams['label'] = !empty($params['new_title']) ? $params['new_title'] : ts('Membership');
- if (!CRM_Utils_Array::value('mem_price_field_id', $params)) {
+ if (empty($params['mem_price_field_id'])) {
CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', 0, 1, array('price_set_id' => $priceSetID));
}
$fieldParams['weight'] = 1;
$fieldParams['is_display_amounts'] = !empty($params['display_min_fee']) ? 1 : 0;
$rowCount = 1;
$options = array();
- if (CRM_Utils_Array::value('id', $fieldParams)) {
+ if (!empty($fieldParams['id'])) {
CRM_Core_PseudoConstant::populate($options, 'CRM_Price_DAO_PriceFieldValue', TRUE, 'membership_type_id', NULL, " price_field_id = {$fieldParams['id']} ");
}
);
CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceField', $conditionParams, $pFIDs);
- if (!CRM_Utils_Array::value('id', $pFIDs)) {
+ if (empty($pFIDs['id'])) {
CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $this->_id);
CRM_Price_BAO_PriceSet::setIsQuickConfig($this->_memPriceSetId, '0');
}
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
$defaults['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'financial_type_id');
//CRM-13420
- if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ if (empty($defaults['payment_instrument_id'])) {
$defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
}
$options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required '));
foreach( $allMemberships as $key => $values ) {
- if (CRM_Utils_Array::value('is_active', $values) ) {
+ if (!empty($values['is_active'])) {
$membershipType[$key] = CRM_Utils_Array::value('name', $values);
if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) {
continue;
}
else {
$memberOfContactId = CRM_Utils_Array::value('member_of_contact_id', $values);
- if (!CRM_Utils_Array::value($memberOfContactId, $selMemTypeOrg)) {
+ if (empty($selMemTypeOrg[$memberOfContactId])) {
$selMemTypeOrg[$memberOfContactId] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
$memberOfContactId,
'display_name',
$selOrgMemType[$memberOfContactId][0] = ts('- select -');
}
- if (!CRM_Utils_Array::value($key, $selOrgMemType[$memberOfContactId])) {
+ if (empty($selOrgMemType[$memberOfContactId][$key])) {
$selOrgMemType[$memberOfContactId][$key] = CRM_Utils_Array::value('name', $values);
}
}
'total_amount_numeric' => CRM_Utils_Array::value('minimum_fee', $values)
);
- if (CRM_Utils_Array::value('auto_renew', $values)) {
+ if (!empty($values['auto_renew'])) {
$allMembershipInfo[$key]['auto_renew'] = $options[$values['auto_renew']];
}
}
if (!$params['total_amount']) {
$errors['total_amount'] = ts('Please enter a Contribution Amount.');
}
- if (!CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ if (empty($params['payment_instrument_id'])) {
$errors['payment_instrument_id'] = ts('Paid By is a required field.');
}
}
$this->convertDateFieldsToMySQL($formValues);
$this->assign('receive_date', $formValues['receive_date']);
- if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
+ if (!empty($this->_params['send_receipt'])) {
$formValues['receipt_date'] = $now;
$this->assign('receipt_date', CRM_Utils_Date::mysqlToIso($formValues['receipt_date']));
}
$formValues['total_amount'] = CRM_Utils_Array::value('total_amount', $this->_params, CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
$this->_memType, 'minimum_fee'
));
- if (!CRM_Utils_Array::value('financial_type_id', $formValues)) {
+ if (empty($formValues['financial_type_id'])) {
$formValues['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType,'financial_type_id');
}
// all the payment processors expect the name and address to be in the passed params
// so we copy stuff over to first_name etc.
$paymentParams = $this->_params;
- if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
+ if (!empty($this->_params['send_receipt'])) {
$paymentParams['email'] = $this->_contributorEmail;
}
//CRM-10377 if payment is by an alternate contact then we need to set that person
// as the contact in the payment params
if ($this->_contributorContactID != $this->_contactID) {
- if (CRM_Utils_Array::value('honor_type_id', $this->_params)) {
+ if (!empty($this->_params['honor_type_id'])) {
$paymentParams['honor_contact_id'] = $this->_contactID;
$paymentParams['honor_type_id'] = $this->_params['honor_type_id'];
}
$memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $renewMembership->membership_type_id, 'name');
- if (CRM_Utils_Array::value('record_contribution', $formValues) || $this->_mode) {
+ if (!empty($formValues['record_contribution']) || $this->_mode) {
// set the source
$formValues['contribution_source'] = "{$memType} Membership: Offline membership renewal (by {$userName})";
//assign contribution contact id to the field expected by recordMembershipContribution
if($this->_contributorContactID != $this->_contactID){
$formValues['contribution_contact_id'] = $this->_contributorContactID;
- if(CRM_Utils_Array::value('soft_credit_type_id', $this->_params)){
+ if (!empty($this->_params['soft_credit_type_id'])){
$formValues['soft_credit'][] = array(
'soft_credit_type_id' => $this->_params['soft_credit_type_id'],
'contact_id' => $this->_contactID,
CRM_Member_BAO_Membership::recordMembershipContribution(array_merge($formValues, array('membership_id' => $renewMembership->id)));
}
- if (CRM_Utils_Array::value('send_receipt', $formValues)) {
+ if (!empty($formValues['send_receipt'])) {
CRM_Core_DAO::setFieldValue('CRM_Member_DAO_MembershipType',
$formValues['membership_type_id'][1],
'receipt_text_renewal',
}
$receiptSend = FALSE;
- if (CRM_Utils_Array::value('send_receipt', $formValues)) {
+ if (!empty($formValues['send_receipt'])) {
$receiptSend = TRUE;
$receiptFrom = $formValues['from_email_address'];
- if (CRM_Utils_Array::value('payment_instrument_id', $formValues)) {
+ if (!empty($formValues['payment_instrument_id'])) {
$paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
$formValues['paidBy'] = $paymentInstrument[$formValues['payment_instrument_id']];
}
CRM_Core_BAO_UFGroup::getValues($this->_contactID, $customFields, $customValues, FALSE, $members);
$this->assign_by_ref('formValues', $formValues);
- if ( CRM_Utils_Array::value( 'contribution_id', $formValues ) ) {
+ if (!empty($formValues['contribution_id'])) {
$this->assign('contributionID', $formValues['contribution_id']);
}
$this->assign('membershipID', $this->_id);
));
$this->assign('customValues', $customValues);
if ($this->_mode) {
- if (CRM_Utils_Array::value('billing_first_name', $this->_params)) {
+ if (!empty($this->_params['billing_first_name'])) {
$name = $this->_params['billing_first_name'];
}
- if (CRM_Utils_Array::value('billing_middle_name', $this->_params)) {
+ if (!empty($this->_params['billing_middle_name'])) {
$name .= " {$this->_params['billing_middle_name']}";
}
- if (CRM_Utils_Array::value('billing_last_name', $this->_params)) {
+ if (!empty($this->_params['billing_last_name'])) {
$name .= " {$this->_params['billing_last_name']}";
}
$this->assign('billingName', $name);
$defaults = parent::setDefaultValues();
//finding default weight to be put
- if (!CRM_Utils_Array::value('weight', $defaults)) {
+ if (empty($defaults['weight'])) {
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Member_DAO_MembershipStatus');
}
return $defaults;
$periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
foreach ($periods as $per) {
- if (CRM_Utils_Array::value('M', $params[$per]) &&
+ if (!empty($params[$per]['M']) &&
CRM_Utils_Array::value('d', $params[$per])
) {
$mon = $params[$per]['M'];
$this->assign('has_related', FALSE);
// if membership can be granted, and we are the owner of the membership
- if (CRM_Utils_Array::value('relationship_type_id', $membershipType)
- && !CRM_Utils_Array::value('owner_membership_id', $values)
+ if (!empty($membershipType['relationship_type_id']) && !CRM_Utils_Array::value('owner_membership_id', $values)
) {
// display related contacts/membership block
$this->assign('has_related', TRUE);
$autoRenew = $isRecur ? TRUE : FALSE;
}
- if (CRM_Utils_Array::value('is_test', $values)) {
+ if (!empty($values['is_test'])) {
$values['membership_type'] .= ' (test) ';
}
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $customFields);
- if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) {
+ if (!empty($customValue['extends_entity_column_value'])) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$customValue['extends_entity_column_value']
);
$customFields = array();
foreach ($params['field'] as $key => $value) {
$ids['membership'] = $key;
- if (CRM_Utils_Array::value('membership_source', $value)) {
+ if (!empty($value['membership_source'])) {
$value['source'] = $value['membership_source'];
}
- if (CRM_Utils_Array::value('membership_type', $value)) {
+ if (!empty($value['membership_type'])) {
$membershipTypeId = $value['membership_type_id'] = $value['membership_type'][1];
}
}
}
if (empty($customFields)) {
- if (!CRM_Utils_Array::value('membership_type_id', $value)) {
+ if (empty($value['membership_type_id'])) {
$membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $key, 'membership_type_id');
}
$membership = CRM_Member_BAO_Membership::add($value, $ids);
// add custom field values
- if (CRM_Utils_Array::value('custom', $value) &&
+ if (!empty($value['custom']) &&
is_array($value['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($value['custom'], 'civicrm_membership', $membership->id);
}
- if (CRM_Utils_Array::value('saveMapping', $fields)) {
+ if (!empty($fields['saveMapping'])) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
$mapper[$i] = $this->_mapperFields[$mapperKeys[$i][0]];
$mapperKeysMain[$i] = $mapperKeys[$i][0];
- if (CRM_Utils_Array::value(1, $mapperKeys[$i]) && is_numeric($mapperKeys[$i][1])) {
+ if (!empty($mapperKeys[$i][1]) && is_numeric($mapperKeys[$i][1])) {
$mapperLocType[$i] = $mapperKeys[$i][1];
}
else {
$mapperLocType[$i] = NULL;
}
- if (CRM_Utils_Array::value(2, $mapperKeys[$i]) && (!is_numeric($mapperKeys[$i][2]))) {
+ if (!empty($mapperKeys[$i][2]) && (!is_numeric($mapperKeys[$i][2]))) {
$mapperPhoneType[$i] = $mapperKeys[$i][2];
}
else {
$this->set('mapper', $mapper);
// store mapping Id to display it in the preview page
- if (CRM_Utils_Array::value('mappingId', $params)) {
+ if (!empty($params['mappingId'])) {
$this->set('loadMappingId', $params['mappingId']);
}
//Updating Mapping Records
- if (CRM_Utils_Array::value('updateMapping', $params)) {
+ if (!empty($params['updateMapping'])) {
$mappingFields = new CRM_Core_DAO_MappingField();
$mappingFields->mapping_id = $params['mappingId'];
$mappingFields->find();
}
//Saving Mapping Details and Records
- if (CRM_Utils_Array::value('saveMapping', $params)) {
+ if (!empty($params['saveMapping'])) {
$mappingParams = array(
'name' => $params['saveMappingName'],
'description' => $params['saveMappingDesc'],
foreach ($mapper as $key => $value) {
$mapperKeys[$key] = $mapper[$key][0];
- if (CRM_Utils_Array::value(1, $mapper[$key]) && is_numeric($mapper[$key][1])) {
+ if (!empty($mapper[$key][1]) && is_numeric($mapper[$key][1])) {
$mapperLocType[$key] = $mapper[$key][1];
}
else {
$mapperLocType[$key] = NULL;
}
- if (CRM_Utils_Array::value(2, $mapper[$key]) && (!is_numeric($mapper[$key][2]))) {
+ if (!empty($mapper[$key][2]) && (!is_numeric($mapper[$key][2]))) {
$mapperPhoneType[$key] = $mapper[$key][2];
}
else {
$errorMessage = NULL;
//To check whether start date or join date is provided
- if (!CRM_Utils_Array::value('membership_start_date', $params) && !CRM_Utils_Array::value('join_date', $params)) {
+ if (empty($params['membership_start_date']) && !CRM_Utils_Array::value('join_date', $params)) {
$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 (!CRM_Utils_Array::value('join_date', $params) &&
+ if (empty($params['join_date']) &&
CRM_Utils_Array::value('membership_start_date', $params)
) {
$params['join_date'] = $params['membership_start_date'];
else {
//fix for CRM-2219 Update Membership
// onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE
- if (CRM_Utils_Array::value('is_override', $formatted) &&
+ if (!empty($formatted['is_override']) &&
!CRM_Utils_Array::value('status_id', $formatted)
) {
array_unshift($values, 'Required parameter missing: Status');
$dao->id = $formatValues['membership_id'];
$dates = array('join_date', 'start_date', 'end_date');
foreach ($dates as $v) {
- if (!CRM_Utils_Array::value( $v, $formatted )) {
+ if (empty($formatted[$v])) {
$formatted[$v] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $formatValues['membership_id'], $v);
}
}
//fix for CRM-3570, exclude the statuses those having is_admin = 1
//now user can import is_admin if is override is true.
$excludeIsAdmin = FALSE;
- if (!CRM_Utils_Array::value('is_override', $formatted)) {
+ if (empty($formatted['is_override'])) {
$formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE;
}
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate,
$excludeIsAdmin
);
- if (!CRM_Utils_Array::value('status_id', $formatted)) {
+ if (empty($formatted['status_id'])) {
$formatted['status_id'] = $calcStatus['id'];
}
- elseif (!CRM_Utils_Array::value('is_override', $formatted)) {
+ elseif (empty($formatted['is_override'])) {
if (empty($calcStatus)) {
array_unshift($values, 'Status in import row (' . $formatValues['status_id'] . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.');
return CRM_Import_Parser::ERROR;
}
}
- if (CRM_Utils_Array::value('external_identifier', $params)) {
+ if (!empty($params['external_identifier'])) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
}
}
}
else {
- if (CRM_Utils_Array::value('external_identifier', $formatValues)) {
+ if (!empty($formatValues['external_identifier'])) {
$checkCid = new CRM_Contact_DAO_Contact();
$checkCid->external_identifier = $formatValues['external_identifier'];
$checkCid->find(TRUE);
//fix for CRM-3570, exclude the statuses those having is_admin = 1
//now user can import is_admin if is override is true.
$excludeIsAdmin = FALSE;
- if (!CRM_Utils_Array::value('is_override', $formatted)) {
+ if (empty($formatted['is_override'])) {
$formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE;
}
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate,
'today',
$excludeIsAdmin
);
- if (!CRM_Utils_Array::value('status_id', $formatted)) {
+ if (empty($formatted['status_id'])) {
$formatted['status_id'] = CRM_Utils_Array::value('id', $calcStatus);
}
- elseif (!CRM_Utils_Array::value('is_override', $formatted)) {
+ elseif (empty($formatted['is_override'])) {
if (empty($calcStatus)) {
array_unshift($values, 'Status in import row (' . CRM_Utils_Array::value('status_id', $formatValues) . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.');
return CRM_Import_Parser::ERROR;
CRM_Member_PseudoConstant::membershipType()
);
if ($membershipTypeId) {
- if (CRM_Utils_Array::value('membership_type_id', $values) &&
+ if (!empty($values['membership_type_id']) &&
$membershipTypeId != $values['membership_type_id']
) {
throw new Exception('Mismatched membership Type and Membership Type Id');
CRM_Member_PseudoConstant::membershipStatus()
);
if ($membershipStatusId) {
- if (CRM_Utils_Array::value('status_id', $values) &&
+ if (!empty($values['status_id']) &&
$membershipStatusId != $values['status_id']
) {
throw new Exception('Mismatched membership Status and Membership Status Id');
foreach (array('status', 'membership_type') as $fld) {
$membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
}
- if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id])) {
+ if (!empty($statusANDType[$dao->id]['is_current_member'])) {
$membership[$dao->id]['active'] = TRUE;
}
if (empty($dao->owner_membership_id)) {
}
//does membership have auto renew CRM-7137.
- if (CRM_Utils_Array::value('contribution_recur_id', $membership[$dao->id]) &&
+ if (!empty($membership[$dao->id]['contribution_recur_id']) &&
!CRM_Member_BAO_Membership::isSubscriptionCancelled($membership[$dao->id]['membership_id'])
) {
$membership[$dao->id]['auto_renew'] = 1;
'status', 'membership_type') as $fld) {
$membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
}
- if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id])) {
+ if (!empty($statusANDType[$dao->id]['is_current_member'])) {
$membership[$dao->id]['active'] = TRUE;
}
$row['campaign'] = CRM_Utils_Array::value($result->member_campaign_id, $allCampaigns);
$row['campaign_id'] = $result->member_campaign_id;
- if (CRM_Utils_Array::value('member_is_test', $row)) {
+ if (!empty($row['member_is_test'])) {
$row['membership_type'] = $row['membership_type'] . " (test)";
}
function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
- if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
+ if (!empty($_POST['_qf_' . $formName . '_next_print'])) {
$value = CRM_Member_Task::PRINT_MEMBERS;
}
else {
$statusMessage = ts('The Personal Campaign Page you have just visited is currently %1. However you can still support the campaign here.', array(1 => $pcpStatus[$pcpInfo['status_id']]));
CRM_Core_Error::statusBounce($statusMessage, $url);
}
- elseif (!CRM_Utils_Array::value('is_active', $pcpBlock)) {
+ elseif (empty($pcpBlock['is_active'])) {
$statusMessage = ts('Personal Campaign Pages are currently not enabled for this contribution page. However you can still support the campaign here.');
CRM_Core_Error::statusBounce($statusMessage, $url);
}
- elseif (!CRM_Utils_Array::value('is_active', $pcpInfo)) {
+ elseif (empty($pcpInfo['is_active'])) {
$statusMessage = ts('The Personal Campaign Page you have just visited is currently inactive. However you can still support the campaign here.');
CRM_Core_Error::statusBounce($statusMessage, $url);
}
$this->assign('pageId', $this->_id);
}
- if (!CRM_Utils_Array::value('id', $defaults)) {
+ if (empty($defaults['id'])) {
$defaults['target_entity_type'] = 'contribute';
$defaults['is_approval_needed'] = 1;
$defaults['is_tellfriend_enabled'] = 1;
*/
public static function formRule($params, $files, $self) {
$errors = array();
- if (CRM_Utils_Array::value('is_active', $params)) {
+ if (!empty($params['is_active'])) {
- if (CRM_Utils_Array::value('is_tellfriend_enabled', $params) &&
+ if (!empty($params['is_tellfriend_enabled']) &&
(CRM_Utils_Array::value('tellfriend_limit', $params) <= 0)
) {
$errors['tellfriend_limit'] = ts('if Tell Friend is enabled, Maximum recipients limit should be greater than zero.');
}
- if (!CRM_Utils_Array::value('supporter_profile_id', $params)) {
+ if (empty($params['supporter_profile_id'])) {
$errors['supporter_profile_id'] = ts('Supporter profile is a required field.');
}
else {
$this->assign('pageId', $this->_id);
}
- if (!CRM_Utils_Array::value('id', $defaults)) {
+ if (empty($defaults['id'])) {
$defaults['target_entity_type'] = 'event';
$defaults['is_approval_needed'] = 1;
$defaults['is_tellfriend_enabled'] = 1;
*/
public static function formRule($params, $files, $self) {
$errors = array();
- if (CRM_Utils_Array::value('is_active', $params)) {
+ if (!empty($params['is_active'])) {
- if (CRM_Utils_Array::value('is_tellfriend_enabled', $params) &&
+ if (!empty($params['is_tellfriend_enabled']) &&
(CRM_Utils_Array::value('tellfriend_limit', $params) <= 0)
) {
$errors['tellfriend_limit'] = ts('if Tell Friend is enable, Maximum recipients limit should be greater than zero.');
}
- if (!CRM_Utils_Array::value('supporter_profile_id', $params)) {
+ if (empty($params['supporter_profile_id'])) {
$errors['supporter_profile_id'] = ts('Supporter profile is a required field.');
}
else {
$whereClause = NULL;
if (!empty($_POST) || !empty($_GET['page_type'])) {
- if (CRM_Utils_Array::value('status_id', $_POST)) {
+ if (!empty($_POST['status_id'])) {
$whereClause = ' AND cp.status_id = %1';
$params['1'] = array($_POST['status_id'], 'Integer');
}
- if (CRM_Utils_Array::value('page_type', $_POST)) {
+ if (!empty($_POST['page_type'])) {
$whereClause .= ' AND cp.page_type = %2';
$params['2'] = array($_POST['page_type'], 'String');
}
- elseif (CRM_Utils_Array::value('page_type', $_GET)) {
+ elseif (!empty($_GET['page_type'])) {
$whereClause .= ' AND cp.page_type = %2';
$params['2'] = array($_GET['page_type'], 'String');
}
- if (CRM_Utils_Array::value('page_id', $_POST)) {
+ if (!empty($_POST['page_id'])) {
$whereClause .= ' AND cp.page_id = %4 AND cp.page_type = "contribute"';
$params['4'] = array($_POST['page_id'], 'Integer');
}
- if (CRM_Utils_Array::value('event_id', $_POST)) {
+ if (!empty($_POST['event_id'])) {
$whereClause .= ' AND cp.page_id = %5 AND cp.page_type = "event"';
$params['5'] = array($_POST['event_id'], 'Integer');
}
if ($validDate) {
$contributionText = ts('Contribute Now');
- if (CRM_Utils_Array::value('donate_link_text', $pcpInfo)) {
+ if (!empty($pcpInfo['donate_link_text'])) {
$contributionText = $pcpInfo['donate_link_text'];
}
* @return object
*/
static function add(&$params) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Pledge', $params['id'], $params);
}
else {
$result = $pledge->save();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Pledge', $pledge->id, $pledge);
}
else {
$paymentParams = array();
$paymentParams['status_id'] = CRM_Utils_Array::value('status_id', $params);
- if (CRM_Utils_Array::value('installment_amount', $params)) {
+ if (!empty($params['installment_amount'])) {
$params['amount'] = $params['installment_amount'] * $params['installments'];
}
}
//handle custom data.
- if (CRM_Utils_Array::value('custom', $params) &&
+ if (!empty($params['custom']) &&
is_array($params['custom'])
) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_pledge', $pledge->id);
//if pledge is pending delete all payments and recreate.
- if (CRM_Utils_Array::value('is_pledge_pending', $params)) {
+ if (!empty($params['is_pledge_pending'])) {
CRM_Pledge_BAO_PledgePayment::deletePayments($pledge->id);
}
'installments', 'frequency_day', 'scheduled_amount', 'currency',
);
foreach ($pledgeFields as $field) {
- if (CRM_Utils_Array::value($field, $params)) {
+ if (!empty($params[$field])) {
$form->assign($field, $params[$field]);
}
}
//assign honor fields.
$honor_block_is_active = FALSE;
//make sure we have values for it
- if (CRM_Utils_Array::value('honor_type_id', $params) &&
+ if (!empty($params['honor_type_id']) &&
((!empty($params['honor_first_name']) && !empty($params['honor_last_name'])) ||
(!empty($params['honor_email']))
)
$form->assign('contact', $details[0][$params['contact_id']]);
//handle custom data.
- if (CRM_Utils_Array::value('hidden_custom', $params)) {
+ if (!empty($params['hidden_custom'])) {
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', CRM_Core_DAO::$_nullObject, $params['id']);
$pledgeParams = array(array('pledge_id', '=', $params['id'], 0, 0));
$customGroup = array();
//check for online pledge.
$session = CRM_Core_Session::singleton();
- if (CRM_Utils_Array::value('receipt_from_email', $params)) {
+ if (!empty($params['receipt_from_email'])) {
$userName = CRM_Utils_Array::value('receipt_from_name', $params);
$userEmail = CRM_Utils_Array::value('receipt_from_email', $params);
}
- elseif (CRM_Utils_Array::value('from_email_id', $params)) {
+ elseif (!empty($params['from_email_id'])) {
$receiptFrom = $params['from_email_id'];
}
elseif ($userID = $session->get('userID')) {
);
//lets insert assignee record.
- if (CRM_Utils_Array::value('contact_id', $params)) {
+ if (!empty($params['contact_id'])) {
$activityParams['assignee_contact_id'] = $params['contact_id'];
}
*/
static function add(&$params) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'PledgeBlock', $params['id'], $params);
}
else {
$pledgeBlock->copyValues($params);
$result = $pledgeBlock->save();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'PledgeBlock', $pledgeBlock->id, $pledgeBlock);
}
else {
*/
static function buildPledgeBlock($form) {
//build pledge payment fields.
- if (CRM_Utils_Array::value('pledge_id', $form->_values)) {
+ if (!empty($form->_values['pledge_id'])) {
//get all payments required details.
$allPayments = array();
$returnProperties = array('status_id', 'scheduled_date', 'scheduled_amount');
);
$form->addElement('text', 'pledge_installments', ts('Installments'), array('size' => 3));
- if (CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock)) {
+ if (!empty($pledgeBlock['is_pledge_interval'])) {
$form->assign('is_pledge_interval', CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock));
$form->addElement('text', 'pledge_frequency_interval', NULL, array('size' => 3));
}
* @static
*/
static function add($params) {
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'PledgePayment', $params['id'], $params);
}
else {
$result = $payment->save();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'PledgePayment', $payment->id, $payment);
}
else {
}
//add pledge select
- if (CRM_Utils_Array::value('pledge_amount', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_amount'])) {
$query->_select['pledge_amount'] = 'civicrm_pledge.amount as pledge_amount';
$query->_element['pledge_amount'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_create_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_create_date'])) {
$query->_select['pledge_create_date'] = 'civicrm_pledge.create_date as pledge_create_date';
$query->_element['pledge_create_date'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_status_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_status_id'])) {
$query->_select['pledge_status_id'] = 'pledge_status.value as pledge_status_id';
$query->_element['pledge_status'] = 1;
$query->_tables['pledge_status'] = $query->_whereTables['pledge_status'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_status'])) {
$query->_select['pledge_status'] = 'pledge_status.label as pledge_status';
$query->_element['pledge_status'] = 1;
$query->_tables['pledge_status'] = $query->_whereTables['pledge_status'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_total_paid', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_total_paid'])) {
$query->_select['pledge_total_paid'] = ' (SELECT sum(civicrm_pledge_payment.actual_amount) FROM civicrm_pledge_payment WHERE civicrm_pledge_payment.pledge_id = civicrm_pledge.id AND civicrm_pledge_payment.status_id = 1 ) as pledge_total_paid';
$query->_element['pledge_total_paid'] = 1;
}
- if (CRM_Utils_Array::value('pledge_next_pay_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_next_pay_date'])) {
$query->_select['pledge_next_pay_date'] = " (SELECT civicrm_pledge_payment.scheduled_date FROM civicrm_pledge_payment WHERE civicrm_pledge_payment.pledge_id = civicrm_pledge.id AND civicrm_pledge_payment.status_id IN ( 2, 6 ) ORDER BY civicrm_pledge_payment.scheduled_date ASC LIMIT 0, 1) as pledge_next_pay_date";
$query->_element['pledge_next_pay_date'] = 1;
}
- if (CRM_Utils_Array::value('pledge_next_pay_amount', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_next_pay_amount'])) {
$query->_select['pledge_next_pay_amount'] = " (SELECT civicrm_pledge_payment.scheduled_amount FROM civicrm_pledge_payment WHERE civicrm_pledge_payment.pledge_id = civicrm_pledge.id AND civicrm_pledge_payment.status_id = 2 ORDER BY civicrm_pledge_payment.scheduled_date ASC LIMIT 0, 1) as pledge_next_pay_amount";
$query->_element['pledge_next_pay_amount'] = 1;
$query->_element['pledge_outstanding_amount'] = 1;
}
- if (CRM_Utils_Array::value('pledge_financial_type', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_financial_type'])) {
$query->_select['pledge_financial_type'] = "(SELECT civicrm_financial_type.name FROM civicrm_financial_type WHERE civicrm_financial_type.id = civicrm_pledge.financial_type_id) as pledge_financial_type";
$query->_element['pledge_financial_type'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_contribution_page_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_contribution_page_id'])) {
$query->_select['pledge_contribution_page_id'] = 'civicrm_pledge.contribution_page_id as pledge_contribution_page_id';
$query->_element['pledge_contribution_page_id'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_id'])) {
$query->_select['pledge_payment_id'] = 'civicrm_pledge_payment.id as pledge_payment_id';
$query->_element['pledge_payment_id'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_scheduled_amount', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_scheduled_amount'])) {
$query->_select['pledge_payment_scheduled_amount'] = 'civicrm_pledge_payment.scheduled_amount as pledge_payment_scheduled_amount';
$query->_element['pledge_payment_scheduled_amount'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_scheduled_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_scheduled_date'])) {
$query->_select['pledge_payment_scheduled_date'] = 'civicrm_pledge_payment.scheduled_date as pledge_payment_scheduled_date';
$query->_element['pledge_payment_scheduled_date'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_paid_amount', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_paid_amount'])) {
$query->_select['pledge_payment_paid_amount'] = 'civicrm_pledge_payment.actual_amount as pledge_payment_paid_amount';
$query->_element['pledge_payment_paid_amount'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_paid_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_paid_date'])) {
$query->_select['pledge_payment_paid_date'] = 'payment_contribution.receive_date as pledge_payment_paid_date';
$query->_element['pledge_payment_paid_date'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
$query->_tables['payment_contribution'] = $query->_whereTables['payment_contribution'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_reminder_date', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_reminder_date'])) {
$query->_select['pledge_payment_reminder_date'] = 'civicrm_pledge_payment.reminder_date as pledge_payment_reminder_date';
$query->_element['pledge_payment_reminder_date'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_reminder_count', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_reminder_count'])) {
$query->_select['pledge_payment_reminder_count'] = 'civicrm_pledge_payment.reminder_count as pledge_payment_reminder_count';
$query->_element['pledge_payment_reminder_count'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_status_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_status_id'])) {
$query->_select['pledge_payment_status_id'] = 'payment_status.name as pledge_payment_status_id';
$query->_element['pledge_payment_status_id'] = 1;
$query->_tables['payment_status'] = $query->_whereTables['payment_status'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
}
- if (CRM_Utils_Array::value('pledge_payment_status', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_payment_status'])) {
$query->_select['pledge_payment_status'] = 'payment_status.label as pledge_payment_status';
$query->_element['pledge_payment_status'] = 1;
$query->_tables['payment_status'] = $query->_whereTables['payment_status'] = 1;
$query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1;
}
- if (CRM_Utils_Array::value('pledge_frequency_interval', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_frequency_interval'])) {
$query->_select['pledge_frequency_interval'] = 'civicrm_pledge.frequency_interval as pledge_frequency_interval';
$query->_element['pledge_frequency_interval'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_frequency_unit', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_frequency_unit'])) {
$query->_select['pledge_frequency_unit'] = 'civicrm_pledge.frequency_unit as pledge_frequency_unit';
$query->_element['pledge_frequency_unit'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_is_test', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_is_test'])) {
$query->_select['pledge_is_test'] = 'civicrm_pledge.is_test as pledge_is_test';
$query->_element['pledge_is_test'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_campaign_id', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_campaign_id'])) {
$query->_select['pledge_campaign_id'] = 'civicrm_pledge.campaign_id as pledge_campaign_id';
$query->_element['pledge_campaign_id'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- if (CRM_Utils_Array::value('pledge_currency', $query->_returnProperties)) {
+ if (!empty($query->_returnProperties['pledge_currency'])) {
$query->_select['pledge_currency'] = 'civicrm_pledge.currency as pledge_currency';
$query->_element['pledge_currency'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
- if (!CRM_Utils_Array::value(0, $query->_params[$id])) {
+ if (empty($query->_params[$id][0])) {
continue;
}
if (substr($query->_params[$id][0], 0, 7) == 'pledge_') {
static function tableNames(&$tables) {
//add status table
- if (CRM_Utils_Array::value('pledge_status', $tables) ||
+ if (!empty($tables['pledge_status']) ||
CRM_Utils_Array::value('civicrm_pledge_payment', $tables)
) {
$tables = array_merge(array('civicrm_pledge' => 1), $tables);
return $defaults;
}
- if (CRM_Utils_Array::value('is_test', $defaults)) {
+ if (!empty($defaults['is_test'])) {
$this->assign('is_test', TRUE);
}
$formValues = $this->controller->exportValues($this->_name);
// set the contact, when contact is selected
- if (CRM_Utils_Array::value('contact_select_id', $formValues)) {
+ if (!empty($formValues['contact_select_id'])) {
$this->_contactID = $formValues['contact_select_id'][1];
}
}
$params[$d] = CRM_Utils_Date::processDate($this->_values[$d]);
}
- elseif (CRM_Utils_Array::value($d, $formValues) && !CRM_Utils_System::isNull($formValues[$d])) {
+ elseif (!empty($formValues[$d]) && !CRM_Utils_System::isNull($formValues[$d])) {
if ($d == 'start_date') {
$params['scheduled_date'] = CRM_Utils_Date::processDate($formValues[$d]);
}
}
}
- if (CRM_Utils_Array::value('is_acknowledge', $formValues)) {
+ if (!empty($formValues['is_acknowledge'])) {
$params['acknowledge_date'] = date('Y-m-d');
}
$params['contact_id'] = $this->_contactID;
//format custom data
- if (CRM_Utils_Array::value('hidden_custom', $formValues)) {
+ if (!empty($formValues['hidden_custom'])) {
$params['hidden_custom'] = 1;
$customFields = CRM_Core_BAO_CustomField::getFields('Pledge');
}
//handle Acknowledgment.
- if (CRM_Utils_Array::value('is_acknowledge', $formValues) && $pledge->id) {
+ if (!empty($formValues['is_acknowledge']) && $pledge->id) {
//calculate scheduled amount.
$params['scheduled_amount'] = round($params['amount'] / $params['installments']);
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
- if (CRM_Utils_Array::value('contribution_page_id', $values)) {
+ if (!empty($values['contribution_page_id'])) {
$values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
}
$pledgeStatuses
);
// append (test) to status label
- if (CRM_Utils_Array::value('pledge_is_test', $row)) {
+ if (!empty($row['pledge_is_test'])) {
$row['pledge_status'] .= ' (test)';
}
function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
- if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
+ if (!empty($_POST['_qf_' . $formName . '_next_print'])) {
$value = CRM_Pledge_Task::PRINT_PLEDGES;
}
else {
$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 (CRM_Utils_Array::value('price_field_value_id', $line) && !CRM_Utils_Array::value('financial_type_id', $line)) {
+ if (!empty($line['price_field_value_id']) && !CRM_Utils_Array::value('financial_type_id', $line)) {
$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);
$setID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $values['price_field_id'], 'price_set_id');
$params['is_quick_config'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'is_quick_config');
}
- if (CRM_Utils_Array::value('is_quick_config', $params) && array_key_exists('total_amount', $params)
+ if (!empty($params['is_quick_config']) && array_key_exists('total_amount', $params)
&& $totalEntityId == 1) {
$values['line_total'] = $values['unit_price'] = $params['total_amount'];
}
}
}
else {
- if (CRM_Utils_Array::value('default_option', $params)) {
+ if (!empty($params['default_option'])) {
$defaultArray[$params['default_option']] = 1;
}
}
if (CRM_Utils_Array::value( $index, CRM_Utils_Array::value('option_financial_type_id', $params))) {
$options['financial_type_id'] = $params['option_financial_type_id'][$index];
- } elseif (CRM_Utils_Array::value( 'financial_type_id', $params )) {
+ } elseif (!empty($params['financial_type_id'])) {
$options['financial_type_id'] = $params['financial_type_id'];
}
$label = ts('Additional Contribution');
$useRequired = 0;
}
- elseif (CRM_Utils_Array::value('label', $fieldOptions[$optionKey])) { //check for label.
+ elseif (!empty($fieldOptions[$optionKey]['label'])) { //check for label.
$label = $fieldOptions[$optionKey]['label'];
}
if (!$field->is_required) {
// add "none" option
- if (CRM_Utils_Array::value('is_allow_other_amount', $otherAmount) && $field->name == 'contribution_amount') {
+ 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') {
}
}
- if (CRM_Utils_Array::value($key, $fields)) {
+ if (!empty($fields[$key])) {
$priceFields[$priceField->id] = $fields[$key];
}
}
if ($id = CRM_Utils_Array::value('id', $ids)) {
$fieldValueBAO->id = $id;
}
- if (CRM_Utils_Array::value('is_default', $params)) {
+ if (!empty($params['is_default'])) {
$query = 'UPDATE civicrm_price_field_value SET is_default = 0 WHERE price_field_id = %1';
$p = array(1 => array($params['price_field_id'], 'Integer'));
CRM_Core_DAO::executeQuery($query, $p);
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceFieldValue', $oldWeight, $params['weight'], $fieldValues);
}
else {
- if (!CRM_Utils_Array::value('name', $params)) {
+ if (empty($params['name'])) {
$params['name'] = CRM_Utils_String::munge(CRM_Utils_Array::value('label', $params), '_', 64);
}
- if (!CRM_Utils_Array::value('weight', $params)) {
+ if (empty($params['weight'])) {
$params['weight'] = 1;
}
}
$autoRenew[0] = $autoRenew[1] = $autoRenew[2] = 0;
}
foreach ($fields as $id => $field) {
- if (!CRM_Utils_Array::value("price_{$id}", $params) ||
+ if (empty($params["price_{$id}"]) ||
(empty($params["price_{$id}"]) && $params["price_{$id}"] == NULL)
) {
// skip if nothing was submitted for this field
static $_contact_memberships = array();
$checklifetime = FALSE;
foreach ($options as $key => $value) {
- if (CRM_Utils_Array::value('membership_type_id', $value)) {
+ if (!empty($value['membership_type_id'])) {
if (!isset($_contact_memberships[$userid][$value['membership_type_id']])) {
$_contact_memberships[$userid][$value['membership_type_id']] = CRM_Member_BAO_Membership::getContactMembership($userid, $value['membership_type_id'], FALSE);
}
$defaults['price'] = CRM_Utils_Money::format($defaults['amount'], NULL, '%a');
}
- if (CRM_Utils_Array::value('active_on', $defaults)) {
+ if (!empty($defaults['active_on'])) {
list($defaults['active_on'],
$defaults['active_on_time']
) = CRM_Utils_Date::setDateDefaults($defaults['active_on'], 'activityDateTime');
}
- if (CRM_Utils_Array::value('expire_on', $defaults)) {
+ if (!empty($defaults['expire_on'])) {
list($defaults['expire_on'],
$defaults['expire_on_time']
) = CRM_Utils_Date::setDateDefaults($defaults['expire_on'], 'activityDateTime');
foreach ($memTypesIDS as $key => $val) {
// see if any price field option values in this price field are for memberships with autorenew
$memTypeDetails = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($val);
- if (CRM_Utils_Array::value('auto_renew', $memTypeDetails)) {
+ if (!empty($memTypeDetails['auto_renew'])) {
$foundAutorenew = TRUE;
break;
}
*/
static function formRule($fields, $files, $form) {
$errors = array();
- if (CRM_Utils_Array::value('count', $fields) && CRM_Utils_Array::value('max_value', $fields) &&
+ if (!empty($fields['count']) && CRM_Utils_Array::value('max_value', $fields) &&
$fields['count'] > $fields['max_value']
) {
$errors['count'] = ts('Participant count can not be greater than max participants.');
$defaults = array();
$groupId = $this->get('groupId');
$fieldId = $this->get('fieldId');
- if (CRM_Utils_Array::value('fields', $this->_groupTree[$groupId])) {
+ if (!empty($this->_groupTree[$groupId]['fields'])) {
foreach ($this->_groupTree[$groupId]['fields'] as $key => $val) {
foreach ($val['options'] as $keys => $values) {
if ($values['is_default']) {
$financialType = CRM_Contribute_PseudoConstant::financialType();
foreach ($customOption as $id => $values) {
$action = array_sum(array_keys($this->actionLinks()));
- if( CRM_Utils_Array::value('financial_type_id', $values)){
+ if (!empty($values['financial_type_id'])){
$customOption[$id]['financial_type_id'] = $financialType[$values['financial_type_id']];
}
// update enable/disable links depending on price_field properties.
$action -= CRM_Core_Action::DISABLE;
}
}
- if (CRM_Utils_Array::value('is_default', $customOption[$id])) {
+ if (!empty($customOption[$id]['is_default'])) {
$customOption[$id]['is_default'] = '<img src="' . $config->resourceBase . 'i/check.gif" />';
}
else {
$this->assign('multiRecordFieldListing', $multiRecordFieldListing);
// is profile double-opt in?
- if (CRM_Utils_Array::value('group', $this->_fields) &&
+ if (!empty($this->_fields['group']) &&
CRM_Core_BAO_UFGroup::isProfileDoubleOptin()
) {
$emailField = FALSE;
return;
}
- if (CRM_Utils_Array::value('image_URL', $this->_defaults)) {
+ if (!empty($this->_defaults['image_URL'])) {
list($imageWidth, $imageHeight) = getimagesize($this->_defaults['image_URL']);
list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight);
$this->assign("imageWidth", $imageWidth);
// dont check for duplicates during registration validation: CRM-375
if (!$register && !CRM_Utils_Array::value('_qf_Edit_upload_duplicate', $fields)) {
// fix for CRM-3240
- if (CRM_Utils_Array::value('email-Primary', $fields)) {
+ if (!empty($fields['email-Primary'])) {
$fields['email'] = CRM_Utils_Array::value('email-Primary', $fields);
}
// fix for CRM-6141
- if (CRM_Utils_Array::value('phone-Primary-1', $fields) &&
+ if (!empty($fields['phone-Primary-1']) &&
!CRM_Utils_Array::value('phone-Primary', $fields)
) {
$fields['phone-Primary'] = $fields['phone-Primary-1'];
//if the delete record button is clicked
if ($this->_deleteButtonName) {
- if (CRM_Utils_Array::value($this->_deleteButtonName, $_POST) && $this->_recordId) {
+ if (!empty($_POST[$this->_deleteButtonName]) && $this->_recordId) {
$filterParams['id'] = $this->_customGroupId;
$returnProperities = array('is_multiple', 'table_name');
CRM_Core_DAO::commonRetrieve("CRM_Core_DAO_CustomGroup", $filterParams, $returnValues, $returnProperities);
- if (CRM_Utils_Array::value('is_multiple', $returnValues)) {
+ if (!empty($returnValues['is_multiple'])) {
if ($tableName = CRM_Utils_Array::value('table_name', $returnValues)) {
$sql = "DELETE FROM {$tableName} WHERE id = %1 AND entity_id = %2";
$sqlParams = array(
}
}
CRM_Utils_Hook::processProfile($this->_ufGroupName);
- if (CRM_Utils_Array::value('image_URL', $params)) {
+ if (!empty($params['image_URL'])) {
CRM_Contact_BAO_Contact::processImageParams($params);
}
//array of group id, subscribed by contact
$contactGroup = array();
- if (CRM_Utils_Array::value('group', $params) &&
+ if (!empty($params['group']) &&
CRM_Core_BAO_UFGroup::isProfileDoubleOptin()
) {
$groupSubscribed = array();
- if (CRM_Utils_Array::value('email', $result)) {
+ if (!empty($result['email'])) {
if ($this->_id) {
$contactGroups = new CRM_Contact_DAO_GroupContact();
$contactGroups->contact_id = $this->_id;
}
$addToGroupId = NULL;
- if (CRM_Utils_Array::value('add_to_group', $params)) {
+ if (!empty($params['add_to_group'])) {
$addToGroupId = $params['add_to_group'];
//run same check whether group is a mailing list
if (isset($params['activity_date_time'])) {
$activityParams['activity_date_time'] = CRM_Utils_Date::processDate($params['activity_date_time'], $params['activity_date_time_time']);
}
- if (CRM_Utils_Array::value($fieldName, $params) && isset($params["{$fieldName}_id"])) {
+ if (!empty($params[$fieldName]) && isset($params["{$fieldName}_id"])) {
$activityParams[$fieldName] = $params["{$fieldName}_id"];
}
}
}
//create CMS user (if CMS user option is selected in profile)
- if (CRM_Utils_Array::value('cms_create_account', $params) &&
+ if (!empty($params['cms_create_account']) &&
$this->_mode == self::MODE_CREATE
) {
$params['contactID'] = $this->_id;
}
//for delete record handling
- if (!CRM_Utils_Array::value($this->_deleteButtonName, $_POST)) {
+ if (empty($_POST[$this->_deleteButtonName])) {
CRM_Core_Session::setStatus(ts('Your information has been saved.'), ts('Thank you.'), 'success');
}
)
);
}
- if (CRM_Utils_Array::value('group', $this->_params)) {
+ if (!empty($this->_params['group'])) {
foreach ($this->_params['group'] as $key => $val) {
if (!$val) {
unset($this->_params['group'][$key]);
// add group id to params if a uf group belong to a any group
if ($groupId) {
- if (CRM_Utils_Array::value('group', $params)) {
+ if (!empty($params['group'])) {
$params['group'][$groupId] = 1;
}
else {
// add group id to params if a uf group belong to a any group
if ($groupId) {
- if (CRM_Utils_Array::value('group', $this->_params)) {
+ if (!empty($this->_params['group'])) {
$this->_params['group'][$groupId] = 1;
}
else {
continue;
}
- if (CRM_Utils_Array::value('in_selector', $field) &&
+ if (!empty($field['in_selector']) &&
!in_array($name, $skipFields)
) {
continue;
}
- if (CRM_Utils_Array::value('in_selector', $field) &&
+ if (!empty($field['in_selector']) &&
!in_array($key, $skipFields)
) {
if (strpos($key, '-') !== FALSE) {
}
}
- if (CRM_Utils_Array::value('in_selector', $properties)) {
+ if (!empty($properties['in_selector'])) {
$selectorSet = TRUE;
}
}
}
$instanceID = CRM_Utils_Array::value('id', $params);
- if (CRM_Utils_Array::value('instance_id', $params)) {
+ if (!empty($params['instance_id'])) {
$instanceID = CRM_Utils_Array::value('instance_id', $params);
}
}
// build navigation parameters
- if (CRM_Utils_Array::value('is_navigation', $params)) {
+ if (!empty($params['is_navigation'])) {
if (!array_key_exists('navigation', $params)) {
$params['navigation'] = array();
}
// add to dashboard
$dashletParams = array();
- if (CRM_Utils_Array::value('addToDashboard', $params)) {
+ if (!empty($params['addToDashboard'])) {
$dashletParams = array(
'label' => $params['title'],
'is_active' => 1,
// add / update navigation as required
if (!empty($navigationParams)) {
- if (!CRM_Utils_Array::value('id',$params) &&
+ if (empty($params['id']) &&
!CRM_Utils_Array::value('instance_id',$params) &&
CRM_Utils_Array::value('id', $navigationParams)) {
unset($navigationParams['id']);
$navigationParams['url'] = "civicrm/report/instance/{$instance->id}&reset=1";
$navigation = CRM_Core_BAO_Navigation::add($navigationParams);
- if (CRM_Utils_Array::value('is_active', $navigationParams)) {
+ if (!empty($navigationParams['is_active'])) {
//set the navigation id in report instance table
CRM_Core_DAO::setFieldValue('CRM_Report_DAO_ReportInstance', $instance->id, 'navigation_id', $navigation->id);
}
if (!empty($dashletParams)) {
$section = 2;
$chart = '';
- if (CRM_Utils_Array::value('charts', $params)) {
+ if (!empty($params['charts'])) {
$section = 1;
$chart = "&charts=" . $params['charts'];
}
}
// lets always do a force if reset is found in the url.
- if (CRM_Utils_Array::value('reset', $_REQUEST)) {
+ if (!empty($_REQUEST['reset'])) {
$this->_force = 1;
}
$fieldGroups = array('fields', 'filters', 'group_bys', 'order_bys');
foreach ($fieldGroups as $fieldGrp) {
- if (CRM_Utils_Array::value($fieldGrp, $table) && is_array($table[$fieldGrp])) {
+ if (!empty($table[$fieldGrp]) && is_array($table[$fieldGrp])) {
foreach ($table[$fieldGrp] as $fieldName => $field) {
// $name is the field name used to reference the BAO/DAO export fields array
$name = isset($field['name']) ? $field['name'] : $fieldName;
}
// fill other vars
- if (CRM_Utils_Array::value('no_repeat', $field)) {
+ if (!empty($field['no_repeat'])) {
$this->_noRepeats[] = "{$tableName}_{$fieldName}";
}
- if (CRM_Utils_Array::value('no_display', $field)) {
+ if (!empty($field['no_display'])) {
$this->_noDisplay[] = "{$tableName}_{$fieldName}";
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!CRM_Utils_Array::value('no_display', $field)) {
+ if (empty($field['no_display'])) {
if (isset($field['required'])) {
// set default
$this->_defaults['fields'][$fieldName] = 1;
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
if (isset($field['default'])) {
- if (CRM_Utils_Array::value('frequency', $field)) {
+ if (!empty($field['frequency'])) {
$this->_defaults['group_bys_freq'][$fieldName] = 'MONTH';
}
$this->_defaults['group_bys'][$fieldName] = $field['default'];
$this->_defaults['order_bys'] = array();
}
foreach ($table['order_bys'] as $fieldName => $field) {
- if (
- CRM_Utils_Array::value('default', $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)
'section' => CRM_Utils_Array::value('default_is_section', $field, 0),
);
- if (CRM_Utils_Array::value('default_weight', $field)) {
+ if (!empty($field['default_weight'])) {
$this->_defaults['order_bys'][(int) $field['default_weight']] = $order_by;
}
else {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
$groupTitle = '';
- if (!CRM_Utils_Array::value('no_display', $field)) {
+ if (empty($field['no_display'])) {
foreach ( array('table', 'field') as $var) {
if (!empty(${$var}['grouping'])) {
if (!is_array(${$var}['grouping'])) {
foreach ($table['group_bys'] as $fieldName => $field) {
if (!empty($field)) {
$options[$field['title']] = $fieldName;
- if (CRM_Utils_Array::value('frequency', $field)) {
+ if (!empty($field['frequency'])) {
$freqElements[$field['title']] = $fieldName;
}
}
if ($this->_autoIncludeIndexedFieldsAsOrderBys && array_key_exists('extends', $table) && !empty($table['extends'])) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!CRM_Utils_Array::value('no_display', $field)) {
+ if (empty($field['no_display'])) {
$options[$fieldName] = $field['title'];
}
}
break;
}
- if (CRM_Utils_Array::value('group', $field) && $clause) {
+ if (!empty($field['group']) && $clause) {
$clause = $this->whereGroupClause($field, $value, $op);
}
- elseif (CRM_Utils_Array::value('tag', $field) && $clause) {
+ elseif (!empty($field['tag']) && $clause) {
// not using left join in query because if any contact
// belongs to more than one tag, results duplicate
// entries.
// unset columns not to be displayed.
foreach ($this->_columnHeaders as $key => $value) {
- if (CRM_Utils_Array::value('no_display', $value)) {
+ if (!empty($value['no_display'])) {
unset($this->_columnHeaders[$key]);
}
}
$this->_phoneField = TRUE;
}
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
}
// include statistics columns only if set
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
$alias = "{$tableName}_{$fieldName}_{$stat}";
switch (strtolower($stat)) {
break;
}
// for graphs and charts -
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
+ if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
}
if (!empty($clause)) {
- if (CRM_Utils_Array::value('having', $field)) {
+ if (!empty($field['having'])) {
$this->_havingClauses[] = $clause;
}
else {
// fields array is missing because form building etc is skipped
// in dashboard mode for report
//@todo - this could be done in the dashboard no we have a setter
- if (!CRM_Utils_Array::value('fields', $this->_params) && !$this->_noFields) {
+ if (empty($this->_params['fields']) && !$this->_noFields) {
$this->setParams($this->_formValues);
}
function groupBy() {
$groupBys = array();
- if (CRM_Utils_Array::value('group_bys', $this->_params) &&
+ if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
$groupBys[] = $field['dbAlias'];
}
}
function storeOrderByArray() {
$orderBys = array();
- if (CRM_Utils_Array::value('order_bys', $this->_params) &&
+ if (!empty($this->_params['order_bys']) &&
is_array($this->_params['order_bys']) &&
!empty($this->_params['order_bys'])
) {
$orderBys[] = "{$orderByField['dbAlias']} {$orderBy['order']}";
// Record any section headers for assignment to the template
- if (CRM_Utils_Array::value('section', $orderBy)) {
+ if (!empty($orderBy['section'])) {
$orderByField['pageBreak'] = CRM_Utils_Array::value('pageBreak', $orderBy);
$this->_sections[$orderByField['tplField']] = $orderByField;
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
}
function groupByStat(&$statistics) {
- if (CRM_Utils_Array::value('group_bys', $this->_params) &&
+ if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
$combinations[] = $field['title'];
}
}
}
//might be survey response field.
- if (CRM_Utils_Array::value('survey_response', $this->_params['fields']) &&
+ if (!empty($this->_params['fields']['survey_response']) &&
CRM_Utils_Array::value('isSurveyResponseField', $prop['fields'][$fieldAlias])
) {
return TRUE;
return TRUE;
}
}
- if (CRM_Utils_Array::value($fieldAlias . '_op', $this->_params) &&
+ if (!empty($this->_params[$fieldAlias . '_op']) &&
in_array($this->_params[$fieldAlias . '_op'], array('nll', 'nnll'))
) {
return TRUE;
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
$this->_selectedTables[] = $tableName;
}
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $filterName => $filter) {
- if (CRM_Utils_Array::value("{$filterName}_value", $this->_params) ||
+ if (!empty($this->_params["{$filterName}_value"]) ||
CRM_Utils_Array::value("{$filterName}_op", $this->_params) == 'nll' ||
CRM_Utils_Array::value("{$filterName}_op", $this->_params) == 'nnll'
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
case 'YEARWEEK':
$field['title'] = 'Quarter';
break;
}
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
+ if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_email') {
if ($tableName == 'civicrm_phone') {
$this->_phoneField = TRUE;
}
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
case 'count':
}
}
elseif ($fieldName == 'activity_type_id') {
- if (!CRM_Utils_Array::value('activity_type_id', $this->_params['group_bys'])) {
+ if (empty($this->_params['group_bys']['activity_type_id'])) {
$select[] = "GROUP_CONCAT(DISTINCT {$field['dbAlias']} ORDER BY {$field['dbAlias']} ) as {$tableName}_{$fieldName}";
}
else {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
- if (CRM_Utils_Array::value('chart', $field)) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
+ if (!empty($field['chart'])) {
$this->assign('chartSupported', TRUE);
}
- if (CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) &&
+ if (!empty($table['group_bys'][$fieldName]['frequency']) &&
CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])
) {
function formRule($fields, $files, $self) {
$errors = array();
$contactFields = array('sort_name', 'email', 'phone');
- if (CRM_Utils_Array::value('group_bys', $fields)) {
+ if (!empty($fields['group_bys'])) {
- if (CRM_Utils_Array::value('activity_type_id', $fields['group_bys']) &&
+ if (!empty($fields['group_bys']['activity_type_id']) &&
!CRM_Utils_Array::value('sort_name', $fields['group_bys'])
) {
foreach ($fields['fields'] as $fieldName => $val) {
}
}
- if (CRM_Utils_Array::value('activity_date_time', $fields['group_bys'])) {
- if (CRM_Utils_Array::value('sort_name', $fields['group_bys'])) {
+ if (!empty($fields['group_bys']['activity_date_time'])) {
+ if (!empty($fields['group_bys']['sort_name'])) {
$errors['fields'] = ts("Please do not select GroupBy 'Activity Date' with GroupBy 'Contact'");
}
else {
continue;
}
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields']) || CRM_Utils_Array::value('is_required', $field)
) {
continue;
}
foreach ($values['fields'] as $name => $field) {
- if (CRM_Utils_Array::value('isSurveyResponseField', $field)) {
+ if (!empty($field['isSurveyResponseField'])) {
$fldId = substr($name, 7);
$fieldIds[$fldId] = $fldId;
$title = CRM_Utils_Array::value('label', $field, $field['title']);
$surveyId = CRM_Utils_Array::value(0, $surveyIds);
foreach ($rows as & $row) {
- if (CRM_Utils_Array::value('civicrm_activity_survey_id', $row)) {
+ if (!empty($row['civicrm_activity_survey_id'])) {
$surveyId = $row['civicrm_activity_survey_id'];
}
$result = CRM_Utils_Array::value($surveyId, $resultSet, array());
continue;
}
foreach ($values['fields'] as $name => $field) {
- if (CRM_Utils_Array::value('isSurveyResponseField', $field)) {
+ if (!empty($field['isSurveyResponseField'])) {
$fldId = substr($name, 7);
$surveyResponseFields[$name] = "{$tableName}_{$name}";
$surveyResponseFieldIds[$fldId] = $fldId;
$hasResponseData = FALSE;
foreach ($surveyResponseFields as $fldName) {
foreach ($rows as $row) {
- if (CRM_Utils_Array::value($fldName, $row)) {
+ if (!empty($row[$fldName])) {
$hasResponseData = TRUE;
break;
}
$this->_columns[$resTable]['dao'] = 'CRM_Contact_DAO_Contact';
$this->_columns[$resTable]['extends'] = $response->extends;
}
- if (!CRM_Utils_Array::value('alias', $this->_columns[$resTable])) {
+ if (empty($this->_columns[$resTable]['alias'])) {
$this->_columns[$resTable]['alias'] = "{$resTable}_survey_response";
}
if (!is_array(CRM_Utils_Array::value('fields', $this->_columns[$resTable]))) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_email') {
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_email') {
$this->_relField = TRUE;
}
- if (CRM_Utils_Array::value('activity_date_time_relative', $this->_params) ||
+ if (!empty($this->_params['activity_date_time_relative']) ||
CRM_Utils_Array::value('activity_date_time_from', $this->_params) ||
CRM_Utils_Array::value('activity_date_time_to', $this->_params)
) {
}
foreach (array_keys($this->_caseDetailExtra) as $field) {
- if (CRM_Utils_Array::value($field, $this->_params['case_detail_extra'])) {
+ if (!empty($this->_params['case_detail_extra'][$field])) {
$this->_includeCaseDetailExtra = TRUE;
break;
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $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')))
)
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
// in previous row
foreach ($row as $colName => $colVal) {
- if (CRM_Utils_Array::value($colName, $checkList) && is_array($checkList[$colName]) &&
+ if (!empty($checkList[$colName]) && is_array($checkList[$colName]) &&
in_array($colVal, $checkList[$colName])
) {
$rows[$rowNum][$colName] = "";
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
//isolate the select clause compoenent wise
}
foreach ($this->_component as $val) {
- if (CRM_Utils_Array::value($val, $select)) {
+ if (!empty($select[$val])) {
$this->_selectComponent[$val] = "SELECT " . implode(', ', $select[$val]) . " ";
unset($select[$val]);
}
$this->_from .= "{$group}";
foreach ($this->_component as $val) {
- if (CRM_Utils_Array::value('contribution_civireport', $this->_selectComponent)) {
+ if (!empty($this->_selectComponent['contribution_civireport'])) {
$this->_formComponent['contribution_civireport'] = " FROM
civicrm_contact {$this->_aliases['civicrm_contact']}
INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
{$group}
";
}
- if (CRM_Utils_Array::value('membership_civireport', $this->_selectComponent)) {
+ if (!empty($this->_selectComponent['membership_civireport'])) {
$this->_formComponent['membership_civireport'] = " FROM
civicrm_contact {$this->_aliases['civicrm_contact']}
INNER JOIN civicrm_membership {$this->_aliases['civicrm_membership']}
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_membership']}.contact_id
{$group} ";
}
- if (CRM_Utils_Array::value('participant_civireport', $this->_selectComponent)) {
+ if (!empty($this->_selectComponent['participant_civireport'])) {
$this->_formComponent['participant_civireport'] = " FROM
civicrm_contact {$this->_aliases['civicrm_contact']}
INNER JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
{$group} ";
}
- if (CRM_Utils_Array::value('activity_civireport', $this->_selectComponent)) {
+ if (!empty($this->_selectComponent['activity_civireport'])) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
civicrm_case_contact.case_id = civicrm_case.id ";
}
- if (CRM_Utils_Array::value('relationship_civireport', $this->_selectComponent)) {
+ if (!empty($this->_selectComponent['relationship_civireport'])) {
$this->_formComponent['relationship_civireport'] = "FROM
civicrm_relationship {$this->_aliases['civicrm_relationship']}
$contribution = $membership = $participant = NULL;
$eligibleResult = $rows = $tempArray = array();
foreach ($this->_component as $val) {
- if (CRM_Utils_Array::value($val, $this->_selectComponent) && ($val != 'activity_civireport' && $val != 'relationship_civireport')) {
+ if (!empty($this->_selectComponent[$val]) && ($val != 'activity_civireport' && $val != 'relationship_civireport')) {
$sql = "{$this->_selectComponent[$val]} {$this->_formComponent[$val]}
WHERE {$this->_aliases['civicrm_contact']}.id IN ( $selectedContacts )
GROUP BY {$this->_aliases['civicrm_contact']}.id,{$val}.id ";
}
}
- if (CRM_Utils_Array::value('relationship_civireport', $this->_selectComponent)) {
+ if (!empty($this->_selectComponent['relationship_civireport'])) {
$relTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE);
}
}
- if (CRM_Utils_Array::value('activity_civireport', $this->_selectComponent)) {
+ if (!empty($this->_selectComponent['activity_civireport'])) {
$componentClause = "civicrm_option_value.component_id IS NULL";
$componentsIn = NULL;
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['log_civicrm_entity_altered_contact_id'], 'is_deleted') !== '0';
}
- if (CRM_Utils_Array::value('log_civicrm_entity_altered_contact', $row) &&
+ if (!empty($row['log_civicrm_entity_altered_contact']) &&
!$isDeleted[$row['log_civicrm_entity_altered_contact_id']]) {
$row['log_civicrm_entity_altered_contact_link'] =
CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_entity_altered_contact_id']);
INNER JOIN civicrm_contact modified_contact_civireport
ON (entity_log_civireport.{$detail['fk']} = modified_contact_civireport.id {$clause})";
- if (CRM_Utils_Array::value('joins', $detail)) {
+ if (!empty($detail['joins'])) {
$clause = CRM_Utils_Array::value('entity_table', $detail);
$clause = $clause ? "AND fk_table.entity_table = 'civicrm_contact'" : null;
$joinClause = "
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
}
if (!empty($clause)) {
- if (CRM_Utils_Array::value('having', $field)) {
+ if (!empty($field['having'])) {
$havingClauses[] = $clause;
}
else {
elseif (CRM_Utils_Array::value('is_active_value', $this->_params) == '0') {
$relStatus = 'Is equal to Inactive';
}
- if (CRM_Utils_Array::value('filters', $statistics)) {
+ if (!empty($statistics['filters'])) {
foreach ($statistics['filters'] as $id => $value) {
//for displaying relationship type filter
if ($value['title'] == 'Relationship') {
$this->relationType = NULL;
$relType = array();
- if (CRM_Utils_Array::value('relationship_type_id_value', $this->_params)) {
+ if (!empty($this->_params['relationship_type_id_value'])) {
$relType = explode('_', $this->_params['relationship_type_id_value']);
$this->relationType = $relType[1] . '_' . $relType[2];
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_email') {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
switch ($fieldName) {
{$this->_aliases['civicrm_email']}.is_primary = 1\n";
}
// include contribution note
- if (CRM_Utils_Array::value('contribution_note', $this->_params['fields']) ||
+ if (!empty($this->_params['fields']['contribution_note']) ||
CRM_Utils_Array::value('note_value', $this->_params)) {
$this->_from.= "
LEFT JOIN civicrm_note {$this->_aliases['civicrm_note']}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_address') {
continue;
}
- if (CRM_Utils_Array::value('is_statistics', $field)) {
+ if (!empty($field['is_statistics'])) {
$this->_columnHeaders[$fieldName]['type'] = $field['type'];
$this->_columnHeaders[$fieldName]['title'] = $field['title'];
continue;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
- if (CRM_Utils_Array::value('no_display', $field)) {
+ if (!empty($field['no_display'])) {
$this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = TRUE;
}
}
$this->_statusClause = " AND " . $clause;
}
- if (CRM_Utils_Array::value('having', $field)) {
+ if (!empty($field['having'])) {
$havingClauses[] = $clause;
}
else {
static function formRule($fields, $files, $self) {
$errors = array();
- if (CRM_Utils_Array::value('this_year_value', $fields) &&
+ if (!empty($fields['this_year_value']) &&
CRM_Utils_Array::value('other_year_value', $fields) &&
($fields['this_year_value'] == $fields['other_year_value'])
) {
}
function fixReportParams() {
- if (CRM_Utils_Array::value('this_year_value', $this->_params)) {
+ if (!empty($this->_params['this_year_value'])) {
$this->_referenceYear['this_year'] = $this->_params['this_year_value'];
}
- if (CRM_Utils_Array::value('other_year_value', $this->_params)) {
+ if (!empty($this->_params['other_year_value'])) {
$this->_referenceYear['other_year'] = $this->_params['other_year_value'];
}
}
$addWhere = '';
- if (CRM_Utils_Array::value('other_year', $this->_referenceYear)) {
+ if (!empty($this->_referenceYear['other_year'])) {
(CRM_Utils_Array::value('other_year_op', $this->_params) == 'calendar') ? $other_receive_date = 'YEAR (contri.receive_date)' : $other_receive_date = self::fiscalYearOffset('contri.receive_date');
$addWhere .= " AND {$this->_aliases['civicrm_contact']}.id NOT IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$other_receive_date} = {$this->_referenceYear['other_year']} AND contri.is_test = 0 ) ";
}
- if (CRM_Utils_Array::value('this_year', $this->_referenceYear)) {
+ if (!empty($this->_referenceYear['this_year'])) {
(CRM_Utils_Array::value('this_year_op', $this->_params) == 'calendar') ? $receive_date = 'YEAR (contri.receive_date)' : $receive_date = self::fiscalYearOffset('contri.receive_date');
$addWhere .= " AND {$this->_aliases['civicrm_contact']}.id IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$receive_date} = {$this->_referenceYear['this_year']} AND contri.is_test = 0 ) ";
}
}
foreach (array_keys($this->_relationshipColumns) as $col) {
- if (CRM_Utils_Array::value($col, $relRow)) {
+ if (!empty($relRow[$col])) {
$relatedRow[$col] = $relRow[$col];
}
}
}
// Convert Display name into link
- if (CRM_Utils_Array::value('civicrm_contact_sort_name', $row) &&
+ if (!empty($row['civicrm_contact_sort_name']) &&
CRM_Utils_Array::value('civicrm_contact_id', $row)
) {
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_address') {
$this->_emailField = TRUE;
}
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}_{$stat}";
$this->_columnHeaders["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label;
$params = array('contact_type_b' => 'Household', 'version' => 3);
$typesA = civicrm_api('relationship_type', 'get', $params);
- if (!CRM_Utils_Array::value('is_error', $typesA)) {
+ if (empty($typesA['is_error'])) {
foreach ($typesA['values'] as $rel) {
$relationTypes[$rel['id']][$rel['id'] . '_b_a'] = $rel['label_b_a'];
}
}
$params = array('contact_type_a' => 'Household', 'version' => 3);
$typesB = civicrm_api('relationship_type', 'get', $params);
- if (!CRM_Utils_Array::value('is_error', $typesB)) {
+ if (empty($typesB['is_error'])) {
foreach ($typesB['values'] as $rel) {
$relationTypes[$rel['id']][$rel['id'] . '_a_b'] = $rel['label_a_b'];
//$this->relationTypes[$rel['id'].'_a_b'] = $rel['label_a_b'];
$entryFound = TRUE;
}
- if (CRM_Utils_Array::value('civicrm_contribution_total_amount', $row)) {
+ if (!empty($row['civicrm_contribution_total_amount'])) {
$row['civicrm_contribution_total_amount'] = CRM_Utils_Money::format($row['civicrm_contribution_total_amount'], $row['civicrm_contribution_currency']);
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($fieldName == 'total_amount') {
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
}
- if (CRM_Utils_Array::value('no_display', $field)) {
+ if (!empty($field['no_display'])) {
$this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = TRUE;
}
}
$this->groupBy();
$rows = $contactIds = array();
- if (!CRM_Utils_Array::value('charts', $this->_params)) {
+ if (empty($this->_params['charts'])) {
$this->limit();
$getContacts = "SELECT SQL_CALC_FOUND_ROWS {$this->_aliases['civicrm_contact']}.id as cid {$this->_from} {$this->_where} GROUP BY {$this->_aliases['civicrm_contact']}.id {$this->_limit}";
}
if (!empty($contactIds) || CRM_Utils_Array::value('charts', $this->_params)) {
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
}
else {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_address') {
$this->_emailField = TRUE;
}
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}_{$stat}";
$this->_columnHeaders["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label;
$params = array('contact_type_b' => 'Organization', 'version' => 3);
$typesA = &civicrm_api('relationship_type', 'get', $params);
- if (!CRM_Utils_Array::value('is_error', $typesA)) {
+ if (empty($typesA['is_error'])) {
foreach ($typesA['values'] as $rel) {
$relationTypes[$rel['id']][$rel['id'] . '_b_a'] = $rel['label_b_a'];
}
$params = array('contact_type_a' => 'Organization', 'version' => 3);
$typesB = &civicrm_api('relationship_type', 'get', $params);
- if (!CRM_Utils_Array::value('is_error', $typesB)) {
+ if (empty($typesB['is_error'])) {
foreach ($typesB['values'] as $rel) {
$relationTypes[$rel['id']][$rel['id'] . '_a_b'] = $rel['label_a_b'];
}
$repeatFound = FALSE;
foreach ($row as $colName => $colVal) {
- if (CRM_Utils_Array::value($colName, $checkList) &&
+ if (!empty($checkList[$colName]) &&
is_array($checkList[$colName]) &&
in_array($colVal, $checkList[$colName])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if (isset($field['clause'])) {
$select[] = "{$field['dbAlias']} as {$field['alias']}_{$field['name']}";
$this->_columnHeaders["{$field['alias']}_{$field['name']}"]['type'] = CRM_Utils_Array::value('type', $field);
$this->_columnHeaders["{$field['alias']}_{$field['name']}"]['title'] = CRM_Utils_Array::value('title', $field);
- if (CRM_Utils_Array::value('no_display', $field)) {
+ if (!empty($field['no_display'])) {
$this->_columnHeaders["{$field['alias']}_{$field['name']}"]['no_display'] = TRUE;
}
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
if ($tableCol) {
return array($tableName, $field['alias'], $field['name']);
}
if (!$this->_amountClauseWithAND) {
$amountClauseWithAND = array();
- if (CRM_Utils_Array::value('total_amount1', $clauses)) {
+ if (!empty($clauses['total_amount1'])) {
$amountClauseWithAND[] = str_replace("{$this->_aliases['civicrm_contribution']}.total_amount",
"{$this->_aliases['civicrm_contribution']}1.total_amount_sum", $clauses['total_amount1']);
}
- if (CRM_Utils_Array::value('total_amount2', $clauses)) {
+ if (!empty($clauses['total_amount2'])) {
$amountClauseWithAND[] = str_replace("{$this->_aliases['civicrm_contribution']}.total_amount",
"{$this->_aliases['civicrm_contribution']}2.total_amount_sum", $clauses['total_amount2']);
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
}
// only include statistics columns if set
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
case 'sum':
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
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";
$field['title'] = 'Quarter';
break;
}
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
+ if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
// only include statistics columns if set
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
case 'sum':
$ignoreFields = array('total_amount', 'sort_name');
$errors = $self->customDataFormRule($fields, $ignoreFields);
- if (!CRM_Utils_Array::value('receive_date', $fields['group_bys'])) {
- if (CRM_Utils_Array::value('receive_date_relative', $fields) ||
+ if (empty($fields['group_bys']['receive_date'])) {
+ if (!empty($fields['receive_date_relative']) ||
CRM_Utils_Date::isDate($fields['receive_date_from']) ||
CRM_Utils_Date::isDate($fields['receive_date_to'])
) {
$errors['receive_date_relative'] = ts("Do not use filter on Date if group by Receive Date is not used ");
}
}
- if (!CRM_Utils_Array::value('total_amount', $fields['fields'])) {
+ if (empty($fields['fields']['total_amount'])) {
foreach (array(
'total_count_value', 'total_sum_value', 'total_avg_value') as $val) {
- if (CRM_Utils_Array::value($val, $fields)) {
+ if (!empty($fields[$val])) {
$errors[$val] = ts("Please select the Amount Statistics");
}
}
function from() {
$softCreditJoin = "LEFT";
- if (CRM_Utils_Array::value('soft_amount', $this->_params['fields']) &&
+ if (!empty($this->_params['fields']['soft_amount']) &&
!CRM_Utils_Array::value('total_amount', $this->_params['fields'])) {
// if its only soft credit stats, use inner join
$softCreditJoin = "INNER";
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
- if (CRM_Utils_Array::value('chart', $field)) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
+ if (!empty($field['chart'])) {
$this->assign('chartSupported', TRUE);
}
- if (CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) &&
+ if (!empty($table['group_bys'][$fieldName]['frequency']) &&
CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])
) {
function storeWhereHavingClauseArray(){
parent::storeWhereHavingClauseArray();
- if (!CRM_Utils_Array::value('soft_amount', $this->_params['fields']) && !empty($this->_havingClauses)){
+ if (empty($this->_params['fields']['soft_amount']) && !empty($this->_havingClauses)){
foreach ($this->_havingClauses as $key => $havingClause) {
if (stristr($havingClause, 'soft_soft')){
unset($this->_havingClauses[$key]);
function buildChart(&$rows) {
$graphRows = array();
- if (CRM_Utils_Array::value('charts', $this->_params)) {
- if (CRM_Utils_Array::value('receive_date', $this->_params['group_bys'])) {
+ if (!empty($this->_params['charts'])) {
+ if (!empty($this->_params['group_bys']['receive_date'])) {
$contrib = !empty($this->_params['fields']['total_amount']) ? TRUE : FALSE;
$softContrib = !empty($this->_params['fields']['soft_amount']) ? TRUE : FALSE;
foreach ($rows as $rowNum => $row) {
// make count columns point to detail report
- if (CRM_Utils_Array::value('receive_date', $this->_params['group_bys']) &&
+ 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 (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($fieldName == 'total_amount') {
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
- if (CRM_Utils_Array::value('no_display', $field)) {
+ if (!empty($field['no_display'])) {
$this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = TRUE;
}
}
$this->groupBy();
$rows = $contactIds = array();
- if (!CRM_Utils_Array::value('charts', $this->_params)) {
+ if (empty($this->_params['charts'])) {
$this->limit();
$getContacts = "SELECT SQL_CALC_FOUND_ROWS {$this->_aliases['civicrm_contact']}.id as cid {$this->_from} {$this->_where} GROUP BY {$this->_aliases['civicrm_contact']}.id {$this->_limit}";
}
if (!empty($contactIds) || CRM_Utils_Array::value('charts', $this->_params)) {
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
}
else {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
// only include statistics columns if set
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
case 'sum':
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
case 'count':
$this->_interval = 'events';
$countEvent = NULL;
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $value) {
if ($value['civicrm_event_id']) {
$graphRows['totalParticipants'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
case 'sum':
function groupBy() {
$this->_groupBy = "";
- if (CRM_Utils_Array::value('group_bys', $this->_params) &&
+ if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
$this->_groupBy[] = $field['dbAlias'];
}
}
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_contribution') {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
$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 (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
function buildChart(&$rows) {
$this->_interval = 'events';
$countEvent = NULL;
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $value) {
$graphRows['totalAmount'][] = $graphRows['value'][] = CRM_Utils_Array::value('totalAmount', $rows[$key]);
$graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" . $rows[$key]['civicrm_event_id'] . ") ";
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
function groupBy() {
$this->_groupBy = "";
- if (CRM_Utils_Array::value('group_bys', $this->_params) &&
+ if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
$this->_groupBy[] = $field['dbAlias'];
}
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
function groupBy() {
$this->_groupBy = '';
- if (CRM_Utils_Array::value('fields', $this->_params) &&
+ if (!empty($this->_params['fields']) &&
is_array($this->_params['fields']) &&
!empty($this->_params['fields'])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['fields'])) {
+ if (!empty($this->_params['fields'][$fieldName])) {
$this->_groupBy[] = $field['dbAlias'];
}
}
}
foreach ($rows as $key => $values) {
- if (CRM_Utils_Array::value('civicrm_grant_grant_report_received', $values)) {
+ if (!empty($values['civicrm_grant_grant_report_received'])) {
$grantReportsReceived++;
}
- if (CRM_Utils_Array::value('civicrm_grant_grant_type_id', $values)) {
+ if (!empty($values['civicrm_grant_grant_type_id'])) {
$grantType = CRM_Utils_Array::value($values['civicrm_grant_grant_type_id'], $grantTypes);
$grantStatistics['civicrm_grant_grant_type_id']['title'] = ts('By Grant Type');
self::getStatistics($grantStatistics['civicrm_grant_grant_type_id'], $grantType, $values,
$defaults['report_header'] = CRM_Utils_Array::value('header', $defaults);
$defaults['report_footer'] = CRM_Utils_Array::value('footer', $defaults);
- if (CRM_Utils_Array::value('navigation_id', $defaults)) {
+ if (!empty($defaults['navigation_id'])) {
//get the default navigation parent id
$params = array('id' => $defaults['navigation_id']);
CRM_Core_BAO_Navigation::retrieve($params, $navigationDefaults);
$defaults['is_navigation'] = 1;
$defaults['parent_id'] = CRM_Utils_Array::value('parent_id', $navigationDefaults);
- if (CRM_Utils_Array::value('is_active', $navigationDefaults)) {
+ if (!empty($navigationDefaults['is_active'])) {
$form->assign('is_navigation', TRUE);
}
- if (CRM_Utils_Array::value('id', $navigationDefaults)) {
+ if (!empty($navigationDefaults['id'])) {
$form->_navigation['id'] = $navigationDefaults['id'];
$form->_navigation['parent_id'] = $navigationDefaults['parent_id'];
}
}
- if (CRM_Utils_Array::value('grouprole', $defaults)) {
+ if (!empty($defaults['grouprole'])) {
foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $defaults['grouprole']) as $value) {
$grouproles[] = $value;
}
$instanceID = NULL; //unset $instanceID so a new copy would be created
}
$params['instance_id'] = $instanceID;
- if (CRM_Utils_Array::value('is_navigation', $params)) {
+ if (!empty($params['is_navigation'])) {
$params['navigation'] = $form->_navigation;
}
elseif ($instanceID){
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_email') {
}
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
$select[] = "COUNT({$this->_aliases['civicrm_mailing_event_bounce']}.id) as civicrm_mailing_bounce_count";
$this->_columnHeaders["civicrm_mailing_bounce_count"]['title'] = ts('Bounce Count');
}
}
function groupBy() {
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_mailing']}.id";
}
else {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_email') {
}
}
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
$select[] = "COUNT(civicrm_mailing_event_trackable_url_open.id) as civicrm_mailing_click_count";
$this->_columnHeaders["civicrm_mailing_click_count"]['title'] = ts('Click Count');
}
function groupBy() {
$this->_groupBy = '';
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_mailing']}.id";
}
else {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if (in_array($fieldName, array(
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_email') {
}
}
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
$select[] = "COUNT(civicrm_mailing_event_opened.id) as civicrm_mailing_opened_count";
$this->_columnHeaders["civicrm_mailing_opened_count"]['title'] = ts('Opened Count');
}
}
function groupBy() {
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_mailing']}.id";
}
else {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
# for statistics
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
switch ($field['statistics']['calc']) {
case 'PERCENTAGE':
$base_table_column = explode('.', $field['statistics']['base']);
function formRule($fields, $files, $self) {
$errors = array();
- if (!CRM_Utils_Array::value('charts', $fields)) {
+ if (empty($fields['charts'])) {
return $errors;
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_address') {
}
// only include statistics columns if set
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
case 'sum':
";
//for premiums
- if (CRM_Utils_Array::value('product_name', $this->_params['fields']) || CRM_Utils_Array::value('product_option', $this->_params['fields'])) {
+ if (!empty($this->_params['fields']['product_name']) || CRM_Utils_Array::value('product_option', $this->_params['fields'])) {
$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)
}
// include contribution note
- if (CRM_Utils_Array::value('contribution_note', $this->_params['fields']) || !empty($this->_params['note_value'])) {
+ 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
}
- if (CRM_Utils_Array::value('phone', $this->_params['fields'])) {
+ if (!empty($this->_params['fields']['phone'])) {
$this->_from .= "
LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']}
ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND
function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id ";
- if (CRM_Utils_Array::value('first_donation_date', $this->_params['fields'])
- || CRM_Utils_Array::value('first_donation_amount', $this->_params['fields'])) {
+ if (!empty($this->_params['fields']['first_donation_date']) || CRM_Utils_Array::value('first_donation_amount', $this->_params['fields'])) {
$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 (CRM_Utils_Array::value('csv_display', $field) && CRM_Utils_Array::value('no_display', $field)) {
+ if (!empty($field['csv_display']) && CRM_Utils_Array::value('no_display', $field)) {
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
$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 (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_address') {
// in previous row
$repeatFound = FALSE;
foreach ($row as $colName => $colVal) {
- if (CRM_Utils_Array::value($colName, $checkList) &&
+ if (!empty($checkList[$colName]) &&
is_array($checkList[$colName]) &&
in_array($colVal, $checkList[$colName])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
// to include optional columns address ,email and phone only if checked
$repeatFound = FALSE;
foreach ($row as $colName => $colVal) {
- if (CRM_Utils_Array::value($colName, $checkList) &&
+ if (!empty($checkList[$colName]) &&
is_array($checkList[$colName]) &&
in_array($colVal, $checkList[$colName])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
case 'YEARWEEK':
$field['title'] = 'Quarter';
break;
}
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
+ if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
// only include statistics columns if set
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
$this->_statFields[] = 'civicrm_membership_member_count';
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
}
}
elseif ($fieldName == 'membership_type_id') {
- if (!CRM_Utils_Array::value('membership_type_id', $this->_params['group_bys']) &&
+ if (empty($this->_params['group_bys']['membership_type_id']) &&
CRM_Utils_Array::value('join_date', $this->_params['group_bys'])
) {
$select[] = "GROUP_CONCAT(DISTINCT {$field['dbAlias']} ORDER BY {$field['dbAlias']} ) as {$tableName}_{$fieldName}";
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
- if (CRM_Utils_Array::value('chart', $field)) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
+ if (!empty($field['chart'])) {
$this->assign('chartSupported', TRUE);
}
- if (CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) &&
+ if (!empty($table['group_bys'][$fieldName]['frequency']) &&
CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])
) {
$membershipTypeValues = CRM_Member_PseudoConstant::membershipType();
$isMembershipType = CRM_Utils_Array::value('membership_type_id', $this->_params['group_bys']);
$isJoiningDate = CRM_Utils_Array::value('join_date', $this->_params['group_bys']);
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $row) {
if (!($row['civicrm_membership_join_date_subtotal'] &&
$row['civicrm_membership_membership_type_id']
if ($join_date) {
list($year, $month) = explode('-', $join_date);
}
- if (CRM_Utils_Array::value('civicrm_membership_join_date_subtotal', $row)) {
+ if (!empty($row['civicrm_membership_join_date_subtotal'])) {
switch ($this->_interval) {
case 'Month':
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
// make count columns point to detail report
- if (CRM_Utils_Array::value('join_date', $this->_params['group_bys']) &&
+ if (!empty($this->_params['group_bys']['join_date']) &&
CRM_Utils_Array::value('civicrm_membership_join_date_start', $row) &&
$row['civicrm_membership_join_date_start'] &&
$row['civicrm_membership_join_date_subtotal']
break;
}
$typeUrl = '';
- if (CRM_Utils_Array::value('membership_type_id', $this->_params['group_bys']) &&
+ if (!empty($this->_params['group_bys']['membership_type_id']) &&
$typeID = $row['civicrm_membership_membership_type_id']
) {
$typeUrl = "&tid_op=in&tid_value={$typeID}";
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
// to include optional columns address and email, only if checked
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
$this->_groupBy[] = $field['dbAlias'];
}
}
$row[$key] = $dao->$key;
}
- if (CRM_Utils_Array::value('charts', $this->_params) &&
+ if (!empty($this->_params['charts']) &&
$row['civicrm_contribution_receive_date_subtotal']
) {
$graphRows['receive_date'][] = $row['civicrm_contribution_receive_date_start'];
$this->assign_by_ref('rows', $rows);
$this->assign('statistics', $this->statistics($rows));
- if (CRM_Utils_Array::value('charts', $this->_params)) {
+ if (!empty($this->_params['charts'])) {
foreach (array(
'receive_date', $this->_interval, 'value') as $ignore) {
unset($graphRows[$ignore][$count - 1]);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
// to include optional columns address and email, only if checked
{$this->_aliases['civicrm_email']}.is_primary = 1\n";
}
- if(CRM_Utils_Array::value('total_paid', $this->_params['fields'])){
+ if (!empty($this->_params['fields']['total_paid'])){
$this->_from .= "
LEFT JOIN civicrm_pledge_payment {$this->_aliases['civicrm_pledge_payment']} ON
{$this->_aliases['civicrm_pledge']}.id = {$this->_aliases['civicrm_pledge_payment']}.pledge_id
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
- if (CRM_Utils_Array::value('chart', $field)) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
+ if (!empty($field['chart'])) {
$this->assign('chartSupported', TRUE);
}
- if (CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) &&
+ if (!empty($table['group_bys'][$fieldName]['frequency']) &&
CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])
) {
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_address') {
$params['toEmail'] = CRM_Utils_Array::value('email_to', $instanceInfo);
$params['cc'] = CRM_Utils_Array::value('email_cc', $instanceInfo);
$params['subject'] = CRM_Utils_Array::value('email_subject', $instanceInfo);
- if (!CRM_Utils_Array::value('attachments', $instanceInfo)) {
+ if (empty($instanceInfo['attachments'])) {
$instanceInfo['attachments'] = array();
}
$params['attachments'] = array_merge(CRM_Utils_Array::value('attachments', $instanceInfo), $attachments);
foreach (array(
'name', 'group_id', 'is_sms') as $n) {
- if (CRM_Utils_Array::value($n, $values)) {
+ if (!empty($values[$n])) {
$params[$n] = $values[$n];
}
}
$formValues = $this->controller->exportValues($this->_name);
foreach ($uploadParams as $key) {
- if (CRM_Utils_Array::value($key, $formValues)) {
+ if (!empty($formValues[$key])) {
$params[$key] = $formValues[$key];
$this->set($key, $formValues[$key]);
}
if ($formValues['upload_type']) {
$composeParams = array();
foreach ($composeFields as $key) {
- if (CRM_Utils_Array::value($key, $formValues)) {
+ if (!empty($formValues[$key])) {
$composeParams[$key] = $formValues[$key];
$this->set($key, $formValues[$key]);
}
}
- if (CRM_Utils_Array::value('updateTemplate', $composeParams)) {
+ if (!empty($composeParams['updateTemplate'])) {
$templateParams = array(
'msg_text' => $text_message,
'is_active' => TRUE,
$msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
}
- if (CRM_Utils_Array::value('saveTemplate', $composeParams)) {
+ if (!empty($composeParams['saveTemplate'])) {
$templateParams = array(
'msg_text' => $text_message,
'is_active' => TRUE,
* @static
*/
static function formRule($params, $files, $self) {
- if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST)) {
+ if (!empty($_POST['_qf_Import_refresh'])) {
return TRUE;
}
$errors = array();
}
}
else {
- if (!CRM_Utils_Array::value('text_message', $params)) {
+ if (empty($params['text_message'])) {
$errors['text_message'] = ts('Please provide a Text');
}
else {
- if (CRM_Utils_Array::value('text_message', $params)) {
+ if (!empty($params['text_message'])) {
$messageCheck = CRM_Utils_Array::value('text_message', $params);
if ($messageCheck && (strlen($messageCheck) > CRM_SMS_Provider::MAX_SMS_CHAR)) {
$errors['text_message'] = ts("You can configure the SMS message body up to %1 characters", array(1 => CRM_SMS_Provider::MAX_SMS_CHAR));
}
}
}
- if (CRM_Utils_Array::value('saveTemplate', $params) && !CRM_Utils_Array::value('saveTemplateName', $params)) {
+ if (!empty($params['saveTemplate']) && !CRM_Utils_Array::value('saveTemplateName', $params)) {
$errors['saveTemplateName'] = ts('Please provide a Template Name.');
}
}
}
$templateName = CRM_Core_BAO_MessageTemplate::getMessageTemplates();
- if (CRM_Utils_Array::value('saveTemplate', $params)
- && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName)
+ if (!empty($params['saveTemplate']) && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName)
) {
$errors['saveTemplate'] = ts('Duplicate Template Name.');
}
*/
public function buildQuickForm() {
foreach ($this->_fields as $name => $field) {
- if (!CRM_Utils_Array::value('is_view', $field)) {
+ if (empty($field['is_view'])) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE);
}
}
}
$fieldTypeValues = CRM_Core_BAO_UFGroup::groupTypeValues($gid, $fieldType);
- if (!CRM_Utils_Array::value($fieldType, $fieldTypeValues)) {
+ if (empty($fieldTypeValues[$fieldType])) {
return;
}
// create uf group
$ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids);
- if (CRM_Utils_Array::value('is_active', $params)) {
+ if (!empty($params['is_active'])) {
//make entry in uf join table
CRM_Core_BAO_UFGroup::createUFJoin($params, $ufGroup->id);
}
$returnGroupTypes[$type] = $type;
}
- if (CRM_Utils_Array::value(1, $groupTypeParts)) {
+ if (!empty($groupTypeParts[1])) {
foreach (explode(',', $groupTypeParts[1]) as $typeValue) {
$groupTypeValues = $valueLabels = array();
$valueParts = explode(':', $typeValue);
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$addTo = explode('.', $dao->name);
- if (CRM_Utils_Array::value(2, $addTo)) {
+ if (!empty($addTo[2])) {
$options = array ('optionGroup' => $dao->name);
self::createPriceSet($daoName, $addTo, $options);
}
}
$optionValue = array();
- if (CRM_Utils_Array::value('optionGroup', $options)) {
+ if (!empty($options['optionGroup'])) {
CRM_Core_OptionGroup::getAssoc($options['optionGroup'], $optionValue);
if (empty($optionValue))
return;
}
- elseif (!CRM_Utils_Array::value('otherAmount', $options) && !CRM_Utils_Array::value('membership', $options)) {
+ elseif (empty($options['otherAmount']) && !CRM_Utils_Array::value('membership', $options)) {
//CRM-12273
//if options group, otherAmount, membersip is empty then return, contribution should be default price set
return;
CRM_Upgrade_Snapshot_V4p2_Price_BAO_Set::addTo($addTo[0], $addTo[2], $priceSet->id, 1);
$fieldParams['price_set_id'] = $priceSet->id;
- if (CRM_Utils_Array::value('optionGroup', $options)) {
+ if (!empty($options['optionGroup'])) {
$fieldParams['html_type'] = 'Radio';
$fieldParams['is_required'] = 1;
if ($addTo[0] == 'civicrm_event') {
$fieldParams['label'] = "Contribution Amount";
$defaultAmountColumn = 'default_amount_id';
$options['otherAmount'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $addTo[2], 'is_allow_other_amount');
- if (CRM_Utils_Array::value('otherAmount', $options)) {
+ if (!empty($options['otherAmount'])) {
$fieldParams['is_required'] = 0;
}
}
$priceField = CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field::create($fieldParams);
}
- if (CRM_Utils_Array::value('membership', $options)) {
+ if (!empty($options['membership'])) {
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $addTo[2];
}
}
}
- if (CRM_Utils_Array::value('otherAmount', $options)) {
+ if (!empty($options['otherAmount'])) {
$fieldParams = array(
'name' => strtolower(CRM_Utils_String::munge("Other Amount", '_', 245)),
$formValues = unserialize($instances->form_values);
// replace display_name fields by sort_name
- if (CRM_Utils_Array::value('fields', $formValues) && isset($formValues['fields']['display_name'])) {
+ if (!empty($formValues['fields']) && isset($formValues['fields']['display_name'])) {
$formValues['fields']['sort_name'] = $formValues['fields']['display_name'];
unset($formValues['fields']['display_name']);
}
}
}
else {
- if (CRM_Utils_Array::value('default_option', $params)
- ) {
+ if (!empty($params['default_option'])) {
$defaultArray[$params['default_option']] = 1;
}
}
if (property_exists($qf,'_membershipBlock') && CRM_Utils_Array::value('is_separate_payment', $qf->_membershipBlock) && $qf->_quickConfig && $field->name == 'other_amount' && !property_exists($qf,'_contributionAmount')) {
$label = ts('Additional Contribution');
$useRequired = 0;
- } elseif (CRM_Utils_Array::value('label', $fieldOptions[$optionKey])) { //check for label.
+ } elseif (!empty($fieldOptions[$optionKey]['label'])) { //check for label.
$label = $fieldOptions[$optionKey]['label'];
}
if (!$field->is_required) {
// add "none" option
- if (CRM_Utils_Array::value('is_allow_other_amount', $otherAmount) && $field->name == 'contribution_amount') {
+ 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') {
$none = ts('No thank you');
while ($priceField->fetch()) {
$key = "price_{$priceField->id}";
- if (CRM_Utils_Array::value($key, $fields)) {
+ if (!empty($fields[$key])) {
$priceFields[$priceField->id] = $fields[$key];
}
}
if ($id = CRM_Utils_Array::value('id', $ids)) {
$fieldValueBAO->id = $id;
}
- if (CRM_Utils_Array::value('is_default', $params)) {
+ if (!empty($params['is_default'])) {
$query = 'UPDATE civicrm_price_field_value SET is_default = 0 WHERE price_field_id = %1';
$p = array(1 => array($params['price_field_id'], 'Integer'));
CRM_Core_DAO::executeQuery($query, $p);
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue', $oldWeight, $params['weight'], $fieldValues);
}
else {
- if (!CRM_Utils_Array::value('name', $params)) {
+ if (empty($params['name'])) {
$params['name'] = CRM_Utils_String::munge(CRM_Utils_Array::value('label', $params), '_', 64);
}
- if (!CRM_Utils_Array::value('weight', $params)) {
+ if (empty($params['weight'])) {
$params['weight'] = 1;
}
}
$radioLevel = $checkboxLevel = $selectLevel = $textLevel = array();
foreach ($fields as $id => $field) {
- if (!CRM_Utils_Array::value("price_{$id}", $params) ||
+ if (empty($params["price_{$id}"]) ||
(empty($params["price_{$id}"]) && $params["price_{$id}"] == NULL)
) {
// skip if nothing was submitted for this field
static $_contact_memberships = array();
$checklifetime = FALSE;
foreach ($options as $key => $value) {
-if (CRM_Utils_Array::value('membership_type_id', $value)) {
+if (!empty($value['membership_type_id'])) {
if (!isset($_contact_memberships[$userid][$value['membership_type_id']])) {
$_contact_memberships[$userid][$value['membership_type_id']] = CRM_Member_BAO_Membership::getContactMembership($userid, $value['membership_type_id'], FALSE);
}
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('import', $field)) {
+ if (!empty($field['import'])) {
if ($prefix) {
self::$_import['price_field'] = & $fields[$name];
} else {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('export', $field)) {
+ if (!empty($field['export'])) {
if ($prefix) {
self::$_export['price_field'] = & $fields[$name];
} else {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('import', $field)) {
+ if (!empty($field['import'])) {
if ($prefix) {
self::$_import['price_field_value'] = & $fields[$name];
} else {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('export', $field)) {
+ if (!empty($field['export'])) {
if ($prefix) {
self::$_export['price_field_value'] = & $fields[$name];
} else {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('import', $field)) {
+ if (!empty($field['import'])) {
if ($prefix) {
self::$_import['line_item'] = & $fields[$name];
} else {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('export', $field)) {
+ if (!empty($field['export'])) {
if ($prefix) {
self::$_export['line_item'] = & $fields[$name];
} else {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('import', $field)) {
+ if (!empty($field['import'])) {
if ($prefix) {
self::$_import['price_set'] = & $fields[$name];
} else {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('export', $field)) {
+ if (!empty($field['export'])) {
if ($prefix) {
self::$_export['price_set'] = & $fields[$name];
} else {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('import', $field)) {
+ if (!empty($field['import'])) {
if ($prefix) {
self::$_import['price_set_entity'] = & $fields[$name];
} else {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
- if (CRM_Utils_Array::value('export', $field)) {
+ if (!empty($field['export'])) {
if ($prefix) {
self::$_export['price_set_entity'] = & $fields[$name];
} else {
$success = TRUE;
// consider address is automatically parseable,
// when we should found street_number and street_name
- if (!CRM_Utils_Array::value('street_name', $parsedFields) ||
+ if (empty($parsedFields['street_name']) ||
!CRM_Utils_Array::value('street_number', $parsedFields)
) {
$success = FALSE;
$date['M'] = $date['F'];
}
- if (CRM_Utils_Array::value('M', $date)) {
+ if (!empty($date['M'])) {
$date['M'] = (int ) $date['M'];
if ($date['M'] < 1 || $date['M'] > 12) {
return $invalidDate;
$date['M'] = 1;
}
- if (CRM_Utils_Array::value('d', $date)) {
+ if (!empty($date['d'])) {
$date['d'] = (int ) $date['d'];
}
else {
CRM_Utils_Array::value('s', $date) != NULL
) {
// we have time too..
- if (CRM_Utils_Array::value('h', $date)) {
+ if (!empty($date['h'])) {
if (CRM_Utils_Array::value('A', $date) == 'PM' or CRM_Utils_Array::value('a', $date) == 'pm') {
if ($date['h'] != 12) {
$date['h'] = $date['h'] + 12;
}
// in 24-hour format the hour is under the 'H' key
- if (CRM_Utils_Array::value('H', $date)) {
+ if (!empty($date['H'])) {
$date['H'] = (int) $date['H'];
}
else {
$date['H'] = 0;
}
- if (CRM_Utils_Array::value('i', $date)) {
+ if (!empty($date['i'])) {
$date['i'] = (int ) $date['i'];
}
else {
$date['h'] = $date['H'];
}
- if (CRM_Utils_Array::value('s', $date)) {
+ if (!empty($date['s'])) {
$date['s'] = (int ) $date['s'];
}
else {
$prevCen = $cen - 1;
$value = NULL;
- if (CRM_Utils_Array::value($dateParam, $params)) {
+ if (!empty($params[$dateParam])) {
// suppress hh:mm or hh:mm:ss if it exists CRM-7957
$value = preg_replace("/(\s(([01]\d)|[2][0-3])(:([0-5]\d)){1,2})$/", "", $params[$dateParam]);
}
break;
}
}
- if (!CRM_Utils_Array::value('financial_type_id', $values)) {
+ if (empty($values['financial_type_id'])) {
return civicrm_api3_create_error("Financial Type is not valid: $value");
}
break;
case 'payment_instrument':
require_once 'CRM/Core/OptionGroup.php';
$values['payment_instrument_id'] = CRM_Core_OptionGroup::getValue('payment_instrument', $value);
- if (!CRM_Utils_Array::value('payment_instrument_id', $values)) {
+ if (empty($values['payment_instrument_id'])) {
return civicrm_api3_create_error("Payment Instrument is not valid: $value");
}
break;
case 'honor_type_id':
require_once 'CRM/Core/OptionGroup.php';
$values['honor_type_id'] = CRM_Core_OptionGroup::getValue('honor_type', $value);
- if (!CRM_Utils_Array::value('honor_type_id', $values)) {
+ if (empty($values['honor_type_id'])) {
return civicrm_api3_create_error("Honor Type is not valid: $value");
}
break;
case 'pledge_id':
//giving respect to pledge_payment flag.
- if (!CRM_Utils_Array::value('pledge_payment', $params)) {
+ if (empty($params['pledge_payment'])) {
continue;
}
}
else {
// first get the contact id for given contribution record.
- if (CRM_Utils_Array::value('contribution_contact_id', $params)) {
+ if (!empty($params['contribution_contact_id'])) {
$contributionContactID = $params['contribution_contact_id'];
}
- elseif (CRM_Utils_Array::value('external_identifier', $params)) {
+ elseif (!empty($params['external_identifier'])) {
require_once 'CRM/Contact/DAO/Contact.php';
$contact = new CRM_Contact_DAO_Contact();
$contact->external_identifier = $params['external_identifier'];
}
}
- if (CRM_Utils_Array::value('pledge_id', $params)) {
+ if (!empty($params['pledge_id'])) {
if (CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_Pledge', $params['pledge_id'], 'contact_id') != $contributionContactID) {
return civicrm_api3_create_error('Invalid Pledge ID provided. Contribution row was skipped.', 'pledge_payment');
}
}
if (isset($values['individual_prefix'])) {
- if (CRM_Utils_Array::value('prefix_id', $params)) {
+ if (!empty($params['prefix_id'])) {
$prefixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
$params['prefix'] = $prefixes[$params['prefix_id']];
}
}
if (isset($values['individual_suffix'])) {
- if (CRM_Utils_Array::value('suffix_id', $params)) {
+ if (!empty($params['suffix_id'])) {
$suffixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id');
$params['suffix'] = $suffixes[$params['suffix_id']];
}
//CRM-4575
if (isset($values['email_greeting'])) {
- if (CRM_Utils_Array::value('email_greeting_id', $params)) {
+ if (!empty($params['email_greeting_id'])) {
$emailGreetingFilter = array(
'contact_type' => CRM_Utils_Array::value('contact_type', $params),
'greeting_type' => 'email_greeting',
}
if (isset($values['postal_greeting'])) {
- if (CRM_Utils_Array::value('postal_greeting_id', $params)) {
+ if (!empty($params['postal_greeting_id'])) {
$postalGreetingFilter = array(
'contact_type' => CRM_Utils_Array::value('contact_type', $params),
'greeting_type' => 'postal_greeting',
}
if (isset($values['addressee'])) {
- if (CRM_Utils_Array::value('addressee_id', $params)) {
+ if (!empty($params['addressee_id'])) {
$addresseeFilter = array(
'contact_type' => CRM_Utils_Array::value('contact_type', $params),
'greeting_type' => 'addressee',
}
if (isset($values['gender'])) {
- if (CRM_Utils_Array::value('gender_id', $params)) {
+ if (!empty($params['gender_id'])) {
$genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$params['gender'] = $genders[$params['gender_id']];
}
}
//format the website params.
- if (CRM_Utils_Array::value('url', $values)) {
+ if (!empty($values['url'])) {
static $websiteFields;
if (!is_array($websiteFields)) {
require_once 'CRM/Core/DAO/Website.php';
}
// get the formatted location blocks into params - w/ 3.0 format, CRM-4605
- if (CRM_Utils_Array::value('location_type_id', $values)) {
+ if (!empty($values['location_type_id'])) {
_civicrm_api3_deprecated_add_formatted_location_blocks($values, $params);
return TRUE;
}
/* Check for custom field values */
- if (!CRM_Utils_Array::value('custom', $fields)) {
+ if (empty($fields['custom'])) {
$fields['custom'] = &CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $values),
FALSE, FALSE, NULL, NULL, FALSE, FALSE, FALSE
);
$params[$name][++$blockCnt]
);
- if (!CRM_Utils_Array::value('id', $params) && ($blockCnt == 1)) {
+ if (empty($params['id']) && ($blockCnt == 1)) {
$params[$name][$blockCnt]['is_primary'] = TRUE;
}
// Note: we doing multiple value formatting here for address custom fields, plus putting into right format.
// The actual formatting (like date, country ..etc) for address custom fields is taken care of while saving
// the address in CRM_Core_BAO_Address::create method
- if (CRM_Utils_Array::value('location_type_id', $values)) {
+ if (!empty($values['location_type_id'])) {
static $customFields = array();
if (empty($customFields)) {
$customFields = CRM_Core_BAO_CustomField::getFields('Address');
}
//check for loc type id.
- if (!CRM_Utils_Array::value('location_type_id', $values)) {
+ if (empty($values['location_type_id'])) {
return civicrm_api3_create_error('Location Type Id missing.');
}
}
function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplicate = FALSE) {
//check if participant id is valid or not
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$participant = new CRM_Event_BAO_Participant();
$participant->id = $params['id'];
if (!$participant->find(TRUE)) {
}
require_once 'CRM/Contact/BAO/Contact.php';
//check if contact id is valid or not
- if (CRM_Utils_Array::value('contact_id', $params)) {
+ if (!empty($params['contact_id'])) {
$contact = new CRM_Contact_BAO_Contact();
$contact->id = $params['contact_id'];
if (!$contact->find(TRUE)) {
}
//check that event id is not an template
- if (CRM_Utils_Array::value('event_id', $params)) {
+ if (!empty($params['event_id'])) {
$isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template');
if (!empty($isTemplate)) {
return civicrm_api3_create_error(ts('Event templates are not meant to be registered'));
}
}
- if (!CRM_Utils_Array::value('contact_id', $params) && CRM_Utils_Array::value('id', $params)) {
+ if (empty($params['contact_id']) && CRM_Utils_Array::value('id', $params)) {
$valid = FALSE;
$error = '';
foreach ($fields as $field) {
if (is_array($field)) {
$valid = TRUE;
foreach ($field as $element) {
- if (!CRM_Utils_Array::value($element, $params)) {
+ if (empty($params[$element])) {
$valid = FALSE;
$error .= $element;
break;
}
}
else {
- if (CRM_Utils_Array::value($field, $params)) {
+ if (!empty($params[$field])) {
$valid = TRUE;
}
}
}
//check for organisations with same name
- if (CRM_Utils_Array::value('current_employer', $params)) {
+ if (!empty($params['current_employer'])) {
$organizationParams = array();
$organizationParams['organization_name'] = $params['current_employer'];
$dupeIds = CRM_Dedupe_Finder::dupesByParams($dedupParams, 'Organization', 'Supervised');
// check for mismatch employer name and id
- if (CRM_Utils_Array::value('employer_id', $params)
- && !in_array($params['employer_id'], $dupeIds)
+ if (!empty($params['employer_id']) && !in_array($params['employer_id'], $dupeIds)
) {
return civicrm_api3_create_error('Employer name and Employer id Mismatch');
}
// show error if multiple organisation with same name exist
- if (!CRM_Utils_Array::value('employer_id', $params)
- && (count($dupeIds) > 1)
+ if (empty($params['employer_id']) && (count($dupeIds) > 1)
) {
return civicrm_api3_create_error('Found more than one Organisation with same Name.');
}
*/
static function format(&$values, $stateName = FALSE) {
// we need a valid country, else we ignore
- if (!CRM_Utils_Array::value('country', $values)) {
+ if (empty($values['country'])) {
return FALSE;
}
$add = '';
- if (CRM_Utils_Array::value('street_address', $values)) {
+ if (!empty($values['street_address'])) {
$add = urlencode(str_replace('', '+', $values['street_address']));
$add .= ',+';
}
$add .= ',+';
}
- if (CRM_Utils_Array::value('state_province', $values)) {
- if (CRM_Utils_Array::value('state_province_id', $values)) {
+ if (!empty($values['state_province'])) {
+ if (!empty($values['state_province_id'])) {
$stateProvince = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StateProvince', $values['state_province_id']);
}
else {
}
}
- if (CRM_Utils_Array::value('postal_code', $values)) {
+ if (!empty($values['postal_code'])) {
$add .= '+' . urlencode(str_replace('', '+', $values['postal_code']));
$add .= ',+';
}
- if (CRM_Utils_Array::value('country', $values)) {
+ if (!empty($values['country'])) {
$add .= '+' . urlencode(str_replace('', '+', $values['country']));
}
$whereComponents = array();
- if (CRM_Utils_Array::value('street_address', $values)) {
+ if (!empty($values['street_address'])) {
$whereComponents['street'] = $values['street_address'];
}
$whereComponents['city'] = $city;
}
- if (CRM_Utils_Array::value('state_province', $values)) {
- if (CRM_Utils_Array::value('state_province_id', $values)) {
+ if (!empty($values['state_province'])) {
+ if (!empty($values['state_province_id'])) {
$stateProvince = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StateProvince', $values['state_province_id']);
}
else {
}
}
- if (CRM_Utils_Array::value('postal_code', $values)) {
+ if (!empty($values['postal_code'])) {
$whereComponents['postal'] = $values['postal_code'];
}
- if (CRM_Utils_Array::value('country', $values)) {
+ if (!empty($values['country'])) {
$whereComponents['country'] = $values['country'];
}
CRM_Utils_Hook::alterMailParams($params);
// check if any module has aborted mail sending
- if (
- CRM_Utils_Array::value('abortMailSend', $params) ||
+ if (!empty($params['abortMailSend']) ||
!CRM_Utils_Array::value('toEmail', $params)
) {
return FALSE;
$headers = array();
// CRM-10699 support custom email headers
- if (CRM_Utils_Array::value('headers', $params)) {
+ if (!empty($params['headers'])) {
$headers = array_merge($headers, $params['headers']);
}
$headers['From'] = $params['from'];
if ($includeMessageId) {
$headers['Message-ID'] = '<' . uniqid('civicrm_', TRUE) . "@$emailDomain>";
}
- if (CRM_Utils_Array::value('autoSubmitted', $params)) {
+ if (!empty($params['autoSubmitted'])) {
$headers['Auto-Submitted'] = "Auto-Generated";
}
if (get_class($mailer) != "Mail_mail") {
//get emails from headers, since these are
//combination of name and email addresses.
- if ( CRM_Utils_Array::value( 'Cc', $headers ) ) {
+ if (!empty($headers['Cc'])) {
$to[] = CRM_Utils_Array::value( 'Cc', $headers );
}
- if ( CRM_Utils_Array::value( 'Bcc', $headers ) ) {
+ if (!empty($headers['Bcc'])) {
$to[] = CRM_Utils_Array::value( 'Bcc', $headers );
}
}
if (empty($params)) {
return $chart;
}
- if (!CRM_Utils_Array::value('multiValues', $params)) {
+ if (empty($params['multiValues'])) {
$params['multiValues'] = array($params['values']);
}
// rotate the x labels.
$chartData['xLabelAngle'] = CRM_Utils_Array::value('xLabelAngle', $rows, 0);
- if (CRM_Utils_Array::value('tip', $rows)) {
+ if (!empty($rows['tip'])) {
$chartData['tip'] = $rows['tip'];
}
// carry some chart params if pass.
foreach (array(
'xSize', 'ySize', 'divName') as $f) {
- if (CRM_Utils_Array::value($f, $rows)) {
+ if (!empty($rows[$f])) {
$chartData[$f] = $rows[$f];
}
}
// rotate the x labels.
$chartData['xLabelAngle'] = CRM_Utils_Array::value('xLabelAngle', $chartInfo, 20);
- if (CRM_Utils_Array::value('tip', $chartInfo)) {
+ if (!empty($chartInfo['tip'])) {
$chartData['tip'] = $chartInfo['tip'];
}
// carry some chart params if pass.
foreach (array(
'xSize', 'ySize', 'divName') as $f) {
- if (CRM_Utils_Array::value($f, $rows)) {
+ if (!empty($rows[$f])) {
$chartData[$f] = $rows[$f];
}
}
$result = self::error('Could not interpret return values from function.');
}
- if (CRM_Utils_Array::value('json', $_REQUEST)) {
+ if (!empty($_REQUEST['json'])) {
header('Content-Type: text/javascript');
$json = json_encode(array_merge($result));
- if (CRM_Utils_Array::value('debug', $_REQUEST)) {
+ if (!empty($_REQUEST['debug'])) {
return self::jsonFormated($json);
}
return $json;
* @access public
*/
function orderBy() {
- if (!CRM_Utils_Array::value($this->_currentSortID, $this->_vars)) {
+ if (empty($this->_vars[$this->_currentSortID])) {
return '';
}
return NULL;
}
- if (!CRM_Utils_Array::value('query', $items)) {
+ if (empty($items['query'])) {
return $url;
}
$items['query'] = urlencode($items['query']);
$url = $items['scheme'] . '://';
- if (CRM_Utils_Array::value('user', $items)) {
+ if (!empty($items['user'])) {
$url .= "{$items['user']}:{$items['pass']}@";
}
$url .= $items['host'];
- if (CRM_Utils_Array::value('port', $items)) {
+ if (!empty($items['port'])) {
$url .= ":{$items['port']}";
}
$url .= "{$items['path']}?{$items['query']}";
- if (CRM_Utils_Array::value('fragment', $items)) {
+ if (!empty($items['fragment'])) {
$url .= "#{$items['fragment']}";
}
unset($_SESSION['messages']);
}
- if (CRM_Utils_Array::value('name', $params)) {
+ if (!empty($params['name'])) {
if ($nameError = user_validate_name($params['name'])) {
$errors['cms_name'] = $nameError;
}
}
}
- if (CRM_Utils_Array::value('mail', $params)) {
+ if (!empty($params['mail'])) {
if ($emailError = user_validate_mail($params['mail'])) {
$errors[$emailName] = $emailError;
}
_user_edit_validate(NULL, $params);
$errors = form_get_errors();
if ($errors) {
- if (CRM_Utils_Array::value('name', $errors)) {
+ if (!empty($errors['name'])) {
$errors['cms_name'] = $errors['name'];
}
- if (CRM_Utils_Array::value('mail', $errors)) {
+ if (!empty($errors['mail'])) {
$errors[$emailName] = $errors['mail'];
}
// also unset drupal messages to avoid twice display of errors
$name = $dao->escape(CRM_Utils_Array::value('name', $params));
$email = $dao->escape(CRM_Utils_Array::value('mail', $params));
- if (CRM_Utils_Array::value('name', $params)) {
+ if (!empty($params['name'])) {
if (!validate_username($params['name'])) {
$errors['cms_name'] = ts("Your username contains invalid characters");
}
}
}
- if (CRM_Utils_Array::value('mail', $params)) {
+ if (!empty($params['mail'])) {
if (!is_email($params['mail'])) {
$errors[$emailName] = "Your email is invaid";
}
$value = NULL;
/* Construct the address token */
- if (CRM_Utils_Array::value($token, $loc)) {
+ if (!empty($loc[$token])) {
if ($html) {
$value = $loc[$token][1]['display'];
$value = str_replace("\n", '<br />', $value);
/* Construct the phone and email tokens */
$value = NULL;
- if (CRM_Utils_Array::value($token, $loc)) {
+ if (!empty($loc[$token])) {
foreach ($loc[$token] as $index => $entity) {
$value = $entity[$token];
break;
//special case for greeting replacement
foreach (array(
'email_greeting', 'postal_greeting', 'addressee') as $val) {
- if (CRM_Utils_Array::value($val, $contactDetails[$contactID])) {
+ if (!empty($contactDetails[$contactID][$val])) {
$contactDetails[$contactID][$val] = $contactDetails[$contactID]["{$val}_display"];
}
}
CRM_Core_DAO::storeValues($dao, $details[$dao->id]);
// do the necessary transformation
- if (CRM_Utils_Array::value('payment_instrument_id', $details[$dao->id])) {
+ if (!empty($details[$dao->id]['payment_instrument_id'])) {
$piId = $details[$dao->id]['payment_instrument_id'];
$pis = CRM_Contribute_PseudoConstant::paymentInstrument();
$details[$dao->id]['payment_instrument'] = $pis[$piId];
}
- if (CRM_Utils_Array::value('campaign_id', $details[$dao->id])) {
+ if (!empty($details[$dao->id]['campaign_id'])) {
$campaignId = $details[$dao->id]['campaign_id'];
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
$details[$dao->id]['campaign'] = $campaigns[$campaignId];
}
- if (CRM_Utils_Array::value('financial_type_id', $details[$dao->id])) {
+ if (!empty($details[$dao->id]['financial_type_id'])) {
$financialtypeId = $details[$dao->id]['financial_type_id'];
$ftis = CRM_Contribute_PseudoConstant::financialType();
$details[$dao->id]['financial_type'] = $ftis[$financialtypeId];
// we do this before we
_civicrm_api3_swap_out_aliases($apiRequest, $fields);
if (strtolower($action) != 'getfields') {
- if (!CRM_Utils_Array::value('id', $apiRequest['params'])) {
+ if (empty($apiRequest['params']['id'])) {
$apiRequest['params'] = array_merge(_civicrm_api3_getdefaults($apiRequest, $fields), $apiRequest['params']);
}
//if 'id' is set then only 'version' will be checked but should still be checked for consistency
return 0;
}
}
- if (CRM_Utils_Array::value('format.only_id', $apiRequest['params']) && isset($result['id'])) {
+ if (!empty($apiRequest['params']['format.only_id']) && isset($result['id'])) {
return $result['id'];
}
if (CRM_Utils_Array::value('is_error', $result, 0) == 0) {
$data["error_code"] = DB::errorMessage($error->getCode());
$data["sql"] = $error->getDebugInfo();
}
- if (CRM_Utils_Array::value('debug', $apiRequest['params'])) {
+ if (!empty($apiRequest['params']['debug'])) {
if(method_exists($e, 'getUserInfo')) {
$data['debug_info'] = $error->getUserInfo();
}
$data['tip'] = "add debug=1 to your API call to have more info about the error";
}
$err = civicrm_api3_create_error($e->getMessage(), $data, $apiRequest);
- if (CRM_Utils_Array::value('is_transactional', $apiRequest)) {
+ if (!empty($apiRequest['is_transactional'])) {
$transaction->rollback();
}
return $err;
) {
$err['trace'] = $e->getTraceAsString();
}
- if (CRM_Utils_Array::value('is_transactional', $apiRequest)) {
+ if (!empty($apiRequest['is_transactional'])) {
$transaction->rollback();
}
return $err;
}
$data = array();
$err = civicrm_api3_create_error($e->getMessage(), $data, $apiRequest, $e->getCode());
- if (CRM_Utils_Array::value('debug', $apiRequest['params'])) {
+ if (!empty($apiRequest['params']['debug'])) {
$err['trace'] = $e->getTraceAsString();
}
- if (CRM_Utils_Array::value('is_transactional', $apiRequest)) {
+ if (!empty($apiRequest['is_transactional'])) {
$transaction->rollback();
}
return $err;
if (strtolower($apiRequest['action'] == 'getfields')) {
// the main param getfields takes is 'action' - however this param is not compatible with REST
// so we accept 'api_action' as an alias of action on getfields
- if (CRM_Utils_Array::value('api_action', $apiRequest['params'])) {
+ if (!empty($apiRequest['params']['api_action'])) {
// $apiRequest['params']['action'] = $apiRequest['params']['api_action'];
// unset($apiRequest['params']['api_action']);
}
* {@getfields action_schedule_create}
*/
function civicrm_api3_action_schedule_create($params) {
- if (!CRM_Utils_Array::value('id', $params)) {
+ if (empty($params['id'])) {
// an update does not require any mandatory parameters
civicrm_api3_verify_one_mandatory($params,
NULL,
*/
function civicrm_api3_activity_create($params) {
- if (!CRM_Utils_Array::value('id', $params)) {
+ if (empty($params['id'])) {
// an update does not require any mandatory parameters
civicrm_api3_verify_one_mandatory($params,
NULL,
$case_id = '';
$createRevision = FALSE;
$oldActivityValues = array();
- if (CRM_Utils_Array::value('case_id', $params)) {
+ if (!empty($params['case_id'])) {
$case_id = $params['case_id'];
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$oldActivityParams = array('id' => $params['id']);
if (!$oldActivityValues) {
CRM_Activity_BAO_Activity::retrieve($oldActivityParams, $oldActivityValues);
//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 (!CRM_Utils_Array::value('id', $params) &&
+ if (empty($params['id']) &&
!CRM_Utils_Array::value('activity_date_time', $params)
) {
$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 (CRM_Utils_Array::value('contact_sub_type', $params) && CRM_Utils_Array::value('contact_type', $params)) {
+ if (!empty($params['contact_sub_type']) && CRM_Utils_Array::value('contact_type', $params)) {
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']));
}
$where .= " AND $aclWhere ";
}
- if (CRM_Utils_Array::value('org', $params)) {
+ if (!empty($params['org'])) {
$where .= " AND contact_type = \"Organization\"";
// CRM-7157, hack: get current employer details when
// employee_id is present.
$currEmpDetails = array();
- if (CRM_Utils_Array::value('employee_id', $params)) {
+ if (!empty($params['employee_id'])) {
if ($currentEmployer = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
(int) $params['employee_id'],
'employer_id'
}
}
- if (CRM_Utils_Array::value('contact_sub_type', $params)) {
+ if (!empty($params['contact_sub_type'])) {
$contactSubType = CRM_Utils_Type::escape($params['contact_sub_type'], 'String');
$where .= " AND cc.contact_sub_type = '{$contactSubType}'";
}
//set default for current_employer or return contact with particular id
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$where .= " AND cc.id = " . (int) $params['id'];
}
- if (CRM_Utils_Array::value('cid', $params)) {
+ if (!empty($params['cid'])) {
$where .= " AND cc.id <> " . (int) $params['cid'];
}
//contact's based of relationhip type
$relType = NULL;
- if (CRM_Utils_Array::value('rel', $params)) {
+ if (!empty($params['rel'])) {
$relation = explode('_', CRM_Utils_Array::value('rel', $params));
$relType = CRM_Utils_Type::escape($relation[0], 'Integer');
$rel = CRM_Utils_Type::escape($relation[2], 'String');
}
// check if only CMS users are requested
- if (CRM_Utils_Array::value('cmsuser', $params)) {
+ if (!empty($params['cmsuser'])) {
$additionalFrom = "
INNER JOIN civicrm_uf_match um ON (um.contact_id=cc.id)
";
}
$t['data'] = $dao->data;
$contactList[] = $t;
- if (CRM_Utils_Array::value('org', $params) &&
+ if (!empty($params['org']) &&
!empty($currEmpDetails) &&
$dao->id == $currEmpDetails['id']
) {
//return organization name if doesn't exist in db
if (empty($contactList)) {
- if (CRM_Utils_Array::value('org', $params)) {
+ if (!empty($params['org'])) {
if ($listCurrentEmployer && !empty($currEmpDetails)) {
$contactList = array(
array(
'amount' => $params['total_amount']));
}
- if (CRM_Utils_Array::value('id', $params) && CRM_Utils_Array::value('contribution_status_id', $params)) {
+ if (!empty($params['id']) && CRM_Utils_Array::value('contribution_status_id', $params)) {
$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
$n = $idArray[2];
$id = $fieldNumber . "." . $idArray[2];
}
- if (CRM_Utils_Array::value('format.field_names', $params)) {
+ if (!empty($params['format.field_names'])) {
$id = $info['field_name'];
}
else {
$id = $fieldNumber;
}
$values[$id]['entity_id'] = $getParams['entityID'];
- if (CRM_Utils_Array::value('entityType', $getParams)) {
+ if (!empty($getParams['entityType'])) {
$values[$n]['entity_table'] = $getParams['entityType'];
}
//set 'latest' -useful for multi fields but set for single for consistency
*
*/
function civicrm_api3_dashboard_create($params) {
- if (!CRM_Utils_Array::value('id', $params)) {
+ if (empty($params['id'])) {
civicrm_api3_verify_one_mandatory($params,
NULL,
array(
else {
return civicrm_api3_create_error('Could not delete dashlet');
}
-}
\ No newline at end of file
+}
unset($params['version']);
$bao = new CRM_Core_BAO_Domain();
- if (CRM_Utils_Array::value('current_domain', $params)) {
+ if (!empty($params['current_domain'])) {
$domainBAO = CRM_Core_Config::domainID();
$params['id'] = $domainBAO;
}
function civicrm_api3_event_get($params) {
//legacy support for $params['return.sort']
- if (CRM_Utils_Array::value('return.sort', $params)) {
+ if (!empty($params['return.sort'])) {
$params['options']['sort'] = $params['return.sort'];
unset($params['return.sort']);
}
//legacy support for $params['return.offset']
- if (CRM_Utils_Array::value('return.offset', $params)) {
+ if (!empty($params['return.offset'])) {
$params['options']['offset'] = $params['return.offset'];
unset($params['return.offset']);
}
//legacy support for $params['return.max_results']
- if (CRM_Utils_Array::value('return.max_results', $params)) {
+ if (!empty($params['return.max_results'])) {
$params['options']['limit'] = $params['return.max_results'];
unset($params['return.max_results']);
}
$eventDAO = new CRM_Event_BAO_Event();
_civicrm_api3_dao_set_filter($eventDAO, $params, TRUE, 'Event');
- if (CRM_Utils_Array::value('is_template', $params)) {
+ if (!empty($params['is_template'])) {
$eventDAO->whereAdd( '( is_template = 1 )' );
}
elseif(empty($eventDAO->id)){
$eventDAO->whereAdd('( is_template IS NULL ) OR ( is_template = 0 )');
}
- if (CRM_Utils_Array::value('isCurrent', $params)) {
+ if (!empty($params['isCurrent'])) {
$eventDAO->whereAdd('(start_date >= CURDATE() || end_date >= CURDATE())');
}
while ($eventDAO->fetch()) {
$event[$eventDAO->id] = array();
CRM_Core_DAO::storeValues($eventDAO, $event[$eventDAO->id]);
- if (CRM_Utils_Array::value('return.is_full', $params)) {
+ if (!empty($params['return.is_full'])) {
_civicrm_api3_event_getisfull($event, $eventDAO->id);
}
_civicrm_api3_event_get_legacy_support_42($event, $eventDAO->id);
}
// we only take "return=" as valid options
- if (CRM_Utils_Array::value('return', $apiRequest['params'])) {
+ if (!empty($apiRequest['params']['return'])) {
if (!isset($result['values'][0][$apiRequest['params']['return']])) {
return civicrm_api3_create_error("field " . $apiRequest['params']['return'] . " unset or not existing", array('invalid_field' => $apiRequest['params']['return']));
}
$action = CRM_Core_Action::ADD;
// we need user id during add mode
$ids = array ();
- if(CRM_Utils_Array::value('contact_id', $params)) {
+ if (!empty($params['contact_id'])) {
$ids['userId'] = $params['contact_id'];
}
//for edit membership id should be present
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$ids['membership'] = $params['id'];
$action = CRM_Core_Action::UPDATE;
}
}
$activeOnly = CRM_Utils_Array::value('active_only', $params, $activeOnly);
- if (CRM_Utils_Array::value('contact_id', $params) && !is_array($params['contact_id'])) {
+ if (!empty($params['contact_id']) && !is_array($params['contact_id'])) {
$membershipValues = _civicrm_api3_membership_get_customv2behaviour($params, $membershipTypeId, $activeOnly );
}
else {
$membershipValues[$membershipId]['membership_name'] = $membershipType['name'];
- if (CRM_Utils_Array::value('relationship_type_id', $membershipType)) {
+ if (!empty($membershipType['relationship_type_id'])) {
$relationships[$membershipType['relationship_type_id']] = $membershipId;
}
$dao = &CRM_Core_DAO::executeQuery($query, $params);
if ($dao->fetch()) {
// Take the is_admin column in MembershipStatus into consideration when requested
- if (! CRM_Utils_Array::value('ignore_admin_only', $membershipParams) ) {
+ if (empty($membershipParams['ignore_admin_only'])) {
$result = &CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($dao->start_date, $dao->end_date, $dao->join_date, 'today', TRUE);
}
else {
}
//make is error zero only when valid status found.
- if (CRM_Utils_Array::value('id', $result)) {
+ if (!empty($result['id'])) {
$result['is_error'] = 0;
}
}
*/
function civicrm_api3_participant_create($params) {
//check that event id is not an template - should be done @ BAO layer
- if (CRM_Utils_Array::value('event_id', $params)) {
+ if (!empty($params['event_id'])) {
$isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template');
if (!empty($isTemplate)) {
return civicrm_api3_create_error(ts('Event templates are not meant to be registered'));
function civicrm_api3_participant_payment_create($params) {
$ids = array();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$ids['id'] = $params['id'];
}
$participantPayment = CRM_Event_BAO_ParticipantPayment::create($params, $ids);
);
}
- if (CRM_Utils_Array::value('add_to_group_id', $ufGroupDetails)) {
+ if (!empty($ufGroupDetails['add_to_group_id'])) {
$contactIds = array($params['contact_id']);
CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds,
$ufGroupDetails['add_to_group_id']
_civicrm_api3_relationship_format_params($params, $values);
$ids = array();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$ids['contactTarget'] = $values['contact_id_b'];
}
function civicrm_api3_relationship_get($params) {
$options = _civicrm_api3_get_options_from_params($params);
- if (!CRM_Utils_Array::value('contact_id', $params)) {
+ if (empty($params['contact_id'])) {
if(!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) {
CRM_Contact_BAO_Relationship::membershipTypeToRelationshipTypes($params);
}
_civicrm_api3_store_values($fields, $params, $values);
$relationTypes = CRM_Core_PseudoConstant::relationshipType('name');
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$relation = new CRM_Contact_BAO_Relationship();
$relation->id = $params['id'];
if (!$relation->find(TRUE)) {
}
if ($relationshipTypeId) {
- if (CRM_Utils_Array::value('relationship_type_id', $values) &&
+ if (!empty($values['relationship_type_id']) &&
$relationshipTypeId != $values['relationship_type_id']
) {
throw new Exception('Mismatched Relationship Type and Relationship Type Id');
CRM_Utils_Array::value('profile', $params, null)
);
// find any supplemental information
- if(CRM_Utils_Array::value('action',$params)){
+ if (!empty($params['action'])){
$specFunction = '_civicrm_api3_setting_' . strtolower($params['action']) . '_spec';
if (function_exists($specFunction)) {
$specFunction($result);
}
}
if ($entity && $action =='get') {
- if (CRM_Utils_Array::value('id',$returnProperties)) {
+ if (!empty($returnProperties['id'])) {
$returnProperties[$entity . '_id'] = 1;
unset($returnProperties['id']);
}
function _civicrm_api3_build_fields_array(&$bao, $unique = TRUE) {
$fields = $bao->fields();
if ($unique) {
- if(!CRM_Utils_Array::value('id', $fields)){
+ if (empty($fields['id'])){
$entity = _civicrm_api_get_entity_name_from_dao($bao);
$fields['id'] = $fields[$entity . '_id'];
unset($fields[$entity . '_id']);
continue;
}
- if (CRM_Utils_Array::value('required', $v)) {
+ if (!empty($v['required'])) {
// 0 is a valid input for numbers, CRM-8122
if (!isset($params[$k]) || (empty($params[$k]) && !($params[$k] === 0))) {
$missing[] = $k;
// intensive checks - usually only called after DB level fail
if (!empty($errorMode) && strtolower($action) == 'create') {
- if (CRM_Utils_Array::value('FKClassName', $fieldInfo)) {
- if (CRM_Utils_Array::value($fieldName, $params)) {
+ if (!empty($fieldInfo['FKClassName'])) {
+ if (!empty($params[$fieldName])) {
_civicrm_api3_validate_constraint($params, $fieldName, $fieldInfo);
}
- elseif (CRM_Utils_Array::value('required', $fieldInfo)) {
+ elseif (!empty($fieldInfo['required'])) {
throw new Exception("DB Constraint Violation - possibly $fieldName should possibly be marked as mandatory for this API. If so, please raise a bug report");
}
}
- if (CRM_Utils_Array::value('api.unique', $fieldInfo)) {
+ if (!empty($fieldInfo['api.unique'])) {
$params['entity'] = $entity;
_civicrm_api3_validate_uniquekey($params, $fieldName, $fieldInfo);
}
*/
function _civicrm_api3_validate_date(&$params, &$fieldName, &$fieldInfo) {
//should we check first to prevent it from being copied if they have passed in sql friendly format?
- if (CRM_Utils_Array::value($fieldInfo['name'], $params)) {
+ if (!empty($params[$fieldInfo['name']])) {
//accept 'whatever strtotime accepts
if (strtotime($params[$fieldInfo['name']]) === FALSE) {
throw new Exception($fieldInfo['name'] . " is not a valid date: " . $params[$fieldInfo['name']]);
$required = array('version');
foreach ($fields as $field => $values) {
- if (CRM_Utils_Array::value('api.required', $values)) {
+ if (!empty($values['api.required'])) {
$required[] = $field;
}
}
function _civicrm_api3_swap_out_aliases(&$apiRequest, $fields) {
foreach ($fields as $field => $values) {
$uniqueName = CRM_Utils_Array::value('uniqueName', $values);
- if (CRM_Utils_Array::value('api.aliases', $values)) {
+ if (!empty($values['api.aliases'])) {
// if aliased field is not set we try to use field alias
if (!isset($apiRequest['params'][$field])) {
foreach ($values['api.aliases'] as $alias) {
*/
function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $entity) {
//if fieldname exists in params
- if (CRM_Utils_Array::value($fieldName, $params)) {
+ if (!empty($params[$fieldName])) {
// if value = 'user_contact_id' (or similar), replace value with contact id
if (!is_numeric($params[$fieldName]) && is_scalar($params[$fieldName])) {
$realContactId = _civicrm_api3_resolve_contactID($params[$fieldName]);
foreach ($participantDetails as $participantId => $values) {
//process the additional participant at the time of
//primary participant, don't process separately.
- if (CRM_Utils_Array::value('registered_by_id', $values)) {
+ if (!empty($values['registered_by_id'])) {
continue;
}
foreach ($participantDetails as $participantId => $values) {
//process the additional participant at the time of
//primary participant, don't process separately.
- if (CRM_Utils_Array::value('registered_by_id', $values)) {
+ if (!empty($values['registered_by_id'])) {
continue;
}
$success = TRUE;
// consider address is automatically parseable,
// when we should found street_number and street_name
- if (!CRM_Utils_Array::value('street_name', $parsedFields) ||
+ if (empty($parsedFields['street_name']) ||
!CRM_Utils_Array::value('street_number', $parsedFields)
) {
$success = FALSE;
foreach ($options as $oIndex => $oValue) {
$validateStrings[] = $oValue['label'];
$validateStrings[] = $oValue['amount'];
- if (CRM_Utils_Array::value('membership_type_id', $oValue)) {
+ if (!empty($oValue['membership_type_id'])) {
$this->select("membership_type_id_{$oIndex}", "value={$oValue['membership_type_id']}");
}
- if (CRM_Utils_Array::value('financial_type_id', $oValue)) {
+ if (!empty($oValue['financial_type_id'])) {
$this->select("option_financial_type_id_{$oIndex}", "label={$oValue['financial_type_id']}");
}
$this->type("option_label_{$oIndex}", $oValue['label']);
*/
private function _contactCreate($params) {
$result = $this->callAPISuccess('contact', 'create', $params);
- if (CRM_Utils_Array::value('is_error', $result) ||
+ if (!empty($result['is_error']) ||
!CRM_Utils_Array::value('id', $result)
) {
throw new Exception('Could not create test contact, with message: ' . CRM_Utils_Array::value('error_message', $result) . "\nBacktrace:" . CRM_Utils_Array::value('trace', $result));
if (array_key_exists('id', $unformattedArray)) {
unset($unformattedArray['id']);
}
- if (CRM_Utils_Array::value('values', $unformattedArray) && is_array($unformattedArray['values'])) {
+ if (!empty($unformattedArray['values']) && is_array($unformattedArray['values'])) {
foreach ($unformattedArray['values'] as $key => $value) {
if (is_Array($value)) {
foreach ($value as $k => $v) {
$this->type("non_deductible_amount", "{$nonDeductibleAmt}");
}
- if (CRM_Utils_Array::value('premium', $params)) {
+ if (!empty($params['premium'])) {
//Premium section
$this->click("Premium");
$this->waitForElementPresent("fulfilled_date");
case CRM_Utils_Type::T_INT:
// probably created with a 1
$entity[$field] = 2;
- if (CRM_Utils_Array::value('FKClassName', $specs)) {
+ if (!empty($specs['FKClassName'])) {
$entity[$field] = empty($entity2[$field]) ? $entity2[$specs]['uniqueName'] : $entity2[$field];
}
break;
case CRM_Utils_Type::T_INT:
// probably created with a 1
$entity[$fieldName] = '6';
- if (CRM_Utils_Array::value('FKClassName', $specs)) {
+ if (!empty($specs['FKClassName'])) {
if($specs['FKClassName'] == $baoString){
$entity[$fieldName] = (string) $entity2['id'];
}
function add(&$params) {
require_once 'CRM/Utils/Hook.php';
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Auction', $params['id'], $params);
}
else {
$auction->copyValues($params);
$result = $auction->save();
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Auction', $auction->id, $auction);
}
else {
function add(&$params) {
require_once 'CRM/Utils/Hook.php';
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Auction_Item', $params['id'], $params);
}
else {
$auction->id
);
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Auction_Item', $auction->id, $auction);
}
else {
require_once 'CRM/Core/ShowHideBlocks.php';
$this->_showHide = new CRM_Core_ShowHideBlocks();
- if (!CRM_Utils_Array::value('auctionsByDates', $defaults)) {
+ if (empty($defaults['auctionsByDates'])) {
$this->_showHide->addHide('id_fromToDates');
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
if ($tableName == 'civicrm_address') {
// only include statistics columns if set
- if (CRM_Utils_Array::value('statistics', $field)) {
+ if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
case 'sum':
}
// insert first and last contribution at end
- if (CRM_Utils_Array::value('first_contribution', $this->_params['options'])) {
+ if (!empty($this->_params['options']['first_contribution'])) {
$select[] = " '' as first_contribution";
$this->_columnHeaders['first_contribution']['title'] = ts('First Contribution');
}
- if (CRM_Utils_Array::value('last_contribution', $this->_params['options'])) {
+ if (!empty($this->_params['options']['last_contribution'])) {
$select[] = " '' as last_contribution";
$this->_columnHeaders['last_contribution']['title'] = ts('Last Contribution');
}
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) ||
+ if (!empty($field['required']) ||
CRM_Utils_Array::value($fieldName, $this->_params['fields'])
) {
function groupBy() {
$this->_groupBy = "";
- if (CRM_Utils_Array::value('group_bys', $this->_params) &&
+ if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
- if (CRM_Utils_Array::value($fieldName, $this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys'][$fieldName])) {
$this->_groupBy[] = $field['dbAlias'];
}
}
// add all the fields for chosen groups
$this->_tables = $this->_options = array();
foreach ($this->_groupTree as $groupID => $group) {
- if (!CRM_Utils_Array::value($groupID, $this->_customGroupIDs)) {
+ if (empty($this->_customGroupIDs[$groupID])) {
continue;
}
$includeContactIDs = FALSE
) {
//redirect if custom group not select in search criteria
- if (!CRM_Utils_Array::value('custom_group', $this->_formValues)) {
+ if (empty($this->_formValues['custom_group'])) {
CRM_Core_Error::statusBounce(ts("You must select at least one Custom Group as a search criteria."),
CRM_Utils_System::url('civicrm/contact/search/custom',
"reset=1&csid={$this->_formValues['customSearchID']}",