Overview
Comment: | Add ability to link a transaction to a subscription |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA3-256: |
25ce73a144b79825e8d977ec985da27c |
User & Date: | bohwaz on 2022-01-03 22:37:33 |
Other Links: | manifest | tags |
Context
2022-01-03
| ||
22:45 | Make the code slightly more readable as it can be confusing check-in: a748888b58 user: bohwaz tags: trunk, stable | |
22:37 | Add ability to link a transaction to a subscription check-in: 25ce73a144 user: bohwaz tags: trunk, stable | |
22:36 | In transaction edit, also delete users linked with a subscription check-in: a321f6d304 user: bohwaz tags: trunk, stable | |
Changes
Modified src/templates/acc/transactions/service_user.tpl from [46d5909f35] to [99377e25a1].
1 2 3 | {include file="admin/_head.tpl" title="Écritures liées à une inscription" current="acc/accounts"} <nav class="tabs"> | | | > > > > > > | | | | | | | | | | | | | | | | | | | | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 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 40 | {include file="admin/_head.tpl" title="Écritures liées à une inscription" current="acc/accounts"} <nav class="tabs"> {linkbutton href="!membres/fiche.php?id=%d"|args:$user_id label="Retour à la fiche membre" shape="left"} {linkbutton href="!services/user/payment.php?id=%d"|args:$service_user_id label="Nouveau règlement" shape="plus" target="_dialog"} {if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ)} {linkbutton href="!services/user/link.php?id=%d"|args:$service_user_id label="Lier à une écriture" shape="check" target="_dialog"} {/if} </nav> {if empty($balance)} <p class="alert block">Aucune écriture n'est liée à cette inscription.</p> {else} {include file="acc/reports/_journal.tpl"} <h2 class="ruler">Solde des comptes</h2> <table class="list"> <thead> <tr> <td>Numéro</td> <th>Compte</th> <td class="money">Solde débiteur</td> <td class="money">Solde créditeur</td> </tr> </thead> <tbody> {foreach from=$balance item="account"} <tr> <td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}">{$account.code}</a></td> <th>{$account.label}</th> <td class="money">{if $account.sum < 0}{$account.sum|raw|money}{/if}</td> <td class="money">{if $account.sum > 0}{$account.sum|raw|money}{/if}</td> </tr> {/foreach} </tbody> </table> {/if} {include file="admin/_foot.tpl"} |
Modified src/templates/services/user/index.tpl from [2114430dba] to [82ae91a563].
︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | <th>{$row.label}</th> <td>{$row.date|date_short}</td> <td>{$row.expiry|date_short}</td> <td>{$row.fee}</td> <td>{if $row.paid}<b class="confirm">Oui</b>{else}<b class="error">Non</b>{/if}</td> <td>{$row.amount|raw|money_currency}</td> <td class="actions"> {if $session->canAccess($session::SECTION_USERS, $session::ACCESS_WRITE)} {if $row.paid} {linkbutton shape="reset" label="Marquer comme non payé" href="?id=%d&su_id=%d&paid=0"|args:$user.id,$row.id} {else} {linkbutton shape="check" label="Marquer comme payé" href="?id=%d&su_id=%d&paid=1"|args:$user.id,$row.id} {/if} {linkbutton shape="edit" label="Modifier" href="edit.php?id=%d"|args:$row.id} {linkbutton shape="delete" label="Supprimer" href="delete.php?id=%d"|args:$row.id} {/if} | > > > > > > > > > < < < < < < | 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 76 77 78 79 80 | <th>{$row.label}</th> <td>{$row.date|date_short}</td> <td>{$row.expiry|date_short}</td> <td>{$row.fee}</td> <td>{if $row.paid}<b class="confirm">Oui</b>{else}<b class="error">Non</b>{/if}</td> <td>{$row.amount|raw|money_currency}</td> <td class="actions"> {if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE) && $row.id_account} {linkbutton shape="plus" label="Nouveau règlement" href="payment.php?id=%d"|args:$row.id} {/if} {if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ) && $row.id_account} {linkbutton shape="menu" label="Liste des écritures" href="!acc/transactions/service_user.php?id=%d&user=%d"|args:$row.id,$user.id} {/if} {if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE) && !$row.id_account} {linkbutton shape="check" label="Lier des écritures" href="!acc/transactions/service_user.php?id=%d&user=%d"|args:$row.id,$user.id} {/if} {if $session->canAccess($session::SECTION_USERS, $session::ACCESS_WRITE)} {if $row.paid} {linkbutton shape="reset" label="Marquer comme non payé" href="?id=%d&su_id=%d&paid=0"|args:$user.id,$row.id} {else} {linkbutton shape="check" label="Marquer comme payé" href="?id=%d&su_id=%d&paid=1"|args:$user.id,$row.id} {/if} {linkbutton shape="edit" label="Modifier" href="edit.php?id=%d"|args:$row.id} {linkbutton shape="delete" label="Supprimer" href="delete.php?id=%d"|args:$row.id} {/if} </td> </tr> {/foreach} </tbody> </table> {pagination url=$list->paginationURL() page=$list.page bypage=$list.per_page total=$list->count()} {include file="admin/_foot.tpl"} |
Added src/templates/services/user/link.tpl version [2dca006b28].
> > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | {include file="admin/_head.tpl" title="Lier une inscription à une écriture" current="acc/accounts"} {form_errors} <form method="post" action="{$self_url}" data-focus="1"> <fieldset> <legend>Lier à une écriture</legend> <dl> {input type="number" label="Numéro de l'écriture" name="id_transaction" required=true} </dl> </fieldset> <p class="submit"> {csrf_field key=$csrf_key} {button type="submit" name="save" label="Enregistrer" shape="right" class="main"} </p> </form> {include file="admin/_foot.tpl"} |
Added src/www/admin/services/user/link.php version [271776ff7d].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <?php namespace Garradin; use Garradin\Services\Services_User; use Garradin\Accounting\Transactions; require_once __DIR__ . '/../_inc.php'; $session->requireAccess($session::SECTION_USERS, $session::ACCESS_WRITE); $session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ); $su = Services_User::get((int)qg('id')); if (!$su) { throw new UserException("Cette inscription n'existe pas"); } $csrf_key = 'service_link'; $form->runIf('save', function () use ($su) { $id = (int)f('id_transaction'); $transaction = Transactions::get($id); if (!$transaction) { throw new UserException('Impossible de trouver l\'écriture #' . $id); } $transaction->linkToUser($su->id_user, $su->id); }, $csrf_key, '!acc/transactions/service_user.php?id=' . $su->id); $tpl->assign(compact('csrf_key')); $tpl->display('services/user/link.tpl'); |