Overview
Comment:Show a list of services for a user
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev | 1.0.0-alpha5
Files: files | file ages | folders
SHA1: b2c9a6a94e26c45b228f229ed44760520930c1cb
User & Date: bohwaz on 2020-11-08 03:29:16
Other Links: branch diff | manifest | tags
Context
2020-11-08
03:44
Fix wording and old links check-in: 4e0b584286 user: bohwaz tags: dev, 1.0.0-alpha5
03:29
Show a list of services for a user check-in: b2c9a6a94e user: bohwaz tags: dev, 1.0.0-alpha5
03:25
Remove unused code check-in: 91ffebb0bf user: bohwaz tags: dev
Changes

Modified src/VERSION from [981332ef90] to [2609dd7642].

1
1.0.0-alpha4
|
1
1.0.0-alpha5

Modified src/include/lib/Garradin/Services/Services_User.php from [1380a382e3] to [5d2e7d6d87].

14
15
16
17
18
19
20












21
22
23
24
25
26
27
		return EntityManager::findOneById(Service_User::class, $id);
	}

	static public function countForUser(int $user_id)
	{
		return DB::getInstance()->count(Service_User::TABLE, 'id_user = ?', $user_id);
	}













	static public function perUserList(int $user_id): DynamicList
	{
		$columns = [
			'id' => [
				'select' => 'su.id',
			],







>
>
>
>
>
>
>
>
>
>
>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
		return EntityManager::findOneById(Service_User::class, $id);
	}

	static public function countForUser(int $user_id)
	{
		return DB::getInstance()->count(Service_User::TABLE, 'id_user = ?', $user_id);
	}

	static public function listDistinctForUser(int $user_id)
	{
		return DB::getInstance()->get('SELECT
			s.label, MAX(su.expiry_date) AS expiry_date, sf.label AS fee_label, su.paid,
			CASE WHEN su.expiry_date < date() THEN -1 WHEN su.expiry_date >= date() THEN 1 ELSE 0 END AS status
			FROM services_users su
			INNER JOIN services s ON s.id = su.id_service
			INNER JOIN services_fees sf ON sf.id = su.id_fee
			WHERE su.id_user = ?
			GROUP BY su.id_service ORDER BY s.label COLLATE NOCASE;', $user_id);
	}

	static public function perUserList(int $user_id): DynamicList
	{
		$columns = [
			'id' => [
				'select' => 'su.id',
			],

Modified src/templates/admin/membres/ajouter.tpl from [0fe46b0cf5] to [eb2e304a35].

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
        <input type="submit" name="save" value="Enregistrer &rarr;" />
    </p>

</form>

<script type="text/javascript">
{literal}
g.script('scripts/password.js').onload = function () {
    initPasswordField('pw_suggest', 'f_passe', 'f_repasse');
};
{/literal}
</script>


{include file="admin/_foot.tpl"}







|

|





52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
        <input type="submit" name="save" value="Enregistrer &rarr;" />
    </p>

</form>

<script type="text/javascript">
{literal}
g.script('scripts/password.js', () => {
    initPasswordField('pw_suggest', 'f_passe', 'f_repasse');
});
{/literal}
</script>


{include file="admin/_foot.tpl"}

Modified src/templates/admin/membres/fiche.tpl from [3ed5055d5c] to [644d5d023d].

8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
            <li><a href="{$admin_url}membres/supprimer.php?id={$membre.id}">Supprimer</a></li>
        {/if}
    </ul>
</nav>

<dl class="cotisation">
    <dt>Activités et cotisations</dt>

    <dd>
        {if $nb_services == 1}
            <strong>{$nb_services}</strong> inscription à une activité
        {elseif $nb_services}
            <strong>{$nb_services}</strong> inscriptions à des activités
        {else}
            Aucune inscription à des activités
        {/if}
    </dd>

    <dd>
        {linkbutton href="services/user.php?id=%d"|args:$membre.id label="Liste des inscriptions aux activités" shape="menu"}
        {if $session->canAccess('membres', Membres::DROIT_ECRITURE)}
            {linkbutton href="services/save.php?user=%d"|args:$membre.id label="Enregistrer une activité" shape="plus"}
        {/if}
    </dd>
    {if $session->canAccess('membres', Membres::DROIT_ACCES)}







>

|
|
|
|
<
<
|

>







8
9
10
11
12
13
14
15
16
17
18
19
20


21
22
23
24
25
26
27
28
29
30
            <li><a href="{$admin_url}membres/supprimer.php?id={$membre.id}">Supprimer</a></li>
        {/if}
    </ul>
</nav>

<dl class="cotisation">
    <dt>Activités et cotisations</dt>
    {foreach from=$services item="service"}
    <dd>
        {$service.label}
        {if $service.status == -1} — <b class="error">en retard</b>
        {elseif $service.status == 1} — <b class="confirm">à jour</b>{/if}
        {if $service.status.expiry_date} — expire le {$service.expiry_date|date_short}{/if}


        {if !$service.paid} — <b class="error">À payer&nbsp;!</b>{/if}
    </dd>
    {/foreach}
    <dd>
        {linkbutton href="services/user.php?id=%d"|args:$membre.id label="Liste des inscriptions aux activités" shape="menu"}
        {if $session->canAccess('membres', Membres::DROIT_ECRITURE)}
            {linkbutton href="services/save.php?user=%d"|args:$membre.id label="Enregistrer une activité" shape="plus"}
        {/if}
    </dd>
    {if $session->canAccess('membres', Membres::DROIT_ACCES)}

Modified src/templates/admin/membres/modifier.tpl from [0adf96822d] to [05f8dcce8c].

82
83
84
85
86
87
88
89
90
91
92
93
94
95
        <input type="submit" name="save" value="Enregistrer &rarr;" />
    </p>

</form>

<script type="text/javascript">
{literal}
g.script('scripts/password.js').onload = function () {
    initPasswordField('pw_suggest', 'f_passe', 'f_repasse');
};
{/literal}
</script>

{include file="admin/_foot.tpl"}







|

|




82
83
84
85
86
87
88
89
90
91
92
93
94
95
        <input type="submit" name="save" value="Enregistrer &rarr;" />
    </p>

</form>

<script type="text/javascript">
{literal}
g.script('scripts/password.js', () => {
    initPasswordField('pw_suggest', 'f_passe', 'f_repasse');
});
{/literal}
</script>

{include file="admin/_foot.tpl"}

Modified src/templates/services/index.tpl from [37b3309b3e] to [4de4f760e9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{include file="admin/_head.tpl" title="Activités et cotisations" current="membres/services" js=1}

{include file="services/_nav.tpl" current="index" service=null fee=null}

{if isset($_GET['CREATE'])}
	<p class="block error">Vous devez déjà créer une activité pour pouvoir utiliser cette fonction.</p>
{/if}

{if count($list)}
	<table class="list">
		<thead>
			<th>Cotisation</th>
			<td>Période</td>
			<td>Membres à jour</td>
			<td>Membres expirés</td>
			<td>Membres en attente de règlement</td>
			<td></td>
		</thead>
		<tbody>











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{include file="admin/_head.tpl" title="Activités et cotisations" current="membres/services" js=1}

{include file="services/_nav.tpl" current="index" service=null fee=null}

{if isset($_GET['CREATE'])}
	<p class="block error">Vous devez déjà créer une activité pour pouvoir utiliser cette fonction.</p>
{/if}

{if count($list)}
	<table class="list">
		<thead>
			<th>Activité</th>
			<td>Période</td>
			<td>Membres à jour</td>
			<td>Membres expirés</td>
			<td>Membres en attente de règlement</td>
			<td></td>
		</thead>
		<tbody>

Modified src/templates/services/reminders/index.tpl from [9d94f0415d] to [4a30ff099e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{include file="admin/_head.tpl" title="Gestion des rappels automatiques" current="membres/services" js=1}

{include file="services/_nav.tpl" current="reminders"}

<p class="help">
	Les rappels automatiques sont envoyés aux membres disposant d'une adresse e-mail selon le délai défini. Il est possible de définir plusieurs rappels pour une même activité.
</p>

{if empty($list)}
	<p class="alert block">Aucun rappel automatique n'est configuré.</p>
{else}
	<table class="list">
		<thead>
			<td>Cotisation</td>
			<td>Délai de rappel</td>
			<th>Sujet</th>
			<td></td>
		</thead>
		<tbody>
			{foreach from=$list item="reminder"}
				<tr>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{include file="admin/_head.tpl" title="Gestion des rappels automatiques" current="membres/services" js=1}

{include file="services/_nav.tpl" current="reminders"}

<p class="help">
	Les rappels automatiques sont envoyés aux membres disposant d'une adresse e-mail selon le délai défini. Il est possible de définir plusieurs rappels pour une même activité.
</p>

{if empty($list)}
	<p class="alert block">Aucun rappel automatique n'est configuré.</p>
{else}
	<table class="list">
		<thead>
			<td>Activité</td>
			<td>Délai de rappel</td>
			<th>Sujet</th>
			<td></td>
		</thead>
		<tbody>
			{foreach from=$list item="reminder"}
				<tr>

Modified src/www/admin/acc/accounts/journal.php from [9d77473616] to [5fc15c52f2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
namespace Garradin;

use Garradin\Accounting\Accounts;
use Garradin\Accounting\Years;

require_once __DIR__ . '/../_inc.php';

$account = Accounts::get((int) qg('id'));

if (!$account) {
    throw new UserException("Le compte demandé n'existe pas.");
}

$year_id = (int) qg('year') ?: CURRENT_YEAR_ID;

if ($year_id === CURRENT_YEAR_ID) {
	$year = $current_year;
}











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
namespace Garradin;

use Garradin\Accounting\Accounts;
use Garradin\Accounting\Years;

require_once __DIR__ . '/../_inc.php';

$account = Accounts::get((int) qg('id'));

if (!$account) {
	throw new UserException("Le compte demandé n'existe pas.");
}

$year_id = (int) qg('year') ?: CURRENT_YEAR_ID;

if ($year_id === CURRENT_YEAR_ID) {
	$year = $current_year;
}

Modified src/www/admin/membres/fiche.php from [4e74c286f1] to [1ec254fd3b].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$tpl->assign('champs', $champs->getList());

$cats = new Membres\Categories;

$categorie = $cats->get($membre->id_categorie);
$tpl->assign('categorie', $categorie);

$tpl->assign('nb_services', Services_User::countForUser($membre->id));

if ($session->canAccess('compta', Membres::DROIT_ACCES)) {
	$tpl->assign('transactions_linked', Transactions::countForUser($membre->id));
	$tpl->assign('transactions_created', Transactions::countForCreator($membre->id));
}

$tpl->assign('membre', $membre);

$tpl->display('admin/membres/fiche.tpl');







|









21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$tpl->assign('champs', $champs->getList());

$cats = new Membres\Categories;

$categorie = $cats->get($membre->id_categorie);
$tpl->assign('categorie', $categorie);

$tpl->assign('services', Services_User::listDistinctForUser($membre->id));

if ($session->canAccess('compta', Membres::DROIT_ACCES)) {
	$tpl->assign('transactions_linked', Transactions::countForUser($membre->id));
	$tpl->assign('transactions_created', Transactions::countForCreator($membre->id));
}

$tpl->assign('membre', $membre);

$tpl->display('admin/membres/fiche.tpl');

Modified src/www/admin/static/admin.css from [46007bb6d0] to [6c42e24a96].

368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
    outline: 0;
}

input:not(:placeholder-shown):focus:invalid {
    border-color: #f33;
}

input[type=password], input.clearTextPassword {
    font-family: monospace;
}

input.time {
    text-align: center;
    padding: .2em 0;
}

input[type=submit], input[type=button], input[type=checkbox], button {
    padding: 0.3em;







<
<
<
<







368
369
370
371
372
373
374




375
376
377
378
379
380
381
    outline: 0;
}

input:not(:placeholder-shown):focus:invalid {
    border-color: #f33;
}





input.time {
    text-align: center;
    padding: .2em 0;
}

input[type=submit], input[type=button], input[type=checkbox], button {
    padding: 0.3em;
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
}

input.resetButton {
    padding: .1em;
    margin-left: 1em;
}

input[type=button].showPassword {
    position: absolute;
    margin-left: -2em;
    margin-right: 1em;
    background: none;
    margin-top: .1em;
}

input[type=button].showPassword:hover {
    background: none;
}

select, input[size], input[type=color], button, input[type=button], input[type=submit] {
    min-width: 0 !important;
}

form .radio-btn {
    display: flex;
}







<
<
<
<
<
<
<
<
<
<
<
<







389
390
391
392
393
394
395












396
397
398
399
400
401
402
}

input.resetButton {
    padding: .1em;
    margin-left: 1em;
}













select, input[size], input[type=color], button, input[type=button], input[type=submit] {
    min-width: 0 !important;
}

form .radio-btn {
    display: flex;
}
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
form .input-list .label button {
    padding: .2rem;
    border: none;
    background: none;
}

input[readonly] {
    color: #666;
    background-color: #eee;
}

input.money {
    text-align: right;
}

input.money + b {







|
|







459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
form .input-list .label button {
    padding: .2rem;
    border: none;
    background: none;
}

input[readonly] {
    color: #666 !important;
    background-color: #eee !important;
}

input.money {
    text-align: right;
}

input.money + b {