Bugzilla – Attachment 37188 Details for
Bug 4137
OPACViewOthersSuggestions does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 4137: Fix the OPACViewOthersSuggestions behavior
Bug-4137-Fix-the-OPACViewOthersSuggestions-behavio.patch (text/plain), 6.23 KB, created by
Jonathan Druart
on 2015-03-24 16:05:21 UTC
(
hide
)
Description:
Bug 4137: Fix the OPACViewOthersSuggestions behavior
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-03-24 16:05:21 UTC
Size:
6.23 KB
patch
obsolete
>From 707a06efbd9f1bc50f7abd24fb218661d0b08a1b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 24 Mar 2015 17:01:30 +0100 >Subject: [PATCH] Bug 4137: Fix the OPACViewOthersSuggestions behavior > >This pref does not work at all, the interface let the user choose to >list all suggestions, but whatever he chooses the suggestion list is the >same. > >This patch cleans a bit the suggestedby management. > >Test plan: >1/ Enable OPACViewOthersSuggestions >2/ Go at the OPAC and confirm you are able to list all suggestions, even >the ones you don't have created >3/ Disable OPACViewOthersSuggestions >4/ On the same page confirm you are not able to see other suggestions >than yours. > >Also test with AnonSuggestions and AnonymousPatron and confirm the >behavior is the one you expected (or not). >--- > C4/Auth.pm | 1 - > .../bootstrap/en/modules/opac-suggestions.tt | 8 ++++---- > opac/opac-suggestions.pl | 21 +++++++++------------ > 3 files changed, 13 insertions(+), 17 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 22f1e8e..8086abc 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -475,7 +475,6 @@ sub get_template_and_user { > OPACShelfBrowser => "" . C4::Context->preference("OPACShelfBrowser"), > OPACURLOpenInNewWindow => "" . C4::Context->preference("OPACURLOpenInNewWindow"), > OPACUserCSS => "" . C4::Context->preference("OPACUserCSS"), >- OPACViewOthersSuggestions => "" . C4::Context->preference("OPACViewOthersSuggestions"), > OpacAuthorities => C4::Context->preference("OpacAuthorities"), > OPACBaseURL => ( $using_https ? "https://" : "http://" ) . $opac_base_url, > opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 46d0031..c656705 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -92,7 +92,7 @@ > </ol> > </fieldset> > <fieldset class="action"> >- <input type="hidden" name="suggestedby" value="[% suggestedbyme %]" /> >+ <input type="hidden" name="suggestedby" value="[% suggestedby %]" /> > <input type="hidden" name="op" value="add_confirm" /> > <input type="submit" onclick="Check(this.form); return false;" class="btn" value="Submit your suggestion" /> <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a> > </fieldset> >@@ -124,8 +124,8 @@ > <label for="suggestedby">Suggested by:</label> > <div class="input-append"> > <select name="suggestedby" id="suggestedby"> >- <option value="0">Anyone</option> >- <option value="1">Me</option> >+ <option value="suggested_by_anyone">Anyone</option> >+ <option value="suggested_by_me">Me</option> > </select> > <button type="submit" class="btn">Go</button> > </div> >@@ -269,7 +269,7 @@ > [% IF ( loggedinusername ) %]null,[% END %] > { "sType": "anti-the" }, > null, >- [% IF ( OPACViewOthersSuggestions ) %]null,[% END %] >+ [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]null,[% END %] > [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %] > null > ] >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index 16aadf8..d02595d 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -33,7 +33,6 @@ use C4::Scrubber; > use Koha::DateUtils qw( dt_from_string ); > > my $input = new CGI; >-my $allsuggestions = $input->param('showall'); > my $op = $input->param('op'); > my $suggestion = $input->Vars; > delete $suggestion->{negcap}; >@@ -51,8 +50,9 @@ if ( ! C4::Context->preference('suggestion') ) { > exit; > } > >-delete $$suggestion{$_} foreach qw<op suggestedbyme>; >+delete $suggestion->{op}; > $op = 'else' unless $op; >+$suggestion->{suggestedby} //= 'suggested_by_anyone'; > > my ( $template, $borrowernumber, $cookie ); > my $deleted = $input->param('deleted'); >@@ -67,9 +67,6 @@ if ( C4::Context->preference("AnonSuggestions") ) { > authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > } > ); >- if ( !$$suggestion{suggestedby} ) { >- $$suggestion{suggestedby} = C4::Context->preference("AnonymousPatron"); >- } > } > else { > ( $template, $borrowernumber, $cookie ) = get_template_and_user( >@@ -81,13 +78,14 @@ else { > } > ); > } >-if ($allsuggestions){ >- delete $$suggestion{suggestedby}; >-} >-else { >- $$suggestion{suggestedby} ||= $borrowernumber unless ($allsuggestions); >+ >+if ( C4::Context->preference("AnonSuggestions") and C4::Context->preference("AnonymousPatron") ) { >+ $suggestion->{suggestedby} = C4::Context->preference("AnonymousPatron"); >+} elsif ( C4::Context->preference("OPACViewOthersSuggestions") and $suggestion->{suggestedby} eq 'suggested_by_anyone' ) { >+ delete $suggestion->{suggestedby}; >+} else { >+ $suggestion->{suggestedby} = $borrowernumber; > } >-# warn "bornum:",$borrowernumber; > > my $suggestions_loop = > &SearchSuggestion( $suggestion); >@@ -169,7 +167,6 @@ $template->param( > itemtypeloop=> $supportlist, > suggestions_loop => $suggestions_loop, > patron_reason_loop => $patron_reason_loop, >- showall => $allsuggestions, > "op_$op" => 1, > suggestionsview => 1, > ); >-- >2.1.0
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 4137
:
37188
|
37190
|
37207
|
39068
|
39723