From 5e412e5050e091178cbf30087763bd4cfafd5407 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 30 Jun 2016 10:20:39 -0400 Subject: [PATCH] Bug 15128 (QA Followup) Display all purchase suggestions whether or not suggestion was added Correct enforcement of 0 limit Signed-off-by: Jonathan Druart --- .../opac-tmpl/bootstrap/en/modules/opac-suggestions.tt | 6 +++--- opac/opac-suggestions.pl | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt index 3764852..a6a515a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt @@ -28,7 +28,7 @@
[% IF ( op_add ) %] - [% IF ( Koha.Preference('MaxOpenSuggestions') && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %] + [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]

You cannot place any more suggestions

You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') %]). Once the library has processed those suggestions you will be able to place more.

[% ELSE %] @@ -152,7 +152,7 @@ [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
- [% IF ( Koha.Preference('MaxOpenSuggestions') && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %] + [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]

You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') %]).
Once the library has processed those suggestions you will be able to place more.

[% ELSE %] New purchase suggestion @@ -256,7 +256,7 @@

There are no pending purchase suggestions.

[% END %] [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %] - [% IF ( Koha.Preference('MaxOpenSuggestions') && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %] + [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]

You have reached your limit of suggestions you can place at this time.
Once the library has processed those suggestions you will be able to place more

[% ELSE %]

New purchase suggestion

diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index ff64dcb..26bc4f8 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -119,7 +119,7 @@ if ( $borrowernumber ) { my $suggestions_loop = &SearchSuggestion($suggestion); if ( $op eq "add_confirm" ) { - if ( $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") ) #only check limit for signed in borrowers + if ( C4::Context->preference("MaxOpenSuggestions") ne '' && $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") ) #only check limit for signed in borrowers { push @messages, { type => 'error', code => 'too_many' }; } @@ -148,14 +148,14 @@ if ( $op eq "add_confirm" ) { $suggestion->{branchcode} = $input->param('branchcode') || C4::Context->userenv->{"branch"}; &NewSuggestion($suggestion); - - # delete empty fields, to avoid filter in "SearchSuggestion" - foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) { - 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' }; + + } + # delete empty fields, to avoid filter in "SearchSuggestion" and load all suggestions for display + foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) { + delete $suggestion->{$field}; #clear search filters (except borrower related) to show all suggestions after placing a new one } + $suggestions_loop = &SearchSuggestion($suggestion); $op = 'else'; } -- 2.8.1