//check for mobile type
$phoneTypes = CRM_Core_OptionGroup::values('phone_type', TRUE, FALSE, FALSE, NULL, 'name');
$mobileType = CRM_Utils_Array::value('Mobile', $phoneTypes);
-
+
- if ($name = CRM_Utils_Array::value('name', $_GET)) {
+ $name = CRM_Utils_Array::value('name', $_GET);
+ if ($name) {
$name = CRM_Utils_Type::escape($name, 'String');
$queryString = " ( cc.sort_name LIKE '%$name%' OR cp.phone LIKE '%$name%' ) ";
}
$sql = str_replace($replaceSQL, $insertSQL, $sql);
- CRM_Core_Error::ignoreException();
+ $errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
$result = CRM_Core_DAO::executeQuery($sql);
- CRM_Core_Error::setCallback();
+ unset($errorScope);
if (is_a($result, 'DB_Error')) {
- // oops the above query failed, so lets just ignore it
- // and return
- // we print a sorry cant figure it out on view page
- return;
+ // check if we get error during core search
+ if ($coreSearch) {
+ // in the case of error, try rebuilding cache using full sql which is used for search selector display
+ // this fixes the bugs reported in CRM-13996 & CRM-14438
+ $this->rebuildPreNextCache($start, $end, $sort, $cacheKey);
+ }
+ else {
+ // return if above query fails
+ return;
+ }
}
// also record an entry in the cache key table, so we can delete it periodically
if (isset($this->_activityId)) {
$params = array('id' => $this->_activityId);
CRM_Activity_BAO_Activity::retrieve($params, $defaults);
- $defaults['html_message'] = $defaults['details'];
+ $defaults['html_message'] = CRM_Utils_Array::value('details', $defaults);
}
+ else {
+ $defaults['thankyou_update'] = 1;
+ }
$defaults = $defaults + CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues();
return $defaults;
}
}
else {
// Legacy or extension as module instance
- if(empty($paymentClass)) {
- $paymentClass = 'CRM_Core_' . $dao->class_name;
++ if (empty($paymentClass)) {
+ $paymentClass = 'CRM_Core_' . $dao->class_name;
+
+ }
}
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($dao->processor_id, $mode);
$activeOnly = $membershipTypeId = $membershipType = NULL;
$contactID = CRM_Utils_Array::value('contact_id', $params);
- if (!empty($params['filters']) && is_array($params['filters'])) {
- $activeOnly = CRM_Utils_Array::value('is_current', $params['filters'], FALSE);
+ if (!empty($params['filters']) && is_array($params['filters']) && isset($params['filters']['is_current'])) {
+ $activeOnly = $params['filters']['is_current'];
+ unset($params['filters']['is_current']);
}
$activeOnly = CRM_Utils_Array::value('active_only', $params, $activeOnly);
-
- //@todo replace this by handling in API layer - we should have enough info to do this
- // between pseudoconstant & fk - see comments in format_params
- $membershipTypeId = CRM_Utils_Array::value('membership_type_id', $params);
- if (!$membershipTypeId) {
- $membershipType = CRM_Utils_Array::value('membership_type', $params);
- if ($membershipType) {
- $membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
- $membershipType, 'id', 'name'
- );
- }
- if($activeOnly && empty($params['status_id'])) {
++ if ($activeOnly && empty($params['status_id'])) {
+ $params['status_id'] = array('IN' => CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent());
}
- $options = _civicrm_api3_get_options_from_params($params, TRUE,'membership','get');
+
+ if (!empty($params['contact_id']) && !is_array($params['contact_id'])) {
+ $membershipValues = _civicrm_api3_membership_get_customv2behaviour($params, $membershipTypeId, $activeOnly );
+ }
+ else {
+ //legacy behaviour only ever worked when contact_id passed in - use standard api function otherwise
+ $membershipValues = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
+ }
+
- if($options['is_count']) {
+ $options = _civicrm_api3_get_options_from_params($params, TRUE,'membership', 'get');
- $membershipValues = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
-
++ if ($options['is_count']) {
+ return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+ }
+
$return = $options['return'];
if(empty($membershipValues) ||
(!empty($return)
// len ('civicrm_api3_') == 13
$name = substr($name, 13, $last - 13);
}
-
+
- if (strtolower($name) == 'individual' || strtolower($name) == 'household' || strtolower($name) == 'organization') {
+ $name = _civicrm_api_get_camel_name($name, 3);
+
+ if ($name == 'Individual' || $name == 'Household' || $name == 'Organization') {
$name = 'Contact';
}
}
}
- $skipPermissions = CRM_Utils_Array::value('check_permissions', $params)? 0 :1;
++
+ $skipPermissions = !empty($params['check_permissions']) ? 0 :1;
+
list($entities, $options) = CRM_Contact_BAO_Query::apiQuery(
$newParams,
$returnProperties,
if (strtotime($params[$fieldInfo['name']]) === FALSE) {
throw new Exception($fieldInfo['name'] . " is not a valid date: " . $params[$fieldInfo['name']]);
}
- $params[$fieldInfo['name']] = CRM_Utils_Date::processDate($params[$fieldInfo['name']]);
+ $format = ($fieldInfo['type'] == CRM_Utils_Type::T_DATE) ? 'Ymd000000' : 'YmdHis';
+ $params[$fieldInfo['name']] = CRM_Utils_Date::processDate($params[$fieldInfo['name']], NULL, FALSE, $format);
}
- if ((CRM_Utils_Array::value('name', $fieldInfo) != $fieldName) && CRM_Utils_Array::value($fieldName, $params)) {
+ if ((CRM_Utils_Array::value('name', $fieldInfo) != $fieldName) && !empty($params[$fieldName])) {
//If the unique field name differs from the db name & is set handle it here
if (strtotime($params[$fieldName]) === FALSE) {
throw new Exception($fieldName . " is not a valid date: " . $params[$fieldName]);
<?xml version="1.0" encoding="iso-8859-1" ?>
<version>
- <version_no>4.5.alpha1</version_no>
- <version_no>4.4.6</version_no>
++ <version_no>4.5.alpha1</version_no>
</version>