From 27d5c98098d39f22ad397dca9362daec51bc86ee Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 6 Jan 2016 19:11:27 +0100 Subject: [PATCH] Bug 15358: Attempt to fix authorities merge This is a quick fix, and I'm quite sure there are other bugs hiding... but I managed to display both authority in tabs and merge them. The result preview requires at least one click on checkboxes to show up, I haven't looked at this issue yet. Signed-off-by: Nick Clemens --- 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 | 2 +- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 866350e..a88d4fa 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 cfc1ca5..16efdd5 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 a882daa..fc96d3c 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 f74e8ce..2d77a2f 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 78ad394..8e46552 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt @@ -129,7 +129,7 @@ function changeFramework(fw) {
        -[% PROCESS mergesource %] +[% PROCESS mergesource sourcerecords=records %]
        [% PROCESS mergetarget %] -- 2.1.4