View | Details | Raw Unified | Return to bug 11876
Collapse All | Expand All

(-)a/C4/ImportBatch.pm (+20 lines)
Lines 58-63 BEGIN { Link Here
58
    GetStagedWebserviceBatches
58
    GetStagedWebserviceBatches
59
    GetImportBatchRangeDesc
59
    GetImportBatchRangeDesc
60
    GetNumberOfNonZ3950ImportBatches
60
    GetNumberOfNonZ3950ImportBatches
61
    GetImportBiblios
61
    GetImportRecordsRange
62
    GetImportRecordsRange
62
	GetItemNumbersFromImportBatch
63
	GetItemNumbersFromImportBatch
63
    
64
    
Lines 1017-1022 sub GetNumberOfNonZ3950ImportBatches { Link Here
1017
    return $count;
1018
    return $count;
1018
}
1019
}
1019
1020
1021
=head2 GetImportBiblios
1022
1023
  my $results = GetImportBiblios($importid);
1024
1025
=cut
1026
1027
sub GetImportBiblios {
1028
    my ($import_record_id) = @_;
1029
1030
    my $dbh = C4::Context->dbh;
1031
    my $query = "SELECT * FROM import_biblios WHERE import_record_id = ?";
1032
    my $sth = $dbh->prepare_cached($query);
1033
    $sth->execute($import_record_id);
1034
    my $results = $sth->fetchall_arrayref({});
1035
    $sth->finish();
1036
    return $results;
1037
1038
}
1039
1020
=head2 GetImportRecordsRange
1040
=head2 GetImportRecordsRange
1021
1041
1022
  my $results = GetImportRecordsRange($batch_id, $offset, $results_per_group);
1042
  my $results = GetImportRecordsRange($batch_id, $offset, $results_per_group);
(-)a/catalogue/showdiffmarc.pl (+99 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Koha library project  www.koha-community.org
4
5
# Copyright 2011 Libéo
6
#
7
# This file is part of Koha.
8
#
9
# Koha is free software; you can redistribute it and/or modify it under the
10
# terms of the GNU General Public License as published by the Free Software
11
# Foundation; either version 2 of the License, or (at your option) any later
12
# version.
13
#
14
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License along
19
# with Koha; if not, write to the Free Software Foundation, Inc.,
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22
use strict;
23
use warnings;
24
25
# standard or CPAN modules used
26
use CGI qw(:standard);
27
use DBI;
28
29
# Koha modules used
30
use C4::Context;
31
use C4::Output;
32
use C4::Auth;
33
use C4::Biblio;
34
use C4::ImportBatch;
35
use XML::LibXSLT;
36
use XML::LibXML;
37
38
39
# Input params
40
my $input        = new CGI;
41
my $biblionumber = $input->param('id');
42
my $importid	 = $input->param('importid');
43
44
45
if ( $biblionumber and $importid ) {
46
47
	# Init vars
48
	my ($recordBiblionumber, $recordImportid, $biblioTitle, $importTitle, $formatted1, $formatted2, 
49
		$errorFormatted1, $errorFormatted2);
50
51
52
	# Prepare template
53
	my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
54
		{
55
		    template_name   => "catalogue/showdiffmarc.tt",
56
		    query           => $input,
57
		    type            => "intranet",
58
		    authnotrequired => 0,
59
		    flagsrequired   => { catalogue => 1  },
60
		    debug           => 1,
61
		}
62
	);
63
64
65
	$recordBiblionumber =GetMarcBiblio($biblionumber);
66
	if( $recordBiblionumber ) {
67
		$formatted1 = $recordBiblionumber->as_formatted;
68
		my $data = GetBiblioData($biblionumber);
69
		$biblioTitle = $data->{title};
70
	} else {
71
		$errorFormatted1 = 1;
72
	}
73
74
	my ($marc,$encoding) = GetImportRecordMarc($importid);
75
	if( $marc ) {
76
		$recordImportid = MARC::Record->new_from_usmarc($marc) ;
77
		$formatted2 = $recordImportid->as_formatted;
78
		my $biblio = GetImportBiblios($importid);
79
		$importTitle = $biblio->[0]->{'title'};
80
	} else {
81
		$errorFormatted2 = 1;
82
	}
83
84
85
	$template->param( 	SCRIPT_NAME => $ENV{'SCRIPT_NAME'},
86
						BIBLIONUMBER => $biblionumber,
87
						IMPORTID => $importid,
88
						BIBLIOTITLE => $biblioTitle,
89
						IMPORTTITLE => $importTitle,
90
						MARC_FORMATTED1 => $formatted1,
91
						MARC_FORMATTED2 => $formatted2,
92
						ERROR_FORMATTED1 => $errorFormatted1,
93
						ERROR_FORMATTED2 => $errorFormatted2
94
					);
95
96
	output_html_with_http_headers $input, $cookie, $template->output;
97
} else {
98
	exit;
99
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/showdiffmarc.tt (+50 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha -- Cataloging: MARC Import</title>
3
4
<style>
5
div#main {
6
	width: 100%;
7
	margin: 10px auto;
8
}
9
10
div.col1,
11
div.col2 {
12
	float: left;
13
	width: 46%;
14
	margin-left: 3%;
15
	
16
}
17
18
pre {
19
	padding: 10px;
20
	overflow: scroll;
21
}
22
</style> 
23
24
[% INCLUDE 'doc-head-close.inc' %]
25
26
</head>
27
<body>
28
29
<div id="main">
30
	<div class="col1">
31
		<h2>Original</h2>
32
		[% IF ( ERROR_FORMATTED1 ) %]
33
			<p>The biblionumber <em>[% BIBLIONUMBER %]</em> doesn't match to any record.</p>
34
		[% ELSE %]
35
			<h1>[% BIBLIOTITLE %]</h1>
36
			<pre>[% MARC_FORMATTED1 %]</pre>
37
		[% END %]
38
	</div>
39
	<div class="col2">
40
		<h2>Imported</h2>
41
		[% IF ( ERROR_FORMATTED2 ) %]
42
			<p>The importid <em>[% IMPORTID %]</em> doesn't match to any record.</p>
43
		[% ELSE %]
44
			<h1>[% IMPORTTITLE %]</h1>
45
			<pre>[% MARC_FORMATTED2 %] </pre>
46
		[% END %]
47
	</div>
48
</div>
49
50
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-3 / +10 lines)
Lines 10-18 Link Here
10
        <tr>
10
        <tr>
11
            <td />
11
            <td />
12
            [% IF ( record.record_type == 'biblio' ) %]
12
            [% IF ( record.record_type == 'biblio' ) %]
13
                <td class="highlight" colspan="4">Matches biblio [% record_lis.match_id %] (score = [% record_lis.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% record_lis.match_id %]">[% record_lis.match_citation %]</a></td>
13
                <td class="highlight" colspan="5">Matches biblio [% record_lis.match_id %] (score = [% record_lis.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% record_lis.match_id %]">[% record_lis.match_citation %]</a></td>
14
            [% ELSIF ( record.record_type == 'auth' ) %]
14
            [% ELSIF ( record.record_type == 'auth' ) %]
15
                <td class="highlight" colspan="4">Matches authority [% record_lis.match_id %] (score = [% record_lis.match_score %]): <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% record_lis.match_id %]">[% record_lis.match_citation %]</a> |
15
                <td class="highlight" colspan="5">Matches authority [% record_lis.match_id %] (score = [% record_lis.match_score %]): <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% record_lis.match_id %]">[% record_lis.match_citation %]</a> |
16
        <a href="/cgi-bin/koha/authorities/merge.pl?mergereference=breeding&authid=[% record_lis.match_id %]&authid=[% record_lis.import_record_id %]">Merge</a>
16
        <a href="/cgi-bin/koha/authorities/merge.pl?mergereference=breeding&authid=[% record_lis.match_id %]&authid=[% record_lis.import_record_id %]">Merge</a>
17
                </td>
17
                </td>
18
            [% END %]
18
            [% END %]
Lines 395-400 Page Link Here
395
    <th>Status</th>
395
    <th>Status</th>
396
    <th>Match?</th>
396
    <th>Match?</th>
397
    <th>Record</th>
397
    <th>Record</th>
398
    <th><abbr title="Differences between the original biblio and the imported" lang="en">Diff</abbr></th>
398
399
399
  </tr>
400
  </tr>
400
  [% FOREACH record_lis IN record_list %]
401
  [% FOREACH record_lis IN record_list %]
Lines 431-436 Page Link Here
431
        [% PROCESS final_match_link record=record_lis %]
432
        [% PROCESS final_match_link record=record_lis %]
432
        [% END %]
433
        [% END %]
433
    </td>
434
    </td>
435
    [% IF ( record_lis.match_id ) %]
436
        <td>
437
            <a rel="gb_page_center[960,600]" href="/cgi-bin/koha/catalogue/showdiffmarc.pl?importid=[% record_lis.import_record_id %]&id=[% record_lis.match_id %]">View</a>
438
        </td>
439
    [% ELSE %]
440
        <td>&nbsp;</td>
441
    [% END %]
434
  </tr>
442
  </tr>
435
    [% PROCESS match_link record=record_lis %]
443
    [% PROCESS match_link record=record_lis %]
436
  [% END %]
444
  [% END %]
437
- 

Return to bug 11876