|
Lines 24-30
use C4::Context;
Link Here
|
| 24 |
use C4::Auth qw( get_template_and_user ); |
24 |
use C4::Auth qw( get_template_and_user ); |
| 25 |
use C4::Output qw( output_html_with_http_headers ); |
25 |
use C4::Output qw( output_html_with_http_headers ); |
| 26 |
use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate AddRenewal ); |
26 |
use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate AddRenewal ); |
| 27 |
use C4::Log qw( logaction ); |
|
|
| 28 |
use Koha::DateUtils qw( dt_from_string ); |
27 |
use Koha::DateUtils qw( dt_from_string ); |
| 29 |
use Koha::Database; |
28 |
use Koha::Database; |
| 30 |
use Koha::BiblioFrameworks; |
29 |
use Koha::BiblioFrameworks; |
|
Lines 66-107
if ( $op eq 'cud-renew' && $barcode ) {
Link Here
|
| 66 |
|
65 |
|
| 67 |
$patron = $checkout->patron; |
66 |
$patron = $checkout->patron; |
| 68 |
my $borrowernumber = $patron->borrowernumber; |
67 |
my $borrowernumber = $patron->borrowernumber; |
| 69 |
my $user = C4::Context->userenv->{number}; |
|
|
| 70 |
my $branchcode = C4::Context->userenv->{branch}; |
| 71 |
my @message; |
| 72 |
|
68 |
|
| 73 |
if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { |
69 |
if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { |
| 74 |
my $confirmations; |
70 |
my $confirmations; |
| 75 |
my $can_renew; |
71 |
my $can_renew; |
| 76 |
my $info; |
72 |
my $info; |
| 77 |
( $can_renew, $error, $info ) = CanBookBeRenewed( $patron, $checkout, $override_limit ); |
73 |
( $can_renew, $error, $info ) = CanBookBeRenewed( $patron, $checkout, $override_limit ); |
| 78 |
push @{$confirmations}, $override_limit if $override_limit; |
74 |
push @{$confirmations}, 'RENEWAL_LIMIT' if $override_limit; |
| 79 |
|
75 |
|
| 80 |
if ( $error && ( $error eq 'on_reserve' ) ) { |
76 |
if ( $error && ( $error eq 'on_reserve' ) ) { |
| 81 |
if ($override_holds) { |
77 |
if ($override_holds) { |
| 82 |
$can_renew = 1; |
78 |
$can_renew = 1; |
| 83 |
$error = undef; |
79 |
$error = undef; |
| 84 |
|
80 |
push @{$confirmations}, 'ON_RESERVE'; |
| 85 |
@message = ("Override Renew hold for another"); |
|
|
| 86 |
|
| 87 |
my $infos = ( |
| 88 |
{ |
| 89 |
message => \@message, |
| 90 |
borrowernumber => $borrowernumber, |
| 91 |
barcode => $barcode, |
| 92 |
manager_id => $user, |
| 93 |
branchcode => $branchcode, |
| 94 |
} |
| 95 |
); |
| 96 |
|
| 97 |
my $json_infos = JSON->new->utf8->pretty->encode($infos); |
| 98 |
$json_infos =~ s/"/'/g; |
| 99 |
|
| 100 |
logaction( |
| 101 |
"CIRCULATION", "RENEWAL", |
| 102 |
$patron->borrowernumber, |
| 103 |
$json_infos, |
| 104 |
) if C4::Context->preference("RenewalLog"); |
| 105 |
} else { |
81 |
} else { |
| 106 |
$can_renew = 0; |
82 |
$can_renew = 0; |
| 107 |
} |
83 |
} |
|
Lines 133-159
if ( $op eq 'cud-renew' && $barcode ) {
Link Here
|
| 133 |
} |
109 |
} |
| 134 |
); |
110 |
); |
| 135 |
$template->param( date_due => $date_due ); |
111 |
$template->param( date_due => $date_due ); |
| 136 |
|
|
|
| 137 |
@message = ("Override limit Renew"); |
| 138 |
|
| 139 |
my $infos = ( |
| 140 |
{ |
| 141 |
message => \@message, |
| 142 |
borrowernumber => $borrowernumber, |
| 143 |
barcode => $barcode, |
| 144 |
manager_id => $user, |
| 145 |
branchcode => $branchcode, |
| 146 |
} |
| 147 |
); |
| 148 |
|
| 149 |
my $json_infos = JSON->new->utf8->pretty->encode($infos); |
| 150 |
$json_infos =~ s/"/'/g; |
| 151 |
|
| 152 |
logaction( |
| 153 |
"CIRCULATION", "RENEWAL", |
| 154 |
$patron->borrowernumber, |
| 155 |
$json_infos, |
| 156 |
) if C4::Context->preference("RenewalLog"); |
| 157 |
} |
112 |
} |
| 158 |
} else { |
113 |
} else { |
| 159 |
$error = "patron_restricted"; |
114 |
$error = "patron_restricted"; |