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

(-)a/C4/Biblio.pm (+6 lines)
Lines 1261-1266 The MARC record contains biblio data, and items data if $embeditems is set to tr Link Here
1261
sub GetMarcBiblio {
1261
sub GetMarcBiblio {
1262
    my $biblionumber = shift;
1262
    my $biblionumber = shift;
1263
    my $embeditems   = shift || 0;
1263
    my $embeditems   = shift || 0;
1264
1265
    if (not defined $biblionumber) {
1266
        carp 'GetMarcBiblio called with undefined biblionumber';
1267
        return;
1268
    }
1269
1264
    my $dbh          = C4::Context->dbh;
1270
    my $dbh          = C4::Context->dbh;
1265
    my $sth          = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
1271
    my $sth          = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
1266
    $sth->execute($biblionumber);
1272
    $sth->execute($biblionumber);
(-)a/t/Biblio.t (-5 / +11 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 44;
20
use Test::More tests => 46;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
use DBD::Mock;
23
use DBD::Mock;
Lines 167-175 warning_is { $ret = RemoveAllNsb() } Link Here
167
167
168
ok( !defined $ret, 'RemoveAllNsb returns undef if not passed rec');
168
ok( !defined $ret, 'RemoveAllNsb returns undef if not passed rec');
169
169
170
warning_is { $ret = UpdateTotalIssues() }
170
warning_is { $ret = GetMarcBiblio() }
171
           { carped => 'UpdateTotalIssues could not get biblio record'},
171
           { carped => 'GetMarcBiblio called with undefined biblionumber'},
172
           "UpdateTotalIssues returns carped warning if biblio record does not exist";
172
           "GetMarcBiblio returns carped warning on undef biblionumber";
173
174
ok( !defined $ret, 'GetMarcBiblio returns undef if not passed a biblionumber');
175
176
warnings_like { $ret = UpdateTotalIssues() }
177
              [ { carped => qr/GetMarcBiblio called with undefined biblionumber/ },
178
                { carped => qr/UpdateTotalIssues could not get biblio record/ } ],
179
    "UpdateTotalIssues returns carped warnings if biblio record does not exist";
173
180
174
ok( !defined $ret, 'UpdateTotalIssues returns carped warning if biblio record does not exist');
181
ok( !defined $ret, 'UpdateTotalIssues returns carped warning if biblio record does not exist');
175
182
176
- 

Return to bug 14346