[Bug 43544] New: update_patrons.pl cron should have a flag for updating the expiration to match the new category
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Bug ID: 43544 Summary: update_patrons.pl cron should have a flag for updating the expiration to match the new category Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: lisette@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com Target Milestone: --- There should be an option to update the patron's expiration date to match the new category, similar to how it asks in the UI now. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=32459 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #1 from Lisette Scheer <lisette@bywatersolutions.com> --- When the category is updated -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|update_patrons.pl cron |update_patrons.pl cron |should have a flag for |should have a flag for |updating the expiration to |updating the expiration to |match the new category |match the new category when | |changing category -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #2 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 206540 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206540&action=edit Bug 43544: Add ability to update patron expiration dates when changing their category Some libraries expire youth cards on the patron's 18th birthday, then use update_patrons_category.pl to move those patrons into an adult category once they age out. Right now the cron only changes the category, so the patron lands in the adult category still carrying the youth expiration date, and is expired the moment they get there. The staff interface already asks about this. Changing a patron's category there pops up "Patron category changed" with a "Reset expiration date to category default" checkbox, but the cron has no equivalent. This patch adds a --update-expiry switch. When it is passed, each updated patron also gets the expiration date the new category gives a patron enrolled today, which is the same date the staff interface offers. Test Plan: 1) Apply this patch 2) Create a patron category YOUTH, category type child, with an upper age limit of 17 and an enrollment period of 12 months 3) Create a patron category ADULT, category type adult, with an enrollment period of 36 months 4) Create a patron in YOUTH with a date of birth making them 18 or older, and an expiration date in the past 5) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old -v --confirm 6) Note the patron is now in ADULT but still has the old expiration date 7) Set the patron back to YOUTH with the old expiration date 8) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old --update-expiry -v 9) Note the output says the expiration date will be set to 36 months from today, and that nothing was changed because this is test mode 10) Run the same command again, adding --confirm 11) Note the patron is in ADULT and expires 36 months from today! 12) Set the patron back to YOUTH with the old expiration date 13) Repeat step 5 and note the expiration date is left alone without the switch! Sponsored-by: ByWater Solutions Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #3 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 206541 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206541&action=edit Bug 43544: Add unit tests Test Plan: 1) Apply this patch 2) prove t/db_dependent/Patrons.t Sponsored-by: ByWater Solutions Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Sponsorship status|--- |Sponsored Comma delimited| |ByWater Solutions list of Sponsors| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206540|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206541|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #4 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 206845 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206845&action=edit Bug 43544: Add ability to update patron expiration dates when changing their category Some libraries expire youth cards on the patron's 18th birthday, then use update_patrons_category.pl to move those patrons into an adult category once they age out. Right now the cron only changes the category, so the patron lands in the adult category still carrying the youth expiration date, and is expired the moment they get there. The staff interface already asks about this. Changing a patron's category there pops up "Patron category changed" with a "Reset expiration date to category default" checkbox, but the cron has no equivalent. This patch adds a --update-expiry switch. When it is passed, each updated patron also gets the expiration date the new category gives a patron enrolled today, which is the same date the staff interface offers. Test Plan: 1) Apply this patch 2) Create a patron category YOUTH, category type child, with an upper age limit of 17 and an enrollment period of 12 months 3) Create a patron category ADULT, category type adult, with an enrollment period of 36 months 4) Create a patron in YOUTH with a date of birth making them 18 or older, and an expiration date in the past 5) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old -v --confirm 6) Note the patron is now in ADULT but still has the old expiration date 7) Set the patron back to YOUTH with the old expiration date 8) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old --update-expiry -v 9) Note the output says the expiration date will be set to 36 months from today, and that nothing was changed because this is test mode 10) Run the same command again, adding --confirm 11) Note the patron is in ADULT and expires 36 months from today! 12) Set the patron back to YOUTH with the old expiration date 13) Repeat step 5 and note the expiration date is left alone without the switch! Sponsored-by: ByWater Solutions Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #5 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 206846 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206846&action=edit Bug 43544: Add unit tests Test Plan: 1) Apply this patch 2) prove t/db_dependent/Patrons.t Sponsored-by: ByWater Solutions Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #6 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 206847 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206847&action=edit Bug 43544: (follow-up) Don't shorten a membership when updating the expiration date --update-expiry always overwrote the expiration date with today plus the new category's enrollment period. If a patron already expired further out than that, the category change pulled their expiration date backwards. A library that gives youth cards an 18 year enrollment period has patrons expiring in 2044. Moving those patrons into an adult category with a 36 month enrollment period would have cut fifteen years off their cards. This patch only writes the new date when it is later than the one the patron already has, so aging a patron up can extend a membership but never shorten it. Test Plan: 1) Apply this patch 2) Create a patron category YOUTH, category type child, with an upper age limit of 17 and an enrollment period of 216 months 3) Create a patron category ADULT, category type adult, with an enrollment period of 36 months 4) Create two patrons in YOUTH, both with a date of birth making them 18 or older, one expiring in 2044 and one expiring in the past 5) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old --update-expiry -v --confirm 6) Note the patron who expired in the past is now in ADULT and expires 36 months from today! 7) Note the patron expiring in 2044 is now in ADULT and still expires in 2044! 8) prove t/db_dependent/Patrons.t Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |32459 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32459 [Bug 32459] Add option to expire patrons who were updated in the update_patrons.pl cron job -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206847|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206845|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206846|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #7 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 206903 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206903&action=edit Bug 43544: Add ability to update patron expiration dates when changing their category Some libraries expire youth cards on the patron's 18th birthday, then use update_patrons_category.pl to move those patrons into an adult category once they age out. Right now the cron only changes the category, so the patron lands in the adult category still carrying the youth expiration date, and is expired the moment they get there. The staff interface already asks about this. Changing a patron's category there pops up "Patron category changed" with a "Reset expiration date to category default" checkbox, but the cron has no equivalent. This patch adds a --update-expiry switch. When it is passed, each updated patron also gets the expiration date the new category gives a patron enrolled today, which is the same date the staff interface offers. Test Plan: 1) Apply this patch 2) Create a patron category YOUTH, category type child, with an upper age limit of 17 and an enrollment period of 12 months 3) Create a patron category ADULT, category type adult, with an enrollment period of 36 months 4) Create a patron in YOUTH with a date of birth making them 18 or older, and an expiration date in the past 5) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old -v --confirm 6) Note the patron is now in ADULT but still has the old expiration date 7) Set the patron back to YOUTH with the old expiration date 8) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old --update-expiry -v 9) Note the output says the expiration date will be set to 36 months from today, and that nothing was changed because this is test mode 10) Run the same command again, adding --confirm 11) Note the patron is in ADULT and expires 36 months from today! 12) Set the patron back to YOUTH with the old expiration date 13) Repeat step 5 and note the expiration date is left alone without the switch! Sponsored-by: ByWater Solutions Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #8 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 206904 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206904&action=edit Bug 43544: Add unit tests Test Plan: 1) Apply this patch 2) prove t/db_dependent/Patrons.t Sponsored-by: ByWater Solutions Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206903|0 |1 is obsolete| | Attachment #206904|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #9 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 207227 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207227&action=edit Bug 43544: Add ability to update patron expiration dates when changing their category Some libraries expire youth cards on the patron's 18th birthday, then use update_patrons_category.pl to move those patrons into an adult category once they age out. Right now the cron only changes the category, so the patron lands in the adult category still carrying the youth expiration date, and is expired the moment they get there. The staff interface already asks about this. Changing a patron's category there pops up "Patron category changed" with a "Reset expiration date to category default" checkbox, but the cron has no equivalent. This patch adds a --update-expiry switch. When it is passed, each updated patron also gets the expiration date the new category gives a patron enrolled today, which is the same date the staff interface offers. Test Plan: 1) Apply this patch 2) Create a patron category YOUTH, category type child, with an upper age limit of 17 and an enrollment period of 12 months 3) Create a patron category ADULT, category type adult, with an enrollment period of 36 months 4) Create a patron in YOUTH with a date of birth making them 18 or older, and an expiration date in the past 5) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old -v --confirm 6) Note the patron is now in ADULT but still has the old expiration date 7) Set the patron back to YOUTH with the old expiration date 8) Run misc/cronjobs/update_patrons_category.pl -f YOUTH -t ADULT --too_old --update-expiry -v 9) Note the output says the expiration date will be set to 36 months from today, and that nothing was changed because this is test mode 10) Run the same command again, adding --confirm 11) Note the patron is in ADULT and expires 36 months from today! 12) Set the patron back to YOUTH with the old expiration date 13) Repeat step 5 and note the expiration date is left alone without the switch! Sponsored-by: ByWater Solutions Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Juliet Heltibridle <jheltibridle@rcplib.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43544 --- Comment #10 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 207228 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207228&action=edit Bug 43544: Add unit tests Test Plan: 1) Apply this patch 2) prove t/db_dependent/Patrons.t Sponsored-by: ByWater Solutions Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Juliet Heltibridle <jheltibridle@rcplib.org> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org