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 65-70
if ($op eq 'cud-renew' && $barcode) {
Link Here
|
65 |
|
67 |
|
66 |
$patron = $checkout->patron; |
68 |
$patron = $checkout->patron; |
67 |
|
69 |
|
|
|
70 |
$balance = $patron->account->balance; |
71 |
my $amountlimit = C4::Context->preference("OPACFineNoRenewals"); |
72 |
|
68 |
if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { |
73 |
if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { |
69 |
my $can_renew; |
74 |
my $can_renew; |
70 |
my $info; |
75 |
my $info; |
Lines 90-95
if ($op eq 'cud-renew' && $barcode) {
Link Here
|
90 |
$checkout, |
95 |
$checkout, |
91 |
); |
96 |
); |
92 |
} |
97 |
} |
|
|
98 |
|
99 |
if ( $balance > $amountlimit ) { |
100 |
$error = "too_much_debt"; |
101 |
$can_renew = 0; |
102 |
if ($override_debt) { |
103 |
$can_renew = 1; |
104 |
$error = undef; |
105 |
} |
106 |
} |
107 |
|
93 |
if ($can_renew) { |
108 |
if ($can_renew) { |
94 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
109 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
95 |
my $date_due = |
110 |
my $date_due = |
Lines 128-133
if ($op eq 'cud-renew' && $barcode) {
Link Here
|
128 |
error => $error, |
143 |
error => $error, |
129 |
soonestrenewdate => $soonest_renew_date, |
144 |
soonestrenewdate => $soonest_renew_date, |
130 |
latestautorenewdate => $latest_auto_renew_date, |
145 |
latestautorenewdate => $latest_auto_renew_date, |
|
|
146 |
balance => $balance, |
131 |
); |
147 |
); |
132 |
} |
148 |
} |
133 |
|
149 |
|