Description
Tomás Cohen Arazi (tcohen)
2021-12-23 13:07:02 UTC
Created attachment 128887 [details] [review] Bug 29765: Make Koha::Patron->safe_to_delete use Koha::Result::Boolean This patch makes the safe_to_delete method in Koha::Patron return this new object type instead of a plain string. This way we have a consistent way to deal with 'can_*'-like methods return values when feedback is needed. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Patron.t => SUCCESS: The adjusted tests pass. Tests cover the boolean context eval and also the carried messages, that include the same string code that was returned originally. 3. Sign off :-D Created attachment 128888 [details] [review] Bug 29765: Adjust DELETE /patrons/:patron_id controller This patch adjusts the only current place using the Koha::Patron->safe_to_delete method to the new return value. There should be no behavior change To test: 1. Apply the previous patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => FAIL: Tests fail, because of the change, the controller is broken 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! No test tweak required, no behavior change 5. Sign off :-D Created attachment 128914 [details] [review] Bug 29765: Adjust DELETE /patrons/:patron_id controller This patch adjusts the only current place using the Koha::Patron->safe_to_delete method to the new return value. There should be no behavior change To test: 1. Apply the previous patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => FAIL: Tests fail, because of the change, the controller is broken 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! No test tweak required, no behavior change 5. Sign off :-D Created attachment 128928 [details] [review] Bug 29765: Make Koha::Patron->safe_to_delete use Koha::Result::Boolean This patch makes the safe_to_delete method in Koha::Patron return this new object type instead of a plain string. This way we have a consistent way to deal with 'can_*'-like methods return values when feedback is needed. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Patron.t => SUCCESS: The adjusted tests pass. Tests cover the boolean context eval and also the carried messages, that include the same string code that was returned originally. 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Created attachment 128929 [details] [review] Bug 29765: Adjust DELETE /patrons/:patron_id controller This patch adjusts the only current place using the Koha::Patron->safe_to_delete method to the new return value. There should be no behavior change To test: 1. Apply the previous patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => FAIL: Tests fail, because of the change, the controller is broken 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! No test tweak required, no behavior change 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> If we are using Koha::Result::Boolean for Koha::Patron->safe_to_delete we certainly need to implement it for Koha::Item->safe_to_delete as well (same time, same push). (In reply to Jonathan Druart from comment #6) > If we are using Koha::Result::Boolean for Koha::Patron->safe_to_delete we > certainly need to implement it for Koha::Item->safe_to_delete as well (same > time, same push). Sure, if we have consensus on things, I can do it. Created attachment 128999 [details] [review] Bug 29765: Make Koha::Patron->safe_to_delete use Koha::Result::Boolean This patch makes the safe_to_delete method in Koha::Patron return this new object type instead of a plain string. This way we have a consistent way to deal with 'can_*'-like methods return values when feedback is needed. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Patron.t => SUCCESS: The adjusted tests pass. Tests cover the boolean context eval and also the carried messages, that include the same string code that was returned originally. 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 129000 [details] [review] Bug 29765: Adjust DELETE /patrons/:patron_id controller This patch adjusts the only current place using the Koha::Patron->safe_to_delete method to the new return value. There should be no behavior change To test: 1. Apply the previous patches 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => FAIL: Tests fail, because of the change, the controller is broken 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! No test tweak required, no behavior change 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Pushed to master for 22.05, thanks to everybody involved [U+1F984] |