Bug 15005: Replace $ENV{SCRIPT_NAME} with the hardcoded script paths
[koha_ffzg] / tools / batch_record_modification.pl
index d16b547..60775a9 100755 (executable)
@@ -62,6 +62,7 @@ if ( $completedJobID ) {
         view => 'report',
     );
     output_html_with_http_headers $input, $cookie, $template->output;
+    $job->clear();
     exit;
 }
 
@@ -73,6 +74,7 @@ unless ( @templates ) {
         errors => ['no_template_defined'],
     );
     output_html_with_http_headers $input, $cookie, $template->output;
+    exit;
 }
 
 if ( $mmtid ) {
@@ -154,7 +156,7 @@ if ( $op eq 'form' ) {
     my ( $job );
     if ( $runinbackground ) {
         my $job_size = scalar( @record_ids );
-        $job = C4::BackgroundJob->new( $sessionID, "FIXME", $ENV{SCRIPT_NAME}, $job_size );
+        $job = C4::BackgroundJob->new( $sessionID, "FIXME", '/cgi-bin/koha/tools/batch_record_modification.pl', $job_size );
         my $job_id = $job->id;
         if (my $pid = fork) {
             $dbh->{InactiveDestroy}  = 1;
@@ -167,7 +169,7 @@ if ( $op eq 'form' ) {
             close STDOUT;
             close STDERR;
         } else {
-            warn "fork failed while attempting to run $ENV{'SCRIPT_NAME'} as a background job";
+            warn "fork failed while attempting to run tools/batch_record_modification.pl as a background job";
             exit 0;
         }
     }