Bugzilla – Attachment 110688 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 system pref
Bug-23420-Add-OPACSuggestionUnwantedFields-system-.patch (text/plain), 23.75 KB, created by
Katrin Fischer
on 2020-09-24 18:35:40 UTC
(
hide
)
Description:
Bug 23420: Add OPACSuggestionUnwantedFields system pref
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-09-24 18:35:40 UTC
Size:
23.75 KB
patch
obsolete
>From 0e256af3197b11bff4946ebaa64e71bd9c50a9d5 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 18 Sep 2020 22:17:58 +0000 >Subject: [PATCH] Bug 23420: Add OPACSuggestionUnwantedFields system pref > >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 >-Turn on the system preference AllowPurchaseSuggestionBranchChoice to see the branch choice on the form >-Make sure you can correctly hide this one and still submit the purchase suggestion for without error. >-Go through each option and make sure it hides properly. > >Note: You will only see the patron reason field when there are authorised values in the OPAC_SUG category > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > ...0_add_OPACSuggestionUnwantedFields_syspref.perl | 7 + > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/opac.pref | 16 ++ > .../bootstrap/en/modules/opac-suggestions.tt | 186 ++++++++++++--------- > opac/opac-suggestions.pl | 10 ++ > 5 files changed, 138 insertions(+), 82 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..26b9157335 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl >@@ -0,0 +1,7 @@ >+$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','', NULL,'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/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 1df6a1fb53..d16c262f4a 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -451,6 +451,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'), > ('OpacStarRatings','all','disable|all|details',NULL,'Choice'), > ('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo'), >+('OPACSuggestionUnwantedFields',NULL,'','Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'), > ('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'), > ('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'), > ('OpacSuppressionMessage','','Display this message on the redirect page for suppressed biblios','70|10','Textarea'), >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 e078692ff6..3cb298c423 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 >@@ -630,6 +630,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: >+ 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 >+ - "<br />Note: Do not make OPACSuggestionMandatoryFields unwanted fields " >+ - > - 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 4d8a055ec5..6a9630fcd4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -76,79 +76,94 @@ > <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 ( author_hidden ) %] >+ <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> >+ [% 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="copyrightdate">Copyright date:</label> >- <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" /> >+ <label for="isbn">Standard number (ISBN, ISSN or other):</label> >+ <input type="text" id="isbn" name="isbn" maxlength="80" value="[% isbn | 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> >- [% 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 %] >- </li> >- <li> >+ </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> > [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %] >@@ -157,8 +172,10 @@ > <label for="itemtype">Item type:</label> > [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %] > [% END %] >- </li> >+ </li> >+ [% END %] > [% IF branchcode %] >+ [% UNLESS ( branch_hidden )%] > <li> > [% IF ( branchcode_required ) %] > <label for="branch" class="required">Library:</label> >@@ -174,7 +191,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> >@@ -196,16 +215,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 22f6442c9b..ab146ccf25 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -256,6 +256,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