|
Lines 27-32
use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate Ad
Link Here
|
| 27 |
use Koha::DateUtils qw( dt_from_string ); |
27 |
use Koha::DateUtils qw( dt_from_string ); |
| 28 |
use Koha::Database; |
28 |
use Koha::Database; |
| 29 |
use Koha::BiblioFrameworks; |
29 |
use Koha::BiblioFrameworks; |
|
|
30 |
use Koha::Patrons; |
| 30 |
|
31 |
|
| 31 |
my $cgi = CGI->new; |
32 |
my $cgi = CGI->new; |
| 32 |
|
33 |
|
|
Lines 47-57
my $unseen = $cgi->param('unseen') || 0;
Link Here
|
| 47 |
$barcode = barcodedecode($barcode) if $barcode; |
48 |
$barcode = barcodedecode($barcode) if $barcode; |
| 48 |
my $override_limit = $cgi->param('override_limit'); |
49 |
my $override_limit = $cgi->param('override_limit'); |
| 49 |
my $override_holds = $cgi->param('override_holds'); |
50 |
my $override_holds = $cgi->param('override_holds'); |
|
|
51 |
my $override_debt = $cgi->param('override_debt'); |
| 50 |
my $hard_due_date = $cgi->param('hard_due_date'); |
52 |
my $hard_due_date = $cgi->param('hard_due_date'); |
| 51 |
|
53 |
|
| 52 |
my ( $item, $checkout, $patron ); |
54 |
my ( $item, $checkout, $patron ); |
| 53 |
my $error = q{}; |
55 |
my $error = q{}; |
| 54 |
my ( $soonest_renew_date, $latest_auto_renew_date ); |
56 |
my ( $soonest_renew_date, $latest_auto_renew_date, $balance ); |
| 55 |
|
57 |
|
| 56 |
if ( $op eq 'cud-renew' && $barcode ) { |
58 |
if ( $op eq 'cud-renew' && $barcode ) { |
| 57 |
$barcode = barcodedecode($barcode) if $barcode; |
59 |
$barcode = barcodedecode($barcode) if $barcode; |
|
Lines 66-71
if ( $op eq 'cud-renew' && $barcode ) {
Link Here
|
| 66 |
$patron = $checkout->patron; |
68 |
$patron = $checkout->patron; |
| 67 |
my $borrowernumber = $patron->borrowernumber; |
69 |
my $borrowernumber = $patron->borrowernumber; |
| 68 |
|
70 |
|
|
|
71 |
$balance = $patron->account->balance; |
| 72 |
my $amountlimit = C4::Context->preference("OPACFineNoRenewals"); |
| 73 |
|
| 69 |
if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { |
74 |
if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { |
| 70 |
my $confirmations; |
75 |
my $confirmations; |
| 71 |
my $can_renew; |
76 |
my $can_renew; |
|
Lines 92-97
if ( $op eq 'cud-renew' && $barcode ) {
Link Here
|
| 92 |
$checkout, |
97 |
$checkout, |
| 93 |
); |
98 |
); |
| 94 |
} |
99 |
} |
|
|
100 |
|
| 101 |
if ( $balance > $amountlimit ) { |
| 102 |
$error = "too_much_debt"; |
| 103 |
$can_renew = 0; |
| 104 |
if ($override_debt) { |
| 105 |
$can_renew = 1; |
| 106 |
$error = undef; |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 95 |
if ($can_renew) { |
110 |
if ($can_renew) { |
| 96 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
111 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
| 97 |
my $date_due = |
112 |
my $date_due = |
|
Lines 127-132
if ( $op eq 'cud-renew' && $barcode ) {
Link Here
|
| 127 |
error => $error, |
142 |
error => $error, |
| 128 |
soonestrenewdate => $soonest_renew_date, |
143 |
soonestrenewdate => $soonest_renew_date, |
| 129 |
latestautorenewdate => $latest_auto_renew_date, |
144 |
latestautorenewdate => $latest_auto_renew_date, |
|
|
145 |
balance => $balance, |
| 130 |
); |
146 |
); |
| 131 |
} |
147 |
} |
| 132 |
|
148 |
|