Bug 12759: (follow-up) Using tabs for diff ways of adding records
authorAleisha Amohia <aleishaamohia@hotmail.com>
Tue, 10 Jul 2018 04:10:40 +0000 (04:10 +0000)
committerroot <root@f1ebe1bec408>
Tue, 19 Feb 2019 13:52:15 +0000 (13:52 +0000)
This patch includes the changes for both batch record modification and
deletion.
Checks that all public lists are included and only private lists created
by the logged in user.
Hides the virtualshelves option if authorities are selected.
Doesn't show shelf option at all if none exist

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
tools/batch_delete_records.pl
tools/batch_record_modification.pl

index 4b33b1d..5e57f86 100644 (file)
           <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
         </ol>
       </fieldset>
-      <fieldset class="rows">
-        <legend>Use a file</legend>
-        <ol>
-          <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
-        </ol>
-      </fieldset>
-      <fieldset class="rows" id="shelves">
-        <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>
-      <fieldset class="rows">
-        <legend>Or enter a list of record numbers</legend>
-        <ol>
-          <li>
-            <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
-            <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
-          </li>
-        </ol>
-      </fieldset>
+
+      <br><br>
+
+      <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>
+        </ul>
+
+        <div id="uploadfile">
+          <fieldset class="rows">
+            <legend>Use a file</legend>
+            <ol>
+              <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
+            </ol>
+          </fieldset>
+          &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>
+
+        <div id="enterlist">
+          <fieldset class="rows">
+            <legend>Or enter a list of record numbers</legend>
+            <ol>
+              <li>
+                <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
+                <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
+              </li>
+            </ol>
+          </fieldset>
+          &nbsp;
+        </div>
+
+      </div>
+
       <fieldset class="action">
         <input type="hidden" name="op" value="list" />
         <input type="submit" value="Continue" class="button" />
     <script>
         var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
         $(document).ready(function() {
+
+          $("#batch_del_form").tabs();
+
           $("input[type='radio']").click(function(){
             if ($(this).attr('id') == 'authority_type') {
-              $("#shelves").hide();
+              $("#show_list_option").hide();
             } else if ($(this).attr('id') == 'biblio_type') {
-              $("#shelves").show();
+              $("#show_list_option").show();
             }
           });
           $("#selectall").click(function(e){
index 3bdea3a..a8f9b7c 100644 (file)
           <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
         </ol>
       </fieldset>
-      <fieldset class="rows">
-        <legend>Use a file</legend>
-        <ol>
-          <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
-        </ol>
-      </fieldset>
-      <fieldset class="rows" id="shelves">
-        <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>
-      <fieldset class="rows">
-        <legend>Or enter a list of record numbers</legend>
-        <ol>
-          <li>
-            <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
-            <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
-          </li>
-        </ol>
-      </fieldset>
+
+      <br><br>
+
+      <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>
+        </ul>
+
+        <div id="uploadfile">
+          <fieldset class="rows">
+            <legend>Use a file</legend>
+            <ol>
+              <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
+            </ol>
+          </fieldset>
+          &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>
+
+        <div id="enterlist">
+          <fieldset class="rows">
+            <legend>Or enter a list of record numbers</legend>
+            <ol>
+              <li>
+                <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
+                <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
+              </li>
+            </ol>
+          </fieldset>
+          &nbsp;
+        </div>
+
+      </div>
+
       <fieldset class="rows">
         <legend>Use MARC Modification Template:</legend>
         <ol>
     [% Asset.js("js/background-job-progressbar.js") | $raw %]
     <script>
         $(document).ready(function() {
+
+          $("#batch_mod_form").tabs();
+
           $("input[type='radio']").click(function(){
             if ($(this).attr('id') == 'authority_type') {
-              $("#shelves").hide();
+              $("#show_list_option").hide();
             } else if ($(this).attr('id') == 'biblio_type') {
-              $("#shelves").show();
+              $("#show_list_option").show();
             }
           });
           $("#selectall").click(function(e){
index c8d0566..34c6b5a 100755 (executable)
@@ -45,8 +45,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({
         flagsrequired => { tools => 'records_batchdel' },
 });
 
-my @lists = Koha::Virtualshelves->search({});
-$template->param( lists => \@lists );
+$template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) );
 
 my @records;
 my @messages;
index b6f65f3..1a82c47 100755 (executable)
@@ -69,8 +69,7 @@ if ( $completedJobID ) {
     exit;
 }
 
-my @lists = Koha::Virtualshelves->search({});
-$template->param( lists => \@lists );
+$template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) );
 
 my @templates = GetModificationTemplates( $mmtid );
 unless ( @templates ) {