View | Details | Raw Unified | Return to bug 15128
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt (-3 / +3 lines)
Lines 28-34 Link Here
28
                <div class="span10">
28
                <div class="span10">
29
                    <div id="usersuggestions" class="maincontent">
29
                    <div id="usersuggestions" class="maincontent">
30
                        [% IF ( op_add ) %]
30
                        [% IF ( op_add ) %]
31
                            [% IF ( Koha.Preference('MaxOpenSuggestions') && own_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
31
                            [% IF ( Koha.Preference('MaxOpenSuggestions') && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
32
                                    <h1 class="TooManySuggestions">You cannot place any more suggestions</h1>
32
                                    <h1 class="TooManySuggestions">You cannot place any more suggestions</h1>
33
                                    <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>
33
                                    <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>
34
                            [% ELSE %]
34
                            [% ELSE %]
Lines 152-158 Link Here
152
                                    <input type="hidden" name="op" value="delete_confirm" />
152
                                    <input type="hidden" name="op" value="delete_confirm" />
153
                                    [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
153
                                    [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
154
                                        <div id="toolbar" class="toolbar clearfix">
154
                                        <div id="toolbar" class="toolbar clearfix">
155
                                        [% IF ( Koha.Preference('MaxOpenSuggestions') && own_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
155
                                        [% IF ( Koha.Preference('MaxOpenSuggestions') && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
156
                                                <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>
156
                                                <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>
157
                                        [% ELSE %]
157
                                        [% ELSE %]
158
                                                <a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>
158
                                                <a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>
Lines 256-262 Link Here
256
                                    <p>There are no pending purchase suggestions.</p>
256
                                    <p>There are no pending purchase suggestions.</p>
257
                                [% END %]
257
                                [% END %]
258
                                [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
258
                                [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
259
                                    [% IF ( Koha.Preference('MaxOpenSuggestions') && own_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
259
                                    [% IF ( Koha.Preference('MaxOpenSuggestions') && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
260
                                        <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>
260
                                        <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>
261
                                    [% ELSE %]
261
                                    [% ELSE %]
262
                                        <p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>
262
                                        <p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>
(-)a/opac/opac-suggestions.pl (-7 / +4 lines)
Lines 112-121 if ( $op eq 'else' ) { Link Here
112
    }
112
    }
113
}
113
}
114
114
115
my $patrons_pending_suggestions_count = scalar @{ SearchSuggestion( { suggestedby => $borrowernumber, STATUS => 'ASKED' } ) };
116
115
my $suggestions_loop = &SearchSuggestion($suggestion);
117
my $suggestions_loop = &SearchSuggestion($suggestion);
116
if ( $op eq "add_confirm" ) {
118
if ( $op eq "add_confirm" ) {
117
    my $count_own_suggestions = $borrowernumber ? &SearchSuggestion( { suggestedby => $borrowernumber } ) : 0;
119
    my $count_own_suggestions = $borrowernumber ? &SearchSuggestion( { suggestedby => $borrowernumber } ) : 0;
118
    if ( @$count_own_suggestions >= C4::Context->preference("MaxOpenSuggestions") )
120
    if ( $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") )
119
    {
121
    {
120
        push @messages, { type => 'error', code => 'too_many' };
122
        push @messages, { type => 'error', code => 'too_many' };
121
    }
123
    }
Lines 209-219 $template->param( Link Here
209
    messages              => \@messages,
211
    messages              => \@messages,
210
    suggestionsview       => 1,
212
    suggestionsview       => 1,
211
    suggested_by_anyone   => $suggested_by_anyone,
213
    suggested_by_anyone   => $suggested_by_anyone,
212
    own_suggestions_count => scalar @{
214
    patrons_pending_suggestions_count => $patrons_pending_suggestions_count,
213
        SearchSuggestion(
214
            { suggestedby => $borrowernumber, STATUS => 'ASKED' }
215
        )
216
    },
217
);
215
);
218
216
219
output_html_with_http_headers $input, $cookie, $template->output;
217
output_html_with_http_headers $input, $cookie, $template->output;
220
- 

Return to bug 15128