Bug 18127: Add batch modified records to an existing list
authorAleisha Amohia <aleishaamohia@hotmail.com>
Wed, 5 Feb 2020 04:33:50 +0000 (04:33 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 10 Mar 2020 15:20:18 +0000 (15:20 +0000)
To test:
1) Start by having no (zero) lists
2) Go to Tools -> Batch record modification
3) Go through the batch record modification process, confirm everything
works as normal and there is a link to do a new batch record
modification at the end
4) In another tab, go to Lists and create a new list
5) Go back to the first tab and start a new batch modification process
6) At the end of the process, there should be a new option to add
modified records to an existing list
7) Select a list from the dropdown and confirm you are able to save your
modified records to the list as expected
8) Start a new batch modification process, this time for authorities
records
9) At the end confirm there is no option to add modified records to a
list, because authorities cannot be added to lists

Sponsored-by: Catalyst IT
Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt
tools/batch_record_modification.pl

index 3d64557..960217a 100644 (file)
                             </form> <!-- /#process -->
                         [% ELSE %]
                             <div class="dialog message">
-                                No records were modified. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
+                                No records were modified. [% IF recordtype != 'biblio' %]<a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>[% END %]
                             </div>
                         [% END %]
                     [% ELSIF view == 'report' %]
                         [% IF report.total_records == report.total_success %]
                             <div class="dialog message">
-                                All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
+                                All records have successfully been modified! [% IF recordtype != 'biblio' %]<a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>[% END %]
                             </div>
                         [% ELSE %]
                             <div class="dialog message">
                                 [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
                             </div>
                         [% END %]
+
+                        [% IF recordtype == 'biblio' %]
+                            <h3>Next steps</h3>
+                            <ul>
+                                <li><a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
+                                [% IF lists.count %]
+                                <li>
+                                    <label for="add_bibs_to_list">Add modified records to the following list: </label>
+                                    <select name="add_bibs_to_list" id="add_bibs_to_list">
+                                        <option value="">Select a list</option>
+                                        [% FOREACH list IN lists %]
+                                            <option class="shelf" value="[% list.shelfnumber %]">[% list.shelfname %]</option>
+                                        [% END %]
+                                    </select>
+                                </li>
+                                [% END %]
+                            </ul>
+                        [% END %]
                     [% ELSIF view == 'errors' %]
                         [% FOR error IN errors %]
                             [% IF error == 'no_template_defined' %]
                 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
             });
 
+            $("#add_bibs_to_list").change(function(){
+                var selected = $("#add_bibs_to_list").find("option:selected");
+                if ( selected.attr("class") == "shelf" ){
+                    var shelfnumber = selected.attr("value");
+                    var bibs = new Array();
+                    [% FOREACH message IN messages %]
+                        [% IF message.code == 'biblio_modified' %]
+                            bibs.push("biblionumber="+[% message.biblionumber %]);
+                        [% END %]
+                    [% END %]
+                    var bibstring = bibs.join("&");
+                    window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizeable=yes');
+                    return false;
+                }
+            });
+
         });
     </script>
 [% END %]
index 1a82c47..0203b0b 100755 (executable)
@@ -50,6 +50,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
         flagsrequired => { tools => 'records_batchmod' },
 });
 
+$template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) );
 
 my $sessionID = $input->cookie("CGISESSID");
 
@@ -63,14 +64,13 @@ if ( $completedJobID ) {
         report => $report,
         messages => $messages,
         view => 'report',
+        recordtype => $recordtype,
     );
     output_html_with_http_headers $input, $cookie, $template->output;
     $job->clear();
     exit;
 }
 
-$template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) );
-
 my @templates = GetModificationTemplates( $mmtid );
 unless ( @templates ) {
     $op = 'error';