# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Search;
use C4::Acquisition qw(GetOrdersByBiblionumber);
+use Koha::Biblios;
+use Koha::Patrons;
+
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 $itemcount = GetItemsCount($biblionumber);
-
+my $biblio = Koha::Biblios->find( $biblionumber );
+my $itemcount = $biblio ? $biblio->items->count : 0;
my @items = GetItemsInfo($biblionumber);
my $norequests = 1;
}
if ( $query->cookie("holdfor") ) {
- my $holdfor_patron =
- GetMember( 'borrowernumber' => $query->cookie("holdfor") );
+ my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
$template->param(
holdfor => $query->cookie("holdfor"),
- holdfor_surname => $holdfor_patron->{'surname'},
- holdfor_firstname => $holdfor_patron->{'firstname'},
- holdfor_cardnumber => $holdfor_patron->{'cardnumber'},
+ holdfor_surname => $holdfor_patron->surname,
+ holdfor_firstname => $holdfor_patron->firstname,
+ holdfor_cardnumber => $holdfor_patron->cardnumber,
);
}
my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ;
$template->param (countdeletedorders => $count_deletedorders_using_biblio);
-my $holds= C4::Reserves::GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dates => 1 });
-my $holdcount = scalar( @$holds );
-$template->param( holdcount => scalar ( @$holds ) );
+my $hold_count = $biblio ? $biblio->holds->count : 0;
+$template->param( holdcount => $hold_count );
output_html_with_http_headers $query, $cookie, $template->output;