From c5a28b67ec1071922eb5e2e03d393337686818ca Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 20 Jun 2016 16:04:21 -0400 Subject: [PATCH] Bug 15128 - Followup Only check limit for signed in borrower Show all suggestions after a new one is added --- opac/opac-suggestions.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index 6d2b88b..ff64dcb 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -112,12 +112,14 @@ if ( $op eq 'else' ) { } } -my $patrons_pending_suggestions_count = scalar @{ SearchSuggestion( { suggestedby => $borrowernumber, STATUS => 'ASKED' } ) }; +my $patrons_pending_suggestions_count = 0; +if ( $borrowernumber ) { + my $patrons_pending_suggestions_count = scalar @{ SearchSuggestion( { suggestedby => $borrowernumber, STATUS => 'ASKED' } ) } ; +} my $suggestions_loop = &SearchSuggestion($suggestion); if ( $op eq "add_confirm" ) { - my $count_own_suggestions = $borrowernumber ? &SearchSuggestion( { suggestedby => $borrowernumber } ) : 0; - if ( $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") ) + if ( $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") ) #only check limit for signed in borrowers { push @messages, { type => 'error', code => 'too_many' }; } @@ -149,7 +151,7 @@ if ( $op eq "add_confirm" ) { # delete empty fields, to avoid filter in "SearchSuggestion" foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) { - delete $suggestion->{$field} unless $suggestion->{$field}; + delete $suggestion->{$field}; #clear search filters (except borrower related) to show all suggestions after placing a new one } $suggestions_loop = &SearchSuggestion($suggestion); push @messages, { type => 'info', code => 'success_on_inserted' }; -- 2.1.4