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

(-)a/C4/Biblio.pm (-19 / +29 lines)
Lines 632-670 sub _check_valid_auth_link { Link Here
632
632
633
=head2 GetRecordValue
633
=head2 GetRecordValue
634
634
635
  my $values = GetRecordValue($field, $record, $frameworkcode);
635
  my $values = GetRecordValue($field, $record);
636
636
637
Get MARC fields from a keyword defined in fieldmapping table.
637
Get MARC fields from the record using the framework mappings for biblio fields.
638
638
639
=cut
639
=cut
640
640
641
sub GetRecordValue {
641
sub GetRecordValue {
642
    my ( $field, $record, $frameworkcode ) = @_;
642
    my ( $field, $record ) = @_;
643
643
644
    if (!$record) {
644
    if (!$record) {
645
        carp 'GetRecordValue called with undefined record';
645
        carp 'GetRecordValue called with undefined record';
646
        return;
646
        return;
647
    }
647
    }
648
    my $dbh = C4::Context->dbh;
649
650
    my $sth = $dbh->prepare('SELECT fieldcode, subfieldcode FROM fieldmapping WHERE frameworkcode = ? AND field = ?');
651
    $sth->execute( $frameworkcode, $field );
652
653
    my @result = ();
654
655
    while ( my $row = $sth->fetchrow_hashref ) {
656
        foreach my $field ( $record->field( $row->{fieldcode} ) ) {
657
            if ( ( $row->{subfieldcode} ne "" && $field->subfield( $row->{subfieldcode} ) ) ) {
658
                foreach my $subfield ( $field->subfield( $row->{subfieldcode} ) ) {
659
                    push @result, { 'subfield' => $subfield };
660
                }
661
648
662
            } elsif ( $row->{subfieldcode} eq "" ) {
649
    my @result;
663
                push @result, { 'subfield' => $field->as_string() };
650
    my @mss = GetMarcSubfieldStructureFromKohaField("biblio.$field");
651
    foreach my $fldhash ( @mss ) {
652
        my $tag = $fldhash->{tagfield};
653
        my $sub = $fldhash->{tagsubfield};
654
        foreach my $fld ( $record->field($tag) ) {
655
            if( $sub eq '@' || $fld->is_control_field ) {
656
                push @result, $fld->data if $fld->data;
657
            } else {
658
                push @result, grep { $_ } $fld->subfield($sub);
664
            }
659
            }
665
        }
660
        }
666
    }
661
    }
667
668
    return \@result;
662
    return \@result;
669
}
663
}
670
664
Lines 3599-3604 sub RemoveAllNsb { Link Here
3599
    return $record;
3593
    return $record;
3600
}
3594
}
3601
3595
3596
=head2 SplitSubtitle
3597
3598
    $subtitles = SplitSubtitle($subtitle);
3599
3600
Splits a subtitle field to an array of hashes like the one GetRecordValue returns
3601
3602
=cut
3603
3604
sub SplitSubtitle {
3605
    my $subtitle = shift;
3606
3607
    my @subtitles = map( { 'subfield' => $_ }, split(/ \| /, $subtitle // '' ) );
3608
3609
    return \@subtitles;
3610
}
3611
3602
1;
3612
1;
3603
3613
3604
3614
(-)a/C4/HoldsQueue.pm (-8 / +9 lines)
Lines 131-137 sub GetHoldsQueueItems { Link Here
131
    my $dbh   = C4::Context->dbh;
131
    my $dbh   = C4::Context->dbh;
132
132
133
    my @bind_params = ();
133
    my @bind_params = ();
134
    my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, biblioitems.itemtype, items.location, items.enumchron, items.cn_sort, biblioitems.publishercode,biblio.copyrightdate,biblioitems.publicationyear,biblioitems.pages,biblioitems.size,biblioitems.publicationyear,biblioitems.isbn,items.copynumber
134
    my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, biblioitems.itemtype, items.location, 
135
                         items.enumchron, items.cn_sort, biblioitems.publishercode,
136
                         biblio.copyrightdate, biblio.subtitle, biblio.part_number as numbers, 
137
                         biblio.part_name as parts,
138
                         biblioitems.publicationyear, biblioitems.pages, biblioitems.size, biblioitems.publicationyear, 
139
                         biblioitems.isbn, items.copynumber
135
                  FROM tmp_holdsqueue
140
                  FROM tmp_holdsqueue
136
                       JOIN biblio      USING (biblionumber)
141
                       JOIN biblio      USING (biblionumber)
137
                  LEFT JOIN biblioitems USING (biblionumber)
142
                  LEFT JOIN biblioitems USING (biblionumber)
Lines 146-164 sub GetHoldsQueueItems { Link Here
146
    $sth->execute(@bind_params);
151
    $sth->execute(@bind_params);
147
    my $items = [];
152
    my $items = [];
148
    while ( my $row = $sth->fetchrow_hashref ){
153
    while ( my $row = $sth->fetchrow_hashref ){
149
        my $record = GetMarcBiblio({ biblionumber => $row->{biblionumber} });
150
        if ($record){
151
            $row->{subtitle} = [ map { $_->{subfield} } @{ GetRecordValue( 'subtitle', $record, '' ) } ];
152
            $row->{parts} = GetRecordValue('parts',$record,'')->[0]->{subfield};
153
            $row->{numbers} = GetRecordValue('numbers',$record,'')->[0]->{subfield};
154
        }
155
156
        # return the bib-level or item-level itype per syspref
154
        # return the bib-level or item-level itype per syspref
157
        if (!C4::Context->preference('item-level_itypes')) {
155
        if (!C4::Context->preference('item-level_itypes')) {
158
            $row->{itype} = $row->{itemtype};
156
            $row->{itype} = $row->{itemtype};
159
        }
157
        }
160
        delete $row->{itemtype};
158
        delete $row->{itemtype};
161
159
160
        my @subtitles = split(/ \| /, $row->{'subtitle'} // '' );
161
        $row->{'subtitle'} = \@subtitles;
162
162
        push @$items, $row;
163
        push @$items, $row;
163
    }
164
    }
164
    return $items;
165
    return $items;
(-)a/C4/Overdues.pm (+4 lines)
Lines 750-755 sub GetOverduesForBranch { Link Here
750
            borrowers.phone,
750
            borrowers.phone,
751
            borrowers.email,
751
            borrowers.email,
752
               biblio.title,
752
               biblio.title,
753
               biblio.subtitle,
754
               biblio.medium,
755
               biblio.part_number,
756
               biblio.part_name,
753
               biblio.author,
757
               biblio.author,
754
               biblio.biblionumber,
758
               biblio.biblionumber,
755
               issues.date_due,
759
               issues.date_due,
(-)a/C4/Search.pm (-1 / +1 lines)
Lines 1944-1950 sub searchResults { Link Here
1944
1944
1945
        SetUTF8Flag($marcrecord);
1945
        SetUTF8Flag($marcrecord);
1946
        my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw );
1946
        my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw );
1947
        $oldbiblio->{subtitle} = GetRecordValue('subtitle', $marcrecord, $fw);
1947
        $oldbiblio->{subtitle} = GetRecordValue('subtitle', $marcrecord);
1948
        $oldbiblio->{result_number} = $i + 1;
1948
        $oldbiblio->{result_number} = $i + 1;
1949
1949
1950
        # add imageurl to itemtype if there is one
1950
        # add imageurl to itemtype if there is one
(-)a/C4/ShelfBrowser.pm (-2 / +5 lines)
Lines 223-234 sub GetShelfInfo { Link Here
223
        my $this_biblio = GetBibData($item->{biblionumber});
223
        my $this_biblio = GetBibData($item->{biblionumber});
224
        next unless defined $this_biblio;
224
        next unless defined $this_biblio;
225
        $item->{'title'} = $this_biblio->{'title'};
225
        $item->{'title'} = $this_biblio->{'title'};
226
        $item->{'subtitle'} = C4::Biblio::SplitSubtitle($this_biblio->{'subtitle'}),
227
        $item->{'medium'} = $this_biblio->{'medium'};
228
        $item->{'part_number'} = $this_biblio->{'part_number'};
229
        $item->{'part_name'} = $this_biblio->{'part_name'};
226
        my $this_record = GetMarcBiblio({ biblionumber => $this_biblio->{'biblionumber'} });
230
        my $this_record = GetMarcBiblio({ biblionumber => $this_biblio->{'biblionumber'} });
227
        $item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour);
231
        $item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour);
228
        $item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour);
232
        $item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour);
229
        $item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour);
233
        $item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour);
230
        $item->{'browser_normalized_ean'} = GetNormalizedEAN($this_record,$marcflavour);
234
        $item->{'browser_normalized_ean'} = GetNormalizedEAN($this_record,$marcflavour);
231
        $item->{'subtitle'} = GetRecordValue('subtitle', $this_record, GetFrameworkCode( $item->{biblionumber} ));
232
        push @valid_items, $item;
235
        push @valid_items, $item;
233
    }
236
    }
234
    return @valid_items;
237
    return @valid_items;
Lines 239-245 sub GetBibData { Link Here
239
	my ($bibnum) = @_;
242
	my ($bibnum) = @_;
240
243
241
    my $dbh         = C4::Context->dbh;
244
    my $dbh         = C4::Context->dbh;
242
    my $sth = $dbh->prepare("SELECT biblionumber, title FROM biblio WHERE biblionumber=?");
245
    my $sth = $dbh->prepare("SELECT biblionumber, title, subtitle, medium, part_number, part_name FROM biblio WHERE biblionumber=?");
243
    $sth->execute($bibnum);
246
    $sth->execute($bibnum);
244
    my $bib = $sth->fetchrow_hashref();
247
    my $bib = $sth->fetchrow_hashref();
245
    return $bib;
248
    return $bib;
(-)a/Koha/Biblio.pm (-8 / +3 lines)
Lines 65-84 sub store { Link Here
65
65
66
my @subtitles = $biblio->subtitles();
66
my @subtitles = $biblio->subtitles();
67
67
68
Returns list of subtitles for a record.
68
Returns list of subtitles for a record according to the framework.
69
70
Keyword to MARC mapping for subtitle must be set for this method to return any possible values.
71
69
72
=cut
70
=cut
73
71
74
sub subtitles {
72
sub subtitles {
75
    my ( $self ) = @_;
73
    my ( $self ) = @_;
76
74
77
    return map { $_->{subfield} } @{
75
    my @subtitles = split( / \| /, $self->subtitle // '' );
78
        C4::Biblio::GetRecordValue(
76
    return @subtitles;
79
            'subtitle',
80
            C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }),
81
            $self->frameworkcode ) };
82
}
77
}
83
78
84
=head3 can_article_request
79
=head3 can_article_request
(-)a/Koha/Schema/Result/Holding.pm (+242 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::Holding;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::Holding
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<holdings>
19
20
=cut
21
22
__PACKAGE__->table("holdings");
23
24
=head1 ACCESSORS
25
26
=head2 holding_id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
=head2 biblionumber
33
34
  data_type: 'integer'
35
  default_value: 0
36
  is_foreign_key: 1
37
  is_nullable: 0
38
39
=head2 biblioitemnumber
40
41
  data_type: 'integer'
42
  default_value: 0
43
  is_foreign_key: 1
44
  is_nullable: 0
45
46
=head2 frameworkcode
47
48
  data_type: 'varchar'
49
  default_value: (empty string)
50
  is_nullable: 0
51
  size: 4
52
53
=head2 holdingbranch
54
55
  data_type: 'varchar'
56
  is_foreign_key: 1
57
  is_nullable: 1
58
  size: 10
59
60
=head2 location
61
62
  data_type: 'varchar'
63
  is_nullable: 1
64
  size: 80
65
66
=head2 callnumber
67
68
  data_type: 'varchar'
69
  is_nullable: 1
70
  size: 255
71
72
=head2 suppress
73
74
  data_type: 'tinyint'
75
  is_nullable: 1
76
77
=head2 timestamp
78
79
  data_type: 'timestamp'
80
  datetime_undef_if_invalid: 1
81
  default_value: 'current_timestamp()'
82
  is_nullable: 0
83
84
=head2 datecreated
85
86
  data_type: 'date'
87
  datetime_undef_if_invalid: 1
88
  is_nullable: 0
89
90
=head2 deleted_on
91
92
  data_type: 'datetime'
93
  datetime_undef_if_invalid: 1
94
  is_nullable: 1
95
96
=cut
97
98
__PACKAGE__->add_columns(
99
  "holding_id",
100
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
101
  "biblionumber",
102
  {
103
    data_type      => "integer",
104
    default_value  => 0,
105
    is_foreign_key => 1,
106
    is_nullable    => 0,
107
  },
108
  "biblioitemnumber",
109
  {
110
    data_type      => "integer",
111
    default_value  => 0,
112
    is_foreign_key => 1,
113
    is_nullable    => 0,
114
  },
115
  "frameworkcode",
116
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 4 },
117
  "holdingbranch",
118
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
119
  "location",
120
  { data_type => "varchar", is_nullable => 1, size => 80 },
121
  "callnumber",
122
  { data_type => "varchar", is_nullable => 1, size => 255 },
123
  "suppress",
124
  { data_type => "tinyint", is_nullable => 1 },
125
  "timestamp",
126
  {
127
    data_type => "timestamp",
128
    datetime_undef_if_invalid => 1,
129
    default_value => "current_timestamp()",
130
    is_nullable => 0,
131
  },
132
  "datecreated",
133
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 },
134
  "deleted_on",
135
  {
136
    data_type => "datetime",
137
    datetime_undef_if_invalid => 1,
138
    is_nullable => 1,
139
  },
140
);
141
142
=head1 PRIMARY KEY
143
144
=over 4
145
146
=item * L</holding_id>
147
148
=back
149
150
=cut
151
152
__PACKAGE__->set_primary_key("holding_id");
153
154
=head1 RELATIONS
155
156
=head2 biblioitemnumber
157
158
Type: belongs_to
159
160
Related object: L<Koha::Schema::Result::Biblioitem>
161
162
=cut
163
164
__PACKAGE__->belongs_to(
165
  "biblioitemnumber",
166
  "Koha::Schema::Result::Biblioitem",
167
  { biblioitemnumber => "biblioitemnumber" },
168
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
169
);
170
171
=head2 biblionumber
172
173
Type: belongs_to
174
175
Related object: L<Koha::Schema::Result::Biblio>
176
177
=cut
178
179
__PACKAGE__->belongs_to(
180
  "biblionumber",
181
  "Koha::Schema::Result::Biblio",
182
  { biblionumber => "biblionumber" },
183
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
184
);
185
186
=head2 holdingbranch
187
188
Type: belongs_to
189
190
Related object: L<Koha::Schema::Result::Branch>
191
192
=cut
193
194
__PACKAGE__->belongs_to(
195
  "holdingbranch",
196
  "Koha::Schema::Result::Branch",
197
  { branchcode => "holdingbranch" },
198
  {
199
    is_deferrable => 1,
200
    join_type     => "LEFT",
201
    on_delete     => "RESTRICT",
202
    on_update     => "CASCADE",
203
  },
204
);
205
206
=head2 holdings_metadatas
207
208
Type: has_many
209
210
Related object: L<Koha::Schema::Result::HoldingsMetadata>
211
212
=cut
213
214
__PACKAGE__->has_many(
215
  "holdings_metadatas",
216
  "Koha::Schema::Result::HoldingsMetadata",
217
  { "foreign.holding_id" => "self.holding_id" },
218
  { cascade_copy => 0, cascade_delete => 0 },
219
);
220
221
=head2 items
222
223
Type: has_many
224
225
Related object: L<Koha::Schema::Result::Item>
226
227
=cut
228
229
__PACKAGE__->has_many(
230
  "items",
231
  "Koha::Schema::Result::Item",
232
  { "foreign.holding_id" => "self.holding_id" },
233
  { cascade_copy => 0, cascade_delete => 0 },
234
);
235
236
237
# Created by DBIx::Class::Schema::Loader v0.07048 @ 2018-10-26 12:34:01
238
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iCl1nPLIbzMbSIHTDYHVcA
239
240
241
# You can replace this text with custom code or comments, and it will be preserved on regeneration
242
1;
(-)a/Koha/Schema/Result/HoldingsMetadata.pm (+138 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::HoldingsMetadata;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::HoldingsMetadata
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<holdings_metadata>
19
20
=cut
21
22
__PACKAGE__->table("holdings_metadata");
23
24
=head1 ACCESSORS
25
26
=head2 id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
=head2 holding_id
33
34
  data_type: 'integer'
35
  is_foreign_key: 1
36
  is_nullable: 0
37
38
=head2 format
39
40
  data_type: 'varchar'
41
  is_nullable: 0
42
  size: 16
43
44
=head2 marcflavour
45
46
  data_type: 'varchar'
47
  is_nullable: 0
48
  size: 16
49
50
=head2 metadata
51
52
  data_type: 'longtext'
53
  is_nullable: 0
54
55
=head2 deleted_on
56
57
  data_type: 'datetime'
58
  datetime_undef_if_invalid: 1
59
  is_nullable: 1
60
61
=cut
62
63
__PACKAGE__->add_columns(
64
  "id",
65
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
66
  "holding_id",
67
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
68
  "format",
69
  { data_type => "varchar", is_nullable => 0, size => 16 },
70
  "marcflavour",
71
  { data_type => "varchar", is_nullable => 0, size => 16 },
72
  "metadata",
73
  { data_type => "longtext", is_nullable => 0 },
74
  "deleted_on",
75
  {
76
    data_type => "datetime",
77
    datetime_undef_if_invalid => 1,
78
    is_nullable => 1,
79
  },
80
);
81
82
=head1 PRIMARY KEY
83
84
=over 4
85
86
=item * L</id>
87
88
=back
89
90
=cut
91
92
__PACKAGE__->set_primary_key("id");
93
94
=head1 UNIQUE CONSTRAINTS
95
96
=head2 C<holdings_metadata_uniq_key>
97
98
=over 4
99
100
=item * L</holding_id>
101
102
=item * L</format>
103
104
=item * L</marcflavour>
105
106
=back
107
108
=cut
109
110
__PACKAGE__->add_unique_constraint(
111
  "holdings_metadata_uniq_key",
112
  ["holding_id", "format", "marcflavour"],
113
);
114
115
=head1 RELATIONS
116
117
=head2 holding
118
119
Type: belongs_to
120
121
Related object: L<Koha::Schema::Result::Holding>
122
123
=cut
124
125
__PACKAGE__->belongs_to(
126
  "holding",
127
  "Koha::Schema::Result::Holding",
128
  { holding_id => "holding_id" },
129
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
130
);
131
132
133
# Created by DBIx::Class::Schema::Loader v0.07048 @ 2018-10-26 12:34:01
134
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oUc/EZTrVGoRcM1885DOkw
135
136
137
# You can replace this text with custom code or comments, and it will be preserved on regeneration
138
1;
(-)a/acqui/neworderbiblio.pl (-1 / +1 lines)
Lines 129-136 my @results; Link Here
129
foreach my $result ( @{$marcresults} ) {
129
foreach my $result ( @{$marcresults} ) {
130
    my $marcrecord = C4::Search::new_record_from_zebra( 'biblioserver', $result );
130
    my $marcrecord = C4::Search::new_record_from_zebra( 'biblioserver', $result );
131
    my $biblio = TransformMarcToKoha( $marcrecord, '' );
131
    my $biblio = TransformMarcToKoha( $marcrecord, '' );
132
    $biblio->{subtitles} = GetRecordValue( 'subtitle', GetMarcBiblio({ biblionumber => $biblio->{biblionumber} }),  GetFrameworkCode( $biblio->{biblionumber} ) );
133
132
133
    $biblio->{subtitles} = C4::Biblio::SplitSubtitle($biblio->{'subtitle'});
134
    $biblio->{booksellerid} = $booksellerid;
134
    $biblio->{booksellerid} = $booksellerid;
135
    push @results, $biblio;
135
    push @results, $biblio;
136
136
(-)a/basket/basket.pl (-3 / +1 lines)
Lines 59-70 if (C4::Context->preference('TagsEnabled')) { Link Here
59
foreach my $biblionumber ( @bibs ) {
59
foreach my $biblionumber ( @bibs ) {
60
    $template->param( biblionumber => $biblionumber );
60
    $template->param( biblionumber => $biblionumber );
61
61
62
    my $fw = GetFrameworkCode($biblionumber);
63
64
    my $dat              = &GetBiblioData($biblionumber);
62
    my $dat              = &GetBiblioData($biblionumber);
65
    next unless $dat;
63
    next unless $dat;
66
    my $record           = &GetMarcBiblio({ biblionumber => $biblionumber });
64
    my $record           = &GetMarcBiblio({ biblionumber => $biblionumber });
67
    $dat->{subtitle}     = GetRecordValue('subtitle', $record, $fw);
65
    $dat->{subtitle}     = GetRecordValue('subtitle', $record);
68
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
66
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
69
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
67
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
70
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
68
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
(-)a/catalogue/detail.pl (-1 / +1 lines)
Lines 141-147 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); Link Here
141
my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
141
my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
142
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
142
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
143
my $marchostsarray  = GetMarcHosts($record,$marcflavour);
143
my $marchostsarray  = GetMarcHosts($record,$marcflavour);
144
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
144
my $subtitle         = GetRecordValue('subtitle', $record);
145
145
146
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
146
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
147
147
(-)a/catalogue/moredetail.pl (-1 / +1 lines)
Lines 110-116 if (@hostitems){ Link Here
110
        push (@items,@hostitems);
110
        push (@items,@hostitems);
111
}
111
}
112
112
113
my $subtitle = GetRecordValue('subtitle', $record, $fw);
113
my $subtitle = GetRecordValue('subtitle', $record);
114
114
115
my $totalcount=@all_items;
115
my $totalcount=@all_items;
116
my $showncount=@items;
116
my $showncount=@items;
(-)a/circ/branchoverdues.pl (-4 / +4 lines)
Lines 74-86 if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { Link Here
74
# now display infos
74
# now display infos
75
foreach my $num (@getoverdues) {
75
foreach my $num (@getoverdues) {
76
    my %overdueforbranch;
76
    my %overdueforbranch;
77
    my $record = GetMarcBiblio({ biblionumber => $num->{biblionumber} });
78
    if ($record){
79
        $overdueforbranch{'subtitle'} = GetRecordValue('subtitle',$record,'')->[0]->{subfield};
80
    }
81
    my $dt = dt_from_string($num->{date_due}, 'sql');
77
    my $dt = dt_from_string($num->{date_due}, 'sql');
82
    $overdueforbranch{'date_due'}          = output_pref($dt);
78
    $overdueforbranch{'date_due'}          = output_pref($dt);
83
    $overdueforbranch{'title'}             = $num->{'title'};
79
    $overdueforbranch{'title'}             = $num->{'title'};
80
    $overdueforbranch{'subtitle'}          = $num->{'subtitle'};
81
    $overdueforbranch{'medium'}            = $num->{'medium'};
82
    $overdueforbranch{'part_number'}       = $num->{'part_number'};
83
    $overdueforbranch{'part_name'}         = $num->{'part_name'};
84
    $overdueforbranch{'description'}       = $num->{'description'};
84
    $overdueforbranch{'description'}       = $num->{'description'};
85
    $overdueforbranch{'barcode'}           = $num->{'barcode'};
85
    $overdueforbranch{'barcode'}           = $num->{'barcode'};
86
    $overdueforbranch{'biblionumber'}      = $num->{'biblionumber'};
86
    $overdueforbranch{'biblionumber'}      = $num->{'biblionumber'};
(-)a/circ/reserveratios.pl (-4 / +5 lines)
Lines 27-33 use C4::Context; Link Here
27
use C4::Output;
27
use C4::Output;
28
use C4::Auth;
28
use C4::Auth;
29
use C4::Debug;
29
use C4::Debug;
30
use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/;
31
use C4::Acquisition qw/GetOrdersByBiblionumber/;
30
use C4::Acquisition qw/GetOrdersByBiblionumber/;
32
use Koha::DateUtils;
31
use Koha::DateUtils;
33
use Koha::Acquisition::Baskets;
32
use Koha::Acquisition::Baskets;
Lines 125-130 my $strsth = Link Here
125
124
126
        reserves.found,
125
        reserves.found,
127
        biblio.title,
126
        biblio.title,
127
        biblio.subtitle,
128
        biblio.medium,
129
        biblio.part_number,
130
        biblio.part_name,
128
        biblio.author,
131
        biblio.author,
129
        count(DISTINCT reserves.borrowernumber) as reservecount, 
132
        count(DISTINCT reserves.borrowernumber) as reservecount, 
130
        count(DISTINCT items.itemnumber) $include_aqorders_qty as itemcount
133
        count(DISTINCT items.itemnumber) $include_aqorders_qty as itemcount
Lines 154-161 while ( my $data = $sth->fetchrow_hashref ) { Link Here
154
    my $thisratio = $data->{reservecount} / $data->{itemcount};
157
    my $thisratio = $data->{reservecount} / $data->{itemcount};
155
    my $ratiocalc = ($thisratio / $ratio);
158
    my $ratiocalc = ($thisratio / $ratio);
156
    ($thisratio / $ratio) >= 1 or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
159
    ($thisratio / $ratio) >= 1 or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
157
    my $record = GetMarcBiblio({ biblionumber => $data->{biblionumber} });
158
    $data->{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($data->{biblionumber}));
159
    push(
160
    push(
160
        @reservedata,
161
        @reservedata,
161
        {
162
        {
Lines 163-169 while ( my $data = $sth->fetchrow_hashref ) { Link Here
163
            priority           => $data->{priority},
164
            priority           => $data->{priority},
164
            name               => $data->{borrower},
165
            name               => $data->{borrower},
165
            title              => $data->{title},
166
            title              => $data->{title},
166
            subtitle           => $data->{subtitle},
167
            subtitle           => C4::Biblio::SplitSubtitle($data->{'subtitle'});
167
            author             => $data->{author},
168
            author             => $data->{author},
168
            itemnum            => $data->{itemnumber},
169
            itemnum            => $data->{itemnumber},
169
            biblionumber       => $data->{biblionumber},
170
            biblionumber       => $data->{biblionumber},
(-)a/circ/transferstoreceive.pl (-3 / +4 lines)
Lines 99-104 while ( my $library = $libraries->next ) { Link Here
99
            %getransf = (
99
            %getransf = (
100
                %getransf,
100
                %getransf,
101
                title          => $biblio->title,
101
                title          => $biblio->title,
102
                subtitle       => C4::Biblio::SplitSubtitle($biblio->{'subtitle'}),
103
                medium         => $biblio->medium,
104
                part_number    => $biblio->part_number,
105
                part_name      => $biblio->part_name,
102
                author         => $biblio->author,
106
                author         => $biblio->author,
103
                biblionumber   => $biblio->biblionumber,
107
                biblionumber   => $biblio->biblionumber,
104
                itemnumber     => $item->itemnumber,
108
                itemnumber     => $item->itemnumber,
Lines 108-116 while ( my $library = $libraries->next ) { Link Here
108
                itemcallnumber => $item->itemcallnumber,
112
                itemcallnumber => $item->itemcallnumber,
109
            );
113
            );
110
114
111
            my $record = GetMarcBiblio({ biblionumber => $biblio->biblionumber });
112
            $getransf{'subtitle'} = GetRecordValue('subtitle', $record, $biblio->frameworkcode);
113
114
            # we check if we have a reserv for this transfer
115
            # we check if we have a reserv for this transfer
115
            my $holds = $item->current_holds;
116
            my $holds = $item->current_holds;
116
            if ( my $first_hold = $holds->next ) {
117
            if ( my $first_hold = $holds->next ) {
(-)a/circ/waitingreserves.pl (-4 / +4 lines)
Lines 101-106 while ( my $hold = $holds->next ) { Link Here
101
101
102
    my %getreserv = (
102
    my %getreserv = (
103
        title             => $biblio->title,
103
        title             => $biblio->title,
104
        subtitle          => C4::Biblio::SplitSubtitle($biblio->subtitle),
105
        medium            => $biblio->medium,
106
        part_number       => $biblio->part_number,
107
        part_name         => $biblio->part_name,
104
        itemnumber        => $item->itemnumber,
108
        itemnumber        => $item->itemnumber,
105
        waitingdate       => $hold->waitingdate,
109
        waitingdate       => $hold->waitingdate,
106
        reservedate       => $hold->reservedate,
110
        reservedate       => $hold->reservedate,
Lines 122-131 while ( my $hold = $holds->next ) { Link Here
122
    my $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day );
126
    my $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day );
123
127
124
    $getreserv{'itemtype'}       = $itemtype->description; # FIXME Should not it be translated_description?
128
    $getreserv{'itemtype'}       = $itemtype->description; # FIXME Should not it be translated_description?
125
    $getreserv{'subtitle'}       = GetRecordValue(
126
        'subtitle',
127
        GetMarcBiblio({ biblionumber => $biblio->biblionumber }),
128
        $biblio->frameworkcode);
129
    if ( $homebranch ne $holdingbranch ) {
129
    if ( $homebranch ne $holdingbranch ) {
130
        $getreserv{'dotransfer'} = 1;
130
        $getreserv{'dotransfer'} = 1;
131
    }
131
    }
(-)a/opac/opac-basket.pl (-1 / +1 lines)
Lines 105-111 foreach my $biblionumber ( @bibs ) { Link Here
105
        }
105
        }
106
    }
106
    }
107
107
108
    my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
108
    my $subtitle         = GetRecordValue('subtitle', $record);
109
109
110
    my $hasauthors = 0;
110
    my $hasauthors = 0;
111
    if($dat->{'author'} || @$marcauthorsarray) {
111
    if($dat->{'author'} || @$marcauthorsarray) {
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 767-773 if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) { Link Here
767
}
767
}
768
768
769
my $marcnotesarray   = GetMarcNotes   ($record,$marcflavour);
769
my $marcnotesarray   = GetMarcNotes   ($record,$marcflavour);
770
my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
770
my $subtitle         = GetRecordValue('subtitle', $record);
771
771
772
if( C4::Context->preference('ArticleRequests') ) {
772
if( C4::Context->preference('ArticleRequests') ) {
773
    my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
773
    my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
(-)a/opac/opac-readingrecord.pl (-2 / +1 lines)
Lines 97-104 foreach my $issue ( @{$issues} ) { Link Here
97
        my $marc_rec =
97
        my $marc_rec =
98
          MARC::Record::new_from_xml( $marcxml, 'utf8',
98
          MARC::Record::new_from_xml( $marcxml, 'utf8',
99
            C4::Context->preference('marcflavour') );
99
            C4::Context->preference('marcflavour') );
100
        $issue->{subtitle} =
100
        $issue->{subtitle} = GetRecordValue( 'subtitle', $marc_rec );
101
          GetRecordValue( 'subtitle', $marc_rec, $issue->{frameworkcode} );
102
        $issue->{normalized_upc} = GetNormalizedUPC( $marc_rec, C4::Context->preference('marcflavour') );
101
        $issue->{normalized_upc} = GetNormalizedUPC( $marc_rec, C4::Context->preference('marcflavour') );
103
    }
102
    }
104
    # My Summary HTML
103
    # My Summary HTML
(-)a/opac/opac-reserve.pl (-2 / +4 lines)
Lines 390-396 $template->param('item_level_itypes' => $itemLevelTypes); Link Here
390
foreach my $biblioNum (@biblionumbers) {
390
foreach my $biblioNum (@biblionumbers) {
391
391
392
    my @not_available_at = ();
392
    my @not_available_at = ();
393
    my $record = GetMarcBiblio({ biblionumber => $biblioNum });
394
    # Init the bib item with the choices for branch pickup
393
    # Init the bib item with the choices for branch pickup
395
    my %biblioLoopIter;
394
    my %biblioLoopIter;
396
395
Lines 404-410 foreach my $biblioNum (@biblionumbers) { Link Here
404
    my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} );
403
    my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} );
405
    $biblioLoopIter{biblionumber} = $biblioData->{biblionumber};
404
    $biblioLoopIter{biblionumber} = $biblioData->{biblionumber};
406
    $biblioLoopIter{title} = $biblioData->{title};
405
    $biblioLoopIter{title} = $biblioData->{title};
407
    $biblioLoopIter{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode);
406
    $biblioLoopIter{subtitle} = C4::Biblio::SplitSubtitle($biblioData->{'subtitle'});
407
    $biblioLoopIter{medium} = $biblioData->{medium};
408
    $biblioLoopIter{part_number} = $biblioData->{part_number};
409
    $biblioLoopIter{part_name} = $biblioData->{part_name};
408
    $biblioLoopIter{author} = $biblioData->{author};
410
    $biblioLoopIter{author} = $biblioData->{author};
409
    $biblioLoopIter{rank} = $biblioData->{rank};
411
    $biblioLoopIter{rank} = $biblioData->{rank};
410
    $biblioLoopIter{reservecount} = $biblioData->{reservecount};
412
    $biblioLoopIter{reservecount} = $biblioData->{reservecount};
(-)a/opac/opac-sendshelf.pl (-1 / +1 lines)
Lines 101-107 if ( $email ) { Link Here
101
101
102
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
102
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
103
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
103
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
104
        my $subtitle         = GetRecordValue('subtitle', $record, $fw);
104
        my $subtitle         = GetRecordValue('subtitle', $record);
105
105
106
        my @items = GetItemsInfo( $biblionumber );
106
        my @items = GetItemsInfo( $biblionumber );
107
107
(-)a/opac/opac-shelves.pl (-1 / +1 lines)
Lines 295-301 if ( $op eq 'view' ) { Link Here
295
                    $this_item->{notforloan}        = $itemtype->notforloan;
295
                    $this_item->{notforloan}        = $itemtype->notforloan;
296
                }
296
                }
297
                $this_item->{'coins'}           = GetCOinSBiblio($record);
297
                $this_item->{'coins'}           = GetCOinSBiblio($record);
298
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
298
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record ),
299
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
299
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
300
                $this_item->{'normalized_ean'}  = GetNormalizedEAN( $record, $marcflavour );
300
                $this_item->{'normalized_ean'}  = GetNormalizedEAN( $record, $marcflavour );
301
                $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour );
301
                $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour );
(-)a/opac/opac-showreviews.pl (-2 / +4 lines)
Lines 91-103 for my $result (@$reviews){ Link Here
91
    my $biblio = Koha::Biblios->find( $biblionumber );
91
    my $biblio = Koha::Biblios->find( $biblionumber );
92
    my $biblioitem = $biblio->biblioitem;
92
    my $biblioitem = $biblio->biblioitem;
93
    my $record = GetMarcBiblio({ biblionumber => $biblionumber });
93
    my $record = GetMarcBiblio({ biblionumber => $biblionumber });
94
    my $frameworkcode = GetFrameworkCode($biblionumber);
95
	$result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour);
94
	$result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour);
96
	$result->{normalized_ean} = GetNormalizedEAN($record,$marcflavour);
95
	$result->{normalized_ean} = GetNormalizedEAN($record,$marcflavour);
97
	$result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$marcflavour);
96
	$result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$marcflavour);
98
	$result->{normalized_isbn} = GetNormalizedISBN(undef,$record,$marcflavour);
97
	$result->{normalized_isbn} = GetNormalizedISBN(undef,$record,$marcflavour);
99
    $result->{title} = $biblio->title;
98
    $result->{title} = $biblio->title;
100
	$result->{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode);
99
	$result->{subtitle} = GetRecordValue('subtitle', $record );
100
	$result->{medium} = $biblio->medium;
101
	$result->{part_number} = $biblio->part_number;
102
	$result->{part_name} = $biblio->part_name;
101
    $result->{author} = $biblio->author;
103
    $result->{author} = $biblio->author;
102
    $result->{place} = $biblioitem->place;
104
    $result->{place} = $biblioitem->place;
103
    $result->{publishercode} = $biblioitem->publishercode;
105
    $result->{publishercode} = $biblioitem->publishercode;
(-)a/opac/opac-tags.pl (-1 / +4 lines)
Lines 256-263 if ($loggedinuser) { Link Here
256
            $hidden_items = \@hidden_itemnumbers;
256
            $hidden_items = \@hidden_itemnumbers;
257
        }
257
        }
258
        next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers );
258
        next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers );
259
        $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) );
260
        $tag->{title} = $biblio->title;
259
        $tag->{title} = $biblio->title;
260
        $tag->{subtitle} = C4::Biblio::SplitSubtitle($biblio->subtitle);
261
        $tag->{medium} = $biblio->medium;
262
        $tag->{part_number} = $biblio->part_number;
263
        $tag->{part_name} = $biblio->part_name;
261
        $tag->{author} = $biblio->author;
264
        $tag->{author} = $biblio->author;
262
265
263
        my $xslfile = C4::Context->preference('OPACXSLTResultsDisplay');
266
        my $xslfile = C4::Context->preference('OPACXSLTResultsDisplay');
(-)a/opac/opac-user.pl (-6 / +7 lines)
Lines 212-223 if ( $pending_checkouts->count ) { # Useless test Link Here
212
        );
212
        );
213
        $issue->{rentalfines} = $rental_fines->total_outstanding;
213
        $issue->{rentalfines} = $rental_fines->total_outstanding;
214
214
215
        my $marcrecord = GetMarcBiblio({
215
        $issue->{'subtitle'} = C4::Biblio::SplitSubtitle($issue->{'subtitle'});
216
            biblionumber => $issue->{'biblionumber'},
216
        
217
            embed_items  => 1,
218
            opac         => 1,
219
            borcat       => $borcat });
220
        $issue->{'subtitle'} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($issue->{'biblionumber'}));
221
        # check if item is renewable
217
        # check if item is renewable
222
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
218
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
223
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
219
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
Lines 267-272 if ( $pending_checkouts->count ) { # Useless test Link Here
267
263
268
        my $isbn = GetNormalizedISBN($issue->{'isbn'});
264
        my $isbn = GetNormalizedISBN($issue->{'isbn'});
269
        $issue->{normalized_isbn} = $isbn;
265
        $issue->{normalized_isbn} = $isbn;
266
        my $marcrecord = GetMarcBiblio({
267
            biblionumber => $issue->{'biblionumber'},
268
            embed_items  => 1,
269
            opac         => 1,
270
            borcat       => $borcat });
270
        $issue->{normalized_upc} = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') );
271
        $issue->{normalized_upc} = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') );
271
272
272
                # My Summary HTML
273
                # My Summary HTML
(-)a/svc/checkouts (-5 / +9 lines)
Lines 23-29 use CGI; Link Here
23
use JSON qw(to_json);
23
use JSON qw(to_json);
24
24
25
use C4::Auth qw(check_cookie_auth haspermission get_session);
25
use C4::Auth qw(check_cookie_auth haspermission get_session);
26
use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
26
use C4::Biblio qw(SplitSubtitle);
27
use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate);
27
use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate);
28
use C4::Overdues qw(GetFine);
28
use C4::Overdues qw(GetFine);
29
use C4::Context;
29
use C4::Context;
Lines 74-79 my $sql = ' Link Here
74
74
75
        biblionumber,
75
        biblionumber,
76
        biblio.title,
76
        biblio.title,
77
        biblio.subtitle,
78
        biblio.medium,
79
        biblio.part_number,
80
        biblio.part_name,
77
        author,
81
        author,
78
82
79
        itemnumber,
83
        itemnumber,
Lines 174-179 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
174
    my $checkout = {
178
    my $checkout = {
175
        DT_RowId             => $c->{itemnumber} . '-' . $c->{borrowernumber},
179
        DT_RowId             => $c->{itemnumber} . '-' . $c->{borrowernumber},
176
        title                => $c->{title},
180
        title                => $c->{title},
181
        subtitle             => C4::Biblio::SplitSubtitle($c->{'subtitle'}),
182
        medium               => $c->{medium},
183
        part_number          => $c->{part_number},
184
        part_name            => $c->{part_name},
177
        author               => $c->{author},
185
        author               => $c->{author},
178
        barcode              => $c->{barcode},
186
        barcode              => $c->{barcode},
179
        itemtype             => $item_level_itypes ? $c->{itype} : $c->{itemtype},
187
        itemtype             => $item_level_itypes ? $c->{itype} : $c->{itemtype},
Lines 216-225 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
216
                as_due_date => 1
224
                as_due_date => 1
217
            }
225
            }
218
        ),
226
        ),
219
        subtitle => GetRecordValue(
220
            'subtitle',
221
            GetMarcBiblio({ biblionumber => $c->{biblionumber} }),
222
            GetFrameworkCode( $c->{biblionumber} ) ),
223
        lost    => $lost,
227
        lost    => $lost,
224
        damaged => $damaged,
228
        damaged => $damaged,
225
        borrower => {
229
        borrower => {
(-)a/svc/holds (-8 / +9 lines)
Lines 23-29 use CGI; Link Here
23
use JSON qw(to_json);
23
use JSON qw(to_json);
24
24
25
use C4::Auth qw(check_cookie_auth);
25
use C4::Auth qw(check_cookie_auth);
26
use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
26
use C4::Biblio qw(SplitSubtitle);
27
use C4::Charset;
27
use C4::Charset;
28
use C4::Circulation qw(GetTransfers);
28
use C4::Circulation qw(GetTransfers);
29
use C4::Context;
29
use C4::Context;
Lines 84-94 while ( my $h = $holds_rs->next() ) { Link Here
84
    for my $library ( @$libraries ) {
84
    for my $library ( @$libraries ) {
85
        $library->{selected} = 1 if $library->{branchcode} eq $h->branchcode();
85
        $library->{selected} = 1 if $library->{branchcode} eq $h->branchcode();
86
    }
86
    }
87
88
    my $biblio = $h->biblio();
87
    my $hold = {
89
    my $hold = {
88
        DT_RowId       => $h->reserve_id(),
90
        DT_RowId       => $h->reserve_id(),
89
        biblionumber   => $biblionumber,
91
        biblionumber   => $biblionumber,
90
        title          => $h->biblio()->title(),
92
        title          => $biblio->title(),
91
        author         => $h->biblio()->author(),
93
        subtitle       => C4::Biblio::SplitSubtitles($biblio->subtitle()),
94
        medium         => $biblio->medium(),
95
        part_number    => $biblio->part_number(),
96
        part_name      => $biblio->part_name(),
97
        author         => $biblio->author(),
92
        reserve_id     => $h->reserve_id(),
98
        reserve_id     => $h->reserve_id(),
93
        branchcode     => $h->branch()->branchname(),
99
        branchcode     => $h->branch()->branchname(),
94
        branches       => $libraries,
100
        branches       => $libraries,
Lines 102-112 while ( my $h = $holds_rs->next() ) { Link Here
102
        waiting_here   => $h->branch()->branchcode() eq $branch,
108
        waiting_here   => $h->branch()->branchcode() eq $branch,
103
        priority       => $h->priority(),
109
        priority       => $h->priority(),
104
        itemtype_limit => $itemtype_limit,
110
        itemtype_limit => $itemtype_limit,
105
        subtitle       => GetRecordValue(
106
            'subtitle',
107
            GetMarcBiblio({ biblionumber => $biblionumber }),
108
            GetFrameworkCode($biblionumber)
109
        ),
110
        reservedate_formatted => $h->reservedate() ? output_pref(
111
        reservedate_formatted => $h->reservedate() ? output_pref(
111
            { dt => dt_from_string( $h->reservedate() ), dateonly => 1 }
112
            { dt => dt_from_string( $h->reservedate() ), dateonly => 1 }
112
          )
113
          )
(-)a/t/Biblio.t (-1 / +1 lines)
Lines 51-57 warning_is { $ret = BiblioAutoLink(undef, q{}) } Link Here
51
51
52
is( $ret, 0, 'BiblioAutoLink returns zero if not passed rec');
52
is( $ret, 0, 'BiblioAutoLink returns zero if not passed rec');
53
53
54
warning_is { $ret = GetRecordValue('100', undef, q{}) }
54
warning_is { $ret = GetRecordValue('100', undef) }
55
           { carped => 'GetRecordValue called with undefined record'},
55
           { carped => 'GetRecordValue called with undefined record'},
56
           "GetRecordValue returns carped warning on undef record";
56
           "GetRecordValue returns carped warning on undef record";
57
57
(-)a/t/Biblio2.t (+16 lines)
Lines 52-55 sub _koha_marc_update_bib_ids_control { Link Here
52
    is($r->field('004')->data(), 20, 'Biblioitemnumber to control field');
52
    is($r->field('004')->data(), 20, 'Biblioitemnumber to control field');
53
}
53
}
54
54
55
subtest 'SplitSubtitle' => sub {
56
    plan tests => 4;
57
58
    my $res = C4::Biblio::SplitSubtitle(undef);
59
    is_deeply($res, [], 'undef returned as an array');
60
61
    $res = C4::Biblio::SplitSubtitle('');
62
    is_deeply($res, [], 'Empty string returned as an array');
63
64
    $res = C4::Biblio::SplitSubtitle('Single');
65
    is_deeply($res, [{'subfield' => 'Single'}], 'Single subtitle returns an array');
66
67
    $res = C4::Biblio::SplitSubtitle('First | Second');
68
    is_deeply($res, [{'subfield' => 'First'}, {'subfield' => 'Second'}], 'Two subtitles returns an array');
69
};
70
55
done_testing();
71
done_testing();
(-)a/tags/list.pl (-4 / +1 lines)
Lines 61-70 else { Link Here
61
        my $taglist = get_tag_rows( { term => $tag } );
61
        my $taglist = get_tag_rows( { term => $tag } );
62
        for ( @{$taglist} ) {
62
        for ( @{$taglist} ) {
63
            my $dat    = &GetBiblioData( $_->{biblionumber} );
63
            my $dat    = &GetBiblioData( $_->{biblionumber} );
64
            my $record = &GetMarcBiblio({ biblionumber => $_->{biblionumber} });
64
            $dat->{'subtitle'} = C4::Biblio::SplitSubtitles($dat->{'subtitle'}),
65
            $dat->{'subtitle'} =
66
              GetRecordValue( 'subtitle', $record,
67
                GetFrameworkCode( $_->{biblionumber} ) );
68
            my @items = GetItemsInfo( $_->{biblionumber} );
65
            my @items = GetItemsInfo( $_->{biblionumber} );
69
            $dat->{biblionumber} = $_->{biblionumber};
66
            $dat->{biblionumber} = $_->{biblionumber};
70
            $dat->{tag_id}       = $_->{tag_id};
67
            $dat->{tag_id}       = $_->{tag_id};
(-)a/tools/batch_delete_records.pl (-1 / +1 lines)
Lines 84-90 if ( $op eq 'form' ) { Link Here
84
            my $holds_count = $biblio->holds->count;
84
            my $holds_count = $biblio->holds->count;
85
            $biblio = $biblio->unblessed;
85
            $biblio = $biblio->unblessed;
86
            my $record = &GetMarcBiblio({ biblionumber => $record_id });
86
            my $record = &GetMarcBiblio({ biblionumber => $record_id });
87
            $biblio->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $record_id ) );
87
            $biblio->{subtitle} = C4::Biblio::SplitSubtitle( $biblio->{subtitle} );
88
            $biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')];
88
            $biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')];
89
            $biblio->{holds_count} = $holds_count;
89
            $biblio->{holds_count} = $holds_count;
90
            $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id );
90
            $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id );
(-)a/virtualshelves/sendshelf.pl (-2 / +1 lines)
Lines 77-90 if ($email) { Link Here
77
77
78
    while ( my $content = $contents->next ) {
78
    while ( my $content = $contents->next ) {
79
        my $biblionumber     = $content->biblionumber;
79
        my $biblionumber     = $content->biblionumber;
80
        my $fw               = GetFrameworkCode($biblionumber);
81
        my $dat              = GetBiblioData($biblionumber);
80
        my $dat              = GetBiblioData($biblionumber);
82
        my $record           = GetMarcBiblio({
81
        my $record           = GetMarcBiblio({
83
            biblionumber => $biblionumber,
82
            biblionumber => $biblionumber,
84
            embed_items  => 1 });
83
            embed_items  => 1 });
85
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
84
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
86
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
85
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
87
        my $subtitle         = GetRecordValue( 'subtitle', $record, $fw );
86
        my $subtitle         = GetRecordValue( 'subtitle', $record );
88
87
89
        my @items = GetItemsInfo($biblionumber);
88
        my @items = GetItemsInfo($biblionumber);
90
89
(-)a/virtualshelves/shelves.pl (-2 / +1 lines)
Lines 279-285 if ( $op eq 'view' ) { Link Here
279
                $this_item->{description}       = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ?
279
                $this_item->{description}       = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ?
280
                $this_item->{notforloan}        = $itemtype->notforloan if $itemtype;
280
                $this_item->{notforloan}        = $itemtype->notforloan if $itemtype;
281
                $this_item->{'coins'}           = GetCOinSBiblio($record);
281
                $this_item->{'coins'}           = GetCOinSBiblio($record);
282
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
282
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record );
283
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
283
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
284
                $this_item->{'normalized_ean'}  = GetNormalizedEAN( $record, $marcflavour );
284
                $this_item->{'normalized_ean'}  = GetNormalizedEAN( $record, $marcflavour );
285
                $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour );
285
                $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour );
286
- 

Return to bug 11529