[Bug 44283] New: AddUniqueDebarment gives an indefinite restriction an end date, and cannot make a dated one indefinite
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44283 Bug ID: 44283 Summary: AddUniqueDebarment gives an indefinite restriction an end date, and cannot make a dated one indefinite Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com Target Milestone: --- AddUniqueDebarment (Koha/Patron/Debarments.pm) is meant not to shorten an existing restriction of the same type ("We don't want to shorten a unique debarment's period"), but it only compares when both have a date: $params->{'expiration'} = $debarment->expiration if ( $debarment->expiration && $debarment->expiration gt $params->{'expiration'} ); - The existing restriction is indefinite, the new call has a date: the date is written, so the indefinite restriction now ends on that date. - The existing restriction has a date, the new call has none (indefinite): the old date is kept, so the restriction is not extended. It is used by debar_patrons_with_fines.pl (FINES), overdue_notices.pl (OVERDUES) and returns (SUSPENSION). To reproduce (main): 1. A patron who owes 50.00. 2. perl misc/cronjobs/debar_patrons_with_fines.pl -a 40 -m 'Fines over 40' -c The patron has a FINES restriction with no end date. 3. perl misc/cronjobs/debar_patrons_with_fines.pl -a 40 -m 'Fines over 40' -e 2026-12-31 -c The FINES restriction now expires on 2026-12-31: after that date the patron can borrow again while still owing 50.00. Expected: an indefinite restriction stays indefinite, and a call with no expiration makes the restriction indefinite. t/db_dependent/Patron/Borrower_Debarments.t currently asserts the first case ("AddUniqueDebarment updated the OVERDUES restriction correctly" after giving an indefinite OVERDUES restriction a date); the patch changes that assertion. Reproduced on main (c8e8025). -- 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=44283 --- Comment #1 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212594 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212594&action=edit Bug 44283: AddUniqueDebarment: keep an indefinite restriction indefinite Bug 44283: AddUniqueDebarment: keep an indefinite restriction indefinite AddUniqueDebarment did not want to shorten an existing restriction, but only compared two dates. An indefinite restriction updated with a date got that date (debar_patrons_with_fines.pl run once without -e and once with -e turns an open-ended FINES restriction into one that ends), and an update with no date kept the old end date. Now an existing indefinite restriction stays indefinite, an update with no expiration makes the restriction indefinite, and a later existing date is still kept. The existing test asserted that an indefinite OVERDUES restriction takes the date of a later call; it now asserts that it stays indefinite, and new tests cover the two other cases. Test plan: 1. prove t/db_dependent/Patron/Borrower_Debarments.t Without the patch the new tests fail; with it they pass. 2. A patron who owes 50.00: perl misc/cronjobs/debar_patrons_with_fines.pl -a 40 -m 'Fines' -c perl misc/cronjobs/debar_patrons_with_fines.pl -a 40 -m 'Fines' -e 2026-12-31 -c Without the patch the FINES restriction now ends on 2026-12-31; with it, it has no end date. 3. prove t/db_dependent/Circulation/MarkIssueReturned.t Sponsored-by: Koha Solutions -- 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=44283 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |babarjunaid1122@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org