Bug 12495 - Include streetnumber in hold alert address
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / marc_modification_templates.tt
index 899dec1..a9b9d3d 100644 (file)
@@ -11,11 +11,26 @@ $(document).ready(function() {
     });
     $("span.match_regex_prefix" ).hide();
     $("span.match_regex_suffix" ).hide();
+
+    $("#conditional_field,#from_field").change(function(){
+        updateWarnings(); // For 3.14.x branches only, if bug 11319 is not pushed into
+    });
 });
 //]]>
 </script>
 
 <script>
+
+function updateWarnings(){
+    if ( $("#conditional_field").is(":visible") ) {
+        if ( $("#conditional_field").val() == $("#from_field").val() && $("#from_field").val().length > 0 ) {
+            $("#warning_multivalued").show();
+        } else {
+            $("#warning_multivalued").hide();
+        }
+    }
+}
+
 function onActionChange(selectObj) {
     // get the index of the selected option
     var idx = selectObj.selectedIndex;
@@ -186,8 +201,8 @@ function editAction( mmta_id, ordering, action, field_number, from_field, from_s
 
     document.getElementById('description').value = description;
 
-    window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerhtml;
-    document.getElementById('modaction_legend').innerhtml = _("Edit action") + ordering;
+    window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML;
+    document.getElementById('modaction_legend').innerHTML = _("Edit action %s").format(ordering);
 
     window.action_submit_value = document.getElementById('action_submit').value;
     document.getElementById('action_submit').value = _("Update action");
@@ -226,7 +241,7 @@ function cancelEditAction() {
 
     document.getElementById('conditional_regex').checked = false;
 
-    document.getElementById('modaction_legend').innerhtml = window.modaction_legend_innerhtml;
+    document.getElementById('modaction_legend').innerHTML = window.modaction_legend_innerhtml;
     document.getElementById('action_submit').value = window.action_submit_value;
 
     hide('cancel_edit');
@@ -257,6 +272,12 @@ function setSelectByValue( selectId, value ) {
     <div id="yui-main">
         <div class="yui-b">
             <h2>MARC modification templates</h2>
+            
+            [% IF error %]
+                [% IF error == 'no_from_field' %]
+                    <div class="dialog message">Error: no field value specified.</div>
+                [% END %]
+            [% END %]
 
             [% IF ( TemplatesLoop ) %]
 
@@ -355,7 +376,9 @@ function setSelectByValue( selectId, value ) {
                                         [% IF ( ActionsLoo.conditional_comparison_equals ) %] matches [% END %]
                                         [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %]
 
-                                        [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %]<strong>[% ActionsLoo.conditional_value %]/</strong>
+                                        [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %]
+                                        <strong>[% ActionsLoo.conditional_value %]</strong>
+                                        [% IF ( ActionsLoo.conditional_regex ) %]/[% END %]
                                     [% END %]
                                 </td>
                                 <td>[% ActionsLoo.description %]</td>
@@ -392,6 +415,7 @@ function setSelectByValue( selectId, value ) {
                     <a name="modaction"></a>
                     <fieldset>
                         <legend id="modaction_legend">Add a new action</legend>
+                        <div id="warning_multivalued" style="color:red; display:none;">You have chosen a condition on the same field as the original field. If your records contain multivalued fields it is highly recommended not to do that.</div>
 
                         <select name="action" id="action" onchange="onActionChange(this);">
                             <option value="delete_field">Delete</option>