Bugzilla – Attachment 73814 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: Add hint for important fields and implemented it for item fields
Bug-8643-Add-hint-for-important-fields-and-impleme.patch (text/plain), 6.56 KB, created by
Katrin Fischer
on 2018-04-07 08:45:59 UTC
(
hide
)
Description:
Bug 8643: Add hint for important fields and implemented it for item fields
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-04-07 08:45:59 UTC
Size:
6.56 KB
patch
obsolete
>From 2c9fee0be73b4da03b54e0f179379d73899c3bcc 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: Add hint for important fields and implemented it > for item fields > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > 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 a6aa25cd0e..f5e0d755b5 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 c92d51e62d..8134c714ed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -577,6 +577,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 8df082e259..f037de1c11 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -88,8 +88,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. >@@ -97,12 +99,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; >@@ -320,12 +337,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 b685c2ac73..7a417b497c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >@@ -557,6 +557,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'); > }); >-- >2.14.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