From fb89c75f6d868d82a7f143816663b89d01529c98 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 5 Jan 2020 22:02:18 +0100 Subject: [PATCH] Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users The 'op' parameter is removed from the CGI object ($input) before get_template_and_user is called. When the user is redirected to the login form (from checkauth, called from get_template_and_user), the op is lost. Moving down the deletion fixes the problem. Test plan: Logout at the OPAC Go the detail page of a bibliographic record Click the "Suggest for purchase" link Fill the login form => Without this patch you will see your suggestion list => With this patch applied the new suggestion form will be displayed, prefilled with the biblio's info --- opac/opac-suggestions.pl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index b502e92737..7593a3529b 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -47,10 +47,6 @@ my $need_confirm = 0; if ($negcaptcha ) { print $input->redirect("/cgi-bin/koha/opac-suggestions.pl"); exit; -} else { - # don't pass 'negcap' column to DB, else DBI::Class will error - # DBIx::Class::Row::store_column(): No such column 'negcap' on Koha::Schema::Result::Suggestion at Koha/C4/Suggestions.pm - delete $suggestion->{negcap}; } #If suggestions are turned off we redirect to 404 error. This will also redirect guest suggestions @@ -59,9 +55,6 @@ if ( ! C4::Context->preference('suggestion') ) { exit; } -delete $suggestion->{$_} foreach qw; -$op = 'else' unless $op; - my ( $template, $borrowernumber, $cookie, @messages ); my $deleted = $input->param('deleted'); my $submitted = $input->param('submitted'); @@ -87,6 +80,12 @@ else { ); } +# don't pass 'negcap' column to DB, else DBI::Class will error +# DBIx::Class::Row::store_column(): No such column 'negcap' on Koha::Schema::Result::Suggestion at Koha/C4/Suggestions.pm +delete $suggestion->{negcap}; +delete $suggestion->{$_} foreach qw; +$op = 'else' unless $op; + if ( $op eq 'else' ) { if ( C4::Context->preference("OPACViewOthersSuggestions") ) { if ( $borrowernumber ) { -- 2.11.0