Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-04-21-08-12-12
authorkurund <kurund@civicrm.org>
Mon, 21 Apr 2014 15:51:45 +0000 (08:51 -0700)
committerkurund <kurund@civicrm.org>
Mon, 21 Apr 2014 15:51:45 +0000 (08:51 -0700)
Conflicts:
CRM/Contact/Page/AJAX.php
CRM/Core/Payment.php
CRM/Event/Form/Registration/Register.php
api/v3/Membership.php
api/v3/utils.php
sql/civicrm_generated.mysql
xml/version.xml

41 files changed:
1  2 
CRM/Batch/BAO/Batch.php
CRM/Batch/Form/Batch.php
CRM/Batch/Form/Entry.php
CRM/Batch/Page/AJAX.php
CRM/Case/BAO/Case.php
CRM/Contact/BAO/Query.php
CRM/Contact/BAO/Relationship.php
CRM/Contact/Form/Search/Builder.php
CRM/Contact/Import/Parser/Contact.php
CRM/Contact/Page/AJAX.php
CRM/Contact/Selector.php
CRM/Contribute/Form/AbstractEditPayment.php
CRM/Contribute/Form/Task/PDFLetter.php
CRM/Core/BAO/CustomQuery.php
CRM/Core/Config.php
CRM/Core/Config/Defaults.php
CRM/Core/Invoke.php
CRM/Core/Menu.php
CRM/Core/Payment.php
CRM/Core/Session.php
CRM/Dedupe/Merger.php
CRM/Event/Form/Registration/Register.php
CRM/Financial/Form/Export.php
CRM/Financial/Form/Search.php
CRM/Financial/Page/AJAX.php
CRM/Logging/Schema.php
CRM/Member/BAO/Query.php
CRM/PCP/BAO/PCP.php
CRM/PCP/Form/PCPAccount.php
CRM/PCP/Page/PCPInfo.php
CRM/Upgrade/Incremental/php/FourFour.php
CRM/Utils/Check/Security.php
CRM/Utils/System/Joomla.php
CRM/Utils/System/WordPress.php
api/v3/Contact.php
api/v3/Membership.php
api/v3/utils.php
templates/CRM/Report/Form/Layout/Table.tpl
tests/phpunit/api/v3/ContactTest.php
tests/phpunit/api/v3/MembershipTest.php
xml/version.xml

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 7bf572f4085f30035496ea4fd4322069e376c5f5,93992854879bcc8e995b5d2fb564c6b202fbb1c1..75c2c56a4438bb85292a32b48d4ec10153ba5afd
@@@ -733,9 -768,8 +733,9 @@@ LIMIT {$offset}, {$rowCount
      //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%' ) ";
      }
index d818647ce12b8caec5c75dd869c6b3073799cf3b,aa040d8e9b2c24a2500058773b7f8d8092f279ed..344820c82ad88bd68b52110de11d1761934bdde9
@@@ -985,15 -923,21 +975,21 @@@ SELECT 'civicrm_contact', contact_a.id
  
      $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
index a4cd0031484be370ad28786cd0969cc4f6ecdf62,31732f0d65179d8fd4b3277fc6a2f40372b53093..b3c8a412ea02125a676b21c38847164251ddd202
@@@ -84,11 -84,8 +84,11 @@@ class CRM_Contribute_Form_Task_PDFLette
      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;
    }
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 77fb81a2c61e32e103ec721cde8393e9a304d371,56249840903185d4f2f806e43a08b0e0daa56e21..58700a3c97bcca4c5fcacb341b00f6e03897131b
@@@ -261,10 -260,7 +260,10 @@@ abstract class CRM_Core_Payment 
        }
        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);
Simple merge
Simple merge
index 647873ce3c0811f56632b96bfbbe7e9e8ceafdec,3438149ab0488dd7708585abaab4a2681832f15b..36b939fdce6ec49804c6fb4834d3bf97553e1fc0
@@@ -1462,4 -1479,4 +1462,3 @@@ class CRM_Event_Form_Registration_Regis
      }
    }
  }
--
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 8f1c2572d3598bb7af921cd5754560bbe01d90ff,856ae2b967ff394962accaeaf33a576070a43cf2..3c57a7bd4d9ff4ad85b9963df5873b950ff06bfa
@@@ -187,32 -187,21 +187,28 @@@ function civicrm_api3_membership_get($p
    $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)
index 3fde44b5aece31a7b904fc4376621eacb85e9920,bedcdd7ea64b861afb13fec6ff47be4326472d36..5b429d32ec9daeacb1d46afa190c18f0e2e802f7
@@@ -267,10 -288,8 +267,10 @@@ function _civicrm_api3_get_DAO($name) 
      // 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';
    }
  
@@@ -476,8 -462,7 +476,9 @@@ function _civicrm_api3_get_using_query_
      }
  
    }
 -  $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,
@@@ -1238,9 -1261,10 +1239,10 @@@ function _civicrm_api3_validate_date(&$
      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]);
Simple merge
diff --cc xml/version.xml
index c73441922cd9c2f9c8a0874ec23d2f0dd85ebcbe,b4d433948d432c11ab3dc731067ec054ffc89071..5a2f31466e97f39a6b4b81f346e0041d793e736a
@@@ -1,4 -1,4 +1,4 @@@
  <?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>