$details = "-ALTERNATIVE ITEM 0-\n{$html}{$additionalDetails}\n-ALTERNATIVE ITEM 1-\n{$text}{$additionalDetails}\n-ALTERNATIVE END-\n";
}
else {
- $details = $html ? $html : $text;
+ $details = $html ?: $text;
$details .= $additionalDetails;
}
'parent_id'
);
- $parentActivities[$activityId] = $parentId ? $parentId : FALSE;
+ $parentActivities[$activityId] = $parentId ?: FALSE;
}
return $parentActivities[$activityId];
$params['contact_type_a'] = $cTypeA[0];
$params['contact_type_b'] = $cTypeB[0];
- $params['contact_sub_type_a'] = $cTypeA[1] ? $cTypeA[1] : 'null';
- $params['contact_sub_type_b'] = $cTypeB[1] ? $cTypeB[1] : 'null';
+ $params['contact_sub_type_a'] = $cTypeA[1] ?: 'null';
+ $params['contact_sub_type_b'] = $cTypeB[1] ?: 'null';
if (!strlen(trim($params['label_b_a'] ?? ''))) {
$params['label_b_a'] = $params['label_a_b'] ?? NULL;
$activityStatus = array_flip($activityStatus);
$this->_params = [
'name' => "survey_{$survey->id}",
- 'title' => $params['report_title'] ? $params['report_title'] : $this->_values['title'],
+ 'title' => $params['report_title'] ?: $this->_values['title'],
'status_id_op' => 'eq',
// reserved status
'status_id_value' => $activityStatus['Scheduled'],
}
}
- $current = $current ? $current : 'main';
+ $current = $current ?: 'main';
return $current;
}
}
}
- $next = $next ? $next : 'main';
+ $next = $next ?: 'main';
return $next;
}
$cid = CRM_Utils_Request::retrieve('cid', 'Positive');
// retrieve contact id in case of Profile context
$id = CRM_Utils_Request::retrieve('id', 'Positive');
- $cid = $cid ? $cid : $id;
+ $cid = $cid ?: $id;
if ($action & CRM_Core_Action::DELETE) {
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean')) {
CRM_Contact_BAO_Contact::deleteContactImage($cid);
*/
public static function isCurrentEmployerNeedingToBeCleared($params, $relationshipId, $updatedRelTypeID = NULL) {
$existingTypeID = (int) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Relationship', $relationshipId, 'relationship_type_id');
- $updatedRelTypeID = $updatedRelTypeID ? $updatedRelTypeID : $existingTypeID;
+ $updatedRelTypeID = $updatedRelTypeID ?: $existingTypeID;
$currentEmployerID = (int) civicrm_api3('Contact', 'getvalue', ['return' => 'current_employer_id', 'id' => $params['contact_id_a']]);
if ($currentEmployerID !== (int) $params['contact_id_b'] || !self::isRelationshipTypeCurrentEmployer($existingTypeID)) {
$details = "-ALTERNATIVE ITEM 0-\n{$html}{$additionalDetails}\n-ALTERNATIVE ITEM 1-\n{$text}{$additionalDetails}\n-ALTERNATIVE END-\n";
}
else {
- $details = $html ? $html : $text;
+ $details = $html ?: $text;
$details .= $additionalDetails;
}
$noteID = [];
if ($contributionNoteID) {
$noteID = ["id" => $contributionNoteID];
- $noteParams['note'] = $noteParams['note'] ? $noteParams['note'] : "null";
+ $noteParams['note'] = $noteParams['note'] ?: "null";
}
CRM_Core_BAO_Note::add($noteParams, $noteID);
}
*/
public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
- return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+ return $fileName ?: parent::overrideExtraTemplateFileName();
}
/**
}
}
- $current = $current ? $current : 'settings';
+ $current = $current ?: 'settings';
return $current;
}
public static function defaultCurrencySymbol($defaultCurrency = NULL) {
static $cachedSymbol = NULL;
if (!$cachedSymbol || $defaultCurrency) {
- $currency = $defaultCurrency ? $defaultCurrency : Civi::settings()->get('defaultCurrency');
+ $currency = $defaultCurrency ?: Civi::settings()->get('defaultCurrency');
if ($currency) {
$currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', [
'labelColumn' => 'symbol',
$title, 'id', 'title', TRUE
);
}
- return $groupID ? $groupID : FALSE;
+ return $groupID ?: FALSE;
}
/**
// Fudge some extra types that quickform doesn't support
$inputType = $type;
if ($type == 'wysiwyg' || in_array($type, self::$html5Types)) {
- $attributes = ($attributes ? $attributes : []) + ['class' => ''];
+ $attributes = ($attributes ?: []) + ['class' => ''];
$attributes['class'] = ltrim($attributes['class'] . " crm-form-$type");
if ($type == 'wysiwyg' && isset($attributes['preset'])) {
$attributes['data-preset'] = $attributes['preset'];
*/
public function &addRadio($name, $title, $values, $attributes = [], $separator = NULL, $required = FALSE, $optionAttributes = []) {
$options = [];
- $attributes = $attributes ? $attributes : [];
+ $attributes = $attributes ?: [];
$allowClear = !empty($attributes['allowClear']);
unset($attributes['allowClear']);
$attributes['id_suffix'] = $name;
*/
public static function getLocale() {
global $tsLocale;
- return $tsLocale ? $tsLocale : 'en_US';
+ return $tsLocale ?: 'en_US';
}
/**
$query = "SELECT GET_LOCK( %1, %2 )";
$params = [
1 => [$this->_id, 'String'],
- 2 => [$timeout ? $timeout : $this->_timeout, 'Integer'],
+ 2 => [$timeout ?: $this->_timeout, 'Integer'],
];
$res = CRM_Core_DAO::singleValueQuery($query, $params);
if ($res) {
'id', 'name'
);
}
- $menu[$path]['component_id'] = $componentId ? $componentId : NULL;
+ $menu[$path]['component_id'] = $componentId ?: NULL;
$cache[$compPath] = $menu[$path]['component_id'];
}
}
}
$fld = "address[1][{$element}]";
$value = $location['address'][1][$element] ?? NULL;
- $value = $value ? $value : "";
+ $value = $value ?: "";
$result[str_replace([
'][',
'[',
for ($i = 1; $i < 3; $i++) {
$fld = "{$block}[{$i}][{$element}]";
$value = $location[$block][$i][$element] ?? NULL;
- $value = $value ? $value : "";
+ $value = $value ?: "";
$result[str_replace([
'][',
'[',
];
foreach ($lookup as $name => $paypalName) {
$value = $this->retrieve($paypalName, 'String', FALSE);
- $input[$name] = $value ? $value : NULL;
+ $input[$name] = $value ?: NULL;
}
$input['is_test'] = $this->retrieve('test_ipn', 'Integer', FALSE);
];
foreach ($lookup as $name => $paypalName) {
$value = $this->retrieve($paypalName, 'String', FALSE);
- $input[$name] = $value ? $value : NULL;
+ $input[$name] = $value ?: NULL;
}
$input['is_test'] = $this->retrieve('test_ipn', 'Integer', FALSE);
*/
public static function allGroup($groupType = NULL, $excludeHidden = TRUE) {
$condition = CRM_Contact_BAO_Group::groupTypeCondition($groupType, $excludeHidden);
- $groupKey = ($groupType ? $groupType : 'null') . !empty($excludeHidden);
+ $groupKey = ($groupType ?: 'null') . !empty($excludeHidden);
if (!isset(Civi::$statics[__CLASS__]['groups']['allGroup'][$groupKey])) {
self::populate(Civi::$statics[__CLASS__]['groups']['allGroup'][$groupKey], 'CRM_Contact_DAO_Group', FALSE, 'title', 'is_active', $condition);
public function __construct($object, $pageID, $sortID, $action, $store = NULL, $output = self::TEMPLATE, $prefix = NULL, $case = NULL) {
$this->_object = $object;
- $this->_pageID = $pageID ? $pageID : 1;
- $this->_sortID = $sortID ? $sortID : NULL;
+ $this->_pageID = $pageID ?: 1;
+ $this->_sortID = $sortID ?: NULL;
$this->_action = $action;
$this->_store = $store;
$this->_output = $output;
$ts = $this->get($name, 'timer');
if (!$ts || $ts < time() - $expire) {
$this->set($name, time(), 'timer');
- return $ts ? $ts : 'not set';
+ return $ts ?: 'not set';
}
return FALSE;
}
'text' => $text,
'title' => $title,
'type' => $type,
- 'options' => $options ? $options : NULL,
+ 'options' => $options ?: NULL,
];
}
}
}
}
- $current = $current ? $current : 'settings';
+ $current = $current ?: 'settings';
return $current;
}
*/
public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
- return $fileName ? $fileName : parent::getTemplateFileName();
+ return $fileName ?: parent::getTemplateFileName();
}
/**
*/
public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
- return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+ return $fileName ?: parent::overrideExtraTemplateFileName();
}
/**
self::$participantStatus = [];
}
- $index = $cond ? $cond : 'No Condition';
+ $index = $cond ?: 'No Condition';
$index = "{$index}_{$retColumn}";
if (empty(self::$participantStatus[$index])) {
self::$participantStatus[$index] = [];
* array reference of all participant roles if any
*/
public static function &participantRole($id = NULL, $cond = NULL) {
- $index = $cond ? $cond : 'No Condition';
+ $index = $cond ?: 'No Condition';
if (empty(self::$participantRole[$index])) {
self::$participantRole[$index] = [];
unset($_POST['crmPID_B'], $_POST['crmPID']);
}
- $pageId = $pageId ? $pageId : 1;
+ $pageId = $pageId ?: 1;
$offset = ($pageId - 1) * $rowCount;
$offset = CRM_Utils_Type::escape($offset, 'Int');
* array reference of all mailing components
*/
public static function &component($type = NULL) {
- $name = $type ? $type : 'ALL';
+ $name = $type ?: 'ALL';
if (!self::$component || !array_key_exists($name, self::$component)) {
if (!self::$component) {
$actionMask,
[
'mid' => $row['id'],
- 'hashOrMid' => $hash ? $hash : $row['id'],
+ 'hashOrMid' => $hash ?: $row['id'],
],
"more",
FALSE,
}
$this->assign('honor', $honor);
- $this->assign('total', $totalAmount ? $totalAmount : '0.0');
+ $this->assign('total', $totalAmount ?: '0.0');
$this->assign('achieved', $achieved <= 100 ? $achieved : 100);
if ($achieved <= 100) {
// 2. send acknowledgement mail
if ($toEmail && !($doNotEmail || $onHold)) {
// assign value to template
- $template->assign('amount_paid', $details['amount_paid'] ? $details['amount_paid'] : 0);
+ $template->assign('amount_paid', $details['amount_paid'] ?: 0);
$template->assign('next_payment', $details['scheduled_date']);
$template->assign('amount_due', $details['amount_due']);
$template->assign('checksumValue', $details['checksumValue']);
$return = TRUE;
if (!$statusMessage) {
$statusMessage = ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.",
- [1 => $profileSubType ? $profileSubType : $profileType]);
+ [1 => $profileSubType ?: $profileType]);
}
}
}
*/
public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
- return $fileName ? $fileName : parent::getTemplateFileName();
+ return $fileName ?: parent::getTemplateFileName();
}
/**
*/
public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
- return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+ return $fileName ?: parent::overrideExtraTemplateFileName();
}
/**
*/
public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
- return $fileName ? $fileName : parent::getTemplateFileName();
+ return $fileName ?: parent::getTemplateFileName();
}
/**
*/
public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
- return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+ return $fileName ?: parent::overrideExtraTemplateFileName();
}
/**
*/
public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
- return $fileName ? $fileName : parent::getTemplateFileName();
+ return $fileName ?: parent::getTemplateFileName();
}
/**
*/
public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
- return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+ return $fileName ?: parent::overrideExtraTemplateFileName();
}
}
*/
public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
- return $fileName ? $fileName : parent::getTemplateFileName();
+ return $fileName ?: parent::getTemplateFileName();
}
/**
*/
public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
- return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+ return $fileName ?: parent::overrideExtraTemplateFileName();
}
}
unset($_POST['crmPID_B'], $_POST['crmPID']);
}
- $pageId = $pageId ? $pageId : 1;
+ $pageId = $pageId ?: 1;
$this->set(CRM_Utils_Pager::PAGE_ID, $pageId);
$offset = ($pageId - 1) * $rowCount;
* @param string $table
*/
public function setEntityRefDefaults(&$field, $table) {
- $field['attributes'] = $field['attributes'] ? $field['attributes'] : [];
+ $field['attributes'] = $field['attributes'] ?: [];
$field['attributes'] += [
'entity' => CRM_Core_DAO_AllCoreTables::getEntityNameForTable($table),
'multiple' => TRUE,
$startDateRelative = $this->_params["start_date_relative"] ?? NULL;
$startedDateSql = $this->dateClause('start_date', $startDateRelative, $startDateFrom, $startDateTo);
- $startedDateSql = $startedDateSql ? $startedDateSql : " ( 1 ) ";
+ $startedDateSql = $startedDateSql ?: " ( 1 ) ";
$cancelledDateSql = $this->dateClause('cancel_date', $startDateRelative, $startDateFrom, $startDateTo);
- $cancelledDateSql = $cancelledDateSql ? $cancelledDateSql : " ( cancel_date IS NOT NULL ) ";
+ $cancelledDateSql = $cancelledDateSql ?: " ( cancel_date IS NOT NULL ) ";
$started = $cancelled = $active = $total = 0;
}
}
- $pageId = $pageId ? $pageId : 1;
+ $pageId = $pageId ?: 1;
$this->set(CRM_Utils_Pager::PAGE_ID, $pageId);
$offset = ($pageId - 1) * $rowCount;
// We don't want to retrieve template details once it is
// set in session.
$templateId = $this->get('template');
- $this->assign('templateSelected', $templateId ? $templateId : 0);
+ $this->assign('templateSelected', $templateId ?: 0);
if (isset($defaults['msg_template_id']) && !$templateId) {
$defaults['SMStemplate'] = $defaults['msg_template_id'];
$messageTemplate = new CRM_Core_DAO_MessageTemplate();
throw new CRM_Core_Exception(ts('There is no valid smtp server setting. Click <a href=\'%1\'>Administer >> System Setting >> Outbound Email</a> to set the SMTP Server.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')]));
}
- $params['host'] = $mailingInfo['smtpServer'] ? $mailingInfo['smtpServer'] : 'localhost';
- $params['port'] = $mailingInfo['smtpPort'] ? $mailingInfo['smtpPort'] : 25;
+ $params['host'] = $mailingInfo['smtpServer'] ?: 'localhost';
+ $params['port'] = $mailingInfo['smtpPort'] ?: 25;
if ($mailingInfo['smtpAuth']) {
$params['username'] = $mailingInfo['smtpUsername'];
$createContact,
$mail
);
- $subParam['id'] = $contactID ? $contactID : NULL;
+ $subParam['id'] = $contactID ?: NULL;
}
/**