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 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 1336-1346 sub GetMarcBiblio { Link Here
1336
    }
1324
    }
1337
1325
1338
    my $dbh          = C4::Context->dbh;
1326
    my $dbh          = C4::Context->dbh;
1339
    my $sth          = $dbh->prepare("SELECT biblioitemnumber, marcxml FROM biblioitems WHERE biblionumber=? ");
1327
    my $sth          = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? ");
1340
    $sth->execute($biblionumber);
1328
    $sth->execute($biblionumber);
1341
    my $row     = $sth->fetchrow_hashref;
1329
    my $row     = $sth->fetchrow_hashref;
1342
    my $biblioitemnumber = $row->{'biblioitemnumber'};
1330
    my $biblioitemnumber = $row->{'biblioitemnumber'};
1343
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1331
    my $marcxml = GetXmlBiblio( $biblionumber );
1332
    $marcxml = StripNonXmlChars( $marcxml );
1344
    my $frameworkcode = GetFrameworkCode($biblionumber);
1333
    my $frameworkcode = GetFrameworkCode($biblionumber);
1345
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1334
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1346
    my $record = MARC::Record->new();
1335
    my $record = MARC::Record->new();
Lines 1369-1385 sub GetMarcBiblio { Link Here
1369
1358
1370
  my $marcxml = GetXmlBiblio($biblionumber);
1359
  my $marcxml = GetXmlBiblio($biblionumber);
1371
1360
1372
Returns biblioitems.marcxml of the biblionumber passed in parameter.
1361
Returns biblio_metadata.metadata/marcxml of the biblionumber passed in parameter.
1373
The XML should only contain biblio information (item information is no longer stored in marcxml field)
1362
The XML should only contain biblio information (item information is no longer stored in marcxml field)
1374
1363
1375
=cut
1364
=cut
1376
1365
1377
sub GetXmlBiblio {
1366
sub GetXmlBiblio {
1378
    my ($biblionumber) = @_;
1367
    my ($biblionumber) = @_;
1379
    my $dbh            = C4::Context->dbh;
1368
    my $dbh = C4::Context->dbh;
1380
    my $sth            = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
1369
    return unless $biblionumber;
1381
    $sth->execute($biblionumber);
1370
    my ($marcxml) = $dbh->selectrow_array(
1382
    my ($marcxml) = $sth->fetchrow;
1371
        q|
1372
        SELECT metadata
1373
        FROM biblio_metadata
1374
        WHERE biblionumber=?
1375
            AND format='marcxml'
1376
            AND marcflavour=?
1377
    |, undef, $biblionumber, C4::Context->preference('marcflavour')
1378
    );
1383
    return $marcxml;
1379
    return $marcxml;
1384
}
1380
}
1385
1381
Lines 3234-3242 sub _koha_modify_biblio { Link Here
3234
3230
3235
  my ($biblioitemnumber,$error) = _koha_modify_biblioitem_nonmarc( $dbh, $biblioitem );
3231
  my ($biblioitemnumber,$error) = _koha_modify_biblioitem_nonmarc( $dbh, $biblioitem );
3236
3232
3237
Updates biblioitems row except for marc and marcxml, which should be changed
3238
via ModBiblioMarc
3239
3240
=cut
3233
=cut
3241
3234
3242
sub _koha_modify_biblioitem_nonmarc {
3235
sub _koha_modify_biblioitem_nonmarc {
Lines 3523-3531 sub ModBiblioMarc { Link Here
3523
      $f005->update(sprintf("%4d%02d%02d%02d%02d%04.1f",@a)) if $f005;
3516
      $f005->update(sprintf("%4d%02d%02d%02d%02d%04.1f",@a)) if $f005;
3524
    }
3517
    }
3525
3518
3526
    $sth = $dbh->prepare("UPDATE biblioitems SET marcxml=? WHERE biblionumber=?");
3519
    my $metadata = {
3527
    $sth->execute( $record->as_xml_record($encoding), $biblionumber );
3520
        biblionumber => $biblionumber,
3528
    $sth->finish;
3521
        format       => 'marcxml',
3522
        marcflavour  => C4::Context->preference('marcflavour'),
3523
    };
3524
    # FIXME To replace with ->find_or_create?
3525
    if ( my $m_rs = Koha::Biblio::Metadatas->find($metadata) ) {
3526
        $m_rs->metadata( $record->as_xml_record($encoding) );
3527
    } else {
3528
        my $m_rs = Koha::Biblio::Metadata->new($metadata);
3529
        $m_rs->metadata( $record->as_xml_record($encoding) );
3530
        $m_rs->store;
3531
    }
3529
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $record );
3532
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $record );
3530
    return $biblionumber;
3533
    return $biblionumber;
3531
}
3534
}
(-)a/C4/ILSDI/Services.pm (-1 lines)
Lines 411-417 sub GetPatronInfo { Link Here
411
            my $branchname = $library ? $library->branchname : '';
411
            my $branchname = $library ? $library->branchname : '';
412
412
413
            # Remove unwanted fields
413
            # Remove unwanted fields
414
            delete $item->{'marcxml'};
415
            delete $item->{'more_subfields_xml'};
414
            delete $item->{'more_subfields_xml'};
416
415
417
            # Add additional fields
416
            # Add additional fields
(-)a/C4/Members.pm (-2 / +1 lines)
Lines 797-803 Looks up what the patron with the given borrowernumber has borrowed. Link Here
797
C<&GetPendingIssues> returns a
797
C<&GetPendingIssues> returns a
798
reference-to-array where each element is a reference-to-hash; the
798
reference-to-array where each element is a reference-to-hash; the
799
keys are the fields from the C<issues>, C<biblio>, and C<items> tables.
799
keys are the fields from the C<issues>, C<biblio>, and C<items> tables.
800
The keys include C<biblioitems> fields except marc and marcxml.
800
The keys include C<biblioitems> fields.
801
801
802
=cut
802
=cut
803
803
Lines 817-823 sub GetPendingIssues { Link Here
817
        }
817
        }
818
    }
818
    }
819
819
820
    # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance
821
    # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
820
    # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
822
    # FIXME: circ/ciculation.pl tries to sort by timestamp!
821
    # FIXME: circ/ciculation.pl tries to sort by timestamp!
823
    # FIXME: namespace collision: other collisions possible.
822
    # 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