There are two dates that are used to drive our subscription system:
The Subscription Date - this is the date the subscription was first purchased. For old subscribers it needs to be set manually. For subscribers who purchase their first subscription through the system, it is set automatically when they do so.
The Subscription date is passed to the Keygen utility and it uses this and the current date to figure out when the subscription key should expire. The day and month can be got from the Subscription date, but the year has to be calculated. Provided that the current date (ie the day on which the payment for the subscription renewal is received) is between two months prior to the subscription anniversary, and 10 months after, then the key expiry date will be calculated correctly.
The same process occurs when the zero cost 'Subscription Key' product is "purchased" - ie the generated key will have an expiry date derived from the Subscription Date and the current date.
The Subscriber Role Expiry Date - we use this to send out a reminder 1 month prior to the subscription's expiry. 'Role expiry' is a feature of the standard Ubercart e-commerce system that we use. When the customer purchases an Annual Subscription, then if they do not currently have this Subscriber role (either because this is their first subscription purchase, or because the role expired) they are given the role and it is set to expire in 12 months. It they do have the role, then 12 months is added to its expiry date.
Note that when the zero cost 'Subscription Key' product is "purchased" it does NOT affect the Subscriber role.
The Role Expiry Date is set to the anniversary of the Subscription Date. This is achieved by modifying the standard role expiry code to add an expiry type of 'Subscription date', and having code that recognises this expiry type and sets the appropriate date.
This implies that the Annual Subscription product - see http://www.openvpms.org/node/656/edit/features - MUST have its features set as follows:
and the Global expiration - see http://www.openvpms.org/admin/store/settings/products/edit/features - must be as follows: