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

(-)a/C4/Biblio.pm (-31 / +34 lines)
Lines 41-46 use C4::Debug; Link Here
41
use Koha::Caches;
41
use Koha::Caches;
42
use Koha::Authority::Types;
42
use Koha::Authority::Types;
43
use Koha::Acquisition::Currencies;
43
use Koha::Acquisition::Currencies;
44
use Koha::Biblio::Metadata;
45
use Koha::Biblio::Metadatas;
44
use Koha::SearchEngine;
46
use Koha::SearchEngine;
45
use Koha::Libraries;
47
use Koha::Libraries;
46
48
Lines 158-164 Biblio.pm contains functions for managing storage and editing of bibliographic d Link Here
158
160
159
=item 2. as raw MARC in the Zebra index and storage engine
161
=item 2. as raw MARC in the Zebra index and storage engine
160
162
161
=item 3. as MARC XML in biblioitems.marcxml
163
=item 3. as MARC XML in biblio_metadata.metadata
162
164
163
=back
165
=back
164
166
Lines 182-188 Because of this design choice, the process of managing storage and editing is a Link Here
182
184
183
=item 2. _koha_* - low-level internal functions for managing the koha tables
185
=item 2. _koha_* - low-level internal functions for managing the koha tables
184
186
185
=item 3. Marc management function : as the MARC record is stored in biblioitems.marcxml, some subs dedicated to it's management are in this package. They should be used only internally by Biblio.pm, the only official entry points being AddBiblio, AddItem, ModBiblio, ModItem.
187
=item 3. Marc management function : as the MARC record is stored in biblio_metadata.metadata, some subs dedicated to it's management are in this package. They should be used only internally by Biblio.pm, the only official entry points being AddBiblio, AddItem, ModBiblio, ModItem.
186
188
187
=item 4. Zebra functions used to update the Zebra index
189
=item 4. Zebra functions used to update the Zebra index
188
190
Lines 190-196 Because of this design choice, the process of managing storage and editing is a Link Here
190
192
191
=back
193
=back
192
194
193
The MARC record (in biblioitems.marcxml) contains the complete marc record, including items. It also contains the biblionumber. That is the reason why it is not stored directly by AddBiblio, with all other fields . To save a biblio, we need to :
195
The MARC record (in biblio_metadata.metadata) contains the complete marc record, including items. It also contains the biblionumber. That is the reason why it is not stored directly by AddBiblio, with all other fields . To save a biblio, we need to :
194
196
195
=over 4
197
=over 4
196
198
Lines 202-221 The MARC record (in biblioitems.marcxml) contains the complete marc record, incl Link Here
202
204
203
=back
205
=back
204
206
205
When dealing with items, we must :
206
207
=over 4
208
209
=item 1. save the item in items table, that gives us an itemnumber
210
211
=item 2. add the itemnumber to the item MARC field
212
213
=item 3. overwrite the MARC record (with the added item) into biblioitems.marcxml
214
215
When modifying a biblio or an item, the behaviour is quite similar.
216
217
=back
218
219
=head1 EXPORTED FUNCTIONS
207
=head1 EXPORTED FUNCTIONS
220
208
221
=head2 AddBiblio
209
=head2 AddBiblio
Lines 231-237 framework code. Link Here
231
This function also accepts a third, optional argument: a hashref
219
This function also accepts a third, optional argument: a hashref
232
to additional options.  The only defined option is C<defer_marc_save>,
220
to additional options.  The only defined option is C<defer_marc_save>,
233
which if present and mapped to a true value, causes C<AddBiblio>
221
which if present and mapped to a true value, causes C<AddBiblio>
234
to omit the call to save the MARC in C<bibilioitems.marcxml>
222
to omit the call to save the MARC in C<biblio_metadata.metadata>
235
This option is provided B<only>
223
This option is provided B<only>
236
for the use of scripts such as C<bulkmarcimport.pl> that may need
224
for the use of scripts such as C<bulkmarcimport.pl> that may need
237
to do some manipulation of the MARC record for item parsing before
225
to do some manipulation of the MARC record for item parsing before
Lines 1335-1345 sub GetMarcBiblio { Link Here
1335
    }
1323
    }
1336
1324
1337
    my $dbh          = C4::Context->dbh;
1325
    my $dbh          = C4::Context->dbh;
1338
    my $sth          = $dbh->prepare("SELECT biblioitemnumber, marcxml FROM biblioitems WHERE biblionumber=? ");
1326
    my $sth          = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? ");
1339
    $sth->execute($biblionumber);
1327
    $sth->execute($biblionumber);
1340
    my $row     = $sth->fetchrow_hashref;
1328
    my $row     = $sth->fetchrow_hashref;
1341
    my $biblioitemnumber = $row->{'biblioitemnumber'};
1329
    my $biblioitemnumber = $row->{'biblioitemnumber'};
1342
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1330
    my $marcxml = GetXmlBiblio( $biblionumber );
1331
    $marcxml = StripNonXmlChars( $marcxml );
1343
    my $frameworkcode = GetFrameworkCode($biblionumber);
1332
    my $frameworkcode = GetFrameworkCode($biblionumber);
1344
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1333
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1345
    my $record = MARC::Record->new();
1334
    my $record = MARC::Record->new();
Lines 1368-1384 sub GetMarcBiblio { Link Here
1368
1357
1369
  my $marcxml = GetXmlBiblio($biblionumber);
1358
  my $marcxml = GetXmlBiblio($biblionumber);
1370
1359
1371
Returns biblioitems.marcxml of the biblionumber passed in parameter.
1360
Returns biblio_metadata.metadata/marcxml of the biblionumber passed in parameter.
1372
The XML should only contain biblio information (item information is no longer stored in marcxml field)
1361
The XML should only contain biblio information (item information is no longer stored in marcxml field)
1373
1362
1374
=cut
1363
=cut
1375
1364
1376
sub GetXmlBiblio {
1365
sub GetXmlBiblio {
1377
    my ($biblionumber) = @_;
1366
    my ($biblionumber) = @_;
1378
    my $dbh            = C4::Context->dbh;
1367
    my $dbh = C4::Context->dbh;
1379
    my $sth            = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
1368
    return unless $biblionumber;
1380
    $sth->execute($biblionumber);
1369
    my ($marcxml) = $dbh->selectrow_array(
1381
    my ($marcxml) = $sth->fetchrow;
1370
        q|
1371
        SELECT metadata
1372
        FROM biblio_metadata
1373
        WHERE biblionumber=?
1374
            AND format='marcxml'
1375
            AND marcflavour=?
1376
    |, undef, $biblionumber, C4::Context->preference('marcflavour')
1377
    );
1382
    return $marcxml;
1378
    return $marcxml;
1383
}
1379
}
1384
1380
Lines 3233-3241 sub _koha_modify_biblio { Link Here
3233
3229
3234
  my ($biblioitemnumber,$error) = _koha_modify_biblioitem_nonmarc( $dbh, $biblioitem );
3230
  my ($biblioitemnumber,$error) = _koha_modify_biblioitem_nonmarc( $dbh, $biblioitem );
3235
3231
3236
Updates biblioitems row except for marc and marcxml, which should be changed
3237
via ModBiblioMarc
3238
3239
=cut
3232
=cut
3240
3233
3241
sub _koha_modify_biblioitem_nonmarc {
3234
sub _koha_modify_biblioitem_nonmarc {
Lines 3522-3530 sub ModBiblioMarc { Link Here
3522
      $f005->update(sprintf("%4d%02d%02d%02d%02d%04.1f",@a)) if $f005;
3515
      $f005->update(sprintf("%4d%02d%02d%02d%02d%04.1f",@a)) if $f005;
3523
    }
3516
    }
3524
3517
3525
    $sth = $dbh->prepare("UPDATE biblioitems SET marcxml=? WHERE biblionumber=?");
3518
    my $metadata = {
3526
    $sth->execute( $record->as_xml_record($encoding), $biblionumber );
3519
        biblionumber => $biblionumber,
3527
    $sth->finish;
3520
        format       => 'marcxml',
3521
        marcflavour  => C4::Context->preference('marcflavour'),
3522
    };
3523
    # FIXME To replace with ->find_or_create?
3524
    if ( my $m_rs = Koha::Biblio::Metadatas->find($metadata) ) {
3525
        $m_rs->metadata( $record->as_xml_record($encoding) );
3526
    } else {
3527
        my $m_rs = Koha::Biblio::Metadata->new($metadata);
3528
        $m_rs->metadata( $record->as_xml_record($encoding) );
3529
        $m_rs->store;
3530
    }
3528
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $record );
3531
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $record );
3529
    return $biblionumber;
3532
    return $biblionumber;
3530
}
3533
}
(-)a/C4/ILSDI/Services.pm (-1 lines)
Lines 421-427 sub GetPatronInfo { Link Here
421
            my $branchname = $library ? $library->branchname : '';
421
            my $branchname = $library ? $library->branchname : '';
422
422
423
            # Remove unwanted fields
423
            # Remove unwanted fields
424
            delete $item->{'marcxml'};
425
            delete $item->{'more_subfields_xml'};
424
            delete $item->{'more_subfields_xml'};
426
425
427
            # Add additional fields
426
            # Add additional fields
(-)a/C4/Members.pm (-2 / +1 lines)
Lines 688-694 Looks up what the patron with the given borrowernumber has borrowed. Link Here
688
C<&GetPendingIssues> returns a
688
C<&GetPendingIssues> returns a
689
reference-to-array where each element is a reference-to-hash; the
689
reference-to-array where each element is a reference-to-hash; the
690
keys are the fields from the C<issues>, C<biblio>, and C<items> tables.
690
keys are the fields from the C<issues>, C<biblio>, and C<items> tables.
691
The keys include C<biblioitems> fields except marc and marcxml.
691
The keys include C<biblioitems> fields.
692
692
693
=cut
693
=cut
694
694
Lines 708-714 sub GetPendingIssues { Link Here
708
        }
708
        }
709
    }
709
    }
710
710
711
    # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance
712
    # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
711
    # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
713
    # FIXME: circ/ciculation.pl tries to sort by timestamp!
712
    # FIXME: circ/ciculation.pl tries to sort by timestamp!
714
    # FIXME: namespace collision: other collisions possible.
713
    # FIXME: namespace collision: other collisions possible.
(-)a/C4/Overdues.pm (-1 lines)
Lines 158-164 Returns a count and a list of overdueitems for a given borrowernumber Link Here
158
158
159
sub checkoverdues {
159
sub checkoverdues {
160
    my $borrowernumber = shift or return;
160
    my $borrowernumber = shift or return;
161
    # don't select biblioitems.marcxml... too slow on large systems
162
    my $sth = C4::Context->dbh->prepare(
161
    my $sth = C4::Context->dbh->prepare(
163
        "SELECT biblio.*, items.*, issues.*,
162
        "SELECT biblio.*, items.*, issues.*,
164
                biblioitems.volume,
163
                biblioitems.volume,
(-)a/C4/SIP/interactive_item_dump.pl (-1 / +1 lines)
Lines 19-25 while (1) { Link Here
19
        print "No item ($in)";
19
        print "No item ($in)";
20
        next;
20
        next;
21
    }
21
    }
22
    for (qw(marc marcxml)) {
22
    for (qw(marc marcxml)) { # Letting it just in case but should not longer be useful
23
        $item->{$_} = 'suppressed...';
23
        $item->{$_} = 'suppressed...';
24
    }
24
    }
25
    my $queue = $item->hold_queue();
25
    my $queue = $item->hold_queue();
(-)a/Koha/Biblio/Metadata.pm (+44 lines)
Line 0 Link Here
1
package Koha::Biblio::Metadata;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use Koha::Database;
23
24
use base qw(Koha::Object);
25
26
=head1 NAME
27
28
Koha::Metadata - Koha Metadata Object class
29
30
=head1 API
31
32
=head2 Class Methods
33
34
=cut
35
36
=head3 type
37
38
=cut
39
40
sub _type {
41
    return 'BiblioMetadata';
42
}
43
44
1;
(-)a/Koha/Biblio/Metadatas.pm (+50 lines)
Line 0 Link Here
1
package Koha::Biblio::Metadatas;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use Koha::Database;
23
24
use Koha::Biblio::Metadata;
25
26
use base qw(Koha::Objects);
27
28
=head1 NAME
29
30
Koha::Biblio::Metadatas - Koha Metadata Object set class
31
32
=head1 API
33
34
=head2 Class Methods
35
36
=cut
37
38
=head3 type
39
40
=cut
41
42
sub _type {
43
    return 'BiblioMetadata';
44
}
45
46
sub object_class {
47
    return 'Koha::Biblio::Metadata';
48
}
49
50
1;
(-)a/Koha/BiblioUtils/Iterator.pm (-2 / +3 lines)
Lines 92-99 sub next { Link Here
92
    my $marc;
92
    my $marc;
93
    my $row = $self->{rs}->next();
93
    my $row = $self->{rs}->next();
94
    return if !$row;
94
    return if !$row;
95
    if ( $row->marcxml ) {
95
    my $marcxml = C4::Biblio::GetXmlBiblio( $row->get_column('biblionumber') );
96
        $marc = MARC::Record->new_from_xml( $row->marcxml );
96
    if ( $marcxml ) {
97
        $marc = MARC::Record->new_from_xml( $marcxml );
97
    }
98
    }
98
    else {
99
    else {
99
        confess "No marcxml column returned in the request.";
100
        confess "No marcxml column returned in the request.";
(-)a/Koha/OAI/Server/ListRecords.pm (-2 / +2 lines)
Lines 43-56 sub new { Link Here
43
    }
43
    }
44
    my $max = $repository->{koha_max_count};
44
    my $max = $repository->{koha_max_count};
45
    my $sql = "
45
    my $sql = "
46
        (SELECT biblioitems.biblionumber, biblioitems.timestamp, marcxml
46
        (SELECT biblioitems.biblionumber, biblioitems.timestamp
47
        FROM biblioitems
47
        FROM biblioitems
48
    ";
48
    ";
49
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
49
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
50
    $sql .= " WHERE timestamp >= ? AND timestamp <= ? ";
50
    $sql .= " WHERE timestamp >= ? AND timestamp <= ? ";
51
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
51
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
52
    $sql .= ") UNION
52
    $sql .= ") UNION
53
        (SELECT deletedbiblio.biblionumber, null as marcxml, timestamp FROM deletedbiblio";
53
        (SELECT deletedbiblio.biblionumber, timestamp FROM deletedbiblio";
54
    $sql .= " JOIN oai_sets_biblios ON deletedbiblio.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
54
    $sql .= " JOIN oai_sets_biblios ON deletedbiblio.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
55
    $sql .= " WHERE DATE(timestamp) >= ? AND DATE(timestamp) <= ? ";
55
    $sql .= " WHERE DATE(timestamp) >= ? AND DATE(timestamp) <= ? ";
56
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
56
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
(-)a/misc/cronjobs/delete_records_via_leader.pl (-7 / +8 lines)
Lines 36-41 use Getopt::Long; Link Here
36
use C4::Biblio;
36
use C4::Biblio;
37
use C4::Items;
37
use C4::Items;
38
use Koha::Database;
38
use Koha::Database;
39
use Koha::Biblio::Metadatas;
39
40
40
my $delete_items;
41
my $delete_items;
41
my $confirm;
42
my $confirm;
Lines 68-90 This script has the following parameters : Link Here
68
    exit();
69
    exit();
69
}
70
}
70
71
71
my $schema = Koha::Database->new()->schema();
72
my @metadatas =    # Should be replaced by a call to C4::Search on zebra index
72
my @biblioitems = # Should be replaced by a call to C4::Search on zebra index
73
                   # Record-status when bug 15537 will be pushed
73
                  # Record-status when bug 15537 will be pushed
74
  Koha::Biblio::Metadatas->search( { format => 'marcxml', marcflavour => C4::Context->preference('marcflavour'), metadata => { LIKE => '%<leader>_____d%' } } );
74
  $schema->resultset('Biblioitem')->search( { marcxml => { LIKE => '%<leader>_____d%' } } );
75
75
76
my $total_records_count   = @biblioitems;
76
my $total_records_count   = @metadatas;
77
my $deleted_records_count = 0;
77
my $deleted_records_count = 0;
78
my $total_items_count     = 0;
78
my $total_items_count     = 0;
79
my $deleted_items_count   = 0;
79
my $deleted_items_count   = 0;
80
80
81
foreach my $biblioitem (@biblioitems) {
81
foreach my $m (@metadatas) {
82
    my $biblionumber = $biblioitem->get_column('biblionumber');
82
    my $biblionumber = $m->get_column('biblionumber');
83
83
84
    say "RECORD: $biblionumber" if $verbose;
84
    say "RECORD: $biblionumber" if $verbose;
85
85
86
    if ($delete_items) {
86
    if ($delete_items) {
87
        my $deleted_count = 0;
87
        my $deleted_count = 0;
88
        my $biblioitem = Koha::Biblioitem->find( $biblionumber );
88
        foreach my $item ( $biblioitem->items() ) {
89
        foreach my $item ( $biblioitem->items() ) {
89
            my $itemnumber = $item->itemnumber();
90
            my $itemnumber = $item->itemnumber();
90
91
(-)a/misc/migration_tools/build_oai_sets.pl (-3 / +5 lines)
Lines 70-77 my $mappings = GetOAISetsMappings; Link Here
70
# Get all biblionumbers and marcxml
70
# Get all biblionumbers and marcxml
71
print "Retrieving biblios... " if $verbose;
71
print "Retrieving biblios... " if $verbose;
72
my $query = qq{
72
my $query = qq{
73
    SELECT biblionumber, marcxml
73
    SELECT biblionumber, metadata
74
    FROM biblioitems
74
    FROM biblio_metadata
75
    WHERE format='marcxml'
76
    AND marcflavour = ?
75
};
77
};
76
if($length) {
78
if($length) {
77
    $query .= "LIMIT $length";
79
    $query .= "LIMIT $length";
Lines 80-86 if($length) { Link Here
80
    }
82
    }
81
}
83
}
82
my $sth = $dbh->prepare($query);
84
my $sth = $dbh->prepare($query);
83
$sth->execute;
85
$sth->execute( C4::Context->preference('marcflavour') );
84
my $results = $sth->fetchall_arrayref({});
86
my $results = $sth->fetchall_arrayref({});
85
print "done.\n" if $verbose;
87
print "done.\n" if $verbose;
86
88
(-)a/opac/opac-readingrecord.pl (-2 / +3 lines)
Lines 90-97 foreach my $issue ( @{$issues} ) { Link Here
90
          getitemtypeimagelocation( 'opac',
90
          getitemtypeimagelocation( 'opac',
91
            $itemtypes->{ $issue->{$itype_attribute} }->{imageurl} );
91
            $itemtypes->{ $issue->{$itype_attribute} }->{imageurl} );
92
    }
92
    }
93
    if ( $issue->{marcxml} ) {
93
    my $marcxml = C4::Biblio::GetXmlBiblio( $issue->{biblionumber} );
94
        my $marcxml = StripNonXmlChars( $issue->{marcxml} );
94
    if ( $marcxml ) {
95
        $marcxml = StripNonXmlChars( $marcxml );
95
        my $marc_rec =
96
        my $marc_rec =
96
          MARC::Record::new_from_xml( $marcxml, 'utf8',
97
          MARC::Record::new_from_xml( $marcxml, 'utf8',
97
            C4::Context->preference('marcflavour') );
98
            C4::Context->preference('marcflavour') );
(-)a/opac/opac-search.pl (-2 / +1 lines)
Lines 595-602 if ($tag) { Link Here
595
    $query_cgi = "tag=" .$tag . "&" . $query_cgi;
595
    $query_cgi = "tag=" .$tag . "&" . $query_cgi;
596
    my $taglist = get_tags({term=>$tag, approved=>1});
596
    my $taglist = get_tags({term=>$tag, approved=>1});
597
    $results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
597
    $results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
598
    my @biblist  = (map {GetBiblioData($_->{biblionumber})} @$taglist);
598
    my @marclist = map { C4::Biblio::GetXmlBiblio( $_->{biblionumber} ) } @$taglist;
599
    my @marclist = (map { (C4::Context->config('zebra_bib_index_mode') eq 'dom')? $_->{marcxml}: $_->{marc}; } @biblist);
600
    $DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
599
    $DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
601
    $results_hashref->{biblioserver}->{RECORDS} = \@marclist;
600
    $results_hashref->{biblioserver}->{RECORDS} = \@marclist;
602
    # FIXME: tag search and standard search should work together, not exclusively
601
    # FIXME: tag search and standard search should work together, not exclusively
(-)a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t (-1 / +1 lines)
Lines 58-64 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES Link Here
58
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$bib_title'")
58
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$bib_title'")
59
  or BAIL_OUT("Cannot find newly created biblio record");
59
  or BAIL_OUT("Cannot find newly created biblio record");
60
60
61
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
61
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
62
62
63
my $biblioitemnumber =
63
my $biblioitemnumber =
64
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
64
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
(-)a/t/db_dependent/Holds/HoldFulfillmentPolicy.t (-1 / +1 lines)
Lines 57-63 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES Link Here
57
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$bib_title'")
57
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$bib_title'")
58
  or BAIL_OUT("Cannot find newly created biblio record");
58
  or BAIL_OUT("Cannot find newly created biblio record");
59
59
60
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
60
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
61
61
62
my $biblioitemnumber =
62
my $biblioitemnumber =
63
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
63
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
(-)a/t/db_dependent/Holds/HoldItemtypeLimit.t (-1 / +1 lines)
Lines 72-78 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES Link Here
72
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$bib_title'")
72
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$bib_title'")
73
  or BAIL_OUT("Cannot find newly created biblio record");
73
  or BAIL_OUT("Cannot find newly created biblio record");
74
74
75
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$right_itemtype')");
75
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$right_itemtype')");
76
76
77
my $biblioitemnumber =
77
my $biblioitemnumber =
78
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
78
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
(-)a/t/db_dependent/HoldsQueue.t (-8 / +6 lines)
Lines 87-94 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) Link Here
87
          VALUES             ('SER', 'Koha test', '$TITLE', '2011-02-01')");
87
          VALUES             ('SER', 'Koha test', '$TITLE', '2011-02-01')");
88
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
88
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
89
  or BAIL_OUT("Cannot find newly created biblio record");
89
  or BAIL_OUT("Cannot find newly created biblio record");
90
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype)
90
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype)
91
          VALUES                  ($biblionumber, '', '$itemtype')");
91
          VALUES                  ($biblionumber, '$itemtype')");
92
my $biblioitemnumber = $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
92
my $biblioitemnumber = $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
93
  or BAIL_OUT("Cannot find newly created biblioitems record");
93
  or BAIL_OUT("Cannot find newly created biblioitems record");
94
94
Lines 227-237 $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE tit Link Here
227
$dbh->do(qq{
227
$dbh->do(qq{
228
    INSERT INTO biblioitems (
228
    INSERT INTO biblioitems (
229
        biblionumber, 
229
        biblionumber, 
230
        marcxml, 
231
        itemtype
230
        itemtype
232
    ) VALUES (
231
    ) VALUES (
233
        $biblionumber, 
232
        $biblionumber, 
234
        '', 
235
        '$itemtype'
233
        '$itemtype'
236
    )
234
    )
237
});
235
});
Lines 439-445 $dbh->do(" Link Here
439
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
437
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
440
  or BAIL_OUT("Cannot find newly created biblio record");
438
  or BAIL_OUT("Cannot find newly created biblio record");
441
439
442
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
440
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
443
441
444
$biblioitemnumber =
442
$biblioitemnumber =
445
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
443
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
Lines 501-507 $dbh->do(" Link Here
501
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
499
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
502
  or BAIL_OUT("Cannot find newly created biblio record");
500
  or BAIL_OUT("Cannot find newly created biblio record");
503
501
504
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
502
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
505
503
506
$biblioitemnumber =
504
$biblioitemnumber =
507
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
505
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
Lines 542-548 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES Link Here
542
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
540
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
543
  or BAIL_OUT("Cannot find newly created biblio record");
541
  or BAIL_OUT("Cannot find newly created biblio record");
544
542
545
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
543
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
546
544
547
$biblioitemnumber =
545
$biblioitemnumber =
548
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
546
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
Lines 654-660 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES Link Here
654
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
652
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
655
  or BAIL_OUT("Cannot find newly created biblio record");
653
  or BAIL_OUT("Cannot find newly created biblio record");
656
654
657
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
655
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
658
656
659
$biblioitemnumber =
657
$biblioitemnumber =
660
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
658
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
(-)a/t/db_dependent/UsageStats.t (-6 / +5 lines)
Lines 241-254 sub construct_objects_needed { Link Here
241
    # ---------- 3 biblio items  -------------------------
241
    # ---------- 3 biblio items  -------------------------
242
    $query = '
242
    $query = '
243
    INSERT INTO biblioitems
243
    INSERT INTO biblioitems
244
      (biblionumber, itemtype, marcxml)
244
      (biblionumber, itemtype)
245
    VALUES (?,?,?)';
245
    VALUES (?,?)';
246
    $insert_sth = $dbh->prepare($query);
246
    $insert_sth = $dbh->prepare($query);
247
    $insert_sth->execute( $biblionumber1, 'Book', '' );
247
    $insert_sth->execute( $biblionumber1, 'Book' );
248
    my $biblioitemnumber1 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
248
    my $biblioitemnumber1 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
249
    $insert_sth->execute( $biblionumber2, 'Music', '' );
249
    $insert_sth->execute( $biblionumber2, 'Music' );
250
    my $biblioitemnumber2 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
250
    my $biblioitemnumber2 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
251
    $insert_sth->execute( $biblionumber3, 'Book', '' );
251
    $insert_sth->execute( $biblionumber3, 'Book' );
252
    my $biblioitemnumber3 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
252
    my $biblioitemnumber3 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
253
253
254
    # ---------- 3 items  -------------------------
254
    # ---------- 3 items  -------------------------
255
- 

Return to bug 17196