Index: src/include/lib/Garradin/Entities/Services/Service_User.php
==================================================================
--- src/include/lib/Garradin/Entities/Services/Service_User.php
+++ src/include/lib/Garradin/Entities/Services/Service_User.php
@@ -124,11 +124,11 @@
$su = new self;
$su->date = new \DateTime;
$su->importForm($source);
- if ($su->fee() && $su->id_user) {
+ if ($su->fee()->id_account && $su->id_user) {
$su->expected_amount = $su->fee()->getAmountForUser($su->id_user);
}
if ($su->fee()->id_account && !empty($source['amount'])) {
$su->addPayment($user_id, $source);
Index: src/include/lib/Garradin/Services/Services_User.php
==================================================================
--- src/include/lib/Garradin/Services/Services_User.php
+++ src/include/lib/Garradin/Services/Services_User.php
@@ -46,14 +46,10 @@
],
'date' => [
'label' => 'Date d\'inscription',
'select' => 'su.date',
],
- 'status' => [
- 'label' => 'Statut',
- 'select' => 'CASE WHEN su.expiry_date < date() THEN -1 WHEN su.expiry_date >= date() THEN 1 ELSE 0 END',
- ],
'expiry' => [
'label' => 'Date d\'expiration',
'select' => 'MAX(su.expiry_date)',
],
'fee' => [
Index: src/templates/admin/_head.tpl
==================================================================
--- src/templates/admin/_head.tpl
+++ src/templates/admin/_head.tpl
@@ -91,21 +91,20 @@
{if $session->canAccess('wiki', Membres::DROIT_ACCES)}
✎ Wiki
{/if}
{if $session->canAccess('config', Membres::DROIT_ADMIN)}
☸ Configuration
{/if}
- 👤 Mes infos personnelles
+
+ 👤 Mes infos personnelles
{if !defined('Garradin\LOCAL_LOGIN') || !LOCAL_LOGIN}
⤝ Déconnexion
{/if}
DELETED src/templates/admin/mes_cotisations.tpl
Index: src/templates/admin/mes_cotisations.tpl
==================================================================
--- src/templates/admin/mes_cotisations.tpl
+++ src/templates/admin/mes_cotisations.tpl
@@ -1,58 +0,0 @@
-{include file="admin/_head.tpl" title="Mes cotisations" current="mes_cotisations"}
-
-
- -
- {if $nb_activites == 1}
- Vous avez {$nb_activites} cotisation enregistrée.
- {elseif $nb_activites}
- Vous avez {$nb_activites} cotisations enregistrées.
- {else}
- Vous n'avez aucune cotisation enregistrée.
- {/if}
-
-{if !empty($cotisations_membre)}
- - Cotisations en cours
- {foreach from=$cotisations_membre item="co"}
- - {$co.intitule} —
- {if $co.a_jour}
- À jour{if $co.expiration} — Expire le {$co.expiration|format_sqlite_date_to_french}{/if}
- {else}
- En retard
- {/if}
-
- {/foreach}
-{/if}
-
-
-{if !empty($cotisations)}
-
-
Historique des cotisations
-
-
-
-
- Date |
- Cotisation |
-
-
- {foreach from=$cotisations item="c"}
-
- {$c.date|format_sqlite_date_to_french} |
-
- {$c.intitule} —
- {if $c.duree}
- {$c.duree} jours
- {elseif $c.debut}
- du {$c.debut|format_sqlite_date_to_french} au {$c.fin|format_sqlite_date_to_french}
- {else}
- ponctuelle
- {/if}
- — {$c.montant|escape|html_money} {$config.monnaie}
- |
-
- {/foreach}
-
-
-{/if}
-
-{include file="admin/_foot.tpl"}
ADDED src/templates/my_services.tpl
Index: src/templates/my_services.tpl
==================================================================
--- src/templates/my_services.tpl
+++ src/templates/my_services.tpl
@@ -0,0 +1,45 @@
+{include file="admin/_head.tpl" title="Mes activités & cotisations" current="my_services"}
+
+
+ - Mes activités et cotisations
+ {foreach from=$services item="service"}
+ -
+ {$service.label}
+ {if $service.status == -1} — en retard
+ {elseif $service.status == 1} — à jour{/if}
+ {if $service.status.expiry_date} — expire le {$service.expiry_date|date_short}{/if}
+ {if !$service.paid} — À payer !{/if}
+
+ {foreachelse}
+ -
+ Vous n'êtes inscrit à aucune activité ou cotisation.
+
+ {/foreach}
+
+
+{if $list->count()}
+
+ Historique des inscriptions
+
+ {include file="common/dynamic_list_head.tpl"}
+
+ {foreach from=$list->iterate() item="row"}
+
+ {$row.label} |
+ {$row.date|date_short} |
+ {$row.expiry|date_short} |
+ {$row.fee} |
+ {if $row.paid}Oui{else}Non{/if} |
+ {$row.amount|raw|money_currency} |
+
+ |
+
+ {/foreach}
+
+
+
+
+ {pagination url=$list->paginationURL() page=$list.page bypage=$list.per_page total=$list->count()}
+{/if}
+
+{include file="admin/_foot.tpl"}
Index: src/templates/services/user.tpl
==================================================================
--- src/templates/services/user.tpl
+++ src/templates/services/user.tpl
@@ -6,10 +6,24 @@
{form_errors}
+ - Statut des inscriptions
+ {foreach from=$services item="service"}
+ -
+ {$service.label}
+ {if $service.status == -1} — en retard
+ {elseif $service.status == 1} — à jour{/if}
+ {if $service.status.expiry_date} — expire le {$service.expiry_date|date_short}{/if}
+ {if !$service.paid} — À payer !{/if}
+
+ {foreachelse}
+ -
+ Aucune inscription.
+
+ {/foreach}
- Nombre d'inscriptions pour ce membre
-
{$list->count()}
@@ -18,19 +32,10 @@
{foreach from=$list->iterate() item="row"}
{$row.label} |
{$row.date|date_short} |
-
- {if $row.status == 1}
- À jour
- {elseif $row.status == -1}
- En retard
- {else}
- Pas d'expiration
- {/if}
- |
{$row.expiry|date_short} |
{$row.fee} |
{if $row.paid}Oui{else}Non{/if} |
{$row.amount|raw|money_currency} |
DELETED src/www/admin/mes_cotisations.php
Index: src/www/admin/mes_cotisations.php
==================================================================
--- src/www/admin/mes_cotisations.php
+++ src/www/admin/mes_cotisations.php
@@ -1,19 +0,0 @@
-assign('membre', $user);
-
-$cats = new Membres\Categories;
-
-$categorie = $cats->get($user->id_categorie);
-$tpl->assign('categorie', $categorie);
-
-$cotisations = new Membres\Cotisations;
-
-$tpl->assign('nb_activites', $cotisations->countForMember($user->id));
-$tpl->assign('cotisations', $cotisations->listForMember($user->id));
-$tpl->assign('cotisations_membre', $cotisations->listSubscriptionsForMember($user->id));
-
-$tpl->display('admin/mes_cotisations.tpl');
ADDED src/www/admin/my_services.php
Index: src/www/admin/my_services.php
==================================================================
--- src/www/admin/my_services.php
+++ src/www/admin/my_services.php
@@ -0,0 +1,17 @@
+assign('membre', $user);
+
+$list = Services_User::perUserList($user->id);
+$list->loadFromQueryString();
+
+$tpl->assign(compact('list'));
+
+$tpl->assign('services', Services_User::listDistinctForUser($user->id));
+
+$tpl->display('my_services.tpl');
Index: src/www/admin/services/user.php
==================================================================
--- src/www/admin/services/user.php
+++ src/www/admin/services/user.php
@@ -24,8 +24,9 @@
}, null, ADMIN_URL . 'services/user.php?id=' . $user->id);
$list = Services_User::perUserList($user->id);
$list->loadFromQueryString();
+$tpl->assign('services', Services_User::listDistinctForUser($user->id));
$tpl->assign(compact('list', 'user'));
$tpl->display('services/user.tpl');
|