Bugzilla – Attachment 107662 Details for
Bug 23420
Add "SuggestionsUnwantedFields" to hide fields from the suggestions form
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23420: Add OPACSuggestionUnwantedFields option
Bug-23420-Add-OPACSuggestionUnwantedFields-option.patch (text/plain), 23.96 KB, created by
Lucas Gass (lukeg)
on 2020-08-01 03:13:06 UTC
(
hide
)
Description:
Bug 23420: Add OPACSuggestionUnwantedFields option
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2020-08-01 03:13:06 UTC
Size:
23.96 KB
patch
obsolete
>From fbea62613ce83cb82928c477f5ac0ff65b5b3cb4 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Sat, 1 Aug 2020 03:09:33 +0000 >Subject: [PATCH] Bug 23420: Add OPACSuggestionUnwantedFields option > >To test: >-Apply patch >-Check OPACSuggestionUnwantedFields >-Check some fields as unwanted >-Go to the OPAC suggestion page and make sure these correct fields are hidden >-Go through each option and make sure it hides properly >--- > ...0_add_OPACSuggestionUnwantedFields_syspref.perl | 8 + > .../prog/en/modules/admin/preferences/opac.pref | 16 ++ > .../bootstrap/en/modules/opac-suggestions.tt | 201 ++++++++++++--------- > opac/opac-suggestions.pl | 10 + > 4 files changed, 146 insertions(+), 89 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl b/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl >new file mode 100644 >index 0000000000..9d6059492e >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl >@@ -0,0 +1,8 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+ if ( CheckVersion($DBversion) ) { >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('OPACSuggestionUnwantedFields','title','','Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'); >+ }); >+ >+ NewVersion($DBversion, 23420, "Allow configuration of hidden fields on the suggestion form in OPAC"); >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index edc6ec4809..66dbf7b1a1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -640,6 +640,22 @@ OPAC: > note: Note > - "<br />Note: if none of the above options are selected, 'Title' field would be mandatory anyway, by default." > - >+ - "Fields that should be hidden for patron purchase suggestions:" >+ - pref: OPACSuggestionUnwantedFields >+ multiple: >+ title: Title >+ author: Author >+ copyrightdate: Copyright or publication date >+ isbn: ISBN, ISSN or other standard number >+ publishercode: Publisher name >+ collectiontitle: Collection title >+ place: Publication place >+ itemtype: Item type >+ quantity: Quantity >+ branch: Library or branch >+ patronreason: Patron reason >+ note: Note >+ - > - pref: OpacHiddenItems > type: textarea > syntax: text/x-yaml >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 499f330fb0..71fad804b8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -13,7 +13,6 @@ > </head> > [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-usersuggestions' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-suggestions' bodyclass='scrollto' %][% END %] > [% INCLUDE 'masthead.inc' %] >- > <div class="main"> > <ul class="breadcrumb"> > <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> >@@ -57,88 +56,105 @@ > <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form"> > <fieldset class="rows"> > <ol> >- <li> >- [% IF ( title_required ) %] >- <label for="title" class="required">Title:</label> >- <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" /> >- <span class="required">Required</span> >- [% ELSE %] >- <label for="title">Title:</label> >- <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" /> >- [% END %] >- </li> >- <li> >- [% IF ( author_required ) %] >- <label for="author" class="required">Author:</label> >- <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" /> >- <span class="required">Required</span> >- [% ELSE %] >- <label for="author">Author:</label> >- <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" /> >- [% END %] >- </li> >- <li> >- <div title="Copyright or publication year, for example: 2016"> >- [% IF ( copyrightdate_required ) %] >- <label for="copyrightdate" class="required">Copyright date:</label> >- <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" /> >- <span class="required">Required</span> >+ [% UNLESS ( title_hidden ) %] >+ <li> >+ [% IF ( title_required ) %] >+ <label for="title" class="required">Title:</label> >+ <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" /> >+ <span class="required">Required</span> > [% ELSE %] >- <label for="copyrightdate">Copyright date:</label> >- <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" /> >+ <label for="title">Title:</label> >+ <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" /> > [% END %] >- </div> >- </li> >- <li> >- [% IF ( isbn_required ) %] >- <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label> >- <input type="text" id="isbn" name="isbn" maxlength="80" value="[% isbn | html %]" required="required" /> >- <span class="required">Required</span> >- [% ELSE %] >- <label for="isbn">Standard number (ISBN, ISSN or other):</label> >- <input type="text" id="isbn" name="isbn" maxlength="80" value="[% isbn | html %]" /> >- [% END %] >- </li> >- <li> >- [% IF ( publishercode_required ) %] >- <label for="publishercode" class="required">Publisher:</label> >- <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" /> >- <span class="required">Required</span> >- [% ELSE %] >- <label for="publishercode">Publisher:</label> >- <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" /> >- [% END %] >- </li> >- <li> >- [% IF ( collectiontitle_required ) %] >- <label for="collectiontitle" class="required">Collection title:</label> >- <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" /> >- <span class="required">Required</span> >- [% ELSE %] >- <label for="collectiontitle">Collection title:</label> >- <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" /> >- [% END %] >- </li> >+ </li> >+ [% END %] > <li> >- [% IF ( place_required ) %] >- <label for="place" class="required">Publication place:</label> >- <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" /> >- <span class="required">Required</span> >- [% ELSE %] >- <label for="place">Publication place:</label> >- <input type="text" id="place" name="place" maxlength="80" value="[% place | html %]" /> >- [% END %] >- </li> >- <li id="opac-suggestion-quantity"> >- [% IF ( quantity_required ) %] >- <label for="quantity" class="required">Quantity:</label> >- <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" /> >- <span class="required">Required</span> >- [% ELSE %] >- <label for="quantity">Quantity:</label> >- <input type="text" id="quantity" name="quantity" maxlength="4" size="4" /> >- [% END %] >+ [% UNLESS ( author_hidden ) %] >+ [% IF ( author_required ) %] >+ <label for="author" class="required">Author:</label> >+ <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" /> >+ <span class="required">Required</span> >+ [% ELSE %] >+ <label for="author">Author:</label> >+ <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" /> >+ [% END %] > </li> >+ [% END %] >+ [% UNLESS ( copyrightdate_hidden )%] >+ <li> >+ <div title="Copyright or publication year, for example: 2016"> >+ [% IF ( copyrightdate_required ) %] >+ <label for="copyrightdate" class="required">Copyright date:</label> >+ <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" /> >+ <span class="required">Required</span> >+ [% ELSE %] >+ <label for="copyrightdate">Copyright date:</label> >+ <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" /> >+ [% END %] >+ </div> >+ </li> >+ [% END %] >+ [% UNLESS ( isbn_hidden ) %] >+ <li> >+ [% IF ( isbn_required ) %] >+ <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label> >+ <input type="text" id="isbn" name="isbn" maxlength="80" value="[% isbn | html %]" required="required" /> >+ <span class="required">Required</span> >+ [% ELSE %] >+ <label for="isbn">Standard number (ISBN, ISSN or other):</label> >+ <input type="text" id="isbn" name="isbn" maxlength="80" value="[% isbn | html %]" /> >+ [% END %] >+ </li> >+ [% END %] >+ [% UNLESS ( publishercode_hidden ) %] >+ <li> >+ [% IF ( publishercode_required ) %] >+ <label for="publishercode" class="required">Publisher:</label> >+ <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" /> >+ <span class="required">Required</span> >+ [% ELSE %] >+ <label for="publishercode">Publisher:</label> >+ <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" /> >+ [% END %] >+ </li> >+ [% END %] >+ [% UNLESS ( collectiontitle_hidden ) %] >+ <li> >+ [% IF ( collectiontitle_required ) %] >+ <label for="collectiontitle" class="required">Collection title:</label> >+ <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" /> >+ <span class="required">Required</span> >+ [% ELSE %] >+ <label for="collectiontitle">Collection title:</label> >+ <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" /> >+ [% END %] >+ </li> >+ [% END %] >+ [% UNLESS ( place_hidden )%] >+ <li> >+ [% IF ( place_required ) %] >+ <label for="place" class="required">Publication place:</label> >+ <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" /> >+ <span class="required">Required</span> >+ [% ELSE %] >+ <label for="place">Publication place:</label> >+ <input type="text" id="place" name="place" maxlength="80" value="[% place | html %]" /> >+ [% END %] >+ </li> >+ [% END %] >+ [% UNLESS ( quantity_hidden )%] >+ <li id="opac-suggestion-quantity"> >+ [% IF ( quantity_required ) %] >+ <label for="quantity" class="required">Quantity:</label> >+ <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" /> >+ <span class="required">Required</span> >+ [% ELSE %] >+ <label for="quantity">Quantity:</label> >+ <input type="text" id="quantity" name="quantity" maxlength="4" size="4" /> >+ [% END %] >+ </li> >+ [% END %] >+ [% UNLESS (itemtype_hidden) %] > <li> > [% IF ( itemtype_required ) %] > <label for="itemtype" class="required">Item type:</label> >@@ -149,7 +165,9 @@ > [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %] > [% END %] > </li> >+ [% END %] > [% IF branchcode %] >+ [% UNLESS ( branchcode_hidden )%] > <li> > [% IF ( branchcode_required ) %] > <label for="branch" class="required">Library:</label> >@@ -165,7 +183,9 @@ > [% END %] > </li> > [% END %] >+ [% END %] > [% IF ( patron_reason_loop ) %] >+ [% UNLESS ( patronreason_hidden ) %] > <li> > [% IF ( patronreason_required ) %] > <label for="patronreason" class="required">Reason for suggestion: </label> >@@ -187,16 +207,19 @@ > [% END %] > </li> > [% END %] >- <li> >- [% IF ( note_required ) %] >- <label for="note" class="required">Notes:</label> >- <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea> >- <span class="required">Required</span> >- [% ELSE %] >- <label for="note">Notes:</label> >- <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea> >- [% END %] >- </li> >+ [% END %] >+ [% UNLESS ( note_hidden ) %] >+ <li> >+ [% IF ( note_required ) %] >+ <label for="note" class="required">Notes:</label> >+ <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea> >+ <span class="required">Required</span> >+ [% ELSE %] >+ <label for="note">Notes:</label> >+ <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea> >+ [% END %] >+ </li> >+ [% END %] > > <!-- Add a hidden 'negcap' field --> > <li id="negcap" style="position: absolute; left: -2000px;"> >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index 74e3079dfe..9c891384a0 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -257,6 +257,16 @@ my @mandatoryfields; > } > } > >+my @unwantedfields; >+{ >+ last unless ($op eq 'add'); >+ my $fldsreq_sp = C4::Context->preference("OPACSuggestionUnwantedFields"); >+ @unwantedfields = sort split(/\s*\,\s*/, $fldsreq_sp); >+ foreach (@unwantedfields) { >+ $template->param( $_."_hidden" => 1); >+ } >+} >+ > $template->param( > %$suggestion, > suggestions_loop => $suggestions_loop, >-- >2.11.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 23420
:
107662
|
107787
|
108426
|
108429
|
108430
|
109299
|
110414
|
110418
|
110419
|
110671
|
110688
|
110689
|
111254