Bug 12759: Pass records from selected tab
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 12 Nov 2018 17:50:31 +0000 (14:50 -0300)
committerroot <root@f1ebe1bec408>
Tue, 19 Feb 2019 13:52:15 +0000 (13:52 +0000)
To remove ambiguity we should not process the records from other tabs.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt

index 5e57f86..5bd3513 100644 (file)
@@ -57,7 +57,7 @@
     </div>
   [% END %]
   [% IF op == 'form' %]
-    <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl">
+    <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="record_ids_selection">
       <fieldset class="rows">
         <legend>Record type</legend>
         <ol>
 
       <div id="batch_del_form" class="toptabs">
         <ul>
-          <li><a href="#uploadfile">Upload a file</a></li>
-          [% IF lists.count %]<li id="show_list_option"><a href="#shelves">Select a list of records</a></li>[% END %]
-          <li><a href="#enterlist">Enter a list of record numbers</a></li>
+          <li><a href="#uploadfile_tab">Upload a file</a></li>
+          [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
+          <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
         </ul>
 
-        <div id="uploadfile">
+        <div id="uploadfile_tab">
           <fieldset class="rows">
             <legend>Use a file</legend>
             <ol>
           &nbsp;
         </div>
 
-        <div id="shelves">
-          <fieldset class="rows">
-            <legend>Or select a list of records</legend>
-            <ol>
-              <li>
-                <label for="shelf_number">Use records from the following list: </label>
-                <select name="shelf_number" id="shelf_number">
-                  <option value="">Select a list</option>
-                    [% FOREACH list IN lists %]
-                      <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>
-                    [% END %]
-                  </option>
-                </select>
-              </li>
-            </ol>
-          </fieldset>
-          &nbsp;
-        </div>
+        [% IF lists.count %]
+            <div id="shelves_tab">
+              <fieldset class="rows">
+                <legend>Or select a list of records</legend>
+                <ol>
+                  <li>
+                    <label for="shelf_number">Use records from the following list: </label>
+                    <select name="shelf_number" id="shelf_number">
+                      <option value="">Select a list</option>
+                        [% FOREACH list IN lists %]
+                          <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>
+                        [% END %]
+                      </option>
+                    </select>
+                  </li>
+                </ol>
+              </fieldset>
+              &nbsp;
+            </div>
+        [% END %]
 
-        <div id="enterlist">
+        <div id="enterlist_tab">
           <fieldset class="rows">
             <legend>Or enter a list of record numbers</legend>
             <ol>
               return false;
             }
           });
+
+          $("#record_ids_selection").on("submit", function(e){
+            var tab = $(this).find('.ui-tabs-active:first a').attr('href');
+            if ( tab == '#uploadfile_tab' ) {
+                $("#shelf_number").empty('');
+                $("#recordnumber_list").val('');
+            } else if ( tab == '#shelves_tab' ) {
+                $("#uploadfile").val('')
+                $("#recordnumber_list").val('');
+            } else { // enterlist
+                $("#uploadfile").val('')
+                $("#shelf_number").empty('');
+            }
+          });
+
         });
     </script>
 [% END %]
index a8f9b7c..652c74e 100644 (file)
@@ -61,7 +61,7 @@
     [% END %]
 
   [% IF view == 'form' %]
-    <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
+    <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="record_ids_selection">
       <fieldset class="rows">
         <legend>Record type</legend>
         <ol>
 
       <div id="batch_mod_form" class="toptabs">
         <ul>
-          <li><a href="#uploadfile">Upload a file</a></li>
-          [% IF lists.count %]<li id="show_list_option"><a href="#shelves">Select a list of records</a></li>[% END %]
-          <li><a href="#enterlist">Enter a list of record numbers</a></li>
+          <li><a href="#uploadfile_tab">Upload a file</a></li>
+          [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
+          <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
         </ul>
 
-        <div id="uploadfile">
+        <div id="uploadfile_tab">
           <fieldset class="rows">
             <legend>Use a file</legend>
             <ol>
           &nbsp;
         </div>
 
-        <div id="shelves">
-          <fieldset class="rows">
-            <legend>Or select a list of records</legend>
-            <ol>
-              <li>
-                <label for="shelf_number">Use records from the following list: </label>
-                <select name="shelf_number" id="shelf_number">
-                  <option value="">Select a list</option>
-                    [% FOREACH list IN lists %]
-                      <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>
-                    [% END %]
-                  </option>
-                </select>
-              </li>
-            </ol>
-          </fieldset>
-          &nbsp;
-        </div>
+        [% IF lists.count %]
+            <div id="shelves_tab">
+              <fieldset class="rows">
+                <legend>Or select a list of records</legend>
+                <ol>
+                  <li>
+                    <label for="shelf_number">Use records from the following list: </label>
+                    <select name="shelf_number" id="shelf_number">
+                      <option value="">Select a list</option>
+                        [% FOREACH list IN lists %]
+                          <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>
+                        [% END %]
+                      </option>
+                    </select>
+                  </li>
+                </ol>
+              </fieldset>
+              &nbsp;
+            </div>
+        [% END %]
 
-        <div id="enterlist">
+        <div id="enterlist_tab">
           <fieldset class="rows">
             <legend>Or enter a list of record numbers</legend>
             <ol>
             return submitBackgroundJob(document.getElementById("process"));
           });
 
+          $("#record_ids_selection").on("submit", function(e){
+            var tab = $(this).find('.ui-tabs-active:first a').attr('href');
+            if ( tab == '#uploadfile_tab' ) {
+                $("#shelf_number").empty('');
+                $("#recordnumber_list").val('');
+            } else if ( tab == '#shelves_tab' ) {
+                $("#uploadfile").val('')
+                $("#recordnumber_list").val('');
+            } else { // enterlist
+                $("#uploadfile").val('')
+                $("#shelf_number").empty('');
+            }
+          });
+
           $("#marc_modification_template_id").change(function(){
             var url = "/cgi-bin/koha/svc/records/preview?"
             var mmtid = $(this).val();