Overview
Comment: | HelloAsso: Chargeable items account re-setting implemented and details page added |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
b57ffa5163c79057ab0a108acdbfdd90 |
User & Date: | alinaar on 2023-05-28 17:56:51 |
Other Links: | branch diff | manifest | tags |
Context
2023-05-28
| ||
18:53 | HelloAsso: Chargeable item label clarified (options and donations) check-in: e821445e61 user: alinaar tags: dev | |
17:56 | HelloAsso: Chargeable items account re-setting implemented and details page added check-in: b57ffa5163 user: alinaar tags: dev | |
14:33 | HelloAsso: configuration saving improved check-in: a671188f2c user: alinaar tags: dev | |
Changes
Added helloasso/admin/chargeable.php version [29602e00aa].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | <?php namespace Garradin; use KD2\DB\EntityManager; use Garradin\Plugin\HelloAsso\Entities\Chargeable; use Garradin\Plugin\HelloAsso\Entities\Item; use Garradin\Plugin\HelloAsso\Entities\Form; use Garradin\Entities\Accounting\Account; use Garradin\Payments\Payments; use Garradin\Plugin\HelloAsso\HelloAsso; use Garradin\Entities\Payments\Payment; use Garradin\Entities\Accounting\Transaction; use Garradin\UserException; use Garradin\Entities\Users\User; use Garradin\Plugin\HelloAsso\Forms; use Garradin\Plugin\HelloAsso\Orders; require __DIR__ . '/_inc.php'; if ($id = qg('id')) { $chargeable = EntityManager::findOneById(Chargeable::class, (int)$id); } if (!$chargeable) { throw new UserException(sprintf('Article inconnu (n°%d).', $id)); } $csrf_key = 'accounts_setting'; $form->runIf('save', function () use ($chargeable) { // ToDo: add a nice check $chargeable->set('id_credit_account', (int)array_keys($_POST['credit'])[0]); $chargeable->set('id_debit_account', (int)array_keys($_POST['debit'])[0]); $chargeable->save(); }, $csrf_key, 'chargeable.php?id=' . $id . '&ok'); $item = $chargeable->id_item ? EntityManager::findOneById(Item::class, $chargeable->id_item) : null; $form = EntityManager::findOneById(Form::class, $chargeable->id_form); $credit_account = $chargeable->id_credit_account ? EntityManager::findOneById(Account::class, (int)$chargeable->id_credit_account) : null; $debit_account = $chargeable->id_debit_account ? EntityManager::findOneById(Account::class, (int)$chargeable->id_debit_account) : null; $tpl->assign([ 'chargeable' => $chargeable, 'parent_item' => $item, 'form' => $form, 'chart_id' => Plugin\HelloAsso\HelloAsso::CHART_ID, // ToDo: make it dynamic 'credit_account' => (null !== $credit_account) ? [ $credit_account->id => $credit_account->code . ' — ' . $credit_account->label ] : null, 'debit_account' => (null !== $debit_account) ? [ $debit_account->id => $debit_account->code . ' — ' . $debit_account->label ] : null, 'csrf_key' => $csrf_key, 'current_sub' => 'items' ]); $tpl->assign('TECH_DETAILS', SHOW_ERRORS && ENABLE_TECH_DETAILS); $tpl->register_modifier('json_revamp', function ($data) { return json_encode(json_decode($data), JSON_PRETTY_PRINT); }); $tpl->register_modifier('var_dump', function ($data) { ob_start(); var_dump($data); return ob_get_clean(); }); $tpl->display(PLUGIN_ROOT . '/templates/chargeable.tpl'); |
Modified helloasso/admin/chargeables.php from [c6146f56de] to [d815a11f83].
︙ | ︙ | |||
12 13 14 15 16 17 18 | if (!$f) { throw new UserException('Formulaire inconnu'); } $list = Chargeables::list($f); $list->loadFromQueryString(); | | > | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 | if (!$f) { throw new UserException('Formulaire inconnu'); } $list = Chargeables::list($f); $list->loadFromQueryString(); $tpl->assign([ 'form' => $f, 'list' => $list ]); $tpl->display(PLUGIN_ROOT . '/templates/chargeables.tpl'); |
Added helloasso/admin/style.css version [20e755a41a].
> > > | 1 2 3 | .awaits_account_configuration { color: red; } |
Modified helloasso/templates/_chargeables_list.tpl from [66388be3ce] to [d38e5e58d3].
1 2 3 4 5 | {include file="common/dynamic_list_head.tpl"} {foreach from=$list->iterate() item="row"} | > > < > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | {include file="common/dynamic_list_head.tpl"} {assign var='chargeable_need_config' value=false} {foreach from=$list->iterate() item="row"} <tr {if $plugin.config.accounting && (!$row.id_credit_account || !$row.id_debit_account)}class="awaits_account_configuration"{/if}> <td class="num"><a href="{"chargeable.php?id=%s"|args:$row.id}">{$row.id}</a></td> <td>{$row.type}</td> <td>{$row.label}</td> <td class="money">{$row.amount|money_currency|raw}</td> <td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$row.id_credit_account|intval}">{$row.credit_account}</a></td> <td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$row.id_debit_account|intval}">{$row.debit_account}</a></td> {* Not yet supported |
︙ | ︙ | |||
24 25 26 27 28 29 30 | {/foreach} </table> {/if} </td> {/if} *} | > > | > > > > > > > > | | > > > > > > > > > > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | {/foreach} </table> {/if} </td> {/if} *} {if $plugin.config.accounting} <td class="actions"> {if !$row.id_credit_account || !$row.id_debit_account} {assign var='button_label' value='Configurer'} {assign var='button_shape' value='settings'} {assign var='chargeable_need_config' value=true} {else} {assign var='button_label' value='Modifier'} {assign var='button_shape' value='edit'} {/if} {linkbutton href="chargeable.php?id=%s"|args:$row.id shape=$button_shape label=$button_label} </td> {else} <td class="actions"></td> {/if} </tr> {/foreach} </tbody> </table> <p class="help block">Les articles (tarifs et options) configurés dans l'administration de HelloAsso ne peuvent apparaître ici qu'uniquement <em>après</em> avoir été commandés au moins une fois.</p> {if $plugin.config.accounting && $chargeable_need_config} <p class="alert block"> Les articles en rouge nécessitent une configuration de votre part. <br /><br />Vous pouvez soit les configurer un-à-un depuis leur bouton de configuration soit tous d'un coup depuis <a href="{$plugin_admin_url}sync.php">la page de synchronisation</a>. </p> {/if} |
Added helloasso/templates/chargeable.tpl version [27f9951d4a].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | {include file="_head.tpl" title="Article HelloAsso n°%s"|args:$chargeable.id} {include file="./_menu.tpl" current="home"} {if array_key_exists('ok', $_GET)} <p class="confirm block">Article mis à jour avec succès.</p> {/if} <h2 class="ruler">Informations sur l'article</h2> <dl class="describe"> <dt>Label</dt> <dd>{$chargeable->label}</dd> <dt>Type</dt> <dd> {assign var='types' value=Plugin\HelloAsso\Entities\Chargeable::TYPES} {$types[$chargeable->type]} </dd> <dt>Montant</dt> <dd>{$chargeable->amount|money_currency|raw}</dd> <dt>Formulaire</dt> <dd>{$form->name}</dd> {if $plugin->config->accounting} <dt>Statut</dt> <dd> {if !$chargeable->id_credit_account || !$chargeable->id_debit_account} <em>En attente de configuration de votre part.</em> <br />Merci de remplir le formulaire "Comptabilité" ci-dessous. {else} En fonctionnement. {/if} </dd> {/if} </dl> {if $plugin->config->accounting} <form method="post" action="{$self_url}"> <fieldset> <legend>Comptabilité</legend> <dl> {input type="list" target="!acc/charts/accounts/selector.php?targets=%s&chart=%d"|args:'6':$chart_id name="credit" label="Type de recette" required=true default=$credit_account} {input type="list" target="!acc/charts/accounts/selector.php?targets=%s&chart=%d"|args:'1:2:3':$chart_id name="debit" label="Compte d'encaissement" required=true default=$debit_account} </dl> <p class="help block">Cette modification impacte uniquement les <em>futures</em> synchronisations. Elle n'est pas rétro-active.</p> </fieldset> <p class="submit"> {csrf_field key=$csrf_key} {button type="submit" class="main" name="save" label="Enregistrer" shape="right"} </p> </form> {/if} {if $TECH_DETAILS} <dl style="background-color: black; color: limegreen; padding-top: 0.8em;" class="describe"> <dt style="color: limegreen;">item</dt> <dd><pre>{if $chargeable->id_item}{$parent_item|var_dump}{else}NULL{/if}</pre></dd> <dt style="color: limegreen;">item->raw_data</dt> <dd><pre>{if $chargeable->id_item}{$parent_item->raw_data|json_revamp}{else}NULL{/if}</pre></dd> </dl> {/if} {include file="_foot.tpl"} |
Modified helloasso/templates/chargeables.tpl from [ee4a3c783a] to [671c05533c].
|
| | < < | 1 2 3 4 5 6 7 8 9 10 11 | {include file="_head.tpl" title="%s — %s"|args:$form.org_name,$form.name plugin_css=['style.css']} {include file="./_menu.tpl" current="home" current_sub="items" show_export=true} {include file="./_chargeables_list.tpl" details=true} {* {pagination url=$list->paginationURL() page=$list.page bypage=$list.per_page total=$list->count()} *} {include file="_foot.tpl"} |