[Bug 15635] New: Move the patron images related code to Koha::Patron::Images
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15635 Bug ID: 15635 Summary: Move the patron images related code to Koha::Patron::Images Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org Depends on: 15353 Blocks: 15449 There are 3 subroutines in C4::Members to get, add and delete patron images. By creating 2 Koha::Patron::Image[s] classes, we could remove them. Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15353 [Bug 15353] patron image disappears when on fines tab http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15449 [Bug 15449] Move stuffs to the Koha namespace -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15635 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15635 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47122 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47122&action=edit Bug 15635: Koha::Patron::Images - Add new classes There are 3 subroutines in C4::Members to get, add and delete patron images: - GetPatronImage - PutPatronImage - RmPatronImage By creating these 2 Koha::Patron::Image[s] classes, we could remove them easily. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15635 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47124 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47124&action=edit Bug 15635: Koha::Patron::Images - Remove PutPatronImage The C4::Members::PutPatronImage inserted/updated the image of a patron. This can be done easily with ->find->set->store or ->new->store Test plan: 1/ Modify the image of a patron from the patron detail page 2/ Add an image to a new patron 3/ Use the "Upload patron images" tools (tools/picture-upload.pl) to add or modify the image of a patron 4/ Use the "Upload patron images" tools (tools/picture-upload.pl) to add or modify the image of several patrons, using a zip file. Stress the script trying to get as many errors as possible (wrong cardnumber, wrong mimetype, file does not exist, etc.) With this patch, if the cardnumber does not exist, you will get a specific error "Image not imported because this patron does not exist in the database" -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15635 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47125 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47125&action=edit Bug 15635: Koha::Patron::Images - Remove RmPatronImage The C4::Members::RmPatronImage just removed a row in patronimage. This can be accomplished using the delete method of Koha::Patron::Image. Test plan:
From the patron defail page, try to delete the image of a patron.
-- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15635 --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47126 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47126&action=edit Bug 15635: Koha::Patron::Images - Remove GetPatronImage To retrieve a patron image, we can call Koha::Patron::Images->find or Koha::Patrons->find->image Both will return a Koha::Patron::Image object. Test plan: 1/ From the patron/member module, open all tabs on the left (Checkouts, detail, fines, etc.) The image should be correctly displayed. 2/ At the OPAC, on the patron details page (opac-memberentry.pl) the image should be displayed as well. 3/ Same on the sco module. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15635 --- Comment #5 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 47125 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47125 Bug 15635: Koha::Patron::Images - Remove RmPatronImage Review of attachment 47125: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=15635&attachment=47125) ----------------------------------------------------------------- ::: tools/picture-upload.pl @@ +163,5 @@
+ my $deleted = eval { + Koha::Patron::Images->find( $borrowernumber )->delete; + }; + if ( $@ or not $deleted ) { + warn "Image for patron '$borrowernumber' has not been deleted";
Should we not distinguish between $@ and not $deleted? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15635 --- Comment #6 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 47126 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47126 Bug 15635: Koha::Patron::Images - Remove GetPatronImage Review of attachment 47126: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=15635&attachment=47126) ----------------------------------------------------------------- ::: opac/opac-memberentry.pl @@ +232,5 @@
);
if (C4::Context->preference('OPACpatronimages')) { + my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber}); + $template->param( display_patron_image => 1 ) if $patron_image;
After this many changes, I can understand a cut-and-paste mentality. :) -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org