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') && patrons_pending_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') && patrons_pending_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') && patrons_pending_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 (-8 / +7 lines)
Lines 119-125 if ( $borrowernumber ) { Link Here
119
119
120
my $suggestions_loop = &SearchSuggestion($suggestion);
120
my $suggestions_loop = &SearchSuggestion($suggestion);
121
if ( $op eq "add_confirm" ) {
121
if ( $op eq "add_confirm" ) {
122
    if ( $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") ) #only check limit for signed in borrowers
122
    if ( C4::Context->preference("MaxOpenSuggestions") ne '' && $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") ) #only check limit for signed in borrowers
123
    {
123
    {
124
        push @messages, { type => 'error', code => 'too_many' };
124
        push @messages, { type => 'error', code => 'too_many' };
125
    }
125
    }
Lines 148-161 if ( $op eq "add_confirm" ) { Link Here
148
        $suggestion->{branchcode} = $input->param('branchcode') || C4::Context->userenv->{"branch"};
148
        $suggestion->{branchcode} = $input->param('branchcode') || C4::Context->userenv->{"branch"};
149
149
150
        &NewSuggestion($suggestion);
150
        &NewSuggestion($suggestion);
151
152
        # delete empty fields, to avoid filter in "SearchSuggestion"
153
        foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) {
154
            delete $suggestion->{$field}; #clear search filters (except borrower related) to show all suggestions after placing a new one
155
        }
156
        $suggestions_loop = &SearchSuggestion($suggestion);
157
        push @messages, { type => 'info', code => 'success_on_inserted' };
151
        push @messages, { type => 'info', code => 'success_on_inserted' };
152
153
    }
154
    # delete empty fields, to avoid filter in "SearchSuggestion" and load all suggestions for display
155
    foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) {
156
        delete $suggestion->{$field}; #clear search filters (except borrower related) to show all suggestions after placing a new one
158
    }
157
    }
158
    $suggestions_loop = &SearchSuggestion($suggestion);
159
    $op = 'else';
159
    $op = 'else';
160
}
160
}
161
161
162
- 

Return to bug 15128