https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30856 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Nick Clemens (kidclamp) from comment #4)
(In reply to Jonathan Druart from comment #3)
Created attachment 171064 [details] [review] [review] [review] Bug 30856: Move CanReserveBeCanceledFromOpac to Koha::Policy
Why are we adding a whole new module for the hold policy?
I thought it was a good idea to have Koha::Policy::Holds for global hold policies, and a more specific Koha::Policy::Patrons::Holds for the "can patron do x for holds" policies. Also with all the info (what objects) in the name of the module, the method's names are shorter and more readable (IMO): Koha::Policy::Holds->can_patron_cancel_from_opac vs Koha::Policy::Patrons::Holds->can_cancel_from_opac It's there for discussion ofc :) Happy to discuss, continue and extend this Koha::Policy further.
Instead of fetching the patron just to compare borrowernumber, why not: my $hold = Koha::Holds->find({ reserve_id => $reserve_id, borrowernumber => $borrowernumber });
If the borrowernumebr doesn't match, we don't find a hold, can't cancel?
For consistency. We will want to deal with Koha::Object-based objects, and most of the time we will have them before calling the methods. We need to fetch them from opac/opac-modrequest-suspend.pl because it's badly written, because of the redirect. The idea would be to have Policy class for checkouts, holds, courses, etc. And pass the Koha::Patron object and the other entity object (always using the same pattern). -- You are receiving this mail because: You are watching all bug changes.