membership_expiry.pl -renew -active should include patrons 0-MembershipExpiryDaysNotice days before expiration, not exactly MembershipExpiryDaysNotice days before expiration. membership_expiry.pl selects patrons who are expiring in exactly n days where n is the value from MembershipExpiryDaysNotice preference. Let's say, 30 as an example. When we have a cronjob with the following flags membership_expiry.pl -c -n -renew 12 -active it would be expected behavior to renew patrons who are about to expire within 30 days and who have been active in the last 12 months, last activity defined by borrowers.lastseen. It is not the case when lastseen is >12 months away at exactly 30 days from expiration, but <12 months <30 days from expiration. This could happen when login is defined as activity, and patron who hasn't been active receives a notification of an expiring account then logins to update their activity. Once the 30-day mark has been passed, such patrons will simply be ignored and they will expire. This can be fixed with the -before flag, but I think it is unexpected behavior. Also you can only hardcode a value to -before, so if you change MembershipExpiryDaysNotice, it will not update the -before value. I think the expected behavior is to renew patrons 0-MembershipExpiryDaysNotice days before expiration.
I think this needs some discussion first. We can't just change the behavior without having consensus, because this change could break someone's cronjob workflow.
(In reply to Lari Taskula from comment #0) > This can be fixed with the -before flag, but I think it is unexpected > behavior. Also you can only hardcode a value to -before, so if you change > MembershipExpiryDaysNotice, it will not update the -before value. An alternative solution might be to use the --where flag and do a subquery selecting the value from MembershipExpiryDaysNotice. But I'm not a big fan of that solution.
(In reply to Lari Taskula from comment #0) > membership_expiry.pl -c -n -renew 12 -active Correction, membership_expiry.pl -c -n -renew -active 12 I wish Bugzilla had an option to edit :)
Created attachment 192612 [details] [review] Bug 41786: membership_expiry.pl -renew -active should include patrons 0-MembershipExpiryDaysNotice days before expiration