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 88-93
if ( $op eq 'cud-renew' && $barcode ) {
Link Here
|
88 |
$checkout, |
93 |
$checkout, |
89 |
); |
94 |
); |
90 |
} |
95 |
} |
|
|
96 |
|
97 |
if ( $balance > $amountlimit ) { |
98 |
$error = "too_much_debt"; |
99 |
$can_renew = 0; |
100 |
if ($override_debt) { |
101 |
$can_renew = 1; |
102 |
$error = undef; |
103 |
} |
104 |
} |
105 |
|
91 |
if ($can_renew) { |
106 |
if ($can_renew) { |
92 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
107 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
93 |
my $date_due = |
108 |
my $date_due = |
Lines 122-127
if ( $op eq 'cud-renew' && $barcode ) {
Link Here
|
122 |
error => $error, |
137 |
error => $error, |
123 |
soonestrenewdate => $soonest_renew_date, |
138 |
soonestrenewdate => $soonest_renew_date, |
124 |
latestautorenewdate => $latest_auto_renew_date, |
139 |
latestautorenewdate => $latest_auto_renew_date, |
|
|
140 |
balance => $balance, |
125 |
); |
141 |
); |
126 |
} |
142 |
} |
127 |
|
143 |
|