Bugzilla – Attachment 54430 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]
[PASSED QA] Bug 10848 - Allow configuration of mandatory/required fields on the suggestion form in OPAC
PASSED-QA-Bug-10848---Allow-configuration-of-manda.patch (text/plain), 6.87 KB, created by
Katrin Fischer
on 2016-08-14 12:58:58 UTC
(
hide
)
Description:
[PASSED QA] Bug 10848 - Allow configuration of mandatory/required fields on the suggestion form in OPAC
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2016-08-14 12:58:58 UTC
Size:
6.87 KB
patch
obsolete
>From c800131fba5c600a02cd4ec30b9bd67139ee2330 Mon Sep 17 00:00:00 2001 >From: Jacek Ablewicz <abl@biblos.pk.edu.pl> >Date: Fri, 5 Aug 2016 10:47:11 +0200 >Subject: [PATCH] [PASSED QA] Bug 10848 - Allow configuration of > mandatory/required fields on the suggestion form in OPAC > >This patch adds a configuration option which allows to define which >fields should be mandatory for a patron purchase suggestion form in OPAC. > >Test plan: > >1/ Apply patch. >2/ Play with the new OPACSuggestionMandatoryFields system preference >(select some fields as manadatory, select all, deselect all, try to >submit some suggestions with mandatory fields filled and/or not >filled etc.) to ensure that required fields (and only required fields) >are enforced in the browser to be filled. >3/ With all options deselected, 'Title' field should still be >mandatory (by default). > >Signed-off-by: barbara johnson <barbara.johnson@bedfordtx.gov> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../bootstrap/en/modules/opac-suggestions.tt | 41 ++++++++++------------ > opac/opac-suggestions.pl | 8 +++++ > 2 files changed, 26 insertions(+), 23 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 a6a515a..cf4dec2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -35,14 +35,14 @@ > <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> >+ <p>Only certain fields (marked in red) are 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> > >- <form action="/cgi-bin/koha/opac-suggestions.pl" method="post"> >+ <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form"> > <fieldset class="rows"> > <ol> >- <li><label class="required" for="title">Title:</label><input type="text" id="title" name="title" class="span6" maxlength="255" /></li> >+ <li><label for="title">Title:</label><input type="text" id="title" name="title" class="span6" maxlength="255" /></li> > <li><label for="author">Author:</label><input type="text" id="author" name="author" class="span6" 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="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" pattern="[12][0-9\-\?]{3}" 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" class="span6" maxlength="80" /></li> > <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" /></li> >@@ -89,7 +89,7 @@ > <fieldset class="action"> > <input type="hidden" name="suggested_by_anyone" value="[% suggested_by_anyone %]" /> > <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> >+ <input type="submit" class="btn" value="Submit your suggestion" /> <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a> > </fieldset> > </form> > [% END %] >@@ -337,25 +337,20 @@ > return true; > }); > [% END %] >- }); >- >- function Check(f) { >- var _alertString=""; >- var alertString2; >- >- if(f.title.value.length ==0){ >- _alertString += _("- You must enter a Title") + "\n"; >- } >- >- if (_alertString.length==0) { >- f.submit(); >- } else { >- alertString2 = _("Form not submitted because of the following problem(s)"); >- alertString2 += "\n------------------------------------------------------------------------------------\n\n"; >- alertString2 += _alertString; >- alert(alertString2); >+ [% IF ( op_add && mandatoryfields ) %] >+ { >+ var FldsRequired = [[% mandatoryfields %]]; >+ for (var i = 0; i < FldsRequired.length; i++) { >+ var rq_input = $('#' + FldsRequired[i]); >+ if (rq_input.length != 1) continue; >+ $(rq_input).attr("required", "required"); >+ var rq_label = $("label[for=" + rq_input.attr("id") + "]"); >+ if (rq_label.length != 1) continue; >+ $(rq_label).addClass('required'); >+ } > } >- } >+ [% END %] >+ }); > //]]> > </script> > [% END %] >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index 628f864..b183364 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -207,6 +207,13 @@ if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { > $template->param( branchloop => $branchloop ); > } > >+my $mandatoryfields = ''; >+{ >+ last unless ($op eq 'add'); >+ my $fldsreq_sp = C4::Context->preference("OPACSuggestionMandatoryFields") || 'title'; >+ $mandatoryfields = join(', ', (map { '"'.$_.'"'; } sort split(/\s*\,\s*/, $fldsreq_sp))); >+} >+ > $template->param( > %$suggestion, > suggestions_loop => $suggestions_loop, >@@ -216,6 +223,7 @@ $template->param( > messages => \@messages, > suggestionsview => 1, > suggested_by_anyone => $suggested_by_anyone, >+ mandatoryfields => $mandatoryfields, > patrons_pending_suggestions_count => $patrons_pending_suggestions_count, > ); > >-- >1.9.1
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