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

(-)a/C4/Biblio.pm (-31 / +34 lines)
Lines 42-47 use C4::Debug; Link Here
42
use Koha::Cache;
42
use Koha::Cache;
43
use Koha::Authority::Types;
43
use Koha::Authority::Types;
44
use Koha::Acquisition::Currencies;
44
use Koha::Acquisition::Currencies;
45
use Koha::Biblio::Metadata;
46
use Koha::Biblio::Metadatas;
45
use Koha::SearchEngine;
47
use Koha::SearchEngine;
46
48
47
use vars qw(@ISA @EXPORT);
49
use vars qw(@ISA @EXPORT);
Lines 159-165 Biblio.pm contains functions for managing storage and editing of bibliographic d Link Here
159
161
160
=item 2. as raw MARC in the Zebra index and storage engine
162
=item 2. as raw MARC in the Zebra index and storage engine
161
163
162
=item 3. as MARC XML in biblioitems.marcxml
164
=item 3. as MARC XML in biblio_metadata.metadata
163
165
164
=back
166
=back
165
167
Lines 183-189 Because of this design choice, the process of managing storage and editing is a Link Here
183
185
184
=item 2. _koha_* - low-level internal functions for managing the koha tables
186
=item 2. _koha_* - low-level internal functions for managing the koha tables
185
187
186
=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.
188
=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.
187
189
188
=item 4. Zebra functions used to update the Zebra index
190
=item 4. Zebra functions used to update the Zebra index
189
191
Lines 191-197 Because of this design choice, the process of managing storage and editing is a Link Here
191
193
192
=back
194
=back
193
195
194
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 :
196
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 :
195
197
196
=over 4
198
=over 4
197
199
Lines 203-222 The MARC record (in biblioitems.marcxml) contains the complete marc record, incl Link Here
203
205
204
=back
206
=back
205
207
206
When dealing with items, we must :
207
208
=over 4
209
210
=item 1. save the item in items table, that gives us an itemnumber
211
212
=item 2. add the itemnumber to the item MARC field
213
214
=item 3. overwrite the MARC record (with the added item) into biblioitems.marcxml
215
216
When modifying a biblio or an item, the behaviour is quite similar.
217
218
=back
219
220
=head1 EXPORTED FUNCTIONS
208
=head1 EXPORTED FUNCTIONS
221
209
222
=head2 AddBiblio
210
=head2 AddBiblio
Lines 232-238 framework code. Link Here
232
This function also accepts a third, optional argument: a hashref
220
This function also accepts a third, optional argument: a hashref
233
to additional options.  The only defined option is C<defer_marc_save>,
221
to additional options.  The only defined option is C<defer_marc_save>,
234
which if present and mapped to a true value, causes C<AddBiblio>
222
which if present and mapped to a true value, causes C<AddBiblio>
235
to omit the call to save the MARC in C<bibilioitems.marcxml>
223
to omit the call to save the MARC in C<biblio_metadata.metadata>
236
This option is provided B<only>
224
This option is provided B<only>
237
for the use of scripts such as C<bulkmarcimport.pl> that may need
225
for the use of scripts such as C<bulkmarcimport.pl> that may need
238
to do some manipulation of the MARC record for item parsing before
226
to do some manipulation of the MARC record for item parsing before
Lines 1322-1332 sub GetMarcBiblio { Link Here
1322
    }
1310
    }
1323
1311
1324
    my $dbh          = C4::Context->dbh;
1312
    my $dbh          = C4::Context->dbh;
1325
    my $sth          = $dbh->prepare("SELECT biblioitemnumber, marcxml FROM biblioitems WHERE biblionumber=? ");
1313
    my $sth          = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? ");
1326
    $sth->execute($biblionumber);
1314
    $sth->execute($biblionumber);
1327
    my $row     = $sth->fetchrow_hashref;
1315
    my $row     = $sth->fetchrow_hashref;
1328
    my $biblioitemnumber = $row->{'biblioitemnumber'};
1316
    my $biblioitemnumber = $row->{'biblioitemnumber'};
1329
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1317
    my $marcxml = GetXmlBiblio( $biblionumber );
1318
    $marcxml = StripNonXmlChars( $marcxml );
1330
    my $frameworkcode = GetFrameworkCode($biblionumber);
1319
    my $frameworkcode = GetFrameworkCode($biblionumber);
1331
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1320
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1332
    my $record = MARC::Record->new();
1321
    my $record = MARC::Record->new();
Lines 1355-1371 sub GetMarcBiblio { Link Here
1355
1344
1356
  my $marcxml = GetXmlBiblio($biblionumber);
1345
  my $marcxml = GetXmlBiblio($biblionumber);
1357
1346
1358
Returns biblioitems.marcxml of the biblionumber passed in parameter.
1347
Returns biblio_metadata.metadata/marcxml of the biblionumber passed in parameter.
1359
The XML should only contain biblio information (item information is no longer stored in marcxml field)
1348
The XML should only contain biblio information (item information is no longer stored in marcxml field)
1360
1349
1361
=cut
1350
=cut
1362
1351
1363
sub GetXmlBiblio {
1352
sub GetXmlBiblio {
1364
    my ($biblionumber) = @_;
1353
    my ($biblionumber) = @_;
1365
    my $dbh            = C4::Context->dbh;
1354
    my $dbh = C4::Context->dbh;
1366
    my $sth            = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
1355
    return unless $biblionumber;
1367
    $sth->execute($biblionumber);
1356
    my ($marcxml) = $dbh->selectrow_array(
1368
    my ($marcxml) = $sth->fetchrow;
1357
        q|
1358
        SELECT metadata
1359
        FROM biblio_metadata
1360
        WHERE biblionumber=?
1361
            AND format='marcxml'
1362
            AND marcflavour=?
1363
    |, undef, $biblionumber, C4::Context->preference('marcflavour')
1364
    );
1369
    return $marcxml;
1365
    return $marcxml;
1370
}
1366
}
1371
1367
Lines 3214-3222 sub _koha_modify_biblio { Link Here
3214
3210
3215
  my ($biblioitemnumber,$error) = _koha_modify_biblioitem_nonmarc( $dbh, $biblioitem );
3211
  my ($biblioitemnumber,$error) = _koha_modify_biblioitem_nonmarc( $dbh, $biblioitem );
3216
3212
3217
Updates biblioitems row except for marc and marcxml, which should be changed
3218
via ModBiblioMarc
3219
3220
=cut
3213
=cut
3221
3214
3222
sub _koha_modify_biblioitem_nonmarc {
3215
sub _koha_modify_biblioitem_nonmarc {
Lines 3503-3511 sub ModBiblioMarc { Link Here
3503
      $f005->update(sprintf("%4d%02d%02d%02d%02d%04.1f",@a)) if $f005;
3496
      $f005->update(sprintf("%4d%02d%02d%02d%02d%04.1f",@a)) if $f005;
3504
    }
3497
    }
3505
3498
3506
    $sth = $dbh->prepare("UPDATE biblioitems SET marcxml=? WHERE biblionumber=?");
3499
    my $metadata = {
3507
    $sth->execute( $record->as_xml_record($encoding), $biblionumber );
3500
        biblionumber => $biblionumber,
3508
    $sth->finish;
3501
        format       => 'marcxml',
3502
        marcflavour  => C4::Context->preference('marcflavour'),
3503
    };
3504
    # FIXME To replace with ->find_or_create?
3505
    if ( my $m_rs = Koha::Biblio::Metadatas->find($metadata) ) {
3506
        $m_rs->metadata( $record->as_xml_record($encoding) );
3507
    } else {
3508
        my $m_rs = Koha::Biblio::Metadata->new($metadata);
3509
        $m_rs->metadata( $record->as_xml_record($encoding) );
3510
        $m_rs->store;
3511
    }
3509
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $record );
3512
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $record );
3510
    return $biblionumber;
3513
    return $biblionumber;
3511
}
3514
}
(-)a/C4/ILSDI/Services.pm (-1 lines)
Lines 406-412 sub GetPatronInfo { Link Here
406
            my $branchname = GetBranchName( $reserve->{'branchcode'} );
406
            my $branchname = GetBranchName( $reserve->{'branchcode'} );
407
407
408
            # Remove unwanted fields
408
            # Remove unwanted fields
409
            delete $item->{'marcxml'};
410
            delete $item->{'more_subfields_xml'};
409
            delete $item->{'more_subfields_xml'};
411
410
412
            # Add additional fields
411
            # Add additional fields
(-)a/C4/Members.pm (-2 / +1 lines)
Lines 857-863 Looks up what the patron with the given borrowernumber has borrowed. Link Here
857
C<&GetPendingIssues> returns a
857
C<&GetPendingIssues> returns a
858
reference-to-array where each element is a reference-to-hash; the
858
reference-to-array where each element is a reference-to-hash; the
859
keys are the fields from the C<issues>, C<biblio>, and C<items> tables.
859
keys are the fields from the C<issues>, C<biblio>, and C<items> tables.
860
The keys include C<biblioitems> fields except marc and marcxml.
860
The keys include C<biblioitems> fields.
861
861
862
=cut
862
=cut
863
863
Lines 877-883 sub GetPendingIssues { Link Here
877
        }
877
        }
878
    }
878
    }
879
879
880
    # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance
881
    # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
880
    # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
882
    # FIXME: circ/ciculation.pl tries to sort by timestamp!
881
    # FIXME: circ/ciculation.pl tries to sort by timestamp!
883
    # FIXME: namespace collision: other collisions possible.
882
    # FIXME: namespace collision: other collisions possible.
(-)a/C4/Overdues.pm (-1 lines)
Lines 159-165 Returns a count and a list of overdueitems for a given borrowernumber Link Here
159
159
160
sub checkoverdues {
160
sub checkoverdues {
161
    my $borrowernumber = shift or return;
161
    my $borrowernumber = shift or return;
162
    # don't select biblioitems.marcxml... too slow on large systems
163
    my $sth = C4::Context->dbh->prepare(
162
    my $sth = C4::Context->dbh->prepare(
164
        "SELECT biblio.*, items.*, issues.*,
163
        "SELECT biblio.*, items.*, issues.*,
165
                biblioitems.volume,
164
                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 / +9 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 @biblioitems = # Should be replaced by a call to C4::Search on zebra index
73
                  # Record-status when bug 15537 will be pushed
74
  $schema->resultset('Biblioitem')->search( { marcxml => { LIKE => '<leader>_____d%' } } );
75
72
76
my $total_records_count   = @biblioitems;
73
my @metadatas =    # Should be replaced by a call to C4::Search on zebra index
74
                   # Record-status when bug 15537 will be pushed
75
  Koha::Biblio::Metadatas->search( { format => 'marcxml', marcflavour => C4::Context->preference('marcflavour'), metadata => { LIKE => '<leader>_____d%' } } );
76
77
my $total_records_count   = @metadatas;
77
my $deleted_records_count = 0;
78
my $deleted_records_count = 0;
78
my $total_items_count     = 0;
79
my $total_items_count     = 0;
79
my $deleted_items_count   = 0;
80
my $deleted_items_count   = 0;
80
81
81
foreach my $biblioitem (@biblioitems) {
82
foreach my $m (@metadatas) {
82
    my $biblionumber = $biblioitem->get_column('biblionumber');
83
    my $biblionumber = $m->get_column('biblionumber');
83
84
84
    say "RECORD: $biblionumber" if $verbose;
85
    say "RECORD: $biblionumber" if $verbose;
85
86
86
    if ($delete_items) {
87
    if ($delete_items) {
87
        my $deleted_count = 0;
88
        my $deleted_count = 0;
89
        my $biblioitem = Koha::Biblioitem->find( $biblionumber );
88
        foreach my $item ( $biblioitem->items() ) {
90
        foreach my $item ( $biblioitem->items() ) {
89
            my $itemnumber = $item->itemnumber();
91
            my $itemnumber = $item->itemnumber();
90
92
(-)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 600-607 if ($tag) { Link Here
600
    $query_cgi = "tag=" .$tag . "&" . $query_cgi;
600
    $query_cgi = "tag=" .$tag . "&" . $query_cgi;
601
    my $taglist = get_tags({term=>$tag, approved=>1});
601
    my $taglist = get_tags({term=>$tag, approved=>1});
602
    $results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
602
    $results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
603
    my @biblist  = (map {GetBiblioData($_->{biblionumber})} @$taglist);
603
    my @marclist = map { C4::Biblio::GetXmlBiblio( $_->{biblionumber} ) } @$taglist;
604
    my @marclist = (map { (C4::Context->config('zebra_bib_index_mode') eq 'dom')? $_->{marcxml}: $_->{marc}; } @biblist);
605
    $DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
604
    $DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
606
    $results_hashref->{biblioserver}->{RECORDS} = \@marclist;
605
    $results_hashref->{biblioserver}->{RECORDS} = \@marclist;
607
    # FIXME: tag search and standard search should work together, not exclusively
606
    # FIXME: tag search and standard search should work together, not exclusively
(-)a/t/db_dependent/Acquisition.t (-1 lines)
Lines 431-437 my @base_expectedfields = qw( Link Here
431
  serial
431
  serial
432
  cn_suffix
432
  cn_suffix
433
  cn_item
433
  cn_item
434
  marcxml
435
  freight
434
  freight
436
  cn_class
435
  cn_class
437
  title
436
  title
(-)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 86-93 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) Link Here
86
          VALUES             ('SER', 'Koha test', '$TITLE', '2011-02-01')");
86
          VALUES             ('SER', 'Koha test', '$TITLE', '2011-02-01')");
87
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
87
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
88
  or BAIL_OUT("Cannot find newly created biblio record");
88
  or BAIL_OUT("Cannot find newly created biblio record");
89
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype)
89
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype)
90
          VALUES                  ($biblionumber, '', '$itemtype')");
90
          VALUES                  ($biblionumber, '$itemtype')");
91
my $biblioitemnumber = $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
91
my $biblioitemnumber = $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
92
  or BAIL_OUT("Cannot find newly created biblioitems record");
92
  or BAIL_OUT("Cannot find newly created biblioitems record");
93
93
Lines 226-236 $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE tit Link Here
226
$dbh->do(qq{
226
$dbh->do(qq{
227
    INSERT INTO biblioitems (
227
    INSERT INTO biblioitems (
228
        biblionumber, 
228
        biblionumber, 
229
        marcxml, 
230
        itemtype
229
        itemtype
231
    ) VALUES (
230
    ) VALUES (
232
        $biblionumber, 
231
        $biblionumber, 
233
        '', 
234
        '$itemtype'
232
        '$itemtype'
235
    )
233
    )
236
});
234
});
Lines 359-365 $dbh->do(" Link Here
359
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
357
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
360
  or BAIL_OUT("Cannot find newly created biblio record");
358
  or BAIL_OUT("Cannot find newly created biblio record");
361
359
362
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
360
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
363
361
364
$biblioitemnumber =
362
$biblioitemnumber =
365
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
363
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
Lines 421-427 $dbh->do(" Link Here
421
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
419
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
422
  or BAIL_OUT("Cannot find newly created biblio record");
420
  or BAIL_OUT("Cannot find newly created biblio record");
423
421
424
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
422
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
425
423
426
$biblioitemnumber =
424
$biblioitemnumber =
427
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
425
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
Lines 462-468 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES Link Here
462
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
460
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
463
  or BAIL_OUT("Cannot find newly created biblio record");
461
  or BAIL_OUT("Cannot find newly created biblio record");
464
462
465
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
463
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
466
464
467
$biblioitemnumber =
465
$biblioitemnumber =
468
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
466
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
Lines 574-580 $dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES Link Here
574
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
572
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
575
  or BAIL_OUT("Cannot find newly created biblio record");
573
  or BAIL_OUT("Cannot find newly created biblio record");
576
574
577
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
575
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
578
576
579
$biblioitemnumber =
577
$biblioitemnumber =
580
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
578
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
(-)a/t/db_dependent/UsageStats.t (-6 / +5 lines)
Lines 240-253 sub construct_objects_needed { Link Here
240
    # ---------- 3 biblio items  -------------------------
240
    # ---------- 3 biblio items  -------------------------
241
    $query = '
241
    $query = '
242
    INSERT INTO biblioitems
242
    INSERT INTO biblioitems
243
      (biblionumber, itemtype, marcxml)
243
      (biblionumber, itemtype)
244
    VALUES (?,?,?)';
244
    VALUES (?,?)';
245
    $insert_sth = $dbh->prepare($query);
245
    $insert_sth = $dbh->prepare($query);
246
    $insert_sth->execute( $biblionumber1, 'Book', '' );
246
    $insert_sth->execute( $biblionumber1, 'Book' );
247
    my $biblioitemnumber1 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
247
    my $biblioitemnumber1 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
248
    $insert_sth->execute( $biblionumber2, 'Music', '' );
248
    $insert_sth->execute( $biblionumber2, 'Music' );
249
    my $biblioitemnumber2 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
249
    my $biblioitemnumber2 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
250
    $insert_sth->execute( $biblionumber3, 'Book', '' );
250
    $insert_sth->execute( $biblionumber3, 'Book' );
251
    my $biblioitemnumber3 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
251
    my $biblioitemnumber3 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
252
252
253
    # ---------- 3 items  -------------------------
253
    # ---------- 3 items  -------------------------
254
- 

Return to bug 17196