Bugzilla – Attachment 88763 Details for
Bug 11529
Add subtitle, medium and part fields to biblio table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11529: Use new biblio fields whenever possible
Bug-11529-Use-new-biblio-fields-whenever-possible.patch (text/plain), 37.60 KB, created by
Ere Maijala
on 2019-04-25 12:10:07 UTC
(
hide
)
Description:
Bug 11529: Use new biblio fields whenever possible
Filename:
MIME Type:
Creator:
Ere Maijala
Created:
2019-04-25 12:10:07 UTC
Size:
37.60 KB
patch
obsolete
>From f511f6dba23fb94906cf15942fb6ee89678f1cf4 Mon Sep 17 00:00:00 2001 >From: Ere Maijala <ere.maijala@helsinki.fi> >Date: Mon, 5 Nov 2018 14:22:27 +0200 >Subject: [PATCH] Bug 11529: Use new biblio fields whenever possible > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Michal Denar <black23@gmail.com> >--- > C4/Biblio.pm | 49 ++++++++++++------- > C4/HoldsQueue.pm | 17 ++++--- > C4/Overdues.pm | 4 ++ > C4/Search.pm | 2 +- > C4/ShelfBrowser.pm | 7 ++- > Koha/Biblio.pm | 11 ++--- > acqui/neworderbiblio.pl | 2 +- > basket/basket.pl | 4 +- > catalogue/detail.pl | 2 +- > catalogue/moredetail.pl | 2 +- > circ/branchoverdues.pl | 8 +-- > circ/pendingreserves.pl | 11 +++-- > circ/reserveratios.pl | 9 ++-- > circ/transferstoreceive.pl | 7 +-- > .../prog/en/includes/waiting_holds.inc | 2 +- > .../prog/en/modules/circ/pendingreserves.tt | 2 +- > .../prog/en/modules/circ/view_holdsqueue.tt | 6 ++- > opac/opac-basket.pl | 2 +- > opac/opac-detail.pl | 2 +- > opac/opac-readingrecord.pl | 3 +- > opac/opac-reserve.pl | 6 ++- > opac/opac-sendshelf.pl | 2 +- > opac/opac-shelves.pl | 2 +- > opac/opac-showreviews.pl | 6 ++- > opac/opac-tags.pl | 5 +- > opac/opac-user.pl | 13 ++--- > svc/checkouts | 14 ++++-- > svc/holds | 17 ++++--- > t/Biblio.t | 2 +- > t/Biblio2.t | 16 ++++++ > tags/list.pl | 5 +- > tools/batch_delete_records.pl | 2 +- > virtualshelves/sendshelf.pl | 3 +- > virtualshelves/shelves.pl | 2 +- > 34 files changed, 146 insertions(+), 101 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 472a33806b..f1b2dc6135 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -68,6 +68,7 @@ BEGIN { > TransformHtmlToMarc > TransformHtmlToXml > prepare_host_field >+ SplitSubtitle > ); > > # Internal functions >@@ -637,39 +638,33 @@ sub _check_valid_auth_link { > > =head2 GetRecordValue > >- my $values = GetRecordValue($field, $record, $frameworkcode); >+ my $values = GetRecordValue($field, $record); > >-Get MARC fields from a keyword defined in fieldmapping table. >+Get MARC fields from the record using the framework mappings for biblio fields. > > =cut > > sub GetRecordValue { >- my ( $field, $record, $frameworkcode ) = @_; >+ my ( $field, $record ) = @_; > > if (!$record) { > carp 'GetRecordValue called with undefined record'; > return; > } >- my $dbh = C4::Context->dbh; >- >- my $sth = $dbh->prepare('SELECT fieldcode, subfieldcode FROM fieldmapping WHERE frameworkcode = ? AND field = ?'); >- $sth->execute( $frameworkcode, $field ); >- >- my @result = (); >- >- while ( my $row = $sth->fetchrow_hashref ) { >- foreach my $field ( $record->field( $row->{fieldcode} ) ) { >- if ( ( $row->{subfieldcode} ne "" && $field->subfield( $row->{subfieldcode} ) ) ) { >- foreach my $subfield ( $field->subfield( $row->{subfieldcode} ) ) { >- push @result, { 'subfield' => $subfield }; >- } > >- } elsif ( $row->{subfieldcode} eq "" ) { >- push @result, { 'subfield' => $field->as_string() }; >+ my @result; >+ my @mss = GetMarcSubfieldStructureFromKohaField("biblio.$field"); >+ foreach my $fldhash ( @mss ) { >+ my $tag = $fldhash->{tagfield}; >+ my $sub = $fldhash->{tagsubfield}; >+ foreach my $fld ( $record->field($tag) ) { >+ if( $sub eq '@' || $fld->is_control_field ) { >+ push @result, $fld->data if $fld->data; >+ } else { >+ push @result, grep { $_ } $fld->subfield($sub); > } > } > } >- > return \@result; > } > >@@ -3616,6 +3611,22 @@ sub RemoveAllNsb { > return $record; > } > >+=head2 SplitSubtitle >+ >+ $subtitles = SplitSubtitle($subtitle); >+ >+Splits a subtitle field to an array of hashes like the one GetRecordValue returns >+ >+=cut >+ >+sub SplitSubtitle { >+ my $subtitle = shift; >+ >+ my @subtitles = map( { 'subfield' => $_ }, split(/ \| /, $subtitle // '' ) ); >+ >+ return \@subtitles; >+} >+ > 1; > > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index d55e7e3161..650f1792da 100755 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -132,7 +132,12 @@ sub GetHoldsQueueItems { > my $dbh = C4::Context->dbh; > > my @bind_params = (); >- 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 >+ 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, biblio.subtitle, biblio.part_number, >+ biblio.part_name, >+ biblioitems.publicationyear, biblioitems.pages, biblioitems.size, biblioitems.publicationyear, >+ biblioitems.isbn, items.copynumber > FROM tmp_holdsqueue > JOIN biblio USING (biblionumber) > LEFT JOIN biblioitems USING (biblionumber) >@@ -147,19 +152,15 @@ sub GetHoldsQueueItems { > $sth->execute(@bind_params); > my $items = []; > while ( my $row = $sth->fetchrow_hashref ){ >- my $record = GetMarcBiblio({ biblionumber => $row->{biblionumber} }); >- if ($record){ >- $row->{subtitle} = [ map { $_->{subfield} } @{ GetRecordValue( 'subtitle', $record, '' ) } ]; >- $row->{parts} = GetRecordValue('parts',$record,'')->[0]->{subfield}; >- $row->{numbers} = GetRecordValue('numbers',$record,'')->[0]->{subfield}; >- } >- > # return the bib-level or item-level itype per syspref > if (!C4::Context->preference('item-level_itypes')) { > $row->{itype} = $row->{itemtype}; > } > delete $row->{itemtype}; > >+ my @subtitles = split(/ \| /, $row->{'subtitle'} // '' ); >+ $row->{'subtitle'} = \@subtitles; >+ > push @$items, $row; > } > return $items; >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 78ec2e57fa..f75a65a8c9 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -701,6 +701,10 @@ sub GetOverduesForBranch { > borrowers.phone, > borrowers.email, > biblio.title, >+ biblio.subtitle, >+ biblio.medium, >+ biblio.part_number, >+ biblio.part_name, > biblio.author, > biblio.biblionumber, > issues.date_due, >diff --git a/C4/Search.pm b/C4/Search.pm >index 1a9f51b4e1..3433744bfc 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1950,7 +1950,7 @@ sub searchResults { > > SetUTF8Flag($marcrecord); > my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw ); >- $oldbiblio->{subtitle} = GetRecordValue('subtitle', $marcrecord, $fw); >+ $oldbiblio->{subtitle} = GetRecordValue('subtitle', $marcrecord); > $oldbiblio->{result_number} = $i + 1; > > # add imageurl to itemtype if there is one >diff --git a/C4/ShelfBrowser.pm b/C4/ShelfBrowser.pm >index ee551d2c83..b5d19799b6 100644 >--- a/C4/ShelfBrowser.pm >+++ b/C4/ShelfBrowser.pm >@@ -223,12 +223,15 @@ sub GetShelfInfo { > my $this_biblio = GetBibData($item->{biblionumber}); > next unless defined $this_biblio; > $item->{'title'} = $this_biblio->{'title'}; >+ $item->{'subtitle'} = C4::Biblio::SplitSubtitle($this_biblio->{'subtitle'}), >+ $item->{'medium'} = $this_biblio->{'medium'}; >+ $item->{'part_number'} = $this_biblio->{'part_number'}; >+ $item->{'part_name'} = $this_biblio->{'part_name'}; > my $this_record = GetMarcBiblio({ biblionumber => $this_biblio->{'biblionumber'} }); > $item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour); > $item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour); > $item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour); > $item->{'browser_normalized_ean'} = GetNormalizedEAN($this_record,$marcflavour); >- $item->{'subtitle'} = GetRecordValue('subtitle', $this_record, GetFrameworkCode( $item->{biblionumber} )); > push @valid_items, $item; > } > return @valid_items; >@@ -239,7 +242,7 @@ sub GetBibData { > my ($bibnum) = @_; > > my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT biblionumber, title FROM biblio WHERE biblionumber=?"); >+ my $sth = $dbh->prepare("SELECT biblionumber, title, subtitle, medium, part_number, part_name FROM biblio WHERE biblionumber=?"); > $sth->execute($bibnum); > my $bib = $sth->fetchrow_hashref(); > return $bib; >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index b535649b25..5852dc3e0c 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -82,20 +82,15 @@ sub metadata { > > my @subtitles = $biblio->subtitles(); > >-Returns list of subtitles for a record. >- >-Keyword to MARC mapping for subtitle must be set for this method to return any possible values. >+Returns list of subtitles for a record according to the framework. > > =cut > > sub subtitles { > my ( $self ) = @_; > >- return map { $_->{subfield} } @{ >- C4::Biblio::GetRecordValue( >- 'subtitle', >- C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }), >- $self->frameworkcode ) }; >+ my @subtitles = split( / \| /, $self->subtitle // '' ); >+ return @subtitles; > } > > =head3 can_article_request >diff --git a/acqui/neworderbiblio.pl b/acqui/neworderbiblio.pl >index b48737d79f..8333b4723f 100755 >--- a/acqui/neworderbiblio.pl >+++ b/acqui/neworderbiblio.pl >@@ -129,8 +129,8 @@ my @results; > foreach my $result ( @{$marcresults} ) { > my $marcrecord = C4::Search::new_record_from_zebra( 'biblioserver', $result ); > my $biblio = TransformMarcToKoha( $marcrecord, '' ); >- $biblio->{subtitles} = GetRecordValue( 'subtitle', GetMarcBiblio({ biblionumber => $biblio->{biblionumber} }), GetFrameworkCode( $biblio->{biblionumber} ) ); > >+ $biblio->{subtitles} = C4::Biblio::SplitSubtitle($biblio->{'subtitle'}); > $biblio->{booksellerid} = $booksellerid; > push @results, $biblio; > >diff --git a/basket/basket.pl b/basket/basket.pl >index 4318a9560f..c6d317035b 100755 >--- a/basket/basket.pl >+++ b/basket/basket.pl >@@ -59,12 +59,10 @@ if (C4::Context->preference('TagsEnabled')) { > foreach my $biblionumber ( @bibs ) { > $template->param( biblionumber => $biblionumber ); > >- my $fw = GetFrameworkCode($biblionumber); >- > my $dat = &GetBiblioData($biblionumber); > next unless $dat; > my $record = &GetMarcBiblio({ biblionumber => $biblionumber }); >- $dat->{subtitle} = GetRecordValue('subtitle', $record, $fw); >+ $dat->{subtitle} = GetRecordValue('subtitle', $record); > my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); > my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); > my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 9cd6b523bd..397f96962a 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -141,7 +141,7 @@ my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); > my $marcseriesarray = GetMarcSeries($record,$marcflavour); > my $marcurlsarray = GetMarcUrls ($record,$marcflavour); > my $marchostsarray = GetMarcHosts($record,$marcflavour); >-my $subtitle = GetRecordValue('subtitle', $record, $fw); >+my $subtitle = GetRecordValue('subtitle', $record); > > my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; > >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index e8736ff398..b4e0c3d028 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -110,7 +110,7 @@ if (@hostitems){ > push (@items,@hostitems); > } > >-my $subtitle = GetRecordValue('subtitle', $record, $fw); >+my $subtitle = GetRecordValue('subtitle', $record); > > my $totalcount=@all_items; > my $showncount=@items; >diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl >index 7f6218525e..c4929be368 100755 >--- a/circ/branchoverdues.pl >+++ b/circ/branchoverdues.pl >@@ -76,13 +76,13 @@ if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { > # now display infos > foreach my $num (@getoverdues) { > my %overdueforbranch; >- my $record = GetMarcBiblio({ biblionumber => $num->{biblionumber} }); >- if ($record){ >- $overdueforbranch{'subtitle'} = GetRecordValue('subtitle',$record,'')->[0]->{subfield}; >- } > my $dt = dt_from_string($num->{date_due}, 'sql'); > $overdueforbranch{'date_due'} = output_pref($dt); > $overdueforbranch{'title'} = $num->{'title'}; >+ $overdueforbranch{'subtitle'} = $num->{'subtitle'}; >+ $overdueforbranch{'medium'} = $num->{'medium'}; >+ $overdueforbranch{'part_number'} = $num->{'part_number'}; >+ $overdueforbranch{'part_name'} = $num->{'part_name'}; > $overdueforbranch{'description'} = $num->{'description'}; > $overdueforbranch{'barcode'} = $num->{'barcode'}; > $overdueforbranch{'biblionumber'} = $num->{'biblionumber'}; >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index d0c727413f..f7765ce61a 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -198,6 +198,10 @@ my $strsth = > GROUP_CONCAT(DISTINCT items.copynumber > ORDER BY items.itemnumber SEPARATOR '|') l_copynumber, > biblio.title, >+ biblio.subtitle, >+ biblio.medium, >+ biblio.part_number, >+ biblio.part_name, > biblio.author, > count(DISTINCT items.itemnumber) as icount, > count(DISTINCT reserves.borrowernumber) as rcount, >@@ -235,10 +239,6 @@ my $sth = $dbh->prepare($strsth); > $sth->execute(@query_params); > > while ( my $data = $sth->fetchrow_hashref ) { >- my $record = Koha::Biblios->find($data->{biblionumber}); >- if ($record){ >- $data->{subtitle} = [ $record->subtitles ]; >- } > push( > @reservedata, { > reservedate => $data->{l_reservedate}, >@@ -246,6 +246,9 @@ while ( my $data = $sth->fetchrow_hashref ) { > surname => $data->{surname}, > title => $data->{title}, > subtitle => $data->{subtitle}, >+ medium => $data->{medium}, >+ part_number => $data->{part_number}, >+ part_name => $data->{part_name}, > author => $data->{author}, > borrowernumber => $data->{borrowernumber}, > biblionumber => $data->{biblionumber}, >diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl >index 104928addc..15e68959fa 100755 >--- a/circ/reserveratios.pl >+++ b/circ/reserveratios.pl >@@ -27,7 +27,6 @@ use C4::Context; > use C4::Output; > use C4::Auth; > use C4::Debug; >-use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/; > use C4::Acquisition qw/GetOrdersByBiblionumber/; > use Koha::DateUtils; > use Koha::Acquisition::Baskets; >@@ -125,6 +124,10 @@ my $strsth = > > reserves.found, > biblio.title, >+ biblio.subtitle, >+ biblio.medium, >+ biblio.part_number, >+ biblio.part_name, > biblio.author, > count(DISTINCT reserves.borrowernumber) as reservecount, > count(DISTINCT items.itemnumber) $include_aqorders_qty as itemcount >@@ -154,8 +157,6 @@ while ( my $data = $sth->fetchrow_hashref ) { > my $thisratio = $data->{reservecount} / $data->{itemcount}; > my $ratiocalc = ($thisratio / $ratio); > ($thisratio / $ratio) >= 1 or next; # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause >- my $record = GetMarcBiblio({ biblionumber => $data->{biblionumber} }); >- $data->{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($data->{biblionumber})); > push( > @reservedata, > { >@@ -163,7 +164,7 @@ while ( my $data = $sth->fetchrow_hashref ) { > priority => $data->{priority}, > name => $data->{borrower}, > title => $data->{title}, >- subtitle => $data->{subtitle}, >+ subtitle => C4::Biblio::SplitSubtitle($data->{'subtitle'}); > author => $data->{author}, > itemnum => $data->{itemnumber}, > biblionumber => $data->{biblionumber}, >diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl >index a727dda165..f1c09ef013 100755 >--- a/circ/transferstoreceive.pl >+++ b/circ/transferstoreceive.pl >@@ -99,6 +99,10 @@ while ( my $library = $libraries->next ) { > %getransf = ( > %getransf, > title => $biblio->title, >+ subtitle => C4::Biblio::SplitSubtitle($biblio->{'subtitle'}), >+ medium => $biblio->medium, >+ part_number => $biblio->part_number, >+ part_name => $biblio->part_name, > author => $biblio->author, > biblionumber => $biblio->biblionumber, > itemnumber => $item->itemnumber, >@@ -108,9 +112,6 @@ while ( my $library = $libraries->next ) { > itemcallnumber => $item->itemcallnumber, > ); > >- my $record = GetMarcBiblio({ biblionumber => $biblio->biblionumber }); >- $getransf{'subtitle'} = GetRecordValue('subtitle', $record, $biblio->frameworkcode); >- > # we check if we have a reserv for this transfer > my $holds = $item->current_holds; > if ( my $first_hold = $holds->next ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc >index 1639197d7b..51906596d5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc >@@ -22,7 +22,7 @@ > <td><span title="[% reserveloo.waitingdate | html %]">[% reserveloo.waitingdate | $KohaDates %]</span></td> > <td><span title="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %]</span></td> > <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %] >- [% reserveloo.biblio.title | html %] [% FOREACH subtitl IN reserveloo.biblio.subtitles %] [% subtitl.subfield | html %][% END %] >+ [% reserveloo.biblio.title | html %] [% FOREACH subtitl IN reserveloo.biblio.subtitles %] [% subtitl | html %] [% reserveloo.biblio.part_number | html %] [% reserveloo.biblio.part_name | html %][% END %] > </a> > [% UNLESS ( item_level_itypes ) %] > [% IF ( ItemTypes.GetDescription(reserveloo.item.effective_itemtype) ) %] (<b>[% ItemTypes.GetDescription(reserveloo.item.effective_itemtype) | html %]</b>) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >index 331e0a155f..edf9d32058 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >@@ -77,7 +77,7 @@ > <td> > <p> > [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %] >- [% reserveloo.title | html %] [% FOREACH s IN reserveloo.subtitle %] [% s | html %][% END %]</a></p> >+ [% reserveloo.title | html %] [% FOREACH s IN reserveloo.subtitle %] [% s | html %][% END %] [% reserveloo.part_number | html %] [% reserveloo.part_name | html %]</a></p> > [% IF ( reserveloo.author ) %]<p> by [% reserveloo.author | html %]</p>[% END %] > </td> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >index 691b63161c..cd7c0df373 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >@@ -123,7 +123,11 @@ > <tbody>[% FOREACH itemsloo IN itemsloop %] > <tr> > <td class="hq-title"> >- <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itemsloo.biblionumber | uri %]"><strong>[% itemsloo.title | html %]</strong> [% FOREACH s IN itemsloo.subtitle %] [% s | html %][% END %]</a></p> >+ <p> >+ <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itemsloo.biblionumber | uri %]"> >+ <strong>[% itemsloo.title | html %]</strong> [% FOREACH s IN itemsloo.subtitle %] [% s | html %][% END %] [% itemsloo.part_number | html %] [% itemsloo.part_name | html %] >+ </a> >+ </p> > <p> > <div class="hq-biblionumber content_hidden">[% itemsloo.biblionumber | html %]</div> > <div class="hq-author">[% itemsloo.author | html %]</div> >diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl >index c2d57f2f5e..7d7baf1155 100755 >--- a/opac/opac-basket.pl >+++ b/opac/opac-basket.pl >@@ -108,7 +108,7 @@ foreach my $biblionumber ( @bibs ) { > } > } > >- my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber)); >+ my $subtitle = GetRecordValue('subtitle', $record); > > my $hasauthors = 0; > if($dat->{'author'} || @$marcauthorsarray) { >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 8e9aa5947e..b5fdaee3e3 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -768,7 +768,7 @@ if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) { > } > > my $marcnotesarray = GetMarcNotes ($record,$marcflavour); >-my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber)); >+my $subtitle = GetRecordValue('subtitle', $record); > > if( C4::Context->preference('ArticleRequests') ) { > my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef; >diff --git a/opac/opac-readingrecord.pl b/opac/opac-readingrecord.pl >index c01409a700..00c7c436d8 100755 >--- a/opac/opac-readingrecord.pl >+++ b/opac/opac-readingrecord.pl >@@ -98,8 +98,7 @@ foreach my $issue ( @{$issues} ) { > my $marc_rec = > MARC::Record::new_from_xml( $marcxml, 'utf8', > C4::Context->preference('marcflavour') ); >- $issue->{subtitle} = >- GetRecordValue( 'subtitle', $marc_rec, $issue->{frameworkcode} ); >+ $issue->{subtitle} = GetRecordValue( 'subtitle', $marc_rec ); > $issue->{normalized_upc} = GetNormalizedUPC( $marc_rec, C4::Context->preference('marcflavour') ); > } > # My Summary HTML >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 725b31d07b..fa8371694b 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -405,7 +405,6 @@ $template->param('item_level_itypes' => $itemLevelTypes); > > foreach my $biblioNum (@biblionumbers) { > >- my $record = GetMarcBiblio({ biblionumber => $biblioNum }); > # Init the bib item with the choices for branch pickup > my %biblioLoopIter; > >@@ -425,7 +424,10 @@ foreach my $biblioNum (@biblionumbers) { > my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} ); > $biblioLoopIter{biblionumber} = $biblioData->{biblionumber}; > $biblioLoopIter{title} = $biblioData->{title}; >- $biblioLoopIter{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode); >+ $biblioLoopIter{subtitle} = C4::Biblio::SplitSubtitle($biblioData->{'subtitle'}); >+ $biblioLoopIter{medium} = $biblioData->{medium}; >+ $biblioLoopIter{part_number} = $biblioData->{part_number}; >+ $biblioLoopIter{part_name} = $biblioData->{part_name}; > $biblioLoopIter{author} = $biblioData->{author}; > $biblioLoopIter{rank} = $biblioData->{rank}; > $biblioLoopIter{reservecount} = $biblioData->{reservecount}; >diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl >index a5b393e5e4..92adfc2762 100755 >--- a/opac/opac-sendshelf.pl >+++ b/opac/opac-sendshelf.pl >@@ -101,7 +101,7 @@ if ( $email ) { > > my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); > my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); >- my $subtitle = GetRecordValue('subtitle', $record, $fw); >+ my $subtitle = GetRecordValue('subtitle', $record); > > my @items = GetItemsInfo( $biblionumber ); > >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index ab1a835c08..320fc983f1 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -295,7 +295,7 @@ if ( $op eq 'view' ) { > $this_item->{notforloan} = $itemtype->notforloan; > } > $this_item->{'coins'} = GetCOinSBiblio($record); >- $this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) ); >+ $this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record ), > $this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour ); > $this_item->{'normalized_ean'} = GetNormalizedEAN( $record, $marcflavour ); > $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour ); >diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl >index fc6dc6cac1..05432a611e 100755 >--- a/opac/opac-showreviews.pl >+++ b/opac/opac-showreviews.pl >@@ -91,13 +91,15 @@ for my $result (@$reviews){ > my $biblio = Koha::Biblios->find( $biblionumber ); > my $biblioitem = $biblio->biblioitem; > my $record = GetMarcBiblio({ biblionumber => $biblionumber }); >- my $frameworkcode = GetFrameworkCode($biblionumber); > $result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour); > $result->{normalized_ean} = GetNormalizedEAN($record,$marcflavour); > $result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$marcflavour); > $result->{normalized_isbn} = GetNormalizedISBN(undef,$record,$marcflavour); > $result->{title} = $biblio->title; >- $result->{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode); >+ $result->{subtitle} = GetRecordValue('subtitle', $record ); >+ $result->{medium} = $biblio->medium; >+ $result->{part_number} = $biblio->part_number; >+ $result->{part_name} = $biblio->part_name; > $result->{author} = $biblio->author; > $result->{place} = $biblioitem->place; > $result->{publishercode} = $biblioitem->publishercode; >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index 272d896f23..f9f2f9c423 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -256,8 +256,11 @@ if ($loggedinuser) { > $hidden_items = \@hidden_itemnumbers; > } > next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers ); >- $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) ); > $tag->{title} = $biblio->title; >+ $tag->{subtitle} = C4::Biblio::SplitSubtitle($biblio->subtitle); >+ $tag->{medium} = $biblio->medium; >+ $tag->{part_number} = $biblio->part_number; >+ $tag->{part_name} = $biblio->part_name; > $tag->{author} = $biblio->author; > > my $xslfile = C4::Context->preference('OPACXSLTResultsDisplay'); >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 4ef0fb3c0b..dd77be9f75 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -201,12 +201,8 @@ if ( $pending_checkouts->count ) { # Useless test > ); > $issue->{rentalfines} = $rental_fines->total_outstanding; > >- my $marcrecord = GetMarcBiblio({ >- biblionumber => $issue->{'biblionumber'}, >- embed_items => 1, >- opac => 1, >- borcat => $borcat }); >- $issue->{'subtitle'} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($issue->{'biblionumber'})); >+ $issue->{'subtitle'} = C4::Biblio::SplitSubtitle($issue->{'subtitle'}); >+ > # check if item is renewable > my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} ); > ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'}); >@@ -258,6 +254,11 @@ if ( $pending_checkouts->count ) { # Useless test > > my $isbn = GetNormalizedISBN($issue->{'isbn'}); > $issue->{normalized_isbn} = $isbn; >+ my $marcrecord = GetMarcBiblio({ >+ biblionumber => $issue->{'biblionumber'}, >+ embed_items => 1, >+ opac => 1, >+ borcat => $borcat }); > $issue->{normalized_upc} = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') ); > > # My Summary HTML >diff --git a/svc/checkouts b/svc/checkouts >index 9a1b3a5648..8aecac1cb0 100755 >--- a/svc/checkouts >+++ b/svc/checkouts >@@ -23,7 +23,7 @@ use CGI; > use JSON qw(to_json); > > use C4::Auth qw(check_cookie_auth haspermission get_session); >-use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue ); >+use C4::Biblio qw(SplitSubtitle); > use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate); > use C4::Overdues qw(GetFine); > use C4::Context; >@@ -74,6 +74,10 @@ my $sql = ' > > biblionumber, > biblio.title, >+ biblio.subtitle, >+ biblio.medium, >+ biblio.part_number, >+ biblio.part_name, > author, > > itemnumber, >@@ -174,6 +178,10 @@ while ( my $c = $sth->fetchrow_hashref() ) { > my $checkout = { > DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber}, > title => $c->{title}, >+ subtitle => C4::Biblio::SplitSubtitle($c->{'subtitle'}), >+ medium => $c->{medium} // '', >+ part_number => $c->{part_number} // '', >+ part_name => $c->{part_name} // '', > author => $c->{author}, > barcode => $c->{barcode}, > itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype}, >@@ -216,10 +224,6 @@ while ( my $c = $sth->fetchrow_hashref() ) { > as_due_date => 1 > } > ), >- subtitle => GetRecordValue( >- 'subtitle', >- GetMarcBiblio({ biblionumber => $c->{biblionumber} }), >- GetFrameworkCode( $c->{biblionumber} ) ), > lost => $lost, > damaged => $damaged, > borrower => { >diff --git a/svc/holds b/svc/holds >index 062109d40c..8b9a27b310 100755 >--- a/svc/holds >+++ b/svc/holds >@@ -23,7 +23,7 @@ use CGI; > use JSON qw(to_json); > > use C4::Auth qw(check_cookie_auth); >-use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue ); >+use C4::Biblio qw(SplitSubtitle); > use C4::Charset; > use C4::Circulation qw(GetTransfers); > use C4::Context; >@@ -84,11 +84,17 @@ while ( my $h = $holds_rs->next() ) { > for my $library ( @$libraries ) { > $library->{selected} = 1 if $library->{branchcode} eq $h->branchcode(); > } >+ >+ my $biblio = $h->biblio(); > my $hold = { > DT_RowId => $h->reserve_id(), > biblionumber => $biblionumber, >- title => $h->biblio()->title(), >- author => $h->biblio()->author(), >+ title => $biblio->title(), >+ subtitle => $biblio->subtitle() // '', >+ medium => $biblio->medium() // '', >+ part_number => $biblio->part_number() // '', >+ part_name => $biblio->part_name() // '', >+ author => $biblio->author(), > reserve_id => $h->reserve_id(), > branchcode => $h->branch()->branchname(), > branches => $libraries, >@@ -102,11 +108,6 @@ while ( my $h = $holds_rs->next() ) { > waiting_here => $h->branch()->branchcode() eq $branch, > priority => $h->priority(), > itemtype_limit => $itemtype_limit, >- subtitle => GetRecordValue( >- 'subtitle', >- GetMarcBiblio({ biblionumber => $biblionumber }), >- GetFrameworkCode($biblionumber) >- ), > reservedate_formatted => $h->reservedate() ? output_pref( > { dt => dt_from_string( $h->reservedate() ), dateonly => 1 } > ) >diff --git a/t/Biblio.t b/t/Biblio.t >index 0d140bed60..4afb1376f9 100755 >--- a/t/Biblio.t >+++ b/t/Biblio.t >@@ -51,7 +51,7 @@ warning_is { $ret = BiblioAutoLink(undef, q{}) } > > is( $ret, 0, 'BiblioAutoLink returns zero if not passed rec'); > >-warning_is { $ret = GetRecordValue('100', undef, q{}) } >+warning_is { $ret = GetRecordValue('100', undef) } > { carped => 'GetRecordValue called with undefined record'}, > "GetRecordValue returns carped warning on undef record"; > >diff --git a/t/Biblio2.t b/t/Biblio2.t >index 3cb0cb051c..21354eb578 100644 >--- a/t/Biblio2.t >+++ b/t/Biblio2.t >@@ -52,4 +52,20 @@ sub _koha_marc_update_bib_ids_control { > is($r->field('004')->data(), 20, 'Biblioitemnumber to control field'); > } > >+subtest 'SplitSubtitle' => sub { >+ plan tests => 4; >+ >+ my $res = C4::Biblio::SplitSubtitle(undef); >+ is_deeply($res, [], 'undef returned as an array'); >+ >+ $res = C4::Biblio::SplitSubtitle(''); >+ is_deeply($res, [], 'Empty string returned as an array'); >+ >+ $res = C4::Biblio::SplitSubtitle('Single'); >+ is_deeply($res, [{'subfield' => 'Single'}], 'Single subtitle returns an array'); >+ >+ $res = C4::Biblio::SplitSubtitle('First | Second'); >+ is_deeply($res, [{'subfield' => 'First'}, {'subfield' => 'Second'}], 'Two subtitles returns an array'); >+}; >+ > done_testing(); >diff --git a/tags/list.pl b/tags/list.pl >index 862327862f..6f39da509e 100755 >--- a/tags/list.pl >+++ b/tags/list.pl >@@ -61,10 +61,7 @@ else { > my $taglist = get_tag_rows( { term => $tag } ); > for ( @{$taglist} ) { > my $dat = &GetBiblioData( $_->{biblionumber} ); >- my $record = &GetMarcBiblio({ biblionumber => $_->{biblionumber} }); >- $dat->{'subtitle'} = >- GetRecordValue( 'subtitle', $record, >- GetFrameworkCode( $_->{biblionumber} ) ); >+ $dat->{'subtitle'} = C4::Biblio::SplitSubtitles($dat->{'subtitle'}), > my @items = GetItemsInfo( $_->{biblionumber} ); > $dat->{biblionumber} = $_->{biblionumber}; > $dat->{tag_id} = $_->{tag_id}; >diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl >index 34c6b5a8ac..9eba7354a4 100755 >--- a/tools/batch_delete_records.pl >+++ b/tools/batch_delete_records.pl >@@ -94,7 +94,7 @@ if ( $op eq 'form' ) { > my $holds_count = $biblio->holds->count; > $biblio = $biblio->unblessed; > my $record = &GetMarcBiblio({ biblionumber => $record_id }); >- $biblio->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $record_id ) ); >+ $biblio->{subtitle} = C4::Biblio::SplitSubtitle( $biblio->{subtitle} ); > $biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')]; > $biblio->{holds_count} = $holds_count; > $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id ); >diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl >index 3c077ef35d..c8d3cab1d2 100755 >--- a/virtualshelves/sendshelf.pl >+++ b/virtualshelves/sendshelf.pl >@@ -77,14 +77,13 @@ if ($email) { > > while ( my $content = $contents->next ) { > my $biblionumber = $content->biblionumber; >- my $fw = GetFrameworkCode($biblionumber); > my $dat = GetBiblioData($biblionumber); > my $record = GetMarcBiblio({ > biblionumber => $biblionumber, > embed_items => 1 }); > my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); > my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); >- my $subtitle = GetRecordValue( 'subtitle', $record, $fw ); >+ my $subtitle = GetRecordValue( 'subtitle', $record ); > > my @items = GetItemsInfo($biblionumber); > >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index 495f4429b3..082c3f3170 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -280,7 +280,7 @@ if ( $op eq 'view' ) { > $this_item->{description} = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ? > $this_item->{notforloan} = $itemtype->notforloan if $itemtype; > $this_item->{'coins'} = GetCOinSBiblio($record); >- $this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) ); >+ $this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record ); > $this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour ); > $this_item->{'normalized_ean'} = GetNormalizedEAN( $record, $marcflavour ); > $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour ); >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11529
:
81930
|
81931
|
82024
|
82025
|
82026
|
82027
|
82028
|
82029
|
82088
|
82089
|
82090
|
82428
|
82429
|
82430
|
82431
|
82538
|
82539
|
82540
|
82541
|
82542
|
83103
|
83104
|
83105
|
83106
|
83107
|
83108
|
83961
|
83962
|
83963
|
83964
|
83965
|
83966
|
85587
|
85588
|
85589
|
85590
|
85591
|
85592
|
86677
|
86678
|
86679
|
86680
|
86681
|
86682
|
87248
|
87249
|
87250
|
87251
|
87252
|
87253
|
87256
|
87257
|
87258
|
87259
|
87260
|
87261
|
87911
|
87912
|
87913
|
87914
|
87915
|
87916
|
87917
|
87918
|
87919
|
88247
|
88248
|
88249
|
88250
|
88251
|
88252
|
88253
|
88254
|
88255
|
88256
|
88406
|
88407
|
88408
|
88409
|
88410
|
88411
|
88412
|
88413
|
88414
|
88415
|
88416
|
88433
|
88434
|
88435
|
88436
|
88437
|
88438
|
88439
|
88440
|
88441
|
88442
|
88443
|
88762
|
88763
|
88764
|
88765
|
88766
|
88767
|
88768
|
88769
|
88770
|
88771
|
88772
|
88851
|
88852
|
88853
|
88854
|
88855
|
88856
|
88857
|
88858
|
88859
|
88860
|
88861
|
88862
|
89096
|
89097
|
89098
|
89099
|
89100
|
89101
|
89102
|
89103
|
89104
|
89105
|
89106
|
89107
|
89234
|
89235
|
89236
|
89237
|
89238
|
89239
|
89240
|
89241
|
89242
|
89243
|
89244
|
89245
|
89246
|
91680
|
91681
|
91682
|
91683
|
91684
|
91685
|
91686
|
91687
|
91688
|
91689
|
91690
|
91691
|
91692
|
91824
|
91825
|
91826
|
91827
|
91828
|
91829
|
91830
|
91831
|
91832
|
91833
|
91834
|
91835
|
91836
|
91837
|
92016
|
92019
|
92020
|
105667
|
105672