Bugzilla – Attachment 80654 Details for
Bug 21579
showdiffmarc tool during manage staged batches always looks for biblios even when matching authorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21579: Make showdiffmarc.pl work for authorities and biblios
Bug-21579-Make-showdiffmarcpl-work-for-authorities.patch (text/plain), 4.74 KB, created by
Nick Clemens (kidclamp)
on 2018-10-16 14:03:28 UTC
(
hide
)
Description:
Bug 21579: Make showdiffmarc.pl work for authorities and biblios
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-10-16 14:03:28 UTC
Size:
4.74 KB
patch
obsolete
>From 69b79f9e45e7c9df65a08142f5323a5893f11b80 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 16 Oct 2018 14:00:59 +0000 >Subject: [PATCH] Bug 21579: Make showdiffmarc.pl work for authorities and > biblios > >To test: > 1 - Have or make some authority records > 2 - Have or make an authority matching rule > 3 - Export your authrotities > 4 - Import them using the matching rule > 5 - On the 'Manage staged records' page view some diffs > 6 - The import record is correct, but the existing records pull form > bibs > 7 - Apply patch > 8 - Repeat > 9 - Confirm you see the expected authority matches >--- > .../prog/en/modules/tools/showdiffmarc.tt | 4 +-- > tools/batch_records_ajax.pl | 2 +- > tools/showdiffmarc.pl | 34 +++++++++++++--------- > 3 files changed, 24 insertions(+), 16 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt >index 678a9d6..95a2cd2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt >@@ -26,10 +26,10 @@ > <h1>Original</h1> > [% IF ( ERROR_FORMATTED1 ) %] > <div class="dialog alert"> >- <p>The biblionumber <em>[% BIBLIONUMBER | html %]</em> doesn't match any existing record.</p> >+ <p>The record id <em>[% RECORDID | html %]</em> doesn't match any existing record.</p> > </div> > [% ELSE %] >- <h2>[% BIBLIOTITLE | html %]</h2> >+ <h2>[% RECORDTITLE | html %]</h2> > <pre>[% MARC_FORMATTED1 | html %]</pre> > [% END %] > </div> >diff --git a/tools/batch_records_ajax.pl b/tools/batch_records_ajax.pl >index 349d858..17e8236 100755 >--- a/tools/batch_records_ajax.pl >+++ b/tools/batch_records_ajax.pl >@@ -107,7 +107,7 @@ foreach my $record (@$records) { > || q{}, > score => $#$match > -1 ? $match->[0]->{'score'} : 0, > match_id => $match_id, >- diff_url => $match_id ? "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=$import_batch_id&importid=$record->{import_record_id}&id=$match_id" : undef >+ diff_url => $match_id ? "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=$import_batch_id&importid=$record->{import_record_id}&id=$match_id&type=$record->{record_type}" : undef > }; > } > >diff --git a/tools/showdiffmarc.pl b/tools/showdiffmarc.pl >index 0c585a4..f8219aa 100755 >--- a/tools/showdiffmarc.pl >+++ b/tools/showdiffmarc.pl >@@ -29,23 +29,25 @@ use C4::Context; > use C4::Output; > use C4::Auth; > use C4::Biblio; >+use C4::AuthoritiesMarc; > use C4::ImportBatch; > > use Koha::Biblios; > > # Input params > my $input = new CGI; >-my $biblionumber = $input->param('id'); >+my $recordid = $input->param('id'); > my $importid = $input->param('importid'); > my $batchid = $input->param('batchid'); >+my $type = $input->param('type'); > >-if ( not $biblionumber or not $importid ) { >+if ( not $recordid or not $importid ) { > print $input->redirect("/cgi-bin/koha/errors/404.pl"); > exit; > } > > # Init vars >-my ($recordBiblionumber, $recordImportid, $biblioTitle, $importTitle, $formatted1, $formatted2, $errorFormatted1, $errorFormatted2); >+my ($record, $recordImportid, $recordTitle, $importTitle, $formatted1, $formatted2, $errorFormatted1, $errorFormatted2); > > # Prepare template > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -59,14 +61,20 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >-$recordBiblionumber = GetMarcBiblio({ >- biblionumber => $biblionumber, >- embed_items => 1, >-}); >-if( $recordBiblionumber ) { >- $formatted1 = $recordBiblionumber->as_formatted; >- my $biblio = Koha::Biblios->find( $biblionumber ); >- $biblioTitle = $biblio->title; >+if ( $type eq 'biblio' ) { >+ $record = GetMarcBiblio({ >+ biblionumber => $recordid, >+ embed_items => 1, >+ }); >+ my $biblio = Koha::Biblios->find( $recordid ); >+ $recordTitle = $biblio->title; >+} >+elsif ( $type eq 'auth' ) { >+ $record = GetAuthority( $recordid ); >+ $recordTitle = "Authority number " . $recordid; #FIXME we should get the main heading >+} >+if( $record ) { >+ $formatted1 = $record->as_formatted; > } else { > $errorFormatted1 = 1; > } >@@ -82,9 +90,9 @@ if( $importid ) { > > $template->param( > SCRIPT_NAME => '/cgi-bin/koha/tools/showdiffmarc.pl', >- BIBLIONUMBER => $biblionumber, >+ RECORDID => $recordid, > IMPORTID => $importid, >- BIBLIOTITLE => $biblioTitle, >+ RECORDTITLE => $recordTitle, > IMPORTTITLE => $importTitle, > MARC_FORMATTED1 => $formatted1, > MARC_FORMATTED2 => $formatted2, >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21579
:
80654
|
80657
|
80674
|
80682