Bugzilla – Attachment 65149 Details for
Bug 8643
Add ability to mark some MARC tags and subfields as important and alert on saving the record if they are found to be empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8643 - Added hint for important fields and implemented it for item fields
Bug-8643---Added-hint-for-important-fields-and-imp.patch (text/plain), 6.49 KB, created by
Philippe Audet-Fortin
on 2017-07-20 14:48:27 UTC
(
hide
)
Description:
Bug 8643 - Added hint for important fields and implemented it for item fields
Filename:
MIME Type:
Creator:
Philippe Audet-Fortin
Created:
2017-07-20 14:48:27 UTC
Size:
6.49 KB
patch
obsolete
>From b9a26f253c7155371c9bc8602d519e757422cf34 Mon Sep 17 00:00:00 2001 >From: Paudet <philippe.audet-fortin@inlibro.com> >Date: Wed, 19 Jul 2017 17:03:17 -0400 >Subject: [PATCH] Bug 8643 - Added hint for important fields and implemented it > for item fields > >--- > cataloguing/additem.pl | 1 + > .../prog/en/modules/cataloguing/addbiblio.tt | 5 ++++ > .../prog/en/modules/cataloguing/additem.tt | 34 +++++++++++++++++----- > koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 12 ++++++++ > 4 files changed, 45 insertions(+), 7 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 9387072..703d531 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -125,6 +125,7 @@ sub generate_subfield_form { > $subfield_data{subfield} = $subfieldtag; > $subfield_data{marc_lib} ="<span id=\"error$i\" title=\"".$subfieldlib->{lib}."\">".$subfieldlib->{lib}."</span>"; > $subfield_data{mandatory} = $subfieldlib->{mandatory}; >+ $subfield_data{important} = $subfieldlib->{important}; > $subfield_data{repeatable} = $subfieldlib->{repeatable}; > $subfield_data{maxlength} = $subfieldlib->{maxlength}; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index 30e9300..5f7d5a3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -681,6 +681,11 @@ function Changefwk() { > <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a> > [% ELSE %] > <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span> >+ [% IF innerloo.mandatory %] >+ <span style="color:red" title="This field is mandatory">*</span> >+ [% ELSIF innerloo.important %] >+ <span title="This field is important">*</span> >+ [% END %] > [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]'); return false;"> ?</a>[% END %] > [% END %] > [% IF ( innerloo.fixedfield ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >index 26ecf45..6f11d96 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -85,8 +85,10 @@ $(document).ready(function(){ > }); > > function Check(f) { >- var total_errors = CheckMandatorySubfields(f); >- if (total_errors==0) { >+ var total_mandatory = CheckMandatorySubfields(f); >+ var total_important = CheckImportantSubfields(f); >+ var alertString2; >+ if (total_mandatory==0) { > // Explanation about this line: > // In case of limited edition permission, we have to prevent user from modifying some fields. > // But there is no such thing as readonly attribute for select elements. >@@ -94,12 +96,27 @@ function Check(f) { > // So we "un-disable" the elements just before submitting. > // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that. > $("select[name=field_value]").prop('disabled', false); >- return true; > } else { >- var alertString2 = _("Form not submitted because of the following problem(s)"); >+ alertString2 = _("Form not submitted because of the following problem(s)"); > alertString2 += "\n------------------------------------------------------------------------------------\n"; >- alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors); >- alert(alertString2); >+ alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_mandatory); >+ } >+ if(total_important > 0){ >+ if( !alertString2 ){ >+ alertString2 = ""; >+ } >+ alertString2 += "\n\n " + _("%s important field(s) empty (highlighted)").format(total_important); >+ alertString2 += "\n\n " + _("Are you sure you want to save?"); >+ } >+ if(alertString2){ >+ if(total_mandatory){ >+ alert(alertString2); >+ }else{ >+ var a = confirm(alertString2); >+ if( a ){ >+ return true; >+ } >+ } > return false; > } > return true; >@@ -300,12 +317,15 @@ function confirm_deletion() { > <input type="hidden" name="tag" value="[% ite.tag %]" /> > <input type="hidden" name="subfield" value="[% ite.subfield %]" /> > <input type="hidden" name="mandatory" value="[% ite.mandatory %]" /> >+ <input type="hidden" name="important" value="[% ite.important %]" /> > [% IF ( ite.repeatable ) %] > <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;"> > <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> > </a> > [% END %] >- [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %] >+ [% IF ( ite.mandatory ) %] <span class="required">Required</span> >+ [% ELSIF ( ite.important ) %] <span class="important" style="font-style: italic; margin-left: .5em;">Important</span> >+ [% END %] > </div></li> > [% END %] > </ol> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >index eedac25..519ef85 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >@@ -552,6 +552,18 @@ function CheckMandatorySubfields(p){ > return total; > } > >+function CheckImportantSubfields(p){ >+ var total = 0; >+ $(p).find(".subfield_line input[name='important'][value='1']").each(function(i){ >+ var editor = $(this).siblings("[name='field_value']"); >+ if (!editor.val()) { >+ editor.addClass("missing"); >+ total++; >+ } >+ }); >+ return total; >+} >+ > $(document).ready(function() { > $("input.input_marceditor, input.indicator").addClass('noEnterSubmit'); > }); >-- >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 8643
:
11621
|
11622
|
30640
|
31032
|
40232
|
40237
|
41259
|
41261
|
41264
|
41265
|
45834
|
45835
|
45836
|
45837
|
60554
|
60555
|
65148
|
65149
|
65682
|
72154
|
72155
|
72156
|
72157
|
73591
|
73808
|
73809
|
73810
|
73811
|
73812
|
73813
|
73814
|
73815
|
73816
|
73817
|
73818
|
74267
|
74268
|
74269
|
74270
|
74271
|
74272
|
74273
|
81032
|
85982
|
91537
|
92081
|
92384
|
96625
|
96627
|
97325
|
97326
|
98607
|
98608
|
98702
|
98703
|
98712