for my $borrowernumber (@borrowernumbers) {
my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber );
my $library = Koha::Libraries->find( $borrower->{branchcode} )->unblessed;
- my $biblio = C4::Biblio::GetBiblio( $order->{biblionumber} );
+ my $biblio = Koha::Biblios->find( $order->{biblionumber} )->unblessed;
my $letter = C4::Letters::GetPreparedLetter(
module => 'acquisition',
letter_code => 'ACQ_NOTIF_ON_RECEIV',
# to get something
push @EXPORT, qw(
- GetBiblio
GetBiblioData
GetMarcBiblio
GetBiblioItemData
return $res;
}
-=head2 GetBiblio
-
- my $biblio = &GetBiblio($biblionumber);
-
-=cut
-
-sub GetBiblio {
- my ($biblionumber) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("SELECT * FROM biblio WHERE biblionumber = ?");
- my $count = 0;
- my @results;
- $sth->execute($biblionumber);
- if ( my $data = $sth->fetchrow_hashref ) {
- return $data;
- }
- return;
-} # sub GetBiblio
-
=head2 GetBiblioItemInfosOf
GetBiblioItemInfosOf(@biblioitemnumbers);
my $library = Koha::Libraries->find( $hold->branchcode );
my $branchname = $library ? $library->branchname : '';
$unblessed_hold->{branchname} = $branchname;
- $unblessed_hold->{title} = GetBiblio( $hold->biblionumber )->{'title'}; # Should be $hold->get_biblio
+ $biblio = Koha::Biblios->find( $hold->biblionumber ); # Should be $hold->get_biblio
+ $unblessed_hold->{title} = $biblio ? $biblio->title : ''; # Just in case, but should not be needed
push @{ $borrower->{holds}{hold} }, $unblessed_hold;
# Get the biblio record, or return an error code
my $biblionumber = $cgi->param('bib_id');
- my $biblio = GetBiblio( $biblionumber );
- return { code => 'RecordNotFound' } unless $$biblio{biblionumber};
-
- my $title = $$biblio{title};
+ my $biblio = Koha::Biblios->find( $biblionumber );
+ return { code => 'RecordNotFound' } unless $biblio;
+
+ my $title = $biblio ? $biblio->title : '';
# Check if the biblio can be reserved
return { code => 'NotHoldable' } unless CanBookBeReserved( $borrowernumber, $biblionumber ) eq 'OK';
# Get the biblio or return an error code
my $biblionumber = $cgi->param('bib_id');
- my $biblio = GetBiblio($biblionumber);
- return { code => 'RecordNotFound' } unless $$biblio{biblionumber};
+ my $biblio = Koha::Biblios->find( $biblionumber );
+ return { code => 'RecordNotFound' } unless $biblio;
- my $title = $$biblio{title};
+ my $title = $biblio ? $biblio->title : '';
# Get the item or return an error code
my $itemnumber = $cgi->param('item_id');
return { code => 'RecordNotFound' } unless $$item{itemnumber};
# If the biblio does not match the item, return an error code
- return { code => 'RecordNotFound' } if $$item{biblionumber} ne $$biblio{biblionumber};
+ return { code => 'RecordNotFound' } if $$item{biblionumber} ne $biblio->biblionumber;
# Check for item disponibility
my $canitembereserved = C4::Reserves::CanItemBeReserved( $borrowernumber, $itemnumber );
$recordid = $record_match;
my $oldxml;
if ($record_type eq 'biblio') {
- my $oldbiblio = GetBiblio($recordid);
+ my $oldbiblio = Koha::Biblios->find( $recordid );
$oldxml = GetXmlBiblio($recordid);
# remove item fields so that they don't get
}
$oldxml = $old_marc->as_xml($marc_type);
- ModBiblio($marc_record, $recordid, $oldbiblio->{'frameworkcode'});
+ ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode);
$query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?";
if ($item_result eq 'create_new' || $item_result eq 'replace') {
my $old_record = MARC::Record->new_from_xml(StripNonXmlChars($rowref->{'marcxml_old'}), 'UTF-8', $rowref->{'encoding'}, $marc_type);
if ($record_type eq 'biblio') {
my $biblionumber = $rowref->{'matched_biblionumber'};
- my $oldbiblio = GetBiblio($biblionumber);
+ my $oldbiblio = Koha::Biblios->find( $biblionumber );
$logger->info("C4::ImportBatch::BatchRevertRecords: Biblio record $biblionumber does not exist, restoration of this record was skipped") unless $oldbiblio;
next unless $oldbiblio; # Record has since been deleted. Deleted records should stay deleted.
$num_items_deleted += BatchRevertItems($rowref->{'import_record_id'}, $rowref->{'matched_biblionumber'});
- ModBiblio($old_record, $biblionumber, $oldbiblio->{'frameworkcode'});
+ ModBiblio($old_record, $biblionumber, $oldbiblio->frameworkcode);
} else {
my $authid = $rowref->{'matched_authid'};
ModAuthority($authid, $old_record, GuessAuthTypeCode($old_record));
logaction( "SERIAL", "ADD", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");
#set serial flag on biblio if not already set.
- my $bib = GetBiblio($biblionumber);
- if ( $bib and !$bib->{'serial'} ) {
+ my $biblio = Koha::Biblios->find( $biblionumber );
+ if ( $biblio and !$biblio->serial ) {
my $record = GetMarcBiblio($biblionumber);
- my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial', $bib->{'frameworkcode'} );
+ my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial', $biblio->frameworkcode );
if ($tag) {
eval { $record->field($tag)->update( $subf => 1 ); };
}
- ModBiblio( $record, $biblionumber, $bib->{'frameworkcode'} );
+ ModBiblio( $record, $biblionumber, $biblio->frameworkcode );
}
return $subscriptionid;
}
}, 400);
}
$biblionumber ||= $biblio->biblionumber;
- $biblio->unblessed; # FIXME remove later
} else {
- $biblio = C4::Biblio::GetBiblio($biblionumber);
+ $biblio = Koha::Biblios->find( $biblionumber );
}
my $can_reserve =
my $reserve_id = C4::Reserves::AddReserve($branchcode, $borrowernumber,
$biblionumber, undef, $priority, undef, $expirationdate, undef,
- $biblio->{title}, $itemnumber);
+ $biblio->title, $itemnumber);
unless ($reserve_id) {
return $c->$cb({
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
my $imagenumber = $query->param('imagenumber');
-my $biblio = GetBiblio($biblionumber);
-my $biblio_object = Koha::Biblios->find( $biblionumber ); # This should replace $biblio
-my $itemcount = $biblio_object->items->count;;
+my $biblio = Koha::Biblios->find( $biblionumber );
+my $itemcount = $biblio->items->count;;
my @items = GetItemsInfo($biblionumber);
use C4::Biblio; # GetBiblio
use C4::Search; # enabled_staff_search_views
+use Koha::Biblios;
+
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
}
);
-# getting cgi params.
-my $params = $query->Vars;
-
-my $biblionumber = $params->{'biblionumber'};
+my $biblionumber = $query->param('biblionumber');
if (C4::Context->preference("HidePatronName")) {
$template->param(HidePatronName => 1);
}
my $issues = GetBiblioIssues($biblionumber);
-my $biblio = GetBiblio($biblionumber);
-$template->param(%$biblio);
+my $biblio = Koha::Biblios->find( $biblionumber );
$template->param(
+ biblio => $biblio,
total => scalar @$issues,
issues => $issues,
issuehistoryview => 1,
use C4::Koha;
use Koha::AuthorisedValues;
+use Koha::Biblios;
use Koha::Item::Search::Field qw(GetItemSearchFields);
use Koha::ItemTypes;
use Koha::Libraries;
}
foreach my $item (@$results) {
- $item->{biblio} = GetBiblio($item->{biblionumber});
+ $item->{biblio} = Koha::Biblios->find( $item->{biblionumber} );
($item->{biblioitem}) = GetBiblioItemByBiblioNumber($item->{biblionumber});
$item->{status} = $notforloan_map->{$item->{notforloan}};
if (defined $item->{location}) {
[% USE KohaDates %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Catalog › Checkout history for [% title |html %]</title>
+<title>Koha › Catalog › Checkout history for [% biblio.title |html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<link rel="stylesheet" href="[% interface %]/[% theme %]/css/datatables.css" />
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Checkout history for <i>[% title |html %]</i></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Checkout history for <i>[% biblio.title |html %]</i></div>
<div id="doc3" class="yui-t2">
<div id="yui-main">
<div class="yui-b">
-<h1>Checkout history for [% title |html %]</h1>
-[% IF ( author ) %]<h3>by [% author %]</h3>[% END %]
+<h1>Checkout history for [% biblio.title |html %]</h1>
+[% IF biblio.author %]<h3>by [% biblio.author %]</h3>[% END %]
<div class="searchresults">
[% IF ( issues ) %]
</table>
[% ELSE %]
<div class="dialog message"><p>
- <b>[% title |html %][% IF ( author ) %], by [% author %][% END %]</b> has never been checked out.</p></div>
+ <b>[% biblio.title |html %][% IF biblio.author %], by [% biblio.author %][% END %]</b> has never been checked out.</p></div>
[% END %]
</div>
use C4::Output;
use C4::Images;
+use Koha::Biblios;
+
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
my $imagenumber = $query->param('imagenumber');
-my $biblio = GetBiblio($biblionumber);
+my $biblio = Koha::Biblios->find( $biblionumber );
if ( C4::Context->preference("OPACLocalCoverImages") ) {
my @images = ListImagesForBiblio($biblionumber);
use C4::Biblio;
use C4::Reports;
use C4::Acquisition; #GetBasket()
+use Koha::Biblios;
use Koha::DateUtils;
my $query = new CGI;
# Format the order's informations
foreach my $order (@orders) {
# Get the title of the ordered item
- my $biblio = C4::Biblio::GetBiblio($order->{'biblionumber'});
+ my $biblio = Koha::Biblios->find( $order->{biblionumber} );
my $basket = C4::Acquisition::GetBasket($order->{'basketno'});
$order->{'basketname'} = $basket->{'basketname'};
$order->{'authorisedbyname'} = $basket->{'authorisedbyname'};
- $order->{'title'} = $biblio->{'title'} || $order->{'biblionumber'};
+ $order->{title} = $biblio ? $biblio->title : '';
+ $order->{title} ||= $order->{biblionumber};
$order->{'total_rrp'} = $order->{'quantity'} * $order->{'rrp'};
$order->{'total_ecost'} = $order->{'quantity'} * $order->{'ecost'};
use C4::Biblio;
use C4::Serials;
+use Koha::Biblios;
use Koha::DateUtils;
my $input = new CGI;
exit;
} else {
my $history = GetSubscriptionHistoryFromSubscriptionId($subscriptionid);
- my $biblio = GetBiblio($history->{'biblionumber'});
+ my $biblio = Koha::Biblios->find( $history->{biblionumber} );
$template->param(
subscriptionid => $subscriptionid,
- title => $biblio->{'title'},
+ title => $biblio->title,
histstartdate => $history->{'histstartdate'},
histenddate => $history->{'histenddate'},
receivedlist => $history->{'recievedlist'},
$order1 = GetOrder($order1->{ordernumber});
ok((defined $order1->{datecancellationprinted}), "order is cancelled");
ok((not defined $order1->{cancellationreason}), "order has no cancellation reason");
-ok((defined GetBiblio($order1->{biblionumber})), "biblio still exists");
+ok((defined Koha::Biblios->find( $order1->{biblionumber} )), "biblio still exists");
$order2 = GetOrder($ordernumbers[1]);
$error = DelOrder($order2->{biblionumber}, $order2->{ordernumber}, 1);
$order2 = GetOrder($order2->{ordernumber});
ok((defined $order2->{datecancellationprinted}), "order is cancelled");
ok((not defined $order2->{cancellationreason}), "order has no cancellation reason");
-ok((not defined GetBiblio($order2->{biblionumber})), "biblio does not exist anymore");
+ok((not defined Koha::Biblios->find( $order2->{biblionumber} )), "biblio does not exist anymore");
my $order4 = GetOrder($ordernumbers[3]);
$error = DelOrder($order4->{biblionumber}, $order4->{ordernumber}, 1, "foobar");
$order4 = GetOrder($order4->{ordernumber});
ok((defined $order4->{datecancellationprinted}), "order is cancelled");
ok(($order4->{cancellationreason} eq "foobar"), "order has cancellation reason \"foobar\"");
-ok((not defined GetBiblio($order4->{biblionumber})), "biblio does not exist anymore");
+ok((not defined Koha::Biblios->find( $order4->{biblionumber} )), "biblio does not exist anymore");
my $order5 = GetOrder($ordernumbers[4]);
C4::Items::AddItem( { barcode => '0102030405' }, $order5->{biblionumber} );
$error = DelOrder($order5->{biblionumber}, $order5->{ordernumber}, 1);
$order5 = GetOrder($order5->{ordernumber});
ok((defined $order5->{datecancellationprinted}), "order is cancelled");
-ok(GetBiblio($order5->{biblionumber}), "biblio still exists");
+ok((defined Koha::Biblios->find( $order5->{biblionumber} )), "biblio still exists");
# End of tests for DelOrder
use C4::BackgroundJob;
use C4::Biblio qw( GetMarcBiblio ModBiblio );
use C4::MarcModificationTemplates qw( GetModificationTemplateActions GetModificationTemplates ModifyRecordWithTemplate );
+
+use Koha::Biblios;
use Koha::MetadataRecord::Authority;
my $input = new CGI;
for my $record_id ( uniq @record_ids ) {
if ( $recordtype eq 'biblio' ) {
# Retrieve biblio information
- my $biblio = C4::Biblio::GetBiblio( $record_id );
+ my $biblio = Koha::Biblios->find( $record_id );
unless ( $biblio ) {
push @messages, {
type => 'warning',