Bugzilla – Attachment 52611 Details for
Bug 15128
Add ability to limit the number of open purchase suggestions a patron can make
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15128 [QA Followup] - Make suggestion display after being added
Bug-15128-QA-Followup---Make-suggestion-display-af.patch (text/plain), 4.83 KB, created by
Kyle M Hall (khall)
on 2016-06-20 16:46:15 UTC
(
hide
)
Description:
Bug 15128 [QA Followup] - Make suggestion display after being added
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-06-20 16:46:15 UTC
Size:
4.83 KB
patch
obsolete
>From 9af3c704073f4eabf58c1f966fa1d31d868411e5 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 20 Jun 2016 16:44:38 +0000 >Subject: [PATCH] Bug 15128 [QA Followup] - Make suggestion display after being > added > >Also fixes the issue that the add suggestion link would sometimes >show even if the patron could not make an additional suggestion. >--- > opac/opac-suggestions.pl | 78 +++++++++++++++++++++++++++--------------------- > 1 file changed, 44 insertions(+), 34 deletions(-) > >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index c9dc7f0..4624658 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -112,36 +112,46 @@ if ( $op eq 'else' ) { > } > } > >-my $suggestions_loop = >- &SearchSuggestion( $suggestion); >+my $suggestions_loop = &SearchSuggestion($suggestion); > if ( $op eq "add_confirm" ) { >- my $count_own_suggestions = $borrowernumber ? &SearchSuggestion( { suggestedby => $borrowernumber}) : 0; >- if( @$count_own_suggestions >= C4::Context->preference("MaxOpenSuggestions") ){ >- push @messages, { type => 'error', code => 'too_many'}; >+ my $count_own_suggestions = $borrowernumber ? &SearchSuggestion( { suggestedby => $borrowernumber } ) : 0; >+ if ( @$count_own_suggestions >= C4::Context->preference("MaxOpenSuggestions") ) >+ { >+ push @messages, { type => 'error', code => 'too_many' }; > } >- elsif (@$suggestions_loop>=1){ >- #some suggestion are answering the request Donot Add >- for my $suggestion ( @$suggestions_loop ) { >- push @messages, { type => 'error', code => 'already_exists', id => $suggestion->{suggestionid} }; >+ elsif ( @$suggestions_loop >= 1 ) { >+ >+ #some suggestion are answering the request Donot Add >+ for my $suggestion (@$suggestions_loop) { >+ push @messages, >+ { >+ type => 'error', >+ code => 'already_exists', >+ id => $suggestion->{suggestionid} >+ }; > last; > } >- } >- else { >- my $scrubber = C4::Scrubber->new(); >- foreach my $suggest (keys %$suggestion){ >+ } >+ else { >+ my $scrubber = C4::Scrubber->new(); >+ foreach my $suggest ( keys %$suggestion ) { >+ > # Don't know why the encode is needed for Perl v5.10 here >- $suggestion->{$suggest} = Encode::encode("utf8", $scrubber->scrub($suggestion->{$suggest}) ); >- } >+ $suggestion->{$suggest} = Encode::encode( "utf8", >+ $scrubber->scrub( $suggestion->{$suggest} ) ); >+ } > $suggestion->{suggesteddate} = dt_from_string; > $suggestion->{branchcode} = $input->param('branchcode') || C4::Context->userenv->{"branch"}; > >- &NewSuggestion($suggestion); >- # empty fields, to avoid filter in "SearchSuggestion" >- $$suggestion{$_}='' foreach qw<title author publishercode copyrightdate place collectiontitle isbn STATUS>; >- $suggestions_loop = >- &SearchSuggestion( $suggestion ); >+ &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} unless $suggestion->{$field}; >+ } >+ $suggestions_loop = &SearchSuggestion($suggestion); > push @messages, { type => 'info', code => 'success_on_inserted' }; >- } >+ } > $op = 'else'; > } > >@@ -161,13 +171,9 @@ map{ > $library ? $s->{branchcodesuggestedby} = $library->branchname : () > } @$suggestions_loop; > >-my $own_suggestions_count = 0; > foreach my $suggestion(@$suggestions_loop) { > if($suggestion->{'suggestedby'} == $borrowernumber) { > $suggestion->{'showcheckbox'} = $borrowernumber; >- if ( $suggestion->{'STATUS'} eq 'ASKED' ) { >- $own_suggestions_count++; >- } > } else { > $suggestion->{'showcheckbox'} = 0; > } >@@ -195,15 +201,19 @@ if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { > } > > $template->param( >- %$suggestion, >- suggestions_loop => $suggestions_loop, >- patron_reason_loop => $patron_reason_loop, >- "op_$op" => 1, >- $op => 1, >- messages => \@messages, >- suggestionsview => 1, >- suggested_by_anyone => $suggested_by_anyone, >- own_suggestions_count => $own_suggestions_count, >+ %$suggestion, >+ suggestions_loop => $suggestions_loop, >+ patron_reason_loop => $patron_reason_loop, >+ "op_$op" => 1, >+ $op => 1, >+ messages => \@messages, >+ suggestionsview => 1, >+ suggested_by_anyone => $suggested_by_anyone, >+ own_suggestions_count => scalar @{ >+ SearchSuggestion( >+ { suggestedby => $borrowernumber, STATUS => 'ASKED' } >+ ) >+ }, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15128
:
52452
|
52502
|
52596
|
52610
|
52611
|
52623
|
52624
|
52625
|
52626
|
52715
|
52716
|
52717
|
52718
|
52719
|
52720
|
52721
|
52722
|
52997
|
53033
|
53034
|
53037
|
53038
|
53039
|
53040
|
53041
|
53042
|
53043
|
53044
|
53045