@@ -, +, @@
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
---
C4/ImportBatch.pm | 5 +++--
.../intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt | 9 +++++++++
tools/manage-marc-import.pl | 7 ++++---
3 files changed, 16 insertions(+), 5 deletions(-)
--- a/C4/ImportBatch.pm
+++ a/C4/ImportBatch.pm
@@ -567,6 +567,7 @@ sub BatchFindDuplicates {
sub BatchCommitRecords {
my $batch_id = shift;
my $framework = shift;
+ my $overlay_framework = shift;
# optional callback to monitor status
# of job
@@ -673,8 +674,8 @@ sub BatchCommitRecords {
$old_marc->delete_field($item_field);
}
$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') {
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
@@ -364,6 +364,15 @@ $(document).ready(function(){
[% END %]
+
+ When replacing records use this framework:
+
[% END %]
--- a/tools/manage-marc-import.pl
+++ a/tools/manage-marc-import.pl
@@ -106,7 +106,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") {
@@ -237,7 +238,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;
$dbh->{AutoCommit} = 0;
@@ -247,7 +248,7 @@ sub commit_batch {
$callback = progress_callback($job, $dbh);
}
my ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored) =
- BatchCommitRecords($import_batch_id, $framework, 50, $callback);
+ BatchCommitRecords($import_batch_id, $framework, $overlay_framework, 50, $callback);
$dbh->commit();
my $results = {
--