From 04d03fdd69b8dd8dd4e364f8931b56602d0493a0 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 Content-Type: text/plain; charset=utf-8 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 Signed-off-by: Owen Leonard Signed-off-by: Marcel de Rooy --- 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 9f7337be62..a2e4d1439e 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