From c56b0cd02c9a9ee51689f2c101586d4e9ebf534e Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Tue, 9 May 2017 16:37:59 +0200 Subject: [PATCH] Bug 17240 - Allow processes that rely on background jobs run in Plack mode - followup 3 Followup 3 If not running in background mode, items are not displayed in result page in tools/batchMod.pl. --- tools/batchMod.pl | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 19974d4..72a1b11 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -113,20 +113,28 @@ if ($op eq "action") { my $marcitem; # Once the job is done - if ($completedJobID) { - # If we have a reasonable amount of items, we display them - if (scalar(@itemnumbers) <= ( C4::Context->preference("MaxItemsToDisplayForBatchDel") // 1000 ) ) { - $items_display_hashref=BuildItemsData(@itemnumbers); - } else { - # Else, we only display the barcode - my @simple_items_display = map {{ itemnumber => $_, barcode => (GetBarcodeFromItemnumber($_) or ""), biblionumber => (GetBiblionumberFromItemnumber($_) or "") }} @itemnumbers; - $template->param("simple_items_display" => \@simple_items_display); - } + if ($completedJobID || !$runinbackground) { + # If we have a reasonable amount of items, we display them + if (scalar(@itemnumbers) <= ( C4::Context->preference("MaxItemsToDisplayForBatchDel") // 1000 ) ) { + $items_display_hashref=BuildItemsData(@itemnumbers); + } else { + # Else, we only display the barcode + my @simple_items_display = map{ + { + itemnumber => $_, + barcode => (GetBarcodeFromItemnumber($_) or ""), + biblionumber => (GetBiblionumberFromItemnumber($_) or "") + } + } @itemnumbers; + $template->param("simple_items_display" => \@simple_items_display); + } + } - # Setting the job as done - my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID); + if ($completedJobID) { + # Setting the job as done + my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID); - # Calling the template + # Calling the template add_saved_job_results_to_template($template, $completedJobID); } else { -- 2.7.4