Bugzilla – Attachment 64133 Details for
Bug 18262
Koha::Biblios - Remove GetBiblioData - part 1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18262: Koha::Biblio - Remove GetBiblioData - part 1
Bug-18262-KohaBiblio---Remove-GetBiblioData---part.patch (text/plain), 33.90 KB, created by
Jonathan Druart
on 2017-06-09 13:48:14 UTC
(
hide
)
Description:
Bug 18262: Koha::Biblio - Remove GetBiblioData - part 1
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-06-09 13:48:14 UTC
Size:
33.90 KB
patch
obsolete
>From 595cd455380cded463d730e0623bd5e59be2673d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 13 Mar 2017 17:44:25 -0300 >Subject: [PATCH] Bug 18262: Koha::Biblio - Remove GetBiblioData - part 1 > >Most of the time C4::Biblio::GetBiblioData is used to retrieve the title >and/or the author of a bibliographic record. > >This patch replaces the easy occurrences of GetBiblioData, the ones >where the 2 joins are needed, but only data from biblio and biblioitems >table are. > >Test plan: >It will be hard to test everything, I'd suggest a QAer to review this >patch and confirm that the difference occurrences of GetBiblioData have >been correctly replaced by calling Koha::Biblios->find or >$biblio->bibioitem >--- > C4/Acquisition.pm | 41 +++++++++++++++------------------- > C4/Biblio.pm | 11 ++++----- > C4/Circulation.pm | 4 ++-- > C4/HoldsQueue.pm | 4 ++-- > C4/Reserves.pm | 5 +++-- > C4/XISBN.pm | 9 ++++---- > acqui/basketgroup.pl | 5 +++-- > cataloguing/moveitem.pl | 6 +++-- > labels/label-item-search.pl | 1 - > misc/migration_tools/bulkmarcimport.pl | 5 ++++- > misc/migration_tools/import_lexile.pl | 16 +++++++------ > opac/opac-MARCdetail.pl | 6 +++-- > opac/opac-addbybiblionumber.pl | 7 +++--- > opac/opac-detail.pl | 14 +++++++----- > opac/opac-reserve.pl | 4 +++- > opac/opac-review.pl | 6 +++-- > opac/opac-search.pl | 2 +- > opac/opac-showreviews.pl | 21 ++++++++--------- > opac/opac-tags.pl | 8 ++++--- > reserve/request.pl | 20 +++++++++-------- > reviews/reviewswaiting.pl | 6 +++-- > serials/serials-edit.pl | 4 ++-- > serials/subscription-add.pl | 7 +++--- > tools/batchMod.pl | 10 ++++----- > tools/inventory.pl | 8 ++++--- > tools/showdiffmarc.pl | 6 +++-- > virtualshelves/addbybiblionumber.pl | 7 +++--- > 27 files changed, 135 insertions(+), 108 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index ed80b26484..e99ec57017 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -312,20 +312,13 @@ sub GetBasketAsCSV { > } > for my $order (@orders) { > my @row; >- my $bd = GetBiblioData( $order->{'biblionumber'} ); >- my @biblioitems = GetBiblioItemByBiblioNumber( $order->{'biblionumber'}); >- for my $biblioitem (@biblioitems) { >- if ( $biblioitem->{isbn} >- and $order->{isbn} >- and $biblioitem->{isbn} eq $order->{isbn} ) >- { >- $order = { %$order, %$biblioitem }; >- } >- } >+ my $biblio = Koha::Biblios->find( $order->{biblionumber} ); >+ my $biblioitem = $biblio->biblioitem; >+ $order = { %$order, %{ $biblioitem->unblessed } }; > if ($contract) { > $order = {%$order, %$contract}; > } >- $order = {%$order, %$basket, %$bd}; >+ $order = {%$order, %$basket, %{ $biblio->unblessed }}; > for my $field (@fields) { > push @row, $order->{$field}; > } >@@ -341,17 +334,18 @@ sub GetBasketAsCSV { > } > else { > foreach my $order (@orders) { >- my $bd = GetBiblioData( $order->{'biblionumber'} ); >+ my $biblio = Koha::Biblios->find( $order->{biblionumber} ); >+ my $biblioitem = $biblio->biblioitem; > my $row = { > contractname => $contract->{'contractname'}, > ordernumber => $order->{'ordernumber'}, > entrydate => $order->{'entrydate'}, > isbn => $order->{'isbn'}, >- author => $bd->{'author'}, >- title => $bd->{'title'}, >- publicationyear => $bd->{'publicationyear'}, >- publishercode => $bd->{'publishercode'}, >- collectiontitle => $bd->{'collectiontitle'}, >+ author => $biblio->author, >+ title => $biblio->title, >+ publicationyear => $biblioitem->publicationyear, >+ publishercode => $biblioitem->publishercode, >+ collectiontitle => $biblioitem->collectiontitle, > notes => $order->{'order_vendornote'}, > quantity => $order->{'quantity'}, > rrp => $order->{'rrp'}, >@@ -410,16 +404,17 @@ sub GetBasketGroupAsCSV { > my $basketgroup = GetBasketgroup( $$basket{basketgroupid} ); > > foreach my $order (@orders) { >- my $bd = GetBiblioData( $order->{'biblionumber'} ); >+ my $biblio = Koha::Biblios->find( $order->{biblionumber} ); >+ my $biblioitem = $biblio->biblioitem; > my $row = { > clientnumber => $bookseller->accountnumber, > basketname => $basket->{basketname}, > ordernumber => $order->{ordernumber}, >- author => $bd->{author}, >- title => $bd->{title}, >- publishercode => $bd->{publishercode}, >- publicationyear => $bd->{publicationyear}, >- collectiontitle => $bd->{collectiontitle}, >+ author => $biblio->author, >+ title => $biblio->title, >+ publishercode => $biblioitem->publishercode, >+ publicationyear => $biblioitem->publicationyear, >+ collectiontitle => $biblioitem->collectiontitle, > isbn => $order->{isbn}, > quantity => $order->{quantity}, > rrp_tax_included => $order->{rrp_tax_included}, >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index d52d7807af..081d9bdd0c 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -3680,12 +3680,13 @@ sub UpdateTotalIssues { > carp "UpdateTotalIssues could not get biblio record"; > return; > } >- my $data = GetBiblioData($biblionumber); >- unless ($data) { >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ unless ($biblio) { > carp "UpdateTotalIssues could not get datas of biblio"; > return; > } >- my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField('biblioitems.totalissues', $data->{'frameworkcode'}); >+ my $biblioitem = $biblio->biblioitem; >+ my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField('biblioitems.totalissues', $biblio->frameworkcode); > unless ($totalissuestag) { > return 1; # There is nothing to do > } >@@ -3693,7 +3694,7 @@ sub UpdateTotalIssues { > if (defined $value) { > $totalissues = $value; > } else { >- $totalissues = $data->{'totalissues'} + $increase; >+ $totalissues = $biblioitem->totalissues + $increase; > } > > my $field = $record->field($totalissuestag); >@@ -3705,7 +3706,7 @@ sub UpdateTotalIssues { > $record->insert_grouped_field($field); > } > >- return ModBiblio($record, $biblionumber, $data->{'frameworkcode'}); >+ return ModBiblio($record, $biblionumber, $biblio->frameworkcode); > } > > =head2 RemoveAllNsb >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index a439021ba3..94ace1de72 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1832,8 +1832,8 @@ sub AddReturn { > my $itemnumber = $item->{ itemnumber }; > > my $item_level_itypes = C4::Context->preference("item-level_itypes"); >- my $biblio = $item_level_itypes ? undef : GetBiblioData( $item->{ biblionumber } ); # don't get bib data unless we need it >- my $itemtype = $item_level_itypes ? $item->{itype} : $biblio->{itemtype}; >+ my $biblio = $item_level_itypes ? undef : Koha::Biblios->find( $item->{ biblionumber } ); # don't get bib data unless we need it >+ my $itemtype = $item_level_itypes ? $item->{itype} : $biblio->biblioitem->itemtype; > > my $issue = GetItemIssue($itemnumber); > if ($issue and $issue->{borrowernumber}) { >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index 0f2ad221a2..b6f8ce2e0c 100755 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -683,8 +683,8 @@ sub CreatePicklistFromItemMap { > my $firstname = $borrower->{'firstname'}; > my $phone = $borrower->{'phone'}; > >- my $bib = GetBiblioData($biblionumber); >- my $title = $bib->{title}; >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $title = $biblio->title; > > $sth_load->execute($biblionumber, $itemnumber, $barcode, $surname, $firstname, $phone, $borrowernumber, > $cardnumber, $reservedate, $title, $itemcallnumber, >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 7e24ff465a..251e233a18 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -36,6 +36,7 @@ use C4::Members qw(); > use C4::Letters; > use C4::Log; > >+use Koha::Biblios; > use Koha::DateUtils; > use Koha::Calendar; > use Koha::Database; >@@ -365,7 +366,7 @@ sub CanItemBeReserved { > # we retrieve borrowers and items informations # > # item->{itype} will come for biblioitems if necessery > my $item = GetItem($itemnumber); >- my $biblioData = C4::Biblio::GetBiblioData( $item->{biblionumber} ); >+ my $biblio = Koha::Biblios->find( $item->{biblionumber} ); > my $borrower = C4::Members::GetMember( 'borrowernumber' => $borrowernumber ); > > # If an item is damaged and we don't allow holds on damaged items, we can stop right here >@@ -375,7 +376,7 @@ sub CanItemBeReserved { > > # Check for the age restriction > my ( $ageRestriction, $daysToAgeRestriction ) = >- C4::Circulation::GetAgeRestriction( $biblioData->{agerestriction}, $borrower ); >+ C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower ); > return 'ageRestricted' if $daysToAgeRestriction && $daysToAgeRestriction > 0; > > # Check that the patron doesn't have an item level hold on this item already >diff --git a/C4/XISBN.pm b/C4/XISBN.pm >index 55126334b3..6da6f10d9b 100644 >--- a/C4/XISBN.pm >+++ b/C4/XISBN.pm >@@ -26,6 +26,7 @@ use C4::External::Syndetics qw(get_syndetics_editions); > use LWP::UserAgent; > use HTTP::Request::Common; > >+use Koha::Biblios; > use Koha::SearchEngine; > use Koha::SearchEngine::Search; > >@@ -74,10 +75,10 @@ sub _get_biblio_from_xisbn { > my $biblionumber = C4::Biblio::get_koha_field_from_marc('biblio', 'biblionumber', $record, ''); > return unless $biblionumber; > >- my $xbiblio = GetBiblioData($biblionumber); >- return unless $xbiblio; >- $xbiblio->{normalized_isbn} = GetNormalizedISBN($xbiblio->{isbn}); >- return $xbiblio; >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ return unless $biblio; >+ $biblio->{normalized_isbn} = GetNormalizedISBN($biblio->biblioitem->isbn); >+ return $biblio; > } > > =head1 get_xisbns($isbn); >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index 9e50484de7..d8fc73a937 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -55,6 +55,7 @@ use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsBy > use C4::Members qw/GetMember/; > use Koha::EDI qw/create_edi_order get_edifact_ean/; > >+use Koha::Biblioitems; > use Koha::Acquisition::Booksellers; > use Koha::ItemTypes; > >@@ -174,7 +175,7 @@ sub printbasketgrouppdf{ > $ord->{total_tax_included} = $ord->{ecost_tax_included} * $ord->{quantity}; > $ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity}; > >- my $bib = GetBiblioData($ord->{biblionumber}); >+ my $biblioitem = Koha::Biblioitems->search({ biblionumber => $ord->{biblionumber} })->next; > > #FIXME DELETE ME > # 0 1 2 3 4 5 6 7 8 9 >@@ -195,7 +196,7 @@ sub printbasketgrouppdf{ > } > } > >- $ord->{itemtype} = ( $ord->{itemtype} and $bib->{itemtype} ) ? Koha::ItemTypes->find( $bib->{itemtype} )->description : undef; >+ $ord->{itemtype} = ( $ord->{itemtype} and $biblioitem->itemtype ) ? Koha::ItemTypes->find( $bib->{itemtype} )->description : undef; > $ord->{en} = $en ? $en : undef; > $ord->{edition} = $edition ? $edition : undef; > >diff --git a/cataloguing/moveitem.pl b/cataloguing/moveitem.pl >index 79736a6034..7c8c27154a 100755 >--- a/cataloguing/moveitem.pl >+++ b/cataloguing/moveitem.pl >@@ -31,6 +31,8 @@ use C4::Koha; > use C4::ClassSource; > use C4::Acquisition qw/GetOrderFromItemnumber ModOrder GetOrder/; > >+use Koha::Biblios; >+ > use Date::Calc qw(Today); > > use MARC::File::XML; >@@ -55,8 +57,8 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user( > > > >-my $biblio = GetBiblioData($biblionumber); >-$template->param(bibliotitle => $biblio->{'title'}); >+my $biblio = Koha::Biblios->find( $biblionumber ); >+$template->param(bibliotitle => $biblio->title); > $template->param(biblionumber => $biblionumber); > > # If we already have the barcode of the item to move and the biblionumber to move the item to >diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl >index ddc0bf88dd..53b7d46755 100755 >--- a/labels/label-item-search.pl >+++ b/labels/label-item-search.pl >@@ -128,7 +128,6 @@ if ($show_results) { > my @items =(); > # This code needs to be refactored using these subs... > #my @items = &GetItemsInfo( $biblio->{biblionumber}, 'intra' ); >- #my $dat = &GetBiblioData( $biblio->{biblionumber} ); > for ( my $i = 0 ; $i < $hits ; $i++ ) { > my @row_data= (); > #DEBUG Notes: Decode the MARC record from each resulting MARC record... >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index dc2cae4182..29ef0fbe0f 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -31,6 +31,7 @@ use Getopt::Long; > use IO::File; > use Pod::Usage; > >+use Koha::Biblios; > use Koha::SearchEngine; > use Koha::SearchEngine::Search; > >@@ -417,7 +418,9 @@ RECORD: while ( ) { > } > # create biblio, unless we already have it ( either match or isbn ) > if ($biblionumber) { >- eval{$biblioitemnumber=GetBiblioData($biblionumber)->{biblioitemnumber};}; >+ eval{ >+ $biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber; >+ }; > if ($update) { > eval { ( $biblionumber, $biblioitemnumber ) = ModBiblio( $record, $biblionumber, GetFrameworkCode($biblionumber) ) }; > if ($@) { >diff --git a/misc/migration_tools/import_lexile.pl b/misc/migration_tools/import_lexile.pl >index e9fad46503..b185c0489b 100755 >--- a/misc/migration_tools/import_lexile.pl >+++ b/misc/migration_tools/import_lexile.pl >@@ -34,6 +34,8 @@ use Text::CSV; > use C4::Context; > use C4::Biblio; > use C4::Koha qw( GetVariationsOfISBN ); >+ >+use Koha::Biblios; > use Koha::Database; > > binmode STDOUT, ':encoding(UTF-8)'; >@@ -156,13 +158,13 @@ while ( my $row = $csv->getline_hr($fh) ) { > say "Found matching record! Biblionumber: $biblionumber"; > > if ( $verbose > 2 ) { >- my $biblio = GetBiblioData($biblionumber); >- say "Title from record: " . $biblio->{title} >- if ( $biblio->{title} ); >- say "Author from record: " . $biblio->{author} >- if ( $biblio->{author} ); >- say "ISBN from record: " . $biblio->{isbn} >- if ( $biblio->{isbn} ); >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ say "Title from record: " . $biblio->title >+ if $biblio->title; >+ say "Author from record: " . $biblio->author >+ if $biblio->author; >+ say "ISBN from record: " . $biblio->biblioitem->isbn >+ if $biblio->biblioitem->isbn; > } > say "Title: " . $row->{Title}; > say "Author: " . $row->{Author}; >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index 3c9c2c23c8..ccd5d52599 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -57,6 +57,8 @@ use C4::Members; > use C4::Acquisition; > use C4::Koha; > use List::MoreUtils qw( any uniq ); >+ >+use Koha::Biblios; > use Koha::RecordProcessor; > > my $query = new CGI; >@@ -89,7 +91,7 @@ if (scalar @all_items >= 1) { > my $framework = &GetFrameworkCode( $biblionumber ); > my $tagslib = &GetMarcStructure( 0, $framework ); > my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework); >-my $biblio = GetBiblioData($biblionumber); >+my $biblio = Koha::Biblios->find( $biblionumber ); > > my $record_processor = Koha::RecordProcessor->new({ > filters => 'ViewPolicy', >@@ -113,7 +115,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > > my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$framework); > $template->param( >- bibliotitle => $biblio->{title}, >+ bibliotitle => $biblio->title, > ) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible. > $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8; > >diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl >index 9227fa01dc..f4b223c91c 100755 >--- a/opac/opac-addbybiblionumber.pl >+++ b/opac/opac-addbybiblionumber.pl >@@ -25,6 +25,7 @@ use C4::Biblio; > use C4::Output; > use C4::Auth; > >+use Koha::Biblios; > use Koha::Virtualshelves; > > my $query = new CGI; >@@ -141,12 +142,12 @@ if ($newvirtualshelf) { > > if ($authorized) { > for my $biblionumber (@biblionumbers) { >- my $data = GetBiblioData($biblionumber); >+ my $biblio = Koha::Biblios->find( $biblionumber ); > push( > @biblios, > { biblionumber => $biblionumber, >- title => $data->{'title'}, >- author => $data->{'author'}, >+ title => $biblio->title, >+ author => $biblio->author; > } > ); > } >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index f2c2f6fe6a..3f24e9665a 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -48,6 +48,8 @@ use C4::Images; > use Koha::DateUtils; > use C4::HTML5Media; > use C4::CourseReserves qw(GetItemCourseReservesInfo); >+ >+use Koha::Biblios; > use Koha::RecordProcessor; > use Koha::AuthorisedValues; > use Koha::Biblios; >@@ -433,22 +435,22 @@ if ($session->param('busc')) { > $numberBiblioPaging = $paging{'previous'}->{biblionumber}; > if ($numberBiblioPaging) { > $template->param( 'previousBiblionumber' => $numberBiblioPaging ); >- $dataBiblioPaging = GetBiblioData($numberBiblioPaging); >- $template->param('previousTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging); >+ $dataBiblioPaging = Koha::Biblios->find( $numberBiblioPaging ); >+ $template->param('previousTitle' => $dataBiblioPaging->title) if $dataBiblioPaging; > } > # Next biblio > $numberBiblioPaging = $paging{'next'}->{biblionumber}; > if ($numberBiblioPaging) { > $template->param( 'nextBiblionumber' => $numberBiblioPaging ); >- $dataBiblioPaging = GetBiblioData($numberBiblioPaging); >- $template->param('nextTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging); >+ $dataBiblioPaging = Koha::Biblios->find( $numberBiblioPaging ); >+ $template->param('nextTitle' => $dataBiblioPaging->title) if $dataBiblioPaging; > } > # Partial list of biblio results > my @listResults; > for (my $j = 0; $j < @arrBiblios; $j++) { > next unless ($arrBiblios[$j]); >- $dataBiblioPaging = GetBiblioData($arrBiblios[$j]) if ($arrBiblios[$j] != $biblionumber); >- push @listResults, {index => $j + 1 + $offset, biblionumber => $arrBiblios[$j], title => ($arrBiblios[$j] == $biblionumber)?'':$dataBiblioPaging->{title}, author => ($arrBiblios[$j] != $biblionumber && $dataBiblioPaging->{author})?$dataBiblioPaging->{author}:'', url => ($arrBiblios[$j] == $biblionumber)?'':'opac-detail.pl?biblionumber=' . $arrBiblios[$j]}; >+ $dataBiblioPaging = Koha::Biblios->find( $arrBiblios[$j] ) if ($arrBiblios[$j] != $biblionumber); >+ push @listResults, {index => $j + 1 + $offset, biblionumber => $arrBiblios[$j], title => ($arrBiblios[$j] == $biblionumber)?'':$dataBiblioPaging->title, author => ($arrBiblios[$j] != $biblionumber && $dataBiblioPaging->author)?$dataBiblioPaging->author:'', url => ($arrBiblios[$j] == $biblionumber)?'':'opac-detail.pl?biblionumber=' . $arrBiblios[$j]}; > } > $template->param('listResults' => \@listResults) if (@listResults); > $template->param('indexPag' => 1 + $offset, 'totalPag' => $arrParamsBusc{'total'}, 'indexPagEnd' => scalar(@arrBiblios) + $offset); >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 7de7b978b9..b61a9b22b8 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -32,7 +32,9 @@ use C4::Context; > use C4::Members; > use C4::Overdues; > use C4::Debug; >+ > use Koha::AuthorisedValues; >+use Koha::Biblios; > use Koha::DateUtils; > use Koha::Items; > use Koha::ItemTypes; >@@ -521,7 +523,7 @@ foreach my $biblioNum (@biblionumbers) { > if ( $itemInfo->{biblionumber} ne $biblioNum ) { > $biblioLoopIter{hostitemsflag} = 1; > $itemLoopIter->{hostbiblionumber} = $itemInfo->{biblionumber}; >- $itemLoopIter->{hosttitle} = GetBiblioData( $itemInfo->{biblionumber} )->{title}; >+ $itemLoopIter->{hosttitle} = Koha::Biblios->find( $itemInfo->{biblionumber} )->title; > } > > # If there is no loan, return and transfer, we show a checkbox. >diff --git a/opac/opac-review.pl b/opac/opac-review.pl >index f8e86bac13..39af047cfd 100755 >--- a/opac/opac-review.pl >+++ b/opac/opac-review.pl >@@ -25,6 +25,8 @@ use C4::Output; > use C4::Biblio; > use C4::Scrubber; > use C4::Debug; >+ >+use Koha::Biblios; > use Koha::DateUtils; > use Koha::Review; > use Koha::Reviews; >@@ -45,7 +47,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > # FIXME: need to allow user to delete their own comment(s) > > my ( $clean, @errors, $savedreview ); >-my $biblio = GetBiblioData($biblionumber); >+my $biblio = Koha::Biblios->find( $biblionumber ); > > if( !$biblio ) { > push @errors, { nobiblio => 1 }; >@@ -101,7 +103,7 @@ $template->param( > 'borrowernumber' => $borrowernumber, > 'review' => $review, > 'reviewid' => $reviewid || 0, >- 'title' => $biblio->{'title'}, >+ 'title' => $biblio->title, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 7b10ac3bef..b0459289fb 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -46,7 +46,7 @@ use C4::Auth qw(:DEFAULT get_session); > use C4::Languages qw(getLanguages); > use C4::Search; > use C4::Search::History; >-use C4::Biblio; # GetBiblioData >+use C4::Biblio; # Unused here? > use C4::Koha; > use C4::Tags qw(get_tags); > use C4::SocialData; >diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl >index f85a833c56..57c437d20e 100755 >--- a/opac/opac-showreviews.pl >+++ b/opac/opac-showreviews.pl >@@ -89,7 +89,8 @@ my $i = 0; > my $latest_comment_date; > for my $result (@$reviews){ > my $biblionumber = $result->{biblionumber}; >- my $bib = &GetBiblioData($biblionumber); >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $biblioitem = $biblio->biblioitem; > my $record = GetMarcBiblio($biblionumber); > my $frameworkcode = GetFrameworkCode($biblionumber); > my ( $borr ) = GetMember( borrowernumber => $result->{borrowernumber} ); >@@ -97,16 +98,16 @@ for my $result (@$reviews){ > $result->{normalized_ean} = GetNormalizedEAN($record,$marcflavour); > $result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$marcflavour); > $result->{normalized_isbn} = GetNormalizedISBN(undef,$record,$marcflavour); >- $result->{title} = $bib->{'title'}; >+ $result->{title} = $biblio->title; > $result->{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode); >- $result->{author} = $bib->{'author'}; >- $result->{place} = $bib->{'place'}; >- $result->{publishercode} = $bib->{'publishercode'}; >- $result->{copyrightdate} = $bib->{'copyrightdate'}; >- $result->{pages} = $bib->{'pages'}; >- $result->{size} = $bib->{'size'}; >- $result->{notes} = $bib->{'notes'}; >- $result->{timestamp} = $bib->{'timestamp'}; >+ $result->{author} = $biblio->author; >+ $result->{place} = $biblioitem->place; >+ $result->{publishercode} = $biblioitem->publishercode; >+ $result->{copyrightdate} = $biblio->copyrightdate; >+ $result->{pages} = $biblioitem->pages; >+ $result->{size} = $biblioitem->size; >+ $result->{notes} = $biblioitem->notes; >+ $result->{timestamp} = $biblioitem->timestamp; > $result->{borrtitle} = $borr->{'title'}; > $result->{firstname} = $borr->{'firstname'}; > $result->{surname} = $borr->{'surname'}; >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index 665d6b6702..873a9c54d5 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -46,6 +46,8 @@ use C4::XSLT; > > use Data::Dumper; > >+use Koha::Biblios; >+ > my %newtags = (); > my @deltags = (); > my %counts = (); >@@ -229,11 +231,11 @@ if ($loggedinuser) { > $my_tags = get_tag_rows({borrowernumber=>$loggedinuser}); > my $my_approved_tags = get_approval_rows({ approved => 1 }); > foreach my $tag (@$my_tags) { >- my $biblio = GetBiblioData($tag->{biblionumber}); >+ my $biblio = Koha::Biblios->find( $tag->{biblionumber} ); > my $record = &GetMarcBiblio( $tag->{biblionumber} ); > $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) ); >- $tag->{title} = $biblio->{title}; >- $tag->{author} = $biblio->{author}; >+ $tag->{title} = $biblio->title; >+ $tag->{author} = $biblio->author; > > my $xslfile = C4::Context->preference('OPACXSLTResultsDisplay'); > my $lang = $xslfile ? C4::Languages::getlanguage() : undef; >diff --git a/reserve/request.pl b/reserve/request.pl >index db35e165fa..2da43a0b3c 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -42,6 +42,8 @@ use Koha::DateUtils; > use C4::Utils::DataTables::Members; > use C4::Members; > use C4::Search; # enabled_staff_search_views >+ >+use Koha::Biblios; > use Koha::DateUtils; > use Koha::Holds; > use Koha::Items; >@@ -213,7 +215,7 @@ foreach my $biblionumber (@biblionumbers) { > > my %biblioloopiter = (); > >- my $dat = GetBiblioData($biblionumber); >+ my $biblio = Koha::Biblios->find( $biblionumber ); > > my $canReserve = CanBookBeReserved( $borrowerinfo->{borrowernumber}, $biblionumber ); > $canReserve //= ''; >@@ -376,11 +378,11 @@ foreach my $biblionumber (@biblionumbers) { > $item->{holdingbranch} = $item->{holdingbranch}; > } > >- if($item->{biblionumber} ne $biblionumber){ >- $item->{hostitemsflag}=1; >- $item->{hosttitle} = GetBiblioData($item->{biblionumber})->{title}; >- } >- >+ if($item->{biblionumber} ne $biblionumber){ >+ $item->{hostitemsflag} = 1; >+ $item->{hosttitle} = Koha::Biblios->find( $item->{biblionumber} )->title; >+ } >+ > # if the item is currently on loan, we display its return date and > # change the background color > my $issues= GetItemIssue($itemnumber); >@@ -605,8 +607,8 @@ foreach my $biblionumber (@biblionumbers) { > date => $date, > biblionumber => $biblionumber, > findborrower => $findborrower, >- title => $dat->{title}, >- author => $dat->{author}, >+ title => $biblio->title, >+ author => $biblio->author, > holdsview => 1, > C4::Search::enabled_staff_search_views, > ); >@@ -615,7 +617,7 @@ foreach my $biblionumber (@biblionumbers) { > } > > $biblioloopiter{biblionumber} = $biblionumber; >- $biblioloopiter{title} = $dat->{title}; >+ $biblioloopiter{title} = $biblio->title; > $biblioloopiter{rank} = $fixedRank; > $biblioloopiter{reserveloop} = \@reserveloop; > >diff --git a/reviews/reviewswaiting.pl b/reviews/reviewswaiting.pl >index 452b54c283..b403d3f93a 100755 >--- a/reviews/reviewswaiting.pl >+++ b/reviews/reviewswaiting.pl >@@ -23,6 +23,8 @@ use C4::Output; > use C4::Context; > use C4::Members; > use C4::Biblio; >+ >+use Koha::Biblios; > use Koha::Reviews; > > my $query = new CGI; >@@ -69,9 +71,9 @@ my $reviews = Koha::Reviews->search( > foreach ( @$reviews ) { > my $borrowernumber = $_->{borrowernumber}; > my $borrowerData = GetMember('borrowernumber' => $borrowernumber); >- my $biblioData = GetBiblioData($_->{biblionumber}); >+ my $biblio = Koha::Biblios->find( $_->{biblionumber} ); > # setting some borrower info into this hash >- $_->{bibliotitle} = $biblioData->{'title'}; >+ $_->{bibliotitle} = $biblio->title; > $_->{surname} = $borrowerData->{'surname'}; > $_->{firstname} = $borrowerData->{'firstname'}; > } >diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl >index 2bff94b66e..1f5c775ce8 100755 >--- a/serials/serials-edit.pl >+++ b/serials/serials-edit.pl >@@ -164,7 +164,7 @@ foreach my $serialid (@serialids) { > $processedserialid{$serialid} = 1; > } > } >-my $biblio = GetBiblioData( $serialdatalist[0]->{'biblionumber'} ); >+my $biblio = Koha::Biblios->find( $serialdatalist[0]->{biblionumber} ); > > my @newserialloop; > my @subscriptionloop; >@@ -425,7 +425,7 @@ $template->param( > serialsadditems => $serialdatalist[0]->{'serialsadditems'}, > callnumber => $serialdatalist[0]->{'callnumber'}, > internalnotes => $serialdatalist[0]->{'internalnotes'}, >- bibliotitle => $biblio->{'title'}, >+ bibliotitle => $biblio->title, > biblionumber => $serialdatalist[0]->{'biblionumber'}, > serialslist => \@serialdatalist, > default_bib_view => $default_bib_view, >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index ce7f168e8b..c73b28d85b 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -31,6 +31,7 @@ use C4::Serials::Frequency; > use C4::Serials::Numberpattern; > use C4::Letters; > use Koha::AdditionalField; >+use Koha::Biblios; > use Koha::DateUtils; > use Koha::ItemTypes; > use Carp; >@@ -182,10 +183,10 @@ if ($op eq 'addsubscription') { > > my $new_biblionumber = $query->param('biblionumber_for_new_subscription'); > if (defined $new_biblionumber) { >- my $bib = GetBiblioData($new_biblionumber); >- if (defined $bib) { >+ my $biblio = Koha::Biblios->find( $new_biblionumber ); >+ if (defined $biblio) { > $template->param(bibnum => $new_biblionumber); >- $template->param(bibliotitle => $bib->{title}); >+ $template->param(bibliotitle => $biblio->title); > } > } > >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 1dc2174951..e8a716cb04 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -566,11 +566,11 @@ sub BuildItemsData{ > > # grab title, author, and ISBN to identify bib that the item > # belongs to in the display >- my $biblio=GetBiblioData($$itemdata{biblionumber}); >- $this_row{title} = $biblio->{title}; >- $this_row{author} = $biblio->{author}; >- $this_row{isbn} = $biblio->{isbn}; >- $this_row{biblionumber} = $biblio->{biblionumber}; >+ my $biblio = Koha::Biblios->find( $itemdata->{biblionumber} ); >+ $this_row{title} = $biblio->title; >+ $this_row{author} = $biblio->author; >+ $this_row{isbn} = $biblio->biblioitem->isbn; >+ $this_row{biblionumber} = $biblio->biblionumber; > > if (%this_row) { > push(@big_array, \%this_row); >diff --git a/tools/inventory.pl b/tools/inventory.pl >index 1ee40a1014..d6f9e4a907 100755 >--- a/tools/inventory.pl >+++ b/tools/inventory.pl >@@ -34,6 +34,8 @@ use C4::Koha; > use C4::Circulation; > use C4::Reports::Guided; #_get_column_defs > use C4::Charset; >+ >+use Koha::Biblios; > use Koha::DateUtils; > use Koha::AuthorisedValues; > use Koha::BiblioFrameworks; >@@ -311,9 +313,9 @@ my $loop = $uploadbarcodes > ? [ map { $results->{$_} } keys %$results ] > : $inventorylist // []; > for my $item ( @$loop ) { >- my $biblio = C4::Biblio::GetBiblioData($item->{biblionumber}); >- $item->{title} = $biblio->{title}; >- $item->{author} = $biblio->{author}; >+ my $biblio = Koha::Biblios->find( $item->{biblionumber} ); >+ $item->{title} = $biblio->title; >+ $item->{author} = $biblio->author; > } > > $template->param( >diff --git a/tools/showdiffmarc.pl b/tools/showdiffmarc.pl >index ec0f735181..5ccb497b40 100755 >--- a/tools/showdiffmarc.pl >+++ b/tools/showdiffmarc.pl >@@ -31,6 +31,8 @@ use C4::Auth; > use C4::Biblio; > use C4::ImportBatch; > >+use Koha::Biblios; >+ > # Input params > my $input = new CGI; > my $biblionumber = $input->param('id'); >@@ -60,8 +62,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > $recordBiblionumber = GetMarcBiblio($biblionumber, 'embed_items'); > if( $recordBiblionumber ) { > $formatted1 = $recordBiblionumber->as_formatted; >- my $data = GetBiblioData($biblionumber); >- $biblioTitle = $data->{title}; >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ $biblioTitle = $biblio->title; > } else { > $errorFormatted1 = 1; > } >diff --git a/virtualshelves/addbybiblionumber.pl b/virtualshelves/addbybiblionumber.pl >index 6e058e9e49..5d8b1375c7 100755 >--- a/virtualshelves/addbybiblionumber.pl >+++ b/virtualshelves/addbybiblionumber.pl >@@ -63,6 +63,7 @@ use C4::Biblio; > use C4::Output; > use C4::Auth; > >+use Koha::Biblios; > use Koha::Virtualshelves; > > my $query = new CGI; >@@ -184,12 +185,12 @@ if ($newvirtualshelf) { > > my @biblios; > for my $biblionumber (@biblionumbers) { >- my $data = GetBiblioData($biblionumber); >+ my $biblio = Koha::Biblios->find( $biblionumber ); > push( > @biblios, > { biblionumber => $biblionumber, >- title => $data->{'title'}, >- author => $data->{'author'}, >+ title => $biblio->title, >+ author => $biblio->author, > } > ); > } >-- >2.11.0
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 18262
:
61054
|
61058
|
63863
|
64133
|
64148
|
64149
|
64827
|
64977
|
64978
|
65045
|
65046
|
65085