{{ log.raw_request }}
- diff --git a/lib/GaletteHelloasso/Controllers/HelloassoController.php b/lib/GaletteHelloasso/Controllers/HelloassoController.php index 241dbd2..d8f2950 100644 --- a/lib/GaletteHelloasso/Controllers/HelloassoController.php +++ b/lib/GaletteHelloasso/Controllers/HelloassoController.php @@ -416,6 +416,12 @@ public function webhook(Request $request, Response $response): Response return $response->withStatus(500, 'Internal error'); } return $response->withStatus(200); + } else { + Analog::log( + 'A Helloasso payment has been successfully stored as a public donation', + Analog::DEBUG + ); + $hh->setState(HelloassoHistory::STATE_PUBLIC); } } return $response->withStatus(200); diff --git a/lib/GaletteHelloasso/HelloassoHistory.php b/lib/GaletteHelloasso/HelloassoHistory.php index af83573..a2b3e6d 100644 --- a/lib/GaletteHelloasso/HelloassoHistory.php +++ b/lib/GaletteHelloasso/HelloassoHistory.php @@ -16,6 +16,7 @@ use Galette\Core\Login; use Galette\Core\History; use Galette\Core\Preferences; +use Galette\Entity\Adherent; use Galette\Filters\HistoryList; /** @@ -32,7 +33,8 @@ class HelloassoHistory extends History public const int STATE_NONE = 0; public const int STATE_PROCESSED = 1; public const int STATE_ERROR = 2; - public const int STATE_ALREADYDONE = 3; + public const int STATE_PUBLIC = 3; + public const int STATE_ALREADYDONE = 4; private int $id; @@ -123,7 +125,6 @@ public function getHelloassoHistory(): array { $orig = $this->getHistory(); $new = []; - $dedup = []; if (count($orig) > 0) { foreach ($orig as $o) { try { @@ -133,13 +134,11 @@ public function getHelloassoHistory(): array $oa = Galette::jsonDecode($o['request']); } + $member_id = $oa['metadata']['member_id'] ?? 0; + + $o['member_fullname'] = $this->getMemberFullName($member_id); $o['raw_request'] = print_r($oa, true); $o['request'] = $oa; - if (in_array($o['checkout_id'], $dedup)) { - $o['duplicate'] = true; - } else { - $dedup[] = $o['checkout_id']; - } $new[] = $o; } catch (\Exception $e) { @@ -154,6 +153,28 @@ public function getHelloassoHistory(): array return $new; } + /** + * Gets Member full name + * + * @param int $id ID of the member to retrieve + */ + protected function getMemberFullName(int $id): string + { + $fullname = _T('None', 'helloasso'); + + $select = $this->zdb->select(Adherent::TABLE); + $select->columns(['prenom_adh', 'nom_adh']); + $select->where(['id_adh' => $id]); + $result = $this->zdb->execute($select); + $row = $result->current(); + + if ($row) { + $fullname = mb_strtoupper($row['nom_adh']) . ' ' . $row['prenom_adh']; + } + + return $fullname; + } + /** * Builds the order clause * @@ -181,7 +202,7 @@ public function isProcessed(array $request): bool $select->where( [ 'checkout_id' => $request['data']['id'], - 'state' => self::STATE_PROCESSED + 'state' => [self::STATE_PROCESSED, self::STATE_PUBLIC] ] ); $results = $this->zdb->execute($select); diff --git a/scripts/upgrade-to-1.1.0-mysql.sql b/scripts/upgrade-to-1.1.0-mysql.sql new file mode 100644 index 0000000..41f7b36 --- /dev/null +++ b/scripts/upgrade-to-1.1.0-mysql.sql @@ -0,0 +1,7 @@ +-- +-- This file is part of Galette Helloasso plugin (https://galette-community.github.io/plugin-helloasso). +-- SPDX-FileCopyrightText: Copyright © 2025-2026 The Galette Team +-- SPDX-License-Identifier: GPL-3.0-or-later +-- + +UPDATE galette_helloasso_history SET state = 3 WHERE state = 0; diff --git a/scripts/upgrade-to-1.1.0-pgsql.sql b/scripts/upgrade-to-1.1.0-pgsql.sql new file mode 100644 index 0000000..41f7b36 --- /dev/null +++ b/scripts/upgrade-to-1.1.0-pgsql.sql @@ -0,0 +1,7 @@ +-- +-- This file is part of Galette Helloasso plugin (https://galette-community.github.io/plugin-helloasso). +-- SPDX-FileCopyrightText: Copyright © 2025-2026 The Galette Team +-- SPDX-License-Identifier: GPL-3.0-or-later +-- + +UPDATE galette_helloasso_history SET state = 3 WHERE state = 0; diff --git a/templates/default/helloasso_history.html.twig b/templates/default/helloasso_history.html.twig index 58f7d04..3ff6762 100644 --- a/templates/default/helloasso_history.html.twig +++ b/templates/default/helloasso_history.html.twig @@ -36,18 +36,37 @@ 'collapse': true }, { - 'label': _T("Name"), + 'label': _T("Payment nb.", "helloasso"), 'collapse': true }, { - 'label': _T("Subject"), + 'label': _T("Payer name", "helloasso"), + 'collapse': true + }, + { + 'label': _T("Member"), + 'collapse': true + }, + { + 'label': _T("Contribution type"), 'collapse': true }, { 'label': _T("Amount"), 'collapse': true }, - {'label': _T("Request", "helloasso")} + { + 'label': _T("Method", "helloasso"), + 'collapse': true + }, + { + 'label': _T("Status", "helloasso"), + 'collapse': true + }, + { + 'label': _T("Actions"), + 'collapse': true + } ] %} {{ parent() }} {% endblock %} @@ -63,19 +82,23 @@
{{ log.raw_request }}
- {{ log.raw_request }}
+