Bugzilla – Attachment 120182 Details for
Bug 28213
Deleting a patron or patron club causes server error on searching
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28213: Prevent crash if patron or club deleted after search to hold
Bug-28213-Prevent-crash-if-patron-or-club-deleted-.patch (text/plain), 3.55 KB, created by
Andrew Fuerste-Henry
on 2021-04-26 18:11:41 UTC
(
hide
)
Description:
Bug 28213: Prevent crash if patron or club deleted after search to hold
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2021-04-26 18:11:41 UTC
Size:
3.55 KB
patch
obsolete
>From 8421bf451f7e7ef84b6ddcb10a75717c83dca630 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 26 Apr 2021 11:10:11 +0200 >Subject: [PATCH] Bug 28213: Prevent crash if patron or club deleted after > search to hold > >Deleting a patron or patron club causes server error on searching. > >To recreate: >- create a club template >- create a club >- enroll a patron in the club >- from the clubs page, select Search To Hold for your club >- do a search, see that it says "Hold for [club name]" in your search results page >- go back to the clubs page and delete your club >- try to perform a search >=> Without this patch you get "Can't call method "name" on an undefined value at /kohadevbox/koha/catalogue/search.pl line 207" > >Same when placing a hold for a patron (check the search result and the >detail pages) > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > catalogue/detail.pl | 18 ++++++++++-------- > catalogue/search.pl | 24 ++++++++++++++---------- > 2 files changed, 24 insertions(+), 18 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index eca8c718af..8d06f0da51 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -92,15 +92,17 @@ if ( not defined $record ) { > eval { $biblio->metadata->record }; > $template->param( decoding_error => $@ ); > >-if($query->cookie("holdfor")){ >+if($query->cookie("holdfor")){ > my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") ); >- $template->param( >- # FIXME Should pass the patron object >- holdfor => $query->cookie("holdfor"), >- holdfor_surname => $holdfor_patron->surname, >- holdfor_firstname => $holdfor_patron->firstname, >- holdfor_cardnumber => $holdfor_patron->cardnumber, >- ); >+ if ( $holdfor_patron ) { >+ $template->param( >+ # FIXME Should pass the patron object >+ holdfor => $query->cookie("holdfor"), >+ holdfor_surname => $holdfor_patron->surname, >+ holdfor_firstname => $holdfor_patron->firstname, >+ holdfor_cardnumber => $holdfor_patron->cardnumber, >+ ); >+ } > } > > if($query->cookie("searchToOrder")){ >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 1419759c85..4ce6b4f9ed 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -194,20 +194,24 @@ if (C4::Context->preference("marcflavour") eq "UNIMARC" ) { > > if($cgi->cookie("holdfor")){ > my $holdfor_patron = Koha::Patrons->find( $cgi->cookie("holdfor") ); >- $template->param( >- holdfor => $cgi->cookie("holdfor"), >- holdfor_surname => $holdfor_patron->surname, >- holdfor_firstname => $holdfor_patron->firstname, >- holdfor_cardnumber => $holdfor_patron->cardnumber, >- ); >+ if ( $holdfor_patron ) { # may have been deleted in the meanwhile >+ $template->param( >+ holdfor => $cgi->cookie("holdfor"), >+ holdfor_surname => $holdfor_patron->surname, >+ holdfor_firstname => $holdfor_patron->firstname, >+ holdfor_cardnumber => $holdfor_patron->cardnumber, >+ ); >+ } > } > > if($cgi->cookie("holdforclub")){ > my $holdfor_club = Koha::Clubs->find( $cgi->cookie("holdforclub") ); >- $template->param( >- holdforclub => $cgi->cookie("holdforclub"), >- holdforclub_name => $holdfor_club->name, >- ); >+ if ( $holdfor_club ) { # May have been deleted in the meanwhile >+ $template->param( >+ holdforclub => $cgi->cookie("holdforclub"), >+ holdforclub_name => $holdfor_club->name, >+ ); >+ } > } > > if($cgi->cookie("searchToOrder")){ >-- >2.11.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 28213
:
120168
|
120177
|
120182
|
120238