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

(-)a/C4/ImportBatch.pm (-5 / +5 lines)
Lines 1029-1039 sub GetImportBiblios { Link Here
1029
1029
1030
    my $dbh = C4::Context->dbh;
1030
    my $dbh = C4::Context->dbh;
1031
    my $query = "SELECT * FROM import_biblios WHERE import_record_id = ?";
1031
    my $query = "SELECT * FROM import_biblios WHERE import_record_id = ?";
1032
    my $sth = $dbh->prepare_cached($query);
1032
    return $dbh->selectall_arrayref(
1033
    $sth->execute($import_record_id);
1033
        $query,
1034
    my $results = $sth->fetchall_arrayref({});
1034
        { Slice => {} },
1035
    $sth->finish();
1035
        $import_record_id
1036
    return $results;
1036
    );
1037
1037
1038
}
1038
}
1039
1039
(-)a/tools/showdiffmarc.pl (-50 / +49 lines)
Lines 19-26 Link Here
19
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# with Koha; if not, write to the Free Software Foundation, Inc.,
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
21
22
use strict;
22
use Modern::Perl;
23
use warnings;
24
23
25
# standard or CPAN modules used
24
# standard or CPAN modules used
26
use CGI qw(:standard);
25
use CGI qw(:standard);
Lines 43-101 my $importid = $input->param('importid'); Link Here
43
my $batchid      = $input->param('batchid');
42
my $batchid      = $input->param('batchid');
44
43
45
44
46
if ( $biblionumber and $importid ) {
45
if ( not $biblionumber or not $importid ) {
47
46
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
48
    # Init vars
47
    exit;
49
    my ($recordBiblionumber, $recordImportid, $biblioTitle, $importTitle, $formatted1, $formatted2,
48
}
50
        $errorFormatted1, $errorFormatted2);
51
52
53
    # Prepare template
54
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
55
        {
56
            template_name   => "tools/showdiffmarc.tt",
57
            query           => $input,
58
            type            => "intranet",
59
            authnotrequired => 0,
60
            flagsrequired   => { tools => 'manage_staged_marc' },
61
            debug           => 1,
62
        }
63
    );
64
49
50
# Init vars
51
my ($recordBiblionumber, $recordImportid, $biblioTitle, $importTitle, $formatted1, $formatted2,
52
    $errorFormatted1, $errorFormatted2);
65
53
66
    $recordBiblionumber =GetMarcBiblio($biblionumber);
67
    if( $recordBiblionumber ) {
68
        $formatted1 = $recordBiblionumber->as_formatted;
69
        my $data = GetBiblioData($biblionumber);
70
        $biblioTitle = $data->{title};
71
    } else {
72
        $errorFormatted1 = 1;
73
    }
74
54
75
    my ($marc,$encoding) = GetImportRecordMarc($importid);
55
# Prepare template
76
    if( $marc ) {
56
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
77
        $recordImportid = MARC::Record->new_from_usmarc($marc) ;
57
    {
78
        $formatted2 = $recordImportid->as_formatted;
58
        template_name   => "tools/showdiffmarc.tt",
79
        my $biblio = GetImportBiblios($importid);
59
        query           => $input,
80
        $importTitle = $biblio->[0]->{'title'};
60
        type            => "intranet",
81
    } else {
61
        authnotrequired => 0,
82
        $errorFormatted2 = 1;
62
        flagsrequired   => { tools => 'manage_staged_marc' },
63
        debug           => 1,
83
    }
64
    }
65
);
84
66
85
67
86
    $template->param(   SCRIPT_NAME => $ENV{'SCRIPT_NAME'},
68
$recordBiblionumber =GetMarcBiblio($biblionumber);
87
                        BIBLIONUMBER => $biblionumber,
69
if( $recordBiblionumber ) {
88
                        IMPORTID => $importid,
70
    $formatted1 = $recordBiblionumber->as_formatted;
89
                        BIBLIOTITLE => $biblioTitle,
71
    my $data = GetBiblioData($biblionumber);
90
                        IMPORTTITLE => $importTitle,
72
    $biblioTitle = $data->{title};
91
                        MARC_FORMATTED1 => $formatted1,
73
} else {
92
                        MARC_FORMATTED2 => $formatted2,
74
    $errorFormatted1 = 1;
93
                        ERROR_FORMATTED1 => $errorFormatted1,
75
}
94
                        ERROR_FORMATTED2 => $errorFormatted2,
95
                        batchid => $batchid
96
                    );
97
76
98
    output_html_with_http_headers $input, $cookie, $template->output;
77
my ($marc,$encoding) = GetImportRecordMarc($importid);
78
if( $marc ) {
79
    $recordImportid = MARC::Record->new_from_usmarc($marc) ;
80
    $formatted2 = $recordImportid->as_formatted;
81
    my $biblio = GetImportBiblios($importid);
82
    $importTitle = $biblio->[0]->{'title'};
99
} else {
83
} else {
100
    exit;
84
    $errorFormatted2 = 1;
101
}
85
}
102
- 
86
87
88
$template->param(
89
    SCRIPT_NAME      => $ENV{'SCRIPT_NAME'},
90
    BIBLIONUMBER     => $biblionumber,
91
    IMPORTID         => $importid,
92
    BIBLIOTITLE      => $biblioTitle,
93
    IMPORTTITLE      => $importTitle,
94
    MARC_FORMATTED1  => $formatted1,
95
    MARC_FORMATTED2  => $formatted2,
96
    ERROR_FORMATTED1 => $errorFormatted1,
97
    ERROR_FORMATTED2 => $errorFormatted2,
98
    batchid          => $batchid
99
);
100
101
output_html_with_http_headers $input, $cookie, $template->output;

Return to bug 11876