Bugzilla – Attachment 173287 Details for
Bug 22421
accountlines.issue_id is missing a foreign key constraint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22421 (follow-up): Check issue during add_credit
Bug-22421-follow-up-Check-issue-during-addcredit.patch (text/plain), 2.37 KB, created by
Emily Lamancusa (emlam)
on 2024-10-24 15:57:35 UTC
(
hide
)
Description:
Bug 22421 (follow-up): Check issue during add_credit
Filename:
MIME Type:
Creator:
Emily Lamancusa (emlam)
Created:
2024-10-24 15:57:35 UTC
Size:
2.37 KB
patch
obsolete
>From a2dad936a91c8f2193296fc4e2ae194605e7f725 Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Thu, 24 Oct 2024 11:24:11 -0400 >Subject: [PATCH] Bug 22421 (follow-up): Check issue during add_credit > >Additional handling for the case where a credit is added with an >issue_id after the issue is returned. > >add_credit will keep the same method signature, where the issue_id >parameter may now refer to a current issue or an old issue. It will then >internally determine whether it is a current or old checkout and handle >it appropriately. > >If the caller is updating an account line, or adding a credit to refund >an existing debit, they may not need to know whether it is for a current >checkout or an old checkout. In this case, they can use the account >line's ->checkout accessor to pass in the appropriate issue_id >regardless of whether it is a current or old checkout. >--- > Koha/Account.pm | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index e3a2ef7f37..41be5dd8c2 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -224,6 +224,16 @@ sub add_credit { > my $item_id = $params->{item_id}; > my $issue_id = $params->{issue_id}; > >+ my $old_issue_id; >+ if ( $issue_id ) { >+ my $issue = Koha::Checkouts->find($issue_id); >+ unless ( $issue ) { >+ my $old_issue = Koha::Old::Checkouts->find($issue_id); >+ $issue_id = undef; >+ $old_issue_id = $old_issue->id; >+ } >+ } >+ > Koha::Exceptions::Account::RegisterRequired->throw() > if ( C4::Context->preference("UseCashRegisters") > && defined($payment_type) >@@ -252,7 +262,16 @@ sub add_credit { > branchcode => $library_id, > register_id => $cash_register, > itemnumber => $item_id, >- issue_id => $issue_id, >+ ( >+ $issue_id >+ ? ( issue_id => $issue_id ) >+ : () >+ ), >+ ( >+ $old_issue_id >+ ? ( old_issue_id => $old_issue_id ) >+ : () >+ ), > } > )->store(); > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22421
:
85773
|
85774
|
85775
|
90352
|
90353
|
90354
|
90359
|
90360
|
90361
|
90362
|
90365
|
90366
|
90367
|
90368
|
161919
|
161920
|
161921
|
161922
|
161923
|
162244
|
162245
|
162246
|
162247
|
162248
|
166631
|
173287
|
173288
|
173289
|
173305
|
173790
|
173791
|
173792
|
173793
|
173794
|
173795
|
173796
|
173797
|
173798
|
173799
|
174281
|
174974