From 5ef5fb5617d627da46a4ea475a3d9afc8da6e007 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 6 Jan 2016 19:11:27 +0100 Subject: [PATCH] Bug 15358: Fix authorities merge Bug 8064 (Merge several biblio records) change some code used in both biblios and authorities merge tool without updating the authorities merge tool. This patch fixes that. Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- C4/AuthoritiesMarc.pm | 6 +++-- authorities/merge.pl | 22 ++++++++++++++----- cataloguing/merge.pl | 2 +- .../prog/en/includes/merge-record.inc | 20 ++++++++--------- .../prog/en/modules/authorities/merge.tt | 8 +++---- 5 files changed, 35 insertions(+), 23 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 866350e6f0..a88d4fa8f8 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1403,8 +1403,10 @@ sub merge { my ($mergefrom,$MARCfrom,$mergeto,$MARCto) = @_; my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0); my $dbh=C4::Context->dbh; - my $authtypefrom = Koha::Authority::Types->find($mergefrom); - my $authtypeto = Koha::Authority::Types->find($mergeto); + my $authfrom = Koha::Authorities->find($mergefrom); + my $authto = Koha::Authorities->find($mergeto); + my $authtypefrom = Koha::Authority::Types->find($authfrom->authtypecode); + my $authtypeto = Koha::Authority::Types->find($authto->authtypecode); return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0; return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0; diff --git a/authorities/merge.pl b/authorities/merge.pl index cfc1ca5d69..16efdd5522 100755 --- a/authorities/merge.pl +++ b/authorities/merge.pl @@ -133,15 +133,27 @@ else { # Creating a loop for display - my @record1 = $recordObj1->createMergeHash($tagslib); - my @record2 = $recordObj2->createMergeHash($tagslib); + my @records = ( + { + recordid => $mergereference, + record => $recordObj1->record, + frameworkcode => $recordObj1->authtypecode, + display => $recordObj1->createMergeHash($tagslib), + reference => 1, + }, + { + recordid => $notreference, + record => $recordObj2->record, + frameworkcode => $recordObj2->authtypecode, + display => $recordObj2->createMergeHash($tagslib), + }, + ); # Parameters $template->param( recordid1 => $mergereference, recordid2 => $notreference, - record1 => @record1, - record2 => @record2, + records => \@records, framework => $framework, ); } @@ -169,8 +181,6 @@ else { frameworkselect => \@frameworkselect, frameworkcode1 => $recordObj1->authtypecode, frameworkcode2 => $recordObj2->authtypecode, - frameworklabel1 => $recordObj1->authtypetext, - frameworklabel2 => $recordObj2->authtypetext, ); } } diff --git a/cataloguing/merge.pl b/cataloguing/merge.pl index a882daa05c..fc96d3cfcb 100755 --- a/cataloguing/merge.pl +++ b/cataloguing/merge.pl @@ -203,7 +203,7 @@ if ($merge) { my $frameworkcode = GetFrameworkCode($biblionumber); my $recordObj = new Koha::MetadataRecord({'record' => $marcrecord, schema => $marcflavour}); my $record = { - biblionumber => $biblionumber, + recordid => $biblionumber, record => $marcrecord, frameworkcode => $frameworkcode, display => $recordObj->createMergeHash($tagslib), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc index f74e8ce8a3..2d77a2f1f9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc @@ -1,16 +1,16 @@ [% BLOCK sourcetab %] -
+
-
    +
      [% FOREACH field IN record.display %] [% IF field.tag != biblionumbertag %]
    • [% IF (tabrecord.reference) %] - + [% ELSE %] - + [% END %] - + @@ -25,11 +25,11 @@ [% FOREACH subfield IN field.subfield %]
    • [% IF (tabrecord.reference) %] - + [% ELSE %] - + [% END %] - +
    • @@ -50,8 +50,8 @@
        [% FOREACH record IN sourcerecords %]
      • - - [% record.biblionumber %] + + [% record.recordid %] [% IF record.reference %](ref)[% END %]
      • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt index 78ad394511..a029c3ea9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt @@ -15,15 +15,15 @@ div#result { margin-top: 1em; } // When submiting the form function mergeformsubmit() { - $("ul#ulrecord1").remove(); - $("ul#ulrecord2").remove(); -} + $('#tabs').remove(); + } $(document).ready(function(){ // Getting marc structure via ajax tagslib = []; $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework %]" }, function(json) { tagslib = json; + rebuild_target($("#tabs"), $("#resultul")); }); $('.preview-merge-reference').click(function (ev) { @@ -129,7 +129,7 @@ function changeFramework(fw) {
        -[% PROCESS mergesource %] +[% PROCESS mergesource sourcerecords=records %]
        [% PROCESS mergetarget %] -- 2.39.5