Overview
Comment:Display list of users linked to a transaction
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: a0fe66f7668506855da64ee1a7827bf5464aa76d
User & Date: bohwaz on 2020-10-01 11:21:38
Other Links: branch diff | manifest | tags
Context
2020-10-01
14:04
Refactor transaction form, add transaction editing check-in: f2c1ee8e78 user: bohwaz tags: dev
11:21
Display list of users linked to a transaction check-in: a0fe66f766 user: bohwaz tags: dev
11:12
Fix consistency and issues with multiples in input lists check-in: 48a25a7218 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [0734f7a1b0] to [1161b019a8].

260
261
262
263
264
265
266
267









		return $db->insert('acc_transactions_users', [
			'id_transaction' => $this->id(),
			'id_user'        => $user_id,
			'id_service'     => $service_id,
		]);
	}
}















|
>
>
>
>
>
>
>
>
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

		return $db->insert('acc_transactions_users', [
			'id_transaction' => $this->id(),
			'id_user'        => $user_id,
			'id_service'     => $service_id,
		]);
	}

	public function listLinkedUsers()
	{
		$db = EntityManager::getInstance(self::class)->DB();
		$identity_column = Config::getInstance()->get('champ_identite');
		$sql = sprintf('SELECT m.id, m.%s AS identity FROM membres m INNER JOIN acc_transactions_users l ON l.id_user = m.id WHERE l.id_transaction = ?;', $identity_column);
		return $db->get($sql, $this->id());
	}
}

Modified src/templates/acc/transactions/details.tpl from [4d6df636eb] to [d1e9164567].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
..
41
42
43
44
45
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68


69
70
71
72
73
74
75

<dl class="describe">
	<dt>Libellé</dt>
	<dd><h2>{$transaction.label}</h2></dd>
	<dt>Date</dt>
	<dd>{$transaction.date|date_fr:'l j F Y (d/m/Y)'}</dd>
	<dt>Numéro pièce comptable</dt>
	<dd>{if trim($transaction.numero_piece)}{$transaction.numero_piece}{else}<em>Non renseigné</em>{/if}</dd>

	<dt>Exercice</dt>
	<dd>
		<a href="{$admin_url}acc/years/year.php?id={$transaction.id_year}">{$tr_year.label}</a>
		| Du {$tr_year.start_date|date_fr:'d/m/Y'} au {$tr_year.end_date|date_fr:'d/m/Y'}
		| <strong>{if $tr_year.closed}Clôturé{else}En cours{/if}</strong>
	</dd>
................................................................................
			{/if}
		{else}
			<em>membre supprimé</em>
		{/if}
	</dd>

	<dt>Opération liée à</dt>
	<dd>
		{if empty($related_members)}
			Aucun membre n'est lié à cette opération.
		{else}
			{foreach from=$related_members item="membre"}
				<a href="{$admin_url}membres/{if $membre.id_cotisation}cotisations{else}fiche{/if}.php?id={$membre.id_membre}">{if $membre.id_cotisation}Cotisation pour {/if}{$membre.identite}</a>

			{/foreach}
		{/if}
	</dd>

	<dt>Remarques</dt>
	<dd>{if trim($transaction.notes)}{$transaction.notes}{else}<em>Non renseigné</em>{/if}</dd>

	<dt>Fichiers joints</dt>
	{foreach from=$files item="file"}
	<dd>
		<aside class="file">
			<a href="{$file.url}">{$file.nom}</a>
			<small>({$file.type}, {$file.taille|format_bytes})</small>
		</aside>
	</dd>


	{/foreach}
</dl>

<table class="list multi">
	<thead>
		<tr>
			<th colspan="2">Comptes</th>







|







 







<
|
|
|
|
<
>
|
|
<


|









>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
..
41
42
43
44
45
46
47

48
49
50
51

52
53
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

<dl class="describe">
	<dt>Libellé</dt>
	<dd><h2>{$transaction.label}</h2></dd>
	<dt>Date</dt>
	<dd>{$transaction.date|date_fr:'l j F Y (d/m/Y)'}</dd>
	<dt>Numéro pièce comptable</dt>
	<dd>{if trim($transaction.numero_piece)}{$transaction.numero_piece}{else}-{/if}</dd>

	<dt>Exercice</dt>
	<dd>
		<a href="{$admin_url}acc/years/year.php?id={$transaction.id_year}">{$tr_year.label}</a>
		| Du {$tr_year.start_date|date_fr:'d/m/Y'} au {$tr_year.end_date|date_fr:'d/m/Y'}
		| <strong>{if $tr_year.closed}Clôturé{else}En cours{/if}</strong>
	</dd>
................................................................................
			{/if}
		{else}
			<em>membre supprimé</em>
		{/if}
	</dd>

	<dt>Opération liée à</dt>

	{if empty($related_users)}
		<dd><em>Aucun membre n'est lié à cette opération.</em></dd>
	{else}
		{foreach from=$related_users item="u"}

			<dd><a href="{$admin_url}membres/fiche.php?id={$u.id}">{$u.identity}</a></dd>
		{/foreach}
	{/if}


	<dt>Remarques</dt>
	<dd>{if trim($transaction.notes)}{$transaction.notes}{else}-{/if}</dd>

	<dt>Fichiers joints</dt>
	{foreach from=$files item="file"}
	<dd>
		<aside class="file">
			<a href="{$file.url}">{$file.nom}</a>
			<small>({$file.type}, {$file.taille|format_bytes})</small>
		</aside>
	</dd>
	{foreachelse}
	<dd>-</dd>
	{/foreach}
</dl>

<table class="list multi">
	<thead>
		<tr>
			<th colspan="2">Comptes</th>

Modified src/templates/acc/transactions/new.tpl from [a2f0b252f3] to [26d128618b].

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
			</tfoot>
		</table>
	</fieldset>

	<fieldset>
		<legend>Détails</legend>
		<dl>
			{input type="list" multiple=true name="users" label="Membre associé" target="%smembres/selector.php"|args:$admin_url}
			{input type="text" name="reference" label="Numéro de pièce comptable"}
			{input type="textarea" name="notes" label="Remarques" rows=4 cols=30}

			{input type="file" name="file" label="Fichier joint"}

			{if count($analytical_accounts) > 0}
				{input type="select" name="id_analytical" label="Compte analytique (projet)" options=$analytical_accounts}







|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
			</tfoot>
		</table>
	</fieldset>

	<fieldset>
		<legend>Détails</legend>
		<dl>
			{input type="list" multiple=true name="users" label="Membres associés" target="%smembres/selector.php"|args:$admin_url}
			{input type="text" name="reference" label="Numéro de pièce comptable"}
			{input type="textarea" name="notes" label="Remarques" rows=4 cols=30}

			{input type="file" name="file" label="Fichier joint"}

			{if count($analytical_accounts) > 0}
				{input type="select" name="id_analytical" label="Compte analytique (projet)" options=$analytical_accounts}

Modified src/www/admin/acc/transactions/details.php from [201118bacb] to [30440cd5ef].

11
12
13
14
15
16
17
18


19
    throw new UserException('Cette écriture n\'existe pas');
}

$tpl->assign('files', $transaction->listFiles());
$tpl->assign('transaction', $transaction);
$tpl->assign('tr_year', $transaction->year());
$tpl->assign('creator_name', $transaction->id_creator ? (new Membres)->getNom($transaction->id_creator) : null);



$tpl->display('acc/transactions/details.tpl');








>
>

11
12
13
14
15
16
17
18
19
20
21
    throw new UserException('Cette écriture n\'existe pas');
}

$tpl->assign('files', $transaction->listFiles());
$tpl->assign('transaction', $transaction);
$tpl->assign('tr_year', $transaction->year());
$tpl->assign('creator_name', $transaction->id_creator ? (new Membres)->getNom($transaction->id_creator) : null);

$tpl->assign('related_users', $transaction->listLinkedUsers());

$tpl->display('acc/transactions/details.tpl');