From 4e65a65593dde2a962bb80a263a3487daa7a32a1 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 13 Sep 2016 15:23:50 +0000 Subject: [PATCH] Bug 15869 - change framework on overlay This patch allows for selection of framework to use when overlaying records - by default it is set to keep the initial framework To test: 1 - Create some records using one framework 2 - Export the records 3 - Edit the records to add fields not in original framework 4 - Stage records using a rule that will find matches 5 - Import 6 - Note records contain new fields on display, but they are lost on edit 7 - Apply patch 8 - Stage records again 9 - Select a framework that contains the new fields on import 10 - Import records 11 - Note records now use selected framework and are displayed/edited correctly --- C4/ImportBatch.pm | 4 +++- .../intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt | 9 +++++++++ tools/manage-marc-import.pl | 5 +++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 1b74929..8d0f4c0 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -559,6 +559,7 @@ sub BatchFindDuplicates { sub BatchCommitRecords { my $batch_id = shift; my $framework = shift; + my $overlay_framework = shift; # optional callback to monitor status # of job @@ -666,7 +667,8 @@ sub BatchCommitRecords { } $oldxml = $old_marc->as_xml($marc_type); - ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode); + if ($overlay_framework == '_USE_ORIG_') { $overlay_framework = $oldbiblio->frameworkcode; } + ModBiblio($marc_record, $recordid, $overlay_framework); $query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; if ($item_result eq 'create_new' || $item_result eq 'replace') { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt index 82e1e2b..b9152a5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt @@ -210,6 +210,15 @@ [% END %] +
+ When replacing records use this framework: + [% END %]
diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl index 55707aa..e01b23c 100755 --- a/tools/manage-marc-import.pl +++ b/tools/manage-marc-import.pl @@ -100,7 +100,8 @@ if ($op eq "") { add_saved_job_results_to_template($template, $completedJobID); } else { my $framework = $input->param('framework'); - commit_batch($template, $import_batch_id, $framework); + my $overlay_framework = $input->param('overlay_framework'); + commit_batch($template, $import_batch_id, $framework, $overlay_framework); } import_records_list($template, $import_batch_id, $offset, $results_per_page); } elsif ($op eq "revert-batch") { @@ -231,7 +232,7 @@ sub import_batches_list { } sub commit_batch { - my ($template, $import_batch_id, $framework) = @_; + my ($template, $import_batch_id, $framework, $overlay_framework) = @_; my $job = undef; my ( $num_added, $num_updated, $num_items_added, -- 2.1.4