Bugzilla – Attachment 28721 Details for
Bug 10848
Allow configuration of mandatory/required fields on the suggestion form in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10848 - Allow configuration of mandatory/required fields on the suggestion form in OPAC #1/2
Bug-10848---Allow-configuration-of-mandatoryrequir.patch (text/plain), 9.05 KB, created by
Jacek Ablewicz
on 2014-06-08 10:58:56 UTC
(
hide
)
Description:
Bug 10848 - Allow configuration of mandatory/required fields on the suggestion form in OPAC #1/2
Filename:
MIME Type:
Creator:
Jacek Ablewicz
Created:
2014-06-08 10:58:56 UTC
Size:
9.05 KB
patch
obsolete
>From 902b1242db9401fbda381cba9bf0c2042c6daef0 Mon Sep 17 00:00:00 2001 >From: Jacek Ablewicz <abl@biblos.pk.edu.pl> >Date: Sun, 8 Jun 2014 12:04:24 +0200 >Subject: [PATCH] Bug 10848 - Allow configuration of mandatory/required fields > on the suggestion form in OPAC #1/2 > >(part #1: changes in opac-suggestions.* script + bootstrap template) > >This patch adds a configuration option which allows to define which >fields (apart from the title) should be mandatory for a patron >purchase suggestion form in OPAC. >Supported fields that are configurable as mandatory/not mandatory >for suggestions made via OPAC are: author|copyrightdate|isbn| >publishercode|place|itemtype|patronreason. > >Note: this patch only applies to OPAC bootstrap theme. > >To test: >1/ Apply patch. >2/ Without 'OPACSuggestionMandatoryFields' option set, >OPAC suggestion form should work as previously ("Only the title >is required"). >3/ Set 'OPACSuggestionMandatoryFields' syspref to (e.g.) >'author|isbn|itemtype' >4/ Note that suggestion form in OPAC now requires 3 more fields >to be entered and/or choosen (they should be labeled in red), and >the user instruction changes slightly ("Form fields labeled in red >are mandatory" ..). >5/ Try to submit some suggestions: for each field which is configured >as mandatory, but is not filled with anything, there should be >and extra message displayed regarding this field. >6/ Unless all mandatory fields are filled with something, >form submission should not be possible. >7/ Repeat test 3-6 for all supported field names configurable >as mandatory. >--- > .../bootstrap/en/modules/opac-suggestions.tt | 42 ++++++++++++++++---- > opac/opac-suggestions.pl | 8 ++++ > 2 files changed, 42 insertions(+), 8 deletions(-) > >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 e10f37e..206d7dc 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -29,19 +29,24 @@ > <h1>Enter a new purchase suggestion</h1> > > <p>Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion</p> >- <p>Only the title is required, but the more information you enter the easier it will be for the librarians to find the title you're requesting. The "Notes" field can be used to provide any additional information.</p> >+ [% IF (mandatoryfields) %] >+ <p>Form fields labeled in red are mandatory. The more information you enter the easier it will be for the librarians to find the title you're requesting. >+ [% ELSE %] >+ <p>Only the title is required, but the more information you enter the easier it will be for the librarians to find the title you're requesting. >+ [% END %] >+ The "Notes" field can be used to provide any additional information.</p> > > <form action="/cgi-bin/koha/opac-suggestions.pl" method="post"> > <fieldset class="rows"> > <ol> > <li><label class="required" for="title">Title:</label><input type="text" id="title" name="title" maxlength="255" /></li> >- <li><label for="author">Author:</label><input type="text" id="author" name="author" maxlength="80" /></li> >- <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" /></li> >- <li><label for="isbn">Standard number (ISBN, ISSN or other):</label><input type="text" id="isbn" name="isbn" maxlength="80" /></li> >- <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" maxlength="80" /></li> >+ <li><label [% IF (mandatoryfields.author) %]class="required" [% END %]for="author">Author:</label><input type="text" id="author" name="author" maxlength="80" /></li> >+ <li><label [% IF (mandatoryfields.copyrightdate) %]class="required" [% END %]for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" /></li> >+ <li><label [% IF (mandatoryfields.isbn) %]class="required" [% END %]for="isbn">Standard number (ISBN, ISSN or other):</label><input type="text" id="isbn" name="isbn" maxlength="80" /></li> >+ <li><label [% IF (mandatoryfields.publishercode) %]class="required" [% END %]for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" maxlength="80" /></li> > <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" maxlength="80" /></li> >- <li><label for="place">Publication place:</label><input type="text" id="place" name="place" maxlength="80" /></li> >- <li><label for="itemtype">Item type:</label> >+ <li><label [% IF (mandatoryfields.place) %]class="required" [% END %]for="place">Publication place:</label><input type="text" id="place" name="place" maxlength="80" /></li> >+ <li><label [% IF (mandatoryfields.itemtype) %]class="required" [% END %]for="itemtype">Item type:</label> > <select name="itemtype" id="itemtype"> > <option value="">Default</option> > [% FOREACH itemtypeloo IN itemtypeloop %] >@@ -70,7 +75,7 @@ > [% END %] > [% IF ( patron_reason_loop ) %] > <li> >- <label for="patronreason">Reason for suggestion: </label> >+ <label [% IF (mandatoryfields.patronreason) %]class="required" [% END %]for="patronreason">Reason for suggestion: </label> > <select name="patronreason" id="patronreason"> > <option value="">-- Choose --</option> > [% FOREACH patron_reason_loo IN patron_reason_loop %] >@@ -313,6 +318,27 @@ > if(f.title.value.length ==0){ > _alertString += _("- You must enter a Title") + "\n"; > } >+ [% IF (mandatoryfields.author) %]if (f.author.value.length == 0){ >+ _alertString += _("- You must enter an Author") + "\n"; >+ }[% END %] >+ [% IF (mandatoryfields.copyrightdate) %]if (f.copyrightdate.value.length == 0){ >+ _alertString += _("- You must enter a Copyright date") + "\n"; >+ }[% END %] >+ [% IF (mandatoryfields.isbn) %]if (f.isbn.value.length == 0){ >+ _alertString += _("- You must enter a Standard number (ISBN, ISSN or other)") + "\n"; >+ }[% END %] >+ [% IF (mandatoryfields.publishercode) %]if (f.publishercode.value.length == 0){ >+ _alertString += _("- You must enter a Publisher") + "\n"; >+ }[% END %] >+ [% IF (mandatoryfields.place) %]if (f.place.value.length == 0){ >+ _alertString += _("- You must enter a Publication place") + "\n"; >+ }[% END %] >+ [% IF (mandatoryfields.itemtype) %]if (f.itemtype.value.length == 0){ >+ _alertString += _("- You must choose an Item type") + "\n"; >+ }[% END %] >+ [% IF (patron_reason_loop && mandatoryfields.patronreason) %]if (f.patronreason.value.length == 0){ >+ _alertString += _("- You must choose a Reason for suggestion") + "\n"; >+ }[% END %] > > if (_alertString.length==0) { > f.submit(); >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index ac6172d..f64e7a8 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -153,6 +153,13 @@ if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { > $template->param( branchloop => $branchloop ); > } > >+my $mandatoryfields = {}; >+{ >+ my $fldsreqsp = C4::Context->preference("OPACSuggestionMandatoryFields"); >+ ($op eq 'add' && $fldsreqsp) || last; >+ map { $_ && ($mandatoryfields->{$_} = 1); } (split(/\s*\|\s*/, $fldsreqsp)); >+} >+ > $template->param( > %$suggestion, > itemtypeloop=> $supportlist, >@@ -161,6 +168,7 @@ $template->param( > showall => $allsuggestions, > "op_$op" => 1, > suggestionsview => 1, >+ mandatoryfields => $mandatoryfields, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >-- >1.7.10.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 10848
:
28721
|
28722
|
28792
|
29091
|
29092
|
34317
|
34318
|
34319
|
34324
|
34325
|
34326
|
34544
|
34545
|
34546
|
34547
|
35830
|
54016
|
54017
|
54018
|
54019
|
54020
|
54021
|
54083
|
54084
|
54356
|
54430
|
54431
|
54432