From 807a021d1b775744bb9ee0eee774485086db56af Mon Sep 17 00:00:00 2001
From: Yvon Kerdoncuff <yvon@ik.me>
Date: Tue, 19 Nov 2024 10:23:12 +0100
Subject: [PATCH] #7126 ccas transactions export : fix messed up intermediate total lines

---
 src/Command/SendCcasTransactionsExportToPrestatairesCommand.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Command/SendCcasTransactionsExportToPrestatairesCommand.php b/src/Command/SendCcasTransactionsExportToPrestatairesCommand.php
index d6fc81c..569d4dc 100644
--- a/src/Command/SendCcasTransactionsExportToPrestatairesCommand.php
+++ b/src/Command/SendCcasTransactionsExportToPrestatairesCommand.php
@@ -145,12 +145,13 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
             //Write intermediate total line before moving to next client
             if ($previousAnonymousToken !== $row['anonymous_token']) {
                 $this->fputcsvSeparatedBySemicolon($file, [
-                    'TOTAL ' . $row['anonymous_token'],
+                    'TOTAL ' . $previousAnonymousToken,
                     $clientTotal,
                     $nf->format($clientTotal),
                     '',
                 ]);
                 $clientTotal = 0;
+                $previousAnonymousToken = $row['anonymous_token'];
             }
             //Write transaction line
             $this->fputcsvSeparatedBySemicolon($file, [
--
libgit2 0.26.0