Revert #10093 skip status calculation when form dates are not modified
authorJitendra Purohit <jitendra@fuzion.co.nz>
Tue, 24 Oct 2017 09:36:15 +0000 (15:06 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Tue, 24 Oct 2017 09:36:15 +0000 (15:06 +0530)
CRM/Member/Form/Membership.php
tests/phpunit/CRM/Member/Form/MembershipTest.php

index e6f5c984ee699c235116d9e71365df3ba44611a6..acb14746d658952c0400b81bf18a98214ae3630a 100644 (file)
@@ -1201,20 +1201,9 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
       'start_date' => 'startDate',
       'end_date' => 'endDate',
     );
-    $dateModified = FALSE;
     foreach ($dateTypes as $dateField => $dateVariable) {
-      if (!empty($params['id'])) {
-        $membershipDate = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $params['id'], $dateField, 'id');
-        if ($membershipDate != date('Y-m-d', strtotime($formValues[$dateField]))) {
-          $dateModified = TRUE;
-        }
-      }
       $$dateVariable = CRM_Utils_Date::processDate($formValues[$dateField]);
     }
-    //skip status calculation on update if none of the dates are modified.
-    if (!empty($params['id']) && empty($params['is_override']) && !$dateModified) {
-      $params['skipStatusCal'] = TRUE;
-    }
 
     $memTypeNumTerms = empty($termsByType) ? CRM_Utils_Array::value('num_terms', $formValues) : NULL;
 
index c43ac6e039c24ebc7d06f2a9c6353fedd39c49ab..58b1e72b6a45851c1280142721f5192e208dd5b8 100644 (file)
@@ -714,49 +714,6 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
     ), 1);
   }
 
-  /**
-   * Test membership form with Failed Contribution.
-   */
-  public function testFormStatusUpdate() {
-    $form = $this->getForm();
-    $form->preProcess();
-    $this->_individualId = $this->createLoggedInUser();
-    $memParams = array(
-      'contact_id' => $this->_individualId,
-      'membership_type_id' => $this->membershipTypeAnnualFixedID,
-      'is_override' => TRUE,
-      'status_id' => array_search('Cancelled', CRM_Member_PseudoConstant::membershipStatus()),
-    );
-    $params = $this->getBaseSubmitParams();
-    $params['id'] = $this->contactMembershipCreate($memParams);
-    unset($params['price_set_id']);
-    unset($params['credit_card_number']);
-    unset($params['cvv2']);
-    unset($params['credit_card_exp_date']);
-    unset($params['credit_card_type']);
-    unset($params['send_receipt']);
-    unset($params['is_recur']);
-
-    // process date params to mysql date format.
-    $dateTypes = array(
-      'join_date' => 'joinDate',
-      'start_date' => 'startDate',
-      'end_date' => 'endDate',
-    );
-    $previousStatus = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $params['id'], 'status_id');
-    foreach ($dateTypes as $dateField => $dateVariable) {
-      $params[$dateField] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $params['id'], $dateField);
-    }
-    $form->_id = $params['id'];
-    $form->_mode = NULL;
-    $form->_contactID = $this->_individualId;
-
-    $form->testSubmit($params);
-    $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
-    //Assert the status remains when the form dates are not modified.
-    $this->assertEquals($membership['status_id'], $previousStatus);
-  }
-
   /**
    * CRM-20946: Test the financial entires especially the reversed amount,
    *  after related Contribution is cancelled