From f157673e9154e6462f434b0be32a8cb82537d2f0 Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Tue, 14 Dec 2021 09:12:57 +0100
Subject: [PATCH] fix: quiqqer/invoice#122

---
 ajax/invoices/addPayment.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/ajax/invoices/addPayment.php b/ajax/invoices/addPayment.php
index 6bfa9cb..d339b58 100644
--- a/ajax/invoices/addPayment.php
+++ b/ajax/invoices/addPayment.php
@@ -19,7 +19,7 @@
     'package_quiqqer_invoice_ajax_invoices_addPayment',
     function ($invoiceId, $amount, $paymentMethod, $date) {
         $Invoices = QUI\ERP\Accounting\Invoice\Handler::getInstance();
-        $Payment  = Payments::getInstance()->getPayment($paymentMethod);
+        $Payment = Payments::getInstance()->getPayment($paymentMethod);
 
         try {
             $Invoice = $Invoices->getInvoice($invoiceId);
@@ -30,7 +30,7 @@ function ($invoiceId, $amount, $paymentMethod, $date) {
         // create the transaction
         TransactionFactory::createPaymentTransaction(
             $amount,
-            QUI\ERP\Defaults::getCurrency(),
+            $Invoice->getCurrency(),
             $Invoice->getHash(),
             $Payment->getPaymentType()->getName(),
             [],
@@ -39,6 +39,11 @@ function ($invoiceId, $amount, $paymentMethod, $date) {
             $Invoice->getGlobalProcessId()
         );
     },
-    ['invoiceId', 'amount', 'paymentMethod', 'date'],
+    [
+        'invoiceId',
+        'amount',
+        'paymentMethod',
+        'date'
+    ],
     'Permission::checkAdminUser'
 );
-- 
GitLab