https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330
--- Comment #46 from Lari Taskula <[email protected]> --- (In reply to Lari Taskula from comment #45) > Hi! Sorry for the late response. My view for the todo: > > 1. "Move validation logic from controller to Koha::Patron" patch; obsolete > validate() method - validations should occur in Koha::Patron->store(). I'm starting to remember the issues with this and why I implemented a separate validate method. When patron makes a modification request to be verified by librarian, we have to validate the data provided by patron without storing the object and then create a new modification request if provided data is ok. (PUT /patrons/123 where 123 is his own borrowernumber, and they don't have borrowers flag. This functionality is not yet in these patches provided before this comment.) So what I did was in order to avoid validation logic duplication in Koha::Patron::Modification was: $patron->set($provided_data)->validate; # if are able to continue, store new Koha::Patron::Modification request Of course we can have both, a separate validate method and validations integrated in store(). Also my fear was to throw exceptions in widely used method like Koha::Patron->store which would probably break elsewhere in Koha where these exceptions are not yet caught. So this Bug is a lot more problematic to pass. I took a shortcut and excluded the validations from store(). However, as a long term solution, like Tomas suggested, store() is the right place but I think that is too much for the scope of this Bug. Unfortunately I can't work with Koha::Patron more now. Anyway, I have rewritten the tests as explained earlier, and added all of the patron parameteres to be queryable by GET /patrons. Also I added patron modification request to the PUT request. This is provided in the following patch. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
