Lines 112-123
if ( $op eq 'else' ) {
Link Here
|
112 |
} |
112 |
} |
113 |
} |
113 |
} |
114 |
|
114 |
|
115 |
my $patrons_pending_suggestions_count = scalar @{ SearchSuggestion( { suggestedby => $borrowernumber, STATUS => 'ASKED' } ) }; |
115 |
my $patrons_pending_suggestions_count = 0; |
|
|
116 |
if ( $borrowernumber ) { |
117 |
my $patrons_pending_suggestions_count = scalar @{ SearchSuggestion( { suggestedby => $borrowernumber, STATUS => 'ASKED' } ) } ; |
118 |
} |
116 |
|
119 |
|
117 |
my $suggestions_loop = &SearchSuggestion($suggestion); |
120 |
my $suggestions_loop = &SearchSuggestion($suggestion); |
118 |
if ( $op eq "add_confirm" ) { |
121 |
if ( $op eq "add_confirm" ) { |
119 |
my $count_own_suggestions = $borrowernumber ? &SearchSuggestion( { suggestedby => $borrowernumber } ) : 0; |
122 |
if ( $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") ) #only check limit for signed in borrowers |
120 |
if ( $patrons_pending_suggestions_count >= C4::Context->preference("MaxOpenSuggestions") ) |
|
|
121 |
{ |
123 |
{ |
122 |
push @messages, { type => 'error', code => 'too_many' }; |
124 |
push @messages, { type => 'error', code => 'too_many' }; |
123 |
} |
125 |
} |
Lines 149-155
if ( $op eq "add_confirm" ) {
Link Here
|
149 |
|
151 |
|
150 |
# delete empty fields, to avoid filter in "SearchSuggestion" |
152 |
# delete empty fields, to avoid filter in "SearchSuggestion" |
151 |
foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) { |
153 |
foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) { |
152 |
delete $suggestion->{$field} unless $suggestion->{$field}; |
154 |
delete $suggestion->{$field}; #clear search filters (except borrower related) to show all suggestions after placing a new one |
153 |
} |
155 |
} |
154 |
$suggestions_loop = &SearchSuggestion($suggestion); |
156 |
$suggestions_loop = &SearchSuggestion($suggestion); |
155 |
push @messages, { type => 'info', code => 'success_on_inserted' }; |
157 |
push @messages, { type => 'info', code => 'success_on_inserted' }; |
156 |
- |
|
|