From 942402bcdb29aa997e03b2a98366417a2337e2cd Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Fri, 7 Nov 2014 14:31:02 +0200 Subject: [PATCH] Bug 13182 - Overlay an existing Biblio with the acquired import_record If we know we already have a matching biblio in Koha, we can optionally overlay the existing Biblio with the new one. (We don't really need it but looks like Bg_12074 needs it). Also a good hook to attach more advanced automatic overlaying/transformation mechanisms. --- acqui/addorderiso2709.pl | 9 ++++++--- .../prog/en/modules/acqui/addorderiso2709.tt | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 037009e..c6be891 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -159,6 +159,7 @@ if ($op eq ""){ my $import_batch_id = $cgiparams->{'import_batch_id'}; my $biblios = GetImportRecordsRange($import_batch_id); my @import_record_id_selected = $input->param("import_record_id"); + my @overlay = $input->param("overlay"); my @quantities = $input->param('quantity'); my @prices = $input->param('price'); my @budgets_id = $input->param('budget_id'); @@ -173,6 +174,7 @@ if ($op eq ""){ my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 ); my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0; + my $c_overlay = shift @overlay; my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1; my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id; my $c_discount = shift ( @discount); @@ -180,8 +182,8 @@ if ($op eq ""){ my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || ''; my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || ''; - # 1st insert the biblio, or find it through matcher - unless ( $biblionumber ) { + # INSERT the biblio if no match found, or if we want to overlay the existing match + if ( not($biblionumber) || $c_overlay ) { # add the biblio my $bibitemnum; @@ -196,7 +198,8 @@ if ($op eq ""){ } } } - ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); + ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ) unless $c_overlay; + ModBiblio( $marcrecord, $biblionumber, $cgiparams->{'frameworkcode'} || '' ) if $c_overlay; SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); #We need to provide information to koha.import_record_matches to tell Koha that this import_record matches the diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 6464baf..7dca7bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -213,6 +213,7 @@ [% END %] [% IF ( biblio.match_biblionumber ) %] Matches biblio [% biblio.match_biblionumber %] (score = [% biblio.match_score %]): [% biblio.match_citation %] + Overlay? [% END %] -- 1.7.9.5