Bugzilla – Attachment 75302 Details for
Bug 20763
AllowPurchaseSuggestionBranchChoice triggers error opac-suggestions.pl is visited without logging in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20763: AllowPurchaseSuggestionBranchChoice triggers error opac-suggestions.pl is visited without logging in
Bug-20763-AllowPurchaseSuggestionBranchChoice-trig.patch (text/plain), 2.08 KB, created by
Kyle M Hall (khall)
on 2018-05-14 12:53:22 UTC
(
hide
)
Description:
Bug 20763: AllowPurchaseSuggestionBranchChoice triggers error opac-suggestions.pl is visited without logging in
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-05-14 12:53:22 UTC
Size:
2.08 KB
patch
obsolete
>From 6b9e9a7053f98a20de5c4892ea68327a42d6239f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Mon, 14 May 2018 08:45:00 -0400 >Subject: [PATCH] Bug 20763: AllowPurchaseSuggestionBranchChoice triggers error > opac-suggestions.pl is visited without logging in > >Some code executed in the script opac-suggestions.pl if the system preference AllowPurchaseSuggestionBranchChoice is enabled assumes there is a logged in user. If there is not, patrons will see the error "Internal Server Error". > >Test Plan: >1) Enable AllowPurchaseSuggestionBranchChoice >2) Enable AnonSuggestions >3) In the OPAC, perform a search that will have no results, > click the "Make a purchase suggestion" link. >4) Note the error >5) Apply this patch >6) Reload the page >7) The page should load now! >--- > opac/opac-suggestions.pl | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index e086b14ffb..c29278cf89 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -196,16 +196,18 @@ my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG"); > > # Is the person allowed to choose their branch > if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { >+ my $branchcode = $input->param('branchcode') || q{}; > >-# pass the pickup branch along.... >- my $userbranch = ''; >- if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { >- $userbranch = C4::Context->userenv->{'branch'}; >+ if ( !$branchcode && $borrowernumber ) { >+ my $patron = Koha::Patrons->find($borrowernumber); >+ $branchcode = $patron->branchcode; > } >- my $branchcode = $input->param('branchcode'); >- unless ( $branchcode ) { >- my $patron = Koha::Patrons->find( $borrowernumber ); >- $branchcode = $patron->branchcode || $userbranch || '' ; >+ >+ if ( !$branchcode >+ && C4::Context->userenv >+ && C4::Context->userenv->{branch} ) >+ { >+ $branchcode = C4::Context->userenv->{branch}; > } > > $template->param( branchcode => $branchcode ); >-- >2.15.1 (Apple Git-101)
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 20763
:
75302
|
75567
|
75602
|
75603
|
75623