Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-2150

Fixed Membershps - End Date Calculation Incorrect

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8
    • Component/s: CiviMember
    • Labels:
      None

      Description

      Updated Issue Summary
      ====================
      The code for "Add Membership" was using the "current date" to calculate membership End Date regardless of whether the user entered a Join Date or a Start Date. The corrected logic is:

      • If Join Date is set, use it to calculate Start and End Date.
      • For Fixed Period memberships, calculate membership Start Date as follows:
      • IF current day is between Rollover Day and Period Start Day, set membership Start Date to beginning of NEXT Fixed Period.
      • IF current day is NOT between Rollover Day and Period Start Day, set membership Start Date to beginning of CURRENT Fixed Period.
      • For Rolling Period memberships, Start Date should be set equal to Join Date.

      EXAMPLES: Fixed Membership Type with Period Start = Jan 01, Rollover = Nov 30, Duration = 3 years
      1. If Join Date is Oct 1, 2005, then...

      • Start Date = Jan 1, 2005
      • End Date = Dec 31, 2007

      2. If Join Date is Dec 1, 2005, then...

      • Start Date = Jan 1, 2006
      • End Date = Dec 31, 2008

      ================
      Original Bug Report
      ================
      When entering a new membership with period type = fixed - from the contact Memberships tab - the system automatically calculates the End Date. However, for Fixed memberships it seems to be calculating this date incorrectly. (../civicrm/contact/view/membership?reset=1&action=add&cid=115&context=membership)

      I verified this with a 3 year fixed membership type as reported by a community member on the 1.8 demo. This membership type has a fixed Start Day of Oct 01 and a rollover day of Sep 01. I entered both Join and Start Date as Oct 1 2005. The End Date was set to Sep 30 2009. It should have been Sep 30 2008.

      Membership type: http://demo.civicrm.org/drupal/civicrm/admin/member/membershipType?action=update&id=5&reset=1
      Contact membership w/ invalid calc: http://demo.civicrm.org/drupal/civicrm/contact/view/membership?action=update&reset=1&cid=115&id=31&context=membership&selectedChild=member

      I wondered if the bug was caused by the fact that the fixed Start Day was NOT Jan 01 - which is the most common case. So I created another Membership Type with Start Day of Jan 01 and Rollover Day of Dec 31 (defaults) and 3 year duration. I created a membership with the same Join and Start Dates as the above test (Oct 1 2005). The End Date was set to Dec 31 2009. It should have been Dec 31 2007. (Oct 1 2005-Dec 31 2005 = year 1, Jan 1 2006 - Dec 31 2006 = year 2, Jan 1 2007 - Dec 31 2007 = year 3).

      Contact membership for 2nd test: http://demo.civicrm.org/drupal/civicrm/contact/view/membership?action=update&reset=1&cid=115&id=33&context=membership&selectedChild=member
      AND with a 3 year

      One possibility is that the code is using the current date rather than the Join Date or Start Date entered in the form.

        Attachments

          Activity

            People

            • Assignee:
              rupam Rupam Jaiswal
              Reporter:
              dgg David Greenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: