Bug 15128 (QA Followup) Display all purchase suggestions whether or not suggestion...
authorNick Clemens <nick@bywatersolutions.com>
Thu, 30 Jun 2016 14:20:39 +0000 (10:20 -0400)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 8 Jul 2016 14:09:48 +0000 (14:09 +0000)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
opac/opac-suggestions.pl

index 3764852..a6a515a 100644 (file)
@@ -28,7 +28,7 @@
                 <div class="span10">
                     <div id="usersuggestions" class="maincontent">
                         [% 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') ) %]
                                     <h1 class="TooManySuggestions">You cannot place any more suggestions</h1>
                                     <h2 class="TooManySuggestionsText">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.</h2>
                             [% ELSE %]
                                     <input type="hidden" name="op" value="delete_confirm" />
                                     [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
                                         <div id="toolbar" class="toolbar clearfix">
-                                        [% IF ( Koha.Preference('MaxOpenSuggestions') && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
+                                        [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
                                                 <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') %]).</br>Once the library has processed those suggestions you will be able to place more.</p>
                                         [% ELSE %]
                                                 <a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>
                                     <p>There are no pending purchase suggestions.</p>
                                 [% 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') ) %]
                                         <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time.</br>Once the library has processed those suggestions you will be able to place more</p>
                                     [% ELSE %]
                                         <p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>
index ff64dcb..26bc4f8 100755 (executable)
@@ -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';
 }