From 3546d035aca0ff82458691edf6dde5bec5ff7ad9 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Fri, 9 Nov 2018 11:33:59 -0300
Subject: [PATCH] Bug 21801: Make paycollect.pl pass library_id when calling
 ->pay

This patch makes paycollect store the branchcode of the current library
when payments are done.

- Try all the possible options, specially selecting things to pay for (not
using the individual buttons).
- Check on the DB, that the  accountlines for the patron you're playin
with have the branchcode stored correctly in all cases:
  $ sudo koha-mysql kohadev
  > SELECT * FROM accountlines WHERE borrowernumber=<the_bn>;
=> SUCCESS: Things are as expected
- SIgn off :-D
---
 members/paycollect.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/members/paycollect.pl b/members/paycollect.pl
index a15267fa3d..e23c298caf 100755
--- a/members/paycollect.pl
+++ b/members/paycollect.pl
@@ -156,6 +156,7 @@ if ( $total_paid and $total_paid ne '0.00' ) {
                     {
                         type         => $type,
                         amount       => $total_paid,
+                        library_id   => $branch,
                         lines        => \@lines,
                         note         => $note,
                         payment_type => $payment_type,
@@ -167,6 +168,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,
                     }
-- 
2.19.1