From 802619791ea006efba3aabe9a4c96b5f304a5afb Mon Sep 17 00:00:00 2001
From: Lucas Gass <lucas@bywatersolutions.com>
Date: Tue, 11 Feb 2020 22:56:53 +0000
Subject: [PATCH] Bug 24637: Add brancode in all pay circumstances

To TEST:
1. Have some fines. Pay them using the Pay Amount or Pay Selected buttons.
2. SELECT branchcode FROM accountlines where borrowernumber = '{borrowernumber}';
3. See that branchcode is NULL
4. Apply patch and restart_all
5. Make a partial payment using both the Pay select and Pay amount buttons.
6. SELECT branchcode FROM accountlines where borrowernumber = '{borrowernumber}';
7. Now you should see the branchcodes in the table and no NULL values.

Signed-off-by: Benjamin Daeuber <bdaeuber@fargolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 members/paycollect.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/members/paycollect.pl b/members/paycollect.pl
index e11b37e660..0f9e53fae6 100755
--- a/members/paycollect.pl
+++ b/members/paycollect.pl
@@ -158,6 +158,7 @@ if ( $total_paid and $total_paid ne '0.00' ) {
                     {
                         type         => $type,
                         amount       => $total_paid,
+                        library_id   => $branch,
                         lines        => \@lines,
                         note         => $note,
                         interface    => C4::Context->interface,
@@ -170,6 +171,7 @@ if ( $total_paid and $total_paid ne '0.00' ) {
                 Koha::Account->new( { patron_id => $borrowernumber } )->pay(
                     {
                         amount       => $total_paid,
+                        library_id   => $branch,
                         note         => $note,
                         payment_type => $payment_type,
                         interface    => C4::Context->interface
-- 
2.20.1