{# Bloc "Dernières opérations SSA" d'un adhérent. Variables attendues : - ssa (SolidoumeParameter) : la caisse SSA courante - operations (optionnel) : liste d'opérations pré-calculée (Operation[]) ; si absente, les opérations eMLc de la caisse sont chargées automatiquement via getLastOperations(). Ce bloc affiche deux types d'entrées dans le même tableau, triés par date décroissante : 1. Opérations SSA eMLc (prélèvements sur achats, remboursements) → objets Operation, avec operation.flux pour les métadonnées. → chargées via getLastOperations() avec filtre CURRENCY_EMLC + ssa. 2. Cotisations SSA de l'adhérent (paiement mensuel vers la caisse) → objets CotisationSsaAdherent (sous-classe de Flux), accédés directement. → chargées et fusionnées via getLastSsaAllEntriesForCurrentAdherent(). → IMPORTANT : les cotisations en euros (CB, HelloAsso, SEPA, virement, espèces, chèque) ne génèrent qu'une opération côté prestataire (caisse), et aucune opération côté adhérent. Sans cette section, elles seraient invisibles ici. → Les cotisations eMLc sont exclues (elles apparaissent déjà en section 1). La liste finale est triée par date décroissante (la plus récente en premier), quel que soit le type de l'entrée, grâce à getLastSsaAllEntriesForCurrentAdherent(). #} {% set operations = operations|default(getLastOperations(app.request, app.user, constant('App\\Enum\\CurrencyEnum::CURRENCY_EMLC'), ssa)) %} {% set title = title|default('%name% : Dernières opérations'|trans({'%name%': ssa.name})) %} {# Liste unifiée eMLc + cotisations euros, triée par date décroissante (plus récent en premier). getLastSsaAllEntriesForCurrentAdherent() fusionne et trie les deux sources en PHP. Retourne [] si l'utilisateur n'est pas un adhérent connecté. Chaque entrée : { 'isOperation': bool, 'date': DateTime, 'object': Operation|Flux } #} {% set allEntries = getLastSsaAllEntriesForCurrentAdherent(ssa, operations) %} {% extends '@kohinos/block/block_collapse.html.twig' %} {% block blocktitle %} {{ title }} {% endblock blocktitle %} {% block blocksubtitle %} {% endblock blocksubtitle %} {% block blockcontent %} {% if allEntries|length > 0 %}
| Date | Type | Opération | Montant |
|---|---|---|---|
| {{ operation.createdAt|date('d/m/Y') }} | {{ ((isCurrentAccountable(app.user, operation.flux.expediteur) ? 'exp' : 'des')~'_'~operation.flux.parenttype)|trans({}, 'flux') }} | {% if not isCurrentAccountable(app.user, operation.flux.expediteur) %} {% if operation.flux.expediteur is instanceof("App\\Entity\\Prestataire") and is_callable(operation.flux, 'getSolidoumeParameter') and operation.flux.solidoumeParameter != null %} {{ getSsaParam(ssa, 'name')|default('Sécurité Sociale Alimentaire') }} {% else %} {{ operation.flux.expediteur }} {% endif %} {% elseif not isCurrentAccountable(app.user, operation.flux.destinataire) %} {% if operation.flux.destinataire is instanceof("App\\Entity\\Prestataire") and is_callable(operation.flux, 'getSolidoumeParameter') and operation.flux.solidoumeParameter != null and operation.flux.solidoumeParameter.manager.id == operation.flux.destinataire.id %} {{ getSsaParam(ssa, 'name')|default('Sécurité Sociale Alimentaire') }} {% else %} {{ operation.flux.destinataire }} {% endif %} {% endif %} | {{ (operation.montant < 0)? '- ':'+ ' }} {{ operation.montant|abs|number_format(2) }} {{ getCurrencyName(operation.currency) }} |
|
{{ 'Référence'|trans }} :
{{ operation.flux.reference }}
·
{{ 'Moyen'|trans }} :
{{ operation.flux.moyen|trans }}
{% if operation.flux.moyen == constant('App\\Enum\\MoyenEnum::MOYEN_HELLOASSO') %}
{% set urlTicket = getPaymentReceiptUrlFromFlux(operation.flux) %}
{% if urlTicket is not empty %}
·
{{ 'Ticket CB'|trans }}
{% endif %}
{% endif %}
|
|||
| {{ cotisation.createdAt|date('d/m/Y') }} | {{ 'exp_cotisation_ssa'|trans({}, 'flux') }} | {{ getSsaParam(ssa, 'name')|default('Sécurité Sociale Alimentaire') }} | {# Montant : toujours un débit pour l'adhérent. Devise toujours Euro. #}- {{ cotisation.montant|abs|number_format(2) }} {{ getCurrencyName(constant('App\\Enum\\CurrencyEnum::CURRENCY_EURO')) }} |
|
{{ 'Référence'|trans }} :
{{ cotisation.reference }}
·
{{ 'Moyen'|trans }} :
{{ cotisation.moyen|trans }}
{% if cotisation.moyen == constant('App\\Enum\\MoyenEnum::MOYEN_HELLOASSO') %}
{# getPaymentReceiptUrlFromFlux accepte tout objet Flux #}
{% set urlTicket = getPaymentReceiptUrlFromFlux(cotisation) %}
{% if urlTicket is not empty %}
·
{{ 'Ticket CB'|trans }}
{% endif %}
{% endif %}
|
|||