@@ -, +, @@ search to hold - 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 --- catalogue/detail.pl | 18 ++++++++++-------- catalogue/search.pl | 24 ++++++++++++++---------- 2 files changed, 24 insertions(+), 18 deletions(-) --- a/catalogue/detail.pl +++ a/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")){ --- a/catalogue/search.pl +++ a/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")){ --