);
//Add custom fields to columns array for inclusion in export
- $groupTree = CRM_Core_BAO_CustomGroup::getTree('Activity', $form, NULL,
- NULL, '', NULL
- );
+ $groupTree = CRM_Core_BAO_CustomGroup::getTree('Activity');
//use simplified formatted groupTree
- $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1, $form);
+ $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree);
//cycle through custom fields and assign to _columns array
foreach ($groupTree as $key) {
$this->_columns[$fieldlabel] = $field['column_name'];
}
}
- //end custom fields
}
/**
}
// add custom group fields to SELECT and FROM clause
- $groupTree = CRM_Core_BAO_CustomGroup::getTree('Activity', $form, NULL, NULL, '', NULL);
+ $groupTree = CRM_Core_BAO_CustomGroup::getTree('Activity');
foreach ($groupTree as $key) {
if (!empty($key['extends']) && $key['extends'] == 'Activity') {
}
if ($this->_mid) {
- if (CRM_Member_BAO_Membership::isSubscriptionCancelled($this->_mid)) {
- CRM_Core_Error::fatal(ts('The auto renewal option for this membership looks to have been cancelled already.'));
- }
$this->_mode = 'auto_renew';
- $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj');
- $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership');
+ // CRM-18468: crid is more accurate than mid for getting
+ // subscriptionDetails, so don't get them again.
+ if (!$this->_crid) {
+ $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj');
+ $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership');
+ }
$membershipTypes = CRM_Member_PseudoConstant::membershipType();
$membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_mid, 'membership_type_id');
$qf->add('text', $elementName . '_to', ts('To'), $field->attributes);
}
else {
+ if ($field->text_length) {
+ $field->attributes .= ' maxlength=' . $field->text_length;
+ if ($field->text_length < 20) {
+ $field->attributes .= ' size=' . $field->text_length;
+ }
+ }
$element = $qf->add('text', $elementName, $label,
$field->attributes,
$useRequired && !$search
//CRM-18487 - max date should be the last date of the year.
'maxDate' => isset($maxYear) ? $maxYear . '-12-31' : NULL,
'time' => $field->time_format ? $field->time_format * 12 : FALSE,
- 'yearRange' => "{$minYear}:{$maxYear}",
);
if ($field->is_search_range && $search) {
$qf->add('datepicker', $elementName . '_from', $label, $attr + array('placeholder' => ts('From')), FALSE, $params);
*
* @return array
*/
- public static function formatGroupTree(&$groupTree, $groupCount = 1, &$form) {
+ public static function formatGroupTree(&$groupTree, $groupCount = 1, &$form = NULL) {
$formattedGroupTree = array();
$uploadNames = array();
const AUTH_APPROVED = 1;
const AUTH_DECLINED = 2;
const AUTH_ERROR = 3;
+ const AUTH_REVIEW = 4;
const TIMEZONE = 'America/Denver';
protected $_mode = NULL;
curl_close($submit);
$response_fields = $this->explode_csv($response);
-
// check gateway MD5 response
if (!$this->checkMD5($response_fields[37], $response_fields[6], $response_fields[9])) {
return self::error(9003, 'MD5 Verification failed');
// check for application errors
// TODO:
// AVS, CVV2, CAVV, and other verification results
- if ($response_fields[0] != self::AUTH_APPROVED) {
- $errormsg = $response_fields[2] . ' ' . $response_fields[3];
- return self::error($response_fields[1], $errormsg);
- }
-
- // Success
-
- // test mode always returns trxn_id = 0
- // also live mode in CiviCRM with test mode set in
- // Authorize.Net return $response_fields[6] = 0
- // hence treat that also as test mode transaction
- // fix for CRM-2566
- if (($this->_mode == 'test') || $response_fields[6] == 0) {
- $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id RLIKE 'test[0-9]+'";
- $p = array();
- $trxn_id = strval(CRM_Core_DAO::singleValueQuery($query, $p));
- $trxn_id = str_replace('test', '', $trxn_id);
- $trxn_id = intval($trxn_id) + 1;
- $params['trxn_id'] = sprintf('test%08d', $trxn_id);
- }
- else {
- $params['trxn_id'] = $response_fields[6];
+ $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
+ switch ($response_fields[0]) {
+ case self::AUTH_REVIEW :
+ $params['payment_status_id'] = array_search('Pending', $contributionStatus);
+ break;
+
+ case self::AUTH_ERROR :
+ $params['payment_status_id'] = array_search('Failed', $contributionStatus);
+ break;
+
+ case self::AUTH_DECLINED :
+ $errormsg = $response_fields[2] . ' ' . $response_fields[3];
+ return self::error($response_fields[1], $errormsg);
+
+ default:
+ // Success
+
+ // test mode always returns trxn_id = 0
+ // also live mode in CiviCRM with test mode set in
+ // Authorize.Net return $response_fields[6] = 0
+ // hence treat that also as test mode transaction
+ // fix for CRM-2566
+ if (($this->_mode == 'test') || $response_fields[6] == 0) {
+ $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id RLIKE 'test[0-9]+'";
+ $p = array();
+ $trxn_id = strval(CRM_Core_DAO::singleValueQuery($query, $p));
+ $trxn_id = str_replace('test', '', $trxn_id);
+ $trxn_id = intval($trxn_id) + 1;
+ $params['trxn_id'] = sprintf('test%08d', $trxn_id);
+ }
+ else {
+ $params['trxn_id'] = $response_fields[6];
+ }
+ $params['gross_amount'] = $response_fields[9];
+ break;
}
- $params['gross_amount'] = $response_fields[9];
// TODO: include authorization code?
return $params;
);
if (!$search->fetch()) {
- // Whoops, error, don't track it. Return the base url.
+ // Can't find either the URL or the queue. If we can find the URL then
+ // return the URL without tracking. Otherwise return the base URL.
- return CRM_Utils_System::baseURL();
+ $search->query("SELECT $turl.url as url from $turl
+ WHERE $turl.id = " . CRM_Utils_Type::escape($url_id, 'Integer')
+ );
+ if (!$search->fetch()) {
+ return CRM_Utils_System::baseURL();
+ }
+ return $search->url;
}
$open = new CRM_Mailing_Event_BAO_TrackableURLOpen();
'title' => ts('Frequency Unit'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_OptionGroup::values('recur_frequency_units'),
- 'type' => CRM_Utils_Type::T_INT,
+ 'type' => CRM_Utils_Type::T_STRING,
),
'frequency_interval' => array(
'title' => ts('Frequency Interval'),
$dateField = $('<input type="' + type + '">').insertAfter($dataField);
copyAttributes($dataField, $dateField, ['placeholder', 'style', 'class', 'disabled']);
$dateField.addClass('crm-form-' + type);
- settings.minDate = settings.minDate ? CRM.utils.makeDate(settings.minDate) : null;
- settings.maxDate = settings.maxDate ? CRM.utils.makeDate(settings.maxDate) : null;
if (hasDatepicker) {
+ settings.minDate = settings.minDate ? CRM.utils.makeDate(settings.minDate) : null;
+ settings.maxDate = settings.maxDate ? CRM.utils.makeDate(settings.maxDate) : null;
settings.dateFormat = typeof settings.date === 'string' ? settings.date : CRM.config.dateInputFormat;
settings.changeMonth = _.includes(settings.dateFormat, 'm');
settings.changeYear = _.includes(settings.dateFormat, 'y');
+ if (!settings.yearRange && settings.minDate !== null && settings.maxDate !== null) {
+ settings.yearRange = '' + CRM.utils.formatDate(settings.minDate, 'yy') + ':' + CRM.utils.formatDate(settings.maxDate, 'yy');
+ }
$dateField.addClass('crm-form-date').datepicker(settings);
} else {
$dateField.attr('min', settings.minDate ? CRM.utils.formatDate(settings.minDate, 'yy') : '1000');
$(function() {
initForm();
+
+ // Focus first search field
+ $('.crm-form-text:input:visible:first', 'form.crm-search-form').focus();
+
// Handle user interactions with search results
$('#crm-container')
// When toggling between "all records" and "selected records only"
'group' => 'localization',
'name' => 'countryLimit',
'type' => 'Array',
- 'quick_form_type' => 'Select',
- 'html_type' => 'Select',
+ 'quick_form_type' => 'Element',
+ 'html_type' => 'advmultiselect',
'html_attributes' => array(
- 'multiple' => 1,
- 'class' => 'crm-select2',
+ 'size' => 5,
+ 'style' => 'width:150px',
+ 'class' => 'advmultiselect',
),
'default' => array(),
'add' => '4.3',
'group' => 'localization',
'name' => 'provinceLimit',
'type' => 'Array',
- 'quick_form_type' => 'Select',
- 'html_type' => 'Select',
+ 'quick_form_type' => 'Element',
+ 'html_type' => 'advmultiselect',
'html_attributes' => array(
- 'multiple' => 1,
- 'class' => 'crm-select2',
+ 'size' => 5,
+ 'style' => 'width:150px',
+ 'class' => 'advmultiselect',
),
'default' => array(),
'add' => '4.3',
- 'title' => 'Available States and Provinces',
+ 'title' => 'Available States and Provinces (by Country)',
'is_domain' => 1,
'is_contact' => 0,
'description' => '',
$.Menu.closeAll();
})
.on('focus', function() {
+ setQuickSearchValue();
if ($(this).attr('style').indexOf('14em') < 0) {
$(this).animate({width: '14em'});
}
}
e.preventDefault();
});
- $('.crm-quickSearchField').click(function() {
- var label = $(this).text();
- var value = $('input', this).val();
+ function setQuickSearchValue() {
+ var $selection = $('.crm-quickSearchField input:checked'),
+ label = $selection.parent().text(),
+ value = $selection.val();
// These fields are not supported by advanced search
if (value === 'first_name' || value === 'last_name') {
value = 'sort_name';
}
- $('#sort_name_navigation').attr({name: value, placeholder: label}).focus();
+ $('#sort_name_navigation').attr({name: value, placeholder: label});
+ }
+ $('.crm-quickSearchField').click(function() {
+ setQuickSearchValue();
+ $('#sort_name_navigation').focus();
});
+ // Set & retrieve default value
+ if (window.localStorage) {
+ $('.crm-quickSearchField').click(function() {
+ localStorage.quickSearchField = $('input', this).val();
+ });
+ if (localStorage.quickSearchField) {
+ $('.crm-quickSearchField input[value=' + localStorage.quickSearchField + ']').prop('checked', true);
+ }
+ }
// redirect to view page if there is only one contact
$('#id_search_block').on('submit', function() {
var $menu = $('#sort_name_navigation').autocomplete('widget');