Bugzilla – Attachment 48115 Details for
Bug 15635
Move the patron images related code to Koha::Patron::Images
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15635: Koha::Patron::Images - Remove RmPatronImage
Bug-15635-KohaPatronImages---Remove-RmPatronImage.patch (text/plain), 2.37 KB, created by
Jonathan Druart
on 2016-02-16 11:15:39 UTC
(
hide
)
Description:
Bug 15635: Koha::Patron::Images - Remove RmPatronImage
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-02-16 11:15:39 UTC
Size:
2.37 KB
patch
obsolete
>From ea9eb94fa11baee2922ebaa71e0b129566d0a0ec Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Jan 2016 12:37:41 +0000 >Subject: [PATCH] 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. >--- > C4/Members.pm | 21 --------------------- > tools/picture-upload.pl | 9 ++++++--- > 2 files changed, 6 insertions(+), 24 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index ef3141f..bb1c939 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -78,7 +78,6 @@ BEGIN { > &GetTitles > > &GetPatronImage >- &RmPatronImage > > &GetHideLostItemsPreference > >@@ -1911,26 +1910,6 @@ sub GetPatronImage { > return $imagedata, $sth->errstr; > } > >-=head2 RmPatronImage >- >- my ($dberror) = RmPatronImage($borrowernumber); >- >-Removes the image for the patron with the supplied borrowernumber. >- >-=cut >- >-sub RmPatronImage { >- my ($borrowernumber) = @_; >- warn "Borrowernumber passed to GetPatronImage is $borrowernumber" if $debug; >- my $dbh = C4::Context->dbh; >- my $query = "DELETE FROM patronimage WHERE borrowernumber = ?;"; >- my $sth = $dbh->prepare($query); >- $sth->execute($borrowernumber); >- my $dberror = $sth->errstr; >- warn "Database error!" if $sth->errstr; >- return $dberror; >-} >- > =head2 GetHideLostItemsPreference > > $hidelostitemspref = &GetHideLostItemsPreference($borrowernumber); >diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl >index ea058dc..d1d8ba7 100755 >--- a/tools/picture-upload.pl >+++ b/tools/picture-upload.pl >@@ -160,9 +160,12 @@ elsif ( ( $op eq 'Upload' ) && !$uploadfile ) { > $template->param( filetype => $filetype ); > } > elsif ( $op eq 'Delete' ) { >- my $dberror = RmPatronImage($borrowernumber); >- $debug and warn "Patron image deleted for $borrowernumber"; >- warn "Database returned $dberror" if $dberror; >+ my $deleted = eval { >+ Koha::Patron::Images->find( $borrowernumber )->delete; >+ }; >+ if ( $@ or not $deleted ) { >+ warn "Image for patron '$borrowernumber' has not been deleted"; >+ } > } > if ( $borrowernumber && !%errors && !$template->param('ERRORS') ) { > print $input->redirect( >-- >2.7.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15635
:
47122
|
47124
|
47125
|
47126
|
48113
|
48114
|
48115
|
48116
|
48117
|
48136
|
48137
|
48138
|
48139
|
48140
|
48243
|
48244
|
48245
|
48246
|
48247
|
48248
|
48249