Lines 61-66
use Koha::Config::SysPrefs;
Link Here
|
61 |
use Koha::Charges::Fees; |
61 |
use Koha::Charges::Fees; |
62 |
use Koha::Util::SystemPreferences; |
62 |
use Koha::Util::SystemPreferences; |
63 |
use Koha::Checkouts::ReturnClaims; |
63 |
use Koha::Checkouts::ReturnClaims; |
|
|
64 |
use Koha::Exceptions::Checkout; |
64 |
use Carp; |
65 |
use Carp; |
65 |
use List::MoreUtils qw( uniq any ); |
66 |
use List::MoreUtils qw( uniq any ); |
66 |
use Scalar::Util qw( looks_like_number ); |
67 |
use Scalar::Util qw( looks_like_number ); |
Lines 2961-2973
sub AddRenewal {
Link Here
|
2961 |
|
2962 |
|
2962 |
# Update the issues record to have the new due date, and a new count |
2963 |
# Update the issues record to have the new due date, and a new count |
2963 |
# of how many times it has been renewed. |
2964 |
# of how many times it has been renewed. |
2964 |
my $renews = $issue->renewals + 1; |
2965 |
my $renews = ( $issue->renewals || 0 ) + 1; |
2965 |
my $sth = $dbh->prepare("UPDATE issues SET date_due = ?, renewals = ?, lastreneweddate = ? |
2966 |
my $sth = $dbh->prepare("UPDATE issues SET date_due = ?, renewals = ?, lastreneweddate = ? WHERE issue_id = ?"); |
2966 |
WHERE borrowernumber=? |
|
|
2967 |
AND itemnumber=?" |
2968 |
); |
2969 |
|
2967 |
|
2970 |
$sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber ); |
2968 |
eval{ |
|
|
2969 |
$sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $issue->issue_id ); |
2970 |
}; |
2971 |
if( $sth->err ){ |
2972 |
Koha::Exceptions::Checkout::FailedRenewal->throw( |
2973 |
error => 'Update of issue# ' . $issue->issue_id . ' failed with error: ' . $sth->errstr |
2974 |
); |
2975 |
} |
2971 |
|
2976 |
|
2972 |
# Update the renewal count on the item, and tell zebra to reindex |
2977 |
# Update the renewal count on the item, and tell zebra to reindex |
2973 |
$renews = $item_object->renewals + 1; |
2978 |
$renews = $item_object->renewals + 1; |