Bug 21333: Add ability to add to basket from a new file
authorNick Clemens <nick@bywatersolutions.com>
Tue, 11 Sep 2018 16:26:04 +0000 (16:26 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 26 Sep 2018 19:05:53 +0000 (19:05 +0000)
This patch adds a workflow for adding to a basket from a file. It
removes the need to stage the file before going to the basket and allows
you to stage the file and return to the basket

To test:
1 - Have basket in acquissitions
2 - Click add to basket
3 - Note new option to 'Add from new file'
4 - Click it
5 - You will be sent to the record import tool
6 - Stage your file
7 - There is a link after staging 'Add records to basket'
8 - Click it
9 - Your items should be added

Signed-off-by: Sonia <sonia.bouis@univ-lyon3.fr>

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

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

koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc
koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt
tools/stage-marc-import.pl

index 3588005..64234df 100644 (file)
@@ -16,6 +16,7 @@
         <li><a href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">From a subscription</a></li>
         <li><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">From a new (empty) record</a></li>
         <li><a href="/cgi-bin/koha/acqui/z3950_search.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">From an external source</a></li>
+        <li><a href="/cgi-bin/koha/tools/stage-marc-import.pl?basketno=[% basketno | html %]&amp;booksellerid=[% booksellerid | html %]"> From a new file</a></li>
         <li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]"> From a staged file</a></li>
         [% IF ( CAN_user_circulate ) %]<li><a href="/cgi-bin/koha/circ/reserveratios.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">From titles with highest hold ratios</a></li>[% END %]
       </ul>
index 58d114d..fdf87b8 100644 (file)
@@ -41,6 +41,9 @@
        <li>[% total | html %]  records in file</li>
        <li>[% import_errors | html %] records not staged because of MARC error</li>
        <li>[% staged | html %] records staged</li>
+[% IF basketno && booksellerid %]
+    <li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=[% import_batch_id | html %]&basketno=[% basketno | html %]&booksellerid=[% booksellerid | html %]">Add staged files to basket</a></li>
+[% END %]
     [% IF ( checked_matches ) %]
        <li>[% matched | html %] records with at least one match in catalog per matching rule 
         &quot;[% matcher_code | html %]&quot;</li>
 </form>
 
     <form method="post" id="processfile" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
+[% IF basketno && booksellerid %]
+    <input type="hidden" name="basketno" id="basketno" value="[% basketno | html %]" />
+    <input type="hidden" name="booksellerid" id="booksellerid" value="[% booksellerid | html %]" />
+[% END %]
 <fieldset class="rows">
         <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
         <input type="hidden" name="runinbackground" id="runinbackground" value="" />
index f2acc58..d76c35a 100755 (executable)
@@ -58,6 +58,8 @@ my $record_type                = $input->param('record_type');
 my $encoding                   = $input->param('encoding') || 'UTF-8';
 my $format                     = $input->param('format') || 'ISO2709';
 my $marc_modification_template = $input->param('marc_modification_template_id');
+my $basketno                   = $input->param('basketno');
+my $booksellerid               = $input->param('booksellerid');
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
@@ -74,6 +76,8 @@ $template->param(
     SCRIPT_NAME => '/cgi-bin/koha/tools/stage-marc-import.pl',
     uploadmarc  => $fileID,
     record_type => $record_type,
+    basketno => $basketno,
+    booksellerid => $booksellerid,
 );
 
 my %cookies = parse CGI::Cookie($cookie);
@@ -181,7 +185,9 @@ if ($completedJobID) {
         checked_matches => $checked_matches,
         matcher_failed  => $matcher_failed,
         matcher_code    => $matcher_code,
-        import_batch_id => $batch_id
+        import_batch_id => $batch_id,
+        booksellerid    => $booksellerid,
+        basketno        => $basketno
     };
     if ($runinbackground) {
         $job->finish($results);
@@ -195,7 +201,9 @@ if ($completedJobID) {
                          checked_matches => $checked_matches,
                          matcher_failed => $matcher_failed,
                          matcher_code => $matcher_code,
-                         import_batch_id => $batch_id
+                         import_batch_id => $batch_id,
+                         booksellerid => $booksellerid,
+                         basketno => $basketno
                         );
     }