From 760ce0b18c51ee927fe1d64f70875612542d02da Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Mon, 17 Mar 2008 21:27:40 -0500 Subject: [PATCH] Partial commit to add Create-Label-Batch-from-Import-Batch Import batch portion herein. Still need to touch Labels.pm . Signed-off-by: Joshua Ferraro --- C4/ImportBatch.pm | 19 +++++++++++++++++++ .../en/modules/tools/manage-marc-import.tmpl | 8 ++++++-- .../en/modules/tools/stage-marc-import.tmpl | 9 ++++++++- tools/manage-marc-import.pl | 16 +++++++++++++++- 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 283de042e0..bf4e1862a1 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -48,6 +48,7 @@ BEGIN { GetImportBatchRangeDesc GetNumberOfNonZ3950ImportBatches GetImportBibliosRange + GetItemNumbersFromImportBatch GetImportBatchStatus SetImportBatchStatus @@ -720,6 +721,24 @@ sub GetImportBatchRangeDesc { return $results; } +=head2 GetItemNumbersFromImportBatch + +=over 4 +=back +=cut + +sub GetItemNumbersFromImportBatch { + my ($batch_id) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("select itemnumber from import_batches,import_records,import_items where import_batches.import_batch_id=import_records.import_batch_id and import_records.import_record_id=import_items.import_record_id and import_batches.import_batch_id=?"); + $sth->execute($batch_id); + my @items ; + while ( my ($itm) = $sth->fetchrow_array ) { + push @items, $itm; + } + return @items; +} + =head2 GetNumberOfImportBatches =over 4 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tmpl index a17e362c6e..281d99da0b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tmpl @@ -32,7 +32,11 @@ › Batch - + +
+

Label batch created, with id:

+
+

@@ -156,7 +160,7 @@ Page - + ?import_batch_id=&op=create_labels">(Create Label Batch) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tmpl index 014a4e84ad..de92a335c8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tmpl @@ -49,7 +49,10 @@ function CheckForm(f) {
  • item records found and staged
  • -
  • ">Manage staged records
  • + < +
  • New label batch created: #
  • + +
  • ">Manage staged records
  • Back
  • @@ -105,6 +108,10 @@ function CheckForm(f) {
  • +
    • + + +
  • diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl index ec55233a41..9f93266cba 100755 --- a/tools/manage-marc-import.pl +++ b/tools/manage-marc-import.pl @@ -59,6 +59,13 @@ my %cookies = parse CGI::Cookie($cookie); my $sessionID = $cookies{'CGISESSID'}->value; my $dbh = C4::Context->dbh; +if ($op eq "create_labels") { + #create a batch of labels, then lose $op & $import_batch_id so we get back to import batch list. + my $label_batch_id = create_labelbatch_from_importbatch($import_batch_id); + $template->param( label_batch => $label_batch_id ); + $op=''; + $import_batch_id=''; +} if ($op) { $template->param(script_name => $script_name, $op => 1); } else { @@ -93,7 +100,7 @@ if ($op eq "") { my $current_matcher_id = $input->param('current_matcher_id'); redo_matching($template, $import_batch_id, $new_matcher_id, $current_matcher_id); import_biblios_list($template, $import_batch_id, $offset, $results_per_page); -} +} output_html_with_http_headers $input, $cookie, $template->output; @@ -122,6 +129,13 @@ sub redo_matching { $template->param(num_with_matches => $num_with_matches); } +sub create_labelbatch_from_importbatch { + my ($batch_id) = @_; + my @items = GetItemNumbersFromImportBatch($batch_id); + warn join("/",@items); + return 0; # dummy return until C4::Labels::add_batch() takes an array +} + sub import_batches_list { my ($template, $offset, $results_per_page) = @_; my $batches = GetImportBatchRangeDesc($offset, $results_per_page); -- 2.39.5