Bug 5428: (QA follow-up) Add searchid for deleting items in a batch and editing in...
authorNick Clemens <nick@bywatersolutions.com>
Fri, 7 Aug 2020 00:43:29 +0000 (00:43 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 05:55:45 +0000 (07:55 +0200)
To test:
0 - Perform a search in the staff client
1 - Click a title to go to the details page for a record
2 - Click the 'Edit' button and select 'Edit items in a batch'
3 - Note the searchid is in the url
4 - Make a change and hit 'Save'
5 - Note the 'Return the the record' link at the top, and the button on the bottom include searchid in URL
6 - Click one and note the brwoser is stil there
7 - Click 'Edit' and select 'Delete items in a batch'
8 - Delete one item
9 - Click return to record
10 - Browser is there
11 - Click 'Delete items in a batch again
12 - Select all and check 'Delete records if no items remain'
13 - Delete them
14 - Note you have a link to 'Go back to the results'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt
tools/batchMod.pl

index eb5ddd8..acdf6bc 100644 (file)
@@ -76,6 +76,7 @@
 <form name="f" action="batchMod.pl" method="post">
      <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
      <input type="hidden" name="op" value="[% op | html %]" />
+     <input type="hidden" name="searchid" value="[% searchid | html %]" />
      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
      <input type="hidden" name="completedJobID" id="completedJobID" value="" />
      <input type="hidden" name="src" id="src" value="[% src | html %]" />
             [% IF delete_records %] <p>[% deleted_records | html %] record(s) deleted.</p> [% END %]
             [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Delete items in a batch%]
                 [% IF biblio_deleted %]
+                    [% IF searchid %]
+                        <div id="previous_search_link"></div>
+                    [% END %]
                     <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Return to the cataloging module</a>
                 [% ELSE %]
-                    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
+                    [% IF searchid %]
+                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]">Return to the record</a>
+                    [% ELSE %]
+                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
+                    [% END %]
                 [% END %]
             [% ELSIF src %]
                 <a href="[% src | url %]">Return to where you were</a>
     [% INCLUDE 'datatables.inc' %]
     [% Asset.js("js/pages/batchMod.js") | $raw %]
     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
+    [% Asset.js("js/browser.js") | $raw %]
     <script type="text/javascript">
         // Prepare array of all column headers, incrementing each index by
         // two to accommodate control and title columns
                 return submitBackgroundJob(this.form);
             });
         });
+
+        [% IF searchid %]
+            browser = KOHA.browser('[% searchid | html %]');
+            browser.show_back_link();
+        [% END %]
     </script>
 [% END %]
 
index 283ef38..3730e31 100644 (file)
@@ -98,7 +98,11 @@ $(document).ready(function(){
                 [% END %]
               <fieldset class="action">
                   [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
-                      <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
+                      [% IF searchid %]
+                          <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]">Return to the record</a>
+                      [% ELSE %]
+                          <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
+                      [% END %]
                   [% ELSIF src %]
                       <a href="[% src | url %]">Return to where you were</a>
                   [% ELSE %]
@@ -150,6 +154,7 @@ $(document).ready(function(){
 
 <form name="f" action="batchMod.pl" method="post">
      <input type="hidden" name="op" value="[% op | html %]" />
+     <input type="hidden" name="searchid" value="[% searchid | html %]" />
      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
      <input type="hidden" name="runinbackground" id="runinbackground" value="" />
      <input type="hidden" name="completedJobID" id="completedJobID" value="" />
@@ -350,7 +355,11 @@ $(document).ready(function(){
 [% ELSE %] <!-- // show -->
 <fieldset class="action">
 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
-   <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | html %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
+    [% IF searchid %]
+        <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
+    [% ELSE %]
+        <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
+    [% END %]
 [% ELSIF src %]
    <a class="btn btn-default" href="[% src | url %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
 [% ELSE %]
index fe40f84..975f799 100755 (executable)
@@ -69,7 +69,6 @@ if (!defined $op) {
     $template_flag = ($del) ? { tools => 'items_batchdel' }   : { tools => 'items_batchmod' };
 }
 
-
 my ($template, $loggedinuser, $cookie)
     = get_template_and_user({template_name => $template_name,
                  query => $input,
@@ -78,6 +77,8 @@ my ($template, $loggedinuser, $cookie)
                  flagsrequired => $template_flag,
                  });
 
+$template->param( searchid => scalar $input->param('searchid'), );
+
 # Does the user have a restricted item edition permission?
 my $uid = $loggedinuser ? Koha::Patrons->find( $loggedinuser )->userid : undef;
 my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;