# 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; # checkauth, getborrowernumber.
use C4::Koha;
use C4::Overdues;
use C4::Debug;
use Koha::DateUtils;
-use Koha::Borrower::Debarments qw(IsDebarred);
+use Koha::Libraries;
+use Koha::Patrons;
use Date::Calc qw/Today Date_to_Days/;
-# use Data::Dumper;
+use List::MoreUtils qw/uniq/;
my $maxreserves = C4::Context->preference("maxreserves");
my $canreserve = 0;
- my $singleBranchMode = C4::Context->preference("singleBranchMode");
+ my $singleBranchMode = Koha::Libraries->search->count == 1;
if ( $singleBranchMode || !$OPACChooseBranch )
{ # single branch mode or disabled user choosing
$branch = $borr->{'branchcode'};
$canreserve = 0;
}
+ my $itemtype = $query->param('itemtype') || undef;
+ $itemtype = undef if $itemNum;
+
# Here we actually do the reserveration. Stage 3.
if ($canreserve) {
my $reserve_id = AddReserve(
- $branch, $borrowernumber,
- $biblioNum,
- [$biblioNum], $rank,
- $startdate, $expiration_date,
- $notes, $biblioData->{title},
- $itemNum, $found
+ $branch, $borrowernumber, $biblioNum,
+ [$biblioNum], $rank, $startdate,
+ $expiration_date, $notes, $biblioData->{title},
+ $itemNum, $found, $itemtype,
);
$failed_holds++ unless $reserve_id;
++$reserve_cnt;
$noreserves = 1;
$template->param( too_much_oweing => $amount );
}
+
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} == 1) ) {
$noreserves = 1;
$template->param(
GNA => 1
);
}
+
if ( $borr->{lost} && ($borr->{lost} == 1) ) {
$noreserves = 1;
$template->param(
lost => 1
);
}
-if ( IsDebarred($borrowernumber) ) {
+
+if ( Koha::Patrons->find( $borrowernumber )->is_debarred ) {
$noreserves = 1;
$template->param(
- message => 1,
- debarred => 1
+ message => 1,
+ debarred => 1,
+ debarred_comment => $borr->{debarredcomment},
+ debarred_date => $borr->{debarred},
);
}
$itemLoopIter->{copynumber} = $itemInfo->{copynumber};
if ($itemLevelTypes) {
$itemLoopIter->{translated_description} = $itemInfo->{translated_description};
+ $itemLoopIter->{itype} = $itemInfo->{itype};
$itemLoopIter->{imageurl} = $itemInfo->{imageurl};
}
$anyholdable = 1 if $biblioLoopIter{holdable};
}
+
if ( $numBibsAvailable == 0 || $anyholdable == 0) {
$template->param( none_available => 1 );
}