Skip to content

Commit 8fb1e68

Browse files
author
roger
committed
Wrong commit fixed.
1 parent 19bf897 commit 8fb1e68

20 files changed

+756
-8161
lines changed

Koha/Plugin/Com/LMSCloud/LatePaymentClaiming/LatePaymentClaiming/CheckExecution.pm renamed to Koha/Plugin/Com/LMSCloud/LatePaymentClaiming/CheckExecution.pm

File renamed without changes.

Koha/Plugin/Com/LMSCloud/LatePaymentClaiming/LatePaymentClaiming.pm

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,12 @@ sub claimPatronsOfAllConfigurations {
143143
my $claimPatron = $claimPatrons->{$patron_id};
144144

145145
if ( $claimPatron->{claim_id} ) {
146-
$dbh->do("UPDATE lmsc_late_payment_claim SET branchcode = ?, categorycode = ?, level = ?",
146+
$dbh->do("UPDATE lmsc_late_payment_claim SET branchcode = ?, categorycode = ?, level = ? WHERE id = ?",
147147
undef,
148148
$claimPatron->{library_id},
149149
$claimPatron->{category_id},
150-
$claimPatron->{level});
150+
$claimPatron->{level},
151+
$claimPatron->{claim_id});
151152
}
152153
else {
153154
$dbh->do("INSERT INTO lmsc_late_payment_claim (borrowernumber, branchcode, categorycode, creationdate, level, state) VALUES (?,?,?,now(),?,?)",
@@ -559,5 +560,35 @@ sub getLatePaymentClaimHistory {
559560
return { late_payment_claims => $claimhistory, count => scalar(@$claimhistory), full_count => $count, page => $page, page_count => $page_count};
560561
}
561562

563+
sub closePaidLatePaymentClaim {
564+
my $self = shift;
565+
my $patron = shift;
566+
my $claim = shift;
567+
my $unbanActions = shift;
568+
569+
my $dbh = C4::Context->dbh;
570+
my $json = JSON->new->allow_nonref;
571+
572+
$dbh->do("UPDATE lmsc_late_payment_claim SET branchcode = ?, categorycode = ?, state = ? WHERE id = ?",
573+
undef,
574+
$patron->branchcode,
575+
$patron->categorycode,
576+
'closed',
577+
$claim->{id});
578+
579+
$dbh->do("INSERT INTO lmsc_late_payment_claim_history (claim_id,action,level,amountoutstanding,ban_actions) VALUES (?,?,?,?,?)",
580+
undef,
581+
$claim->{id},
582+
'paid',
583+
$claim->{level},
584+
$patron->account->balance,
585+
$json->encode( $unbanActions )
586+
);
587+
588+
my $doActions = Koha::Plugin::Com::LMSCloud::LatePaymentClaiming::BanActions->new();
589+
$doActions->executeBanActions($patron->borrowernumber,$claim->{id},$claim->{level},$unbanActions);
590+
591+
}
592+
562593
1;
563594

0 commit comments

Comments
 (0)