@@ -, +, @@ --- C4/Auth.pm | 1 - .../bootstrap/en/modules/opac-suggestions.tt | 8 ++++---- opac/opac-suggestions.pl | 21 +++++++++----------- 3 files changed, 13 insertions(+), 17 deletions(-) --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -475,7 +475,6 @@ sub get_template_and_user { OPACShelfBrowser => "" . C4::Context->preference("OPACShelfBrowser"), OPACURLOpenInNewWindow => "" . C4::Context->preference("OPACURLOpenInNewWindow"), OPACUserCSS => "" . C4::Context->preference("OPACUserCSS"), - OPACViewOthersSuggestions => "" . C4::Context->preference("OPACViewOthersSuggestions"), OpacAuthorities => C4::Context->preference("OpacAuthorities"), OPACBaseURL => ( $using_https ? "https://" : "http://" ) . $opac_base_url, opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt @@ -92,7 +92,7 @@
- + Cancel
@@ -124,8 +124,8 @@
@@ -269,7 +269,7 @@ [% IF ( loggedinusername ) %]null,[% END %] { "sType": "anti-the" }, null, - [% IF ( OPACViewOthersSuggestions ) %]null,[% END %] + [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]null,[% END %] [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %] null ] --- a/opac/opac-suggestions.pl +++ a/opac/opac-suggestions.pl @@ -33,7 +33,6 @@ use C4::Scrubber; use Koha::DateUtils qw( dt_from_string ); my $input = new CGI; -my $allsuggestions = $input->param('showall'); my $op = $input->param('op'); my $suggestion = $input->Vars; delete $suggestion->{negcap}; @@ -51,8 +50,9 @@ if ( ! C4::Context->preference('suggestion') ) { exit; } -delete $$suggestion{$_} foreach qw; +delete $suggestion->{op}; $op = 'else' unless $op; +$suggestion->{suggestedby} //= 'suggested_by_anyone'; my ( $template, $borrowernumber, $cookie ); my $deleted = $input->param('deleted'); @@ -67,9 +67,6 @@ if ( C4::Context->preference("AnonSuggestions") ) { authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), } ); - if ( !$$suggestion{suggestedby} ) { - $$suggestion{suggestedby} = C4::Context->preference("AnonymousPatron"); - } } else { ( $template, $borrowernumber, $cookie ) = get_template_and_user( @@ -81,13 +78,14 @@ else { } ); } -if ($allsuggestions){ - delete $$suggestion{suggestedby}; -} -else { - $$suggestion{suggestedby} ||= $borrowernumber unless ($allsuggestions); + +if ( C4::Context->preference("AnonSuggestions") and C4::Context->preference("AnonymousPatron") ) { + $suggestion->{suggestedby} = C4::Context->preference("AnonymousPatron"); +} elsif ( C4::Context->preference("OPACViewOthersSuggestions") and $suggestion->{suggestedby} eq 'suggested_by_anyone' ) { + delete $suggestion->{suggestedby}; +} else { + $suggestion->{suggestedby} = $borrowernumber; } -# warn "bornum:",$borrowernumber; my $suggestions_loop = &SearchSuggestion( $suggestion); @@ -169,7 +167,6 @@ $template->param( itemtypeloop=> $supportlist, suggestions_loop => $suggestions_loop, patron_reason_loop => $patron_reason_loop, - showall => $allsuggestions, "op_$op" => 1, suggestionsview => 1, ); --