[Bug 29741] New: Add Koha::Patron->safe_to_delete
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Bug ID: 29741 Summary: Add Koha::Patron->safe_to_delete Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org -- 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=29741 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=29018 -- 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=29741 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m, | |jonathan.druart+koha@gmail. | |com, | |kyle@bywatersolutions.com, | |nick@bywatersolutions.com 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=29741 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 128778 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128778&action=edit Bug 29741: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 128779 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128779&action=edit Bug 29741: Add Koha::Patron->safe_to_delete This patchset adds a handy method for checking if a patron meets the conditions to be deleted. This conditions are: - Has no linked guarantees - Has no pending debts - Has no current checkouts - Is not the system-configured anonymous user To test: 1. Apply the unit tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Patron.t => FAIL: Of course heh 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass, conditions are validated and the right string is returned on each case 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also|https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=29018 | Depends on| |29018 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29018 [Bug 29018] Deleting patrons from REST API doesn't do any checks or move to deletedborrowers -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 128784 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128784&action=edit Bug 29741: (follow-up) Make DELETE /patrons use the new validation method This patch adapts the route so it uses the newly introduced Koha::Patron->safe_to_delete method. To test: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! 4. Sign off :-D Note: There's a trivial behavior change, in which the 'anonymous patron' use case is caugh eariler than the ->delete call. I left the exception catch block just in case, who knows :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |29742 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29742 [Bug 29742] Make deletemem.pl use Koha::Patron->safe_to_delete -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Sorry dude, not 100% sure of the construct here... I feel like 'safe_to_delete' should return a Boolean given it's method name? Perhaps a boolean in scalar context and a Boolean + hash or array of errors as the second slot of an array in list context? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Martin Renvoize from comment #4)
Sorry dude, not 100% sure of the construct here... I feel like 'safe_to_delete' should return a Boolean given it's method name?
Perhaps a boolean in scalar context and a Boolean + hash or array of errors as the second slot of an array in list context?
Maybe a Koha::Validation object that validates to a bool, and carries messages in it? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Tomás Cohen Arazi from comment #5)
(In reply to Martin Renvoize from comment #4)
Sorry dude, not 100% sure of the construct here... I feel like 'safe_to_delete' should return a Boolean given it's method name?
Perhaps a boolean in scalar context and a Boolean + hash or array of errors as the second slot of an array in list context?
Maybe a Koha::Validation object that validates to a bool, and carries messages in it?
I replicated Koha::Item's to limit the conflict surface, but...hey... Hehe -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 David Nind <david@davidnind.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=29741 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #128778|0 |1 is obsolete| | --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 128814 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128814&action=edit Bug 29741: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #128779|0 |1 is obsolete| | --- Comment #8 from David Nind <david@davidnind.com> --- Created attachment 128815 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128815&action=edit Bug 29741: Add Koha::Patron->safe_to_delete This patchset adds a handy method for checking if a patron meets the conditions to be deleted. This conditions are: - Has no linked guarantees - Has no pending debts - Has no current checkouts - Is not the system-configured anonymous user To test: 1. Apply the unit tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Patron.t => FAIL: Of course heh 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass, conditions are validated and the right string is returned on each case 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #128784|0 |1 is obsolete| | --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 128816 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128816&action=edit Bug 29741: (follow-up) Make DELETE /patrons use the new validation method This patch adapts the route so it uses the newly introduced Koha::Patron->safe_to_delete method. To test: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! 4. Sign off :-D Note: There's a trivial behavior change, in which the 'anonymous patron' use case is caugh eariler than the ->delete call. I left the exception catch block just in case, who knows :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Text to go in the| |This enhancement adds a release notes| |handy method for checking | |if a patron meets the | |conditions to be deleted. | |These conditions are: | | | |- | |Has no linked guarantees | |- | |Has no pending debts | |- Has | |no current checkouts | |- Is | |not the system-configured | |anonymous user | | | |It also | |adapts the DELETE /patrons | |route to use the newly | |introduced | |Koha::Patron->safe_to_delet | |e method. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #10 from David Nind <david@davidnind.com> --- I've signed this off, but feel free to change the status if more work is still required (comments 4, 5 and 6). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- (In reply to Tomás Cohen Arazi from comment #6)
(In reply to Tomás Cohen Arazi from comment #5)
(In reply to Martin Renvoize from comment #4)
Sorry dude, not 100% sure of the construct here... I feel like 'safe_to_delete' should return a Boolean given it's method name?
Perhaps a boolean in scalar context and a Boolean + hash or array of errors as the second slot of an array in list context?
Maybe a Koha::Validation object that validates to a bool, and carries messages in it?
I replicated Koha::Item's to limit the conflict surface, but...hey... Hehe
I should have read more code for context, happy to stick with this as there's a precidence in Koha::Item.. I thought I'd seen something somewhere but couldn't place it. In the transfers work I threw exceptions and allowed a force option to be passed, but the use case isn't the same. I'd love to see us settle on something consistent. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Martin Renvoize from comment #11)
(In reply to Tomás Cohen Arazi from comment #6)
(In reply to Tomás Cohen Arazi from comment #5)
(In reply to Martin Renvoize from comment #4)
Sorry dude, not 100% sure of the construct here... I feel like 'safe_to_delete' should return a Boolean given it's method name?
Perhaps a boolean in scalar context and a Boolean + hash or array of errors as the second slot of an array in list context?
Maybe a Koha::Validation object that validates to a bool, and carries messages in it?
I replicated Koha::Item's to limit the conflict surface, but...hey... Hehe
I should have read more code for context, happy to stick with this as there's a precidence in Koha::Item.. I thought I'd seen something somewhere but couldn't place it. In the transfers work I threw exceptions and allowed a force option to be passed, but the use case isn't the same. I'd love to see us settle on something consistent.
I filed bug 29746, and provided an implementation. If I get feedback on that, I can re-do this using that which will be much cleaner. It could be done on a follow-up bug if required, and definitely should cover Koha::Item->safe_to_delete as well. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |29765 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29765 [Bug 29765] Make Koha::Patron->safe_to_delete return a Koha::Result::Boolean object -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #128814|0 |1 is obsolete| | Attachment #128815|0 |1 is obsolete| | Attachment #128816|0 |1 is obsolete| | --- Comment #13 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 128994 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128994&action=edit Bug 29741: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #14 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 128995 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128995&action=edit Bug 29741: Add Koha::Patron->safe_to_delete This patchset adds a handy method for checking if a patron meets the conditions to be deleted. This conditions are: - Has no linked guarantees - Has no pending debts - Has no current checkouts - Is not the system-configured anonymous user To test: 1. Apply the unit tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Patron.t => FAIL: Of course heh 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass, conditions are validated and the right string is returned on each case 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #15 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 128996 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128996&action=edit Bug 29741: (follow-up) Make DELETE /patrons use the new validation method This patch adapts the route so it uses the newly introduced Koha::Patron->safe_to_delete method. To test: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! 4. Sign off :-D Note: There's a trivial behavior change, in which the 'anonymous patron' use case is caugh eariler than the ->delete call. I left the exception catch block just in case, who knows :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #16 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to master for 22.05, thanks to everybody involved 🦄 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|22.05.00 |22.05.00,21.11.02 released in| | Status|Pushed to master |Pushed to stable --- Comment #17 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to 21.11.x for 21.11.02 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 --- Comment #18 from Kyle M Hall <kyle@bywatersolutions.com> --- Backported as part of a combo with 29018. I'd rather not leave 21.11 in a half-finished state for this issue. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29741 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to stable |RESOLVED CC| |andrew@bywatersolutions.com --- Comment #19 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Enhancement, not pushed to 21.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org