Bug 18262: Koha::Biblio - Remove GetBiblioData - part 1
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 13 Mar 2017 20:44:25 +0000 (17:44 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 14 Jul 2017 15:22:23 +0000 (12:22 -0300)
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

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

27 files changed:
C4/Acquisition.pm
C4/Biblio.pm
C4/Circulation.pm
C4/HoldsQueue.pm
C4/Reserves.pm
C4/XISBN.pm
acqui/basketgroup.pl
cataloguing/moveitem.pl
labels/label-item-search.pl
misc/migration_tools/bulkmarcimport.pl
misc/migration_tools/import_lexile.pl
opac/opac-MARCdetail.pl
opac/opac-addbybiblionumber.pl
opac/opac-detail.pl
opac/opac-reserve.pl
opac/opac-review.pl
opac/opac-search.pl
opac/opac-showreviews.pl
opac/opac-tags.pl
reserve/request.pl
reviews/reviewswaiting.pl
serials/serials-edit.pl
serials/subscription-add.pl
tools/batchMod.pl
tools/inventory.pl
tools/showdiffmarc.pl
virtualshelves/addbybiblionumber.pl

index 346fb45..ebbe44b 100644 (file)
@@ -314,20 +314,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};
             }
@@ -343,17 +336,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'},
@@ -412,16 +406,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},
index f55a383..0ee689d 100644 (file)
@@ -3586,12 +3586,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
     }
@@ -3599,7 +3600,7 @@ sub UpdateTotalIssues {
     if (defined $value) {
         $totalissues = $value;
     } else {
-        $totalissues = $data->{'totalissues'} + $increase;
+        $totalissues = $biblioitem->totalissues + $increase;
     }
 
      my $field = $record->field($totalissuestag);
@@ -3611,7 +3612,7 @@ sub UpdateTotalIssues {
          $record->insert_grouped_field($field);
      }
 
-     return ModBiblio($record, $biblionumber, $data->{'frameworkcode'});
+     return ModBiblio($record, $biblionumber, $biblio->frameworkcode);
 }
 
 =head2 RemoveAllNsb
index 0c5585a..cb60da3 100644 (file)
@@ -1822,8 +1822,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  = Koha::Checkouts->find( { itemnumber => $itemnumber } );
     if ( $issue ) {
index 218260e..1e893fa 100755 (executable)
@@ -684,8 +684,8 @@ sub CreatePicklistFromItemMap {
         my $firstname = $patron->firstname;
         my $phone = $patron->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,
index 6d52d6d..5098230 100644 (file)
@@ -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;
@@ -330,7 +331,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 $patron = Koha::Patrons->find( $borrowernumber );
     my $borrower = $patron->unblessed;
 
@@ -341,7 +342,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
index 5512633..6da6f10 100644 (file)
@@ -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);
index 333e542..e1a16fd 100755 (executable)
@@ -54,6 +54,7 @@ use CGI qw ( -utf8 );
 use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/;
 use Koha::EDI qw/create_edi_order get_edifact_ean/;
 
+use Koha::Biblioitems;
 use Koha::Acquisition::Booksellers;
 use Koha::ItemTypes;
 use Koha::Patrons;
@@ -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( $biblioitem->itemtype )->description : undef;
             $ord->{en} = $en ? $en : undef;
             $ord->{edition} = $edition ? $edition : undef;
 
index 37c9a5e..7805da4 100755 (executable)
@@ -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;
@@ -58,8 +60,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
index ddc0bf8..53b7d46 100755 (executable)
@@ -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...
index dc2cae4..29ef0fb 100755 (executable)
@@ -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 ($@) {
index e9fad46..b185c04 100755 (executable)
@@ -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};
index 115e8fd..a899e92 100755 (executable)
@@ -57,6 +57,7 @@ use C4::Members;
 use C4::Acquisition;
 use C4::Koha;
 use List::MoreUtils qw( any uniq );
+use Koha::Biblios;
 use Koha::Patrons;
 use Koha::RecordProcessor;
 
@@ -90,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',
@@ -114,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;
 
index ddebf4f..ddc6778 100755 (executable)
@@ -25,6 +25,7 @@ use C4::Biblio;
 use C4::Output;
 use C4::Auth;
 
+use Koha::Biblios;
 use Koha::Virtualshelves;
 
 my $query           = new CGI;
@@ -142,12 +143,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,
             }
         );
     }
index ed8a5d5..ae89f82 100755 (executable)
@@ -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;
@@ -434,22 +436,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);
index bf50f36..5312449 100755 (executable)
@@ -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;
@@ -522,7 +524,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.
index f8e86ba..39af047 100755 (executable)
@@ -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;
index 1456732..2272587 100755 (executable)
@@ -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;
index 99a7ed1..84eba04 100755 (executable)
@@ -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 = Koha::Patrons->find( $result->{borrowernumber} )->unblessed;
@@ -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'};
index 665d6b6..873a9c5 100755 (executable)
@@ -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;
index 15ad54a..7cda03d 100755 (executable)
@@ -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::Checkouts;
 use Koha::Holds;
@@ -213,7 +215,7 @@ foreach my $biblionumber (@biblionumbers) {
 
     my %biblioloopiter = ();
 
-    my $dat = GetBiblioData($biblionumber);
+    my $biblio = Koha::Biblios->find( $biblionumber );
 
     my $force_hold_level;
     if ( $patron ) {
@@ -380,11 +382,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 $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } );
@@ -612,8 +614,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,
                     );
@@ -622,7 +624,7 @@ foreach my $biblionumber (@biblionumbers) {
     }
 
     $biblioloopiter{biblionumber} = $biblionumber;
-    $biblioloopiter{title} = $dat->{title};
+    $biblioloopiter{title} = $biblio->title;
     $biblioloopiter{rank} = $fixedRank;
     $biblioloopiter{reserveloop} = \@reserveloop;
 
index 2669664..5284252 100755 (executable)
@@ -22,6 +22,7 @@ use C4::Auth;
 use C4::Output;
 use C4::Context;
 use C4::Biblio;
+use Koha::Biblios;
 use Koha::Patrons;
 use Koha::Reviews;
 
@@ -69,9 +70,9 @@ my $reviews = Koha::Reviews->search(
 foreach ( @$reviews ) {
     my $borrowernumber = $_->{borrowernumber};
     my $patron = Koha::Patrons->find( $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}     = $patron->surname;
     $_->{firstname}   = $patron->firstname;
 }
index 2bff94b..1f5c775 100755 (executable)
@@ -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,
index ce7f168..c73b28d 100755 (executable)
@@ -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);
         }
     }
 
index 1a216d7..b24ce2b 100755 (executable)
@@ -576,11 +576,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);
index 1ee40a1..d6f9e4a 100755 (executable)
@@ -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(
index ec0f735..5ccb497 100755 (executable)
@@ -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;
 }
index 210e153..a60c88f 100755 (executable)
@@ -63,6 +63,7 @@ use C4::Biblio;
 use C4::Output;
 use C4::Auth;
 
+use Koha::Biblios;
 use Koha::Virtualshelves;
 
 my $query           = new CGI;
@@ -185,12 +186,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,
         }
     );
 }