use C4::Koha;
use C4::Biblio;
use C4::Dates qw/format_date format_date_in_iso/;
+use C4::Search qw/SimpleSearch/;
use MARC::Record;
use C4::ClassSource;
use C4::Log;
# check for valid home branch
if (exists $item_ref->{'homebranch'} and defined $item_ref->{'homebranch'}) {
- my $branch_name = GetBranchName($item_ref->{'homebranch'});
+ my $branch_name = C4::Branch::GetBranchName($item_ref->{'homebranch'});
unless (defined $branch_name) {
# relies on fact that branches.branchname is a non-NULL column,
# so GetBranchName returns undef only if branch does not exist
# check for valid holding branch
if (exists $item_ref->{'holdingbranch'} and defined $item_ref->{'holdingbranch'}) {
- my $branch_name = GetBranchName($item_ref->{'holdingbranch'});
+ my $branch_name = C4::Branch::GetBranchName($item_ref->{'holdingbranch'});
unless (defined $branch_name) {
# relies on fact that branches.branchname is a non-NULL column,
# so GetBranchName returns undef only if branch does not exist
items.notforloan as itemnotforloan,
itemtypes.description,
itemtypes.notforloan as notforloan_per_itemtype,
- branchurl
+ holding.branchurl
FROM items
- LEFT JOIN branches ON items.holdingbranch = branches.branchcode
+ LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
+ LEFT JOIN branches AS home ON items.homebranch=home.branchcode
LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
LEFT JOIN itemtypes ON itemtypes.itemtype = "
. (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
- $query .= " WHERE items.biblionumber = ? ORDER BY branches.branchname,items.dateaccessioned desc" ;
+ $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname,items.dateaccessioned desc" ;
my $sth = $dbh->prepare($query);
$sth->execute($biblionumber);
my $i = 0;