Comment: | Merge with trunk |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA3-256: |
ec840f8fdc4687e395a926871f9afe9c |
User & Date: | bohwaz on 2021-03-10 19:32:25 |
Other Links: | branch diff | manifest | tags |
2021-03-10
| ||
19:37 | Add breadcrumbs navigation to website edit check-in: c783be305a user: bohwaz tags: dev | |
19:32 | Merge with trunk check-in: ec840f8fdc user: bohwaz tags: dev | |
19:28 | Fix condition refering to deleted constant check-in: 62c600cff6 user: bohwaz tags: dev | |
2021-03-09
| ||
11:27 | Fix export of analytical codes in simple list check-in: 1e9aa61835 user: bohwaz tags: trunk, stable | |
Modified src/include/data/1.0.0_schema.sql from [4710567bc0] to [292ae06778].
︙ | ︙ | |||
262 263 264 265 266 267 268 | id_creator INTEGER NULL REFERENCES membres(id) ON DELETE SET NULL, id_related INTEGER NULL REFERENCES acc_transactions(id) ON DELETE SET NULL -- écriture liée (par ex. remboursement d'une dette) ); CREATE INDEX IF NOT EXISTS acc_transactions_year ON acc_transactions (id_year); CREATE INDEX IF NOT EXISTS acc_transactions_date ON acc_transactions (date); CREATE INDEX IF NOT EXISTS acc_transactions_related ON acc_transactions (id_related); | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | id_creator INTEGER NULL REFERENCES membres(id) ON DELETE SET NULL, id_related INTEGER NULL REFERENCES acc_transactions(id) ON DELETE SET NULL -- écriture liée (par ex. remboursement d'une dette) ); CREATE INDEX IF NOT EXISTS acc_transactions_year ON acc_transactions (id_year); CREATE INDEX IF NOT EXISTS acc_transactions_date ON acc_transactions (date); CREATE INDEX IF NOT EXISTS acc_transactions_related ON acc_transactions (id_related); CREATE INDEX IF NOT EXISTS acc_transactions_type ON acc_transactions (type, id_year); CREATE INDEX IF NOT EXISTS acc_transactions_status ON acc_transactions (status); CREATE TABLE IF NOT EXISTS acc_transactions_lines -- Lignes d'écritures d'une opération ( id INTEGER PRIMARY KEY NOT NULL, |
︙ | ︙ | |||
287 288 289 290 291 292 293 294 295 296 297 298 299 300 | id_analytical INTEGER NULL REFERENCES acc_accounts(id) ON DELETE SET NULL, CONSTRAINT line_check1 CHECK ((credit * debit) = 0), CONSTRAINT line_check2 CHECK ((credit + debit) > 0) ); CREATE INDEX IF NOT EXISTS acc_transactions_lines_account ON acc_transactions_lines (id_account); CREATE INDEX IF NOT EXISTS acc_transactions_lines_analytical ON acc_transactions_lines (id_analytical); CREATE INDEX IF NOT EXISTS acc_transactions_lines_reconciled ON acc_transactions_lines (reconciled); CREATE TABLE IF NOT EXISTS acc_transactions_users -- Liaison des écritures et des membres ( | > | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | id_analytical INTEGER NULL REFERENCES acc_accounts(id) ON DELETE SET NULL, CONSTRAINT line_check1 CHECK ((credit * debit) = 0), CONSTRAINT line_check2 CHECK ((credit + debit) > 0) ); CREATE INDEX IF NOT EXISTS acc_transactions_lines_transaction ON acc_transactions_lines (id_transaction); CREATE INDEX IF NOT EXISTS acc_transactions_lines_account ON acc_transactions_lines (id_account); CREATE INDEX IF NOT EXISTS acc_transactions_lines_analytical ON acc_transactions_lines (id_analytical); CREATE INDEX IF NOT EXISTS acc_transactions_lines_reconciled ON acc_transactions_lines (reconciled); CREATE TABLE IF NOT EXISTS acc_transactions_users -- Liaison des écritures et des membres ( |
︙ | ︙ |
Added src/include/data/1.0.6_migration.sql version [6e98c5399a].
> > | 1 2 | -- Fix credit/debt payment types UPDATE acc_transactions SET type = 0 WHERE id_related IS NOT NULL AND type IN (4,5); |
Added src/include/data/1.0.7_migration.sql version [607cda27c7].
> > > > > | 1 2 3 4 5 | -- Add indexes DROP INDEX acc_transactions_type; CREATE INDEX IF NOT EXISTS acc_transactions_type ON acc_transactions (type, id_year); CREATE INDEX IF NOT EXISTS acc_transactions_lines_transaction ON acc_transactions_lines (id_transaction); |
Modified src/include/lib/Garradin/Accounting/Transactions.php from [69fd74d5a9] to [035a5402f3].
︙ | ︙ | |||
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | $reverse = 1; $columns = Account::LIST_COLUMNS; unset($columns['line_label'], $columns['sum'], $columns['debit'], $columns['credit']); $columns['line_reference']['label'] = 'Réf. paiement'; $columns['change']['select'] = sprintf('SUM(l.credit) * %d', $reverse); $columns['change']['label'] = 'Montant'; $tables = 'acc_transactions_lines l INNER JOIN acc_transactions t ON t.id = l.id_transaction INNER JOIN acc_accounts a ON a.id = l.id_account LEFT JOIN acc_accounts b ON b.id = l.id_analytical'; $conditions = sprintf('t.type = %s AND t.id_year = %d', $type, $year_id); $sum = 0; $list = new DynamicList($columns, $tables, $conditions); $list->orderBy('date', true); $list->setCount('COUNT(DISTINCT t.id)'); $list->groupBy('t.id'); $list->setModifier(function (&$row) { $row->date = \DateTime::createFromFormat('!Y-m-d', $row->date); }); $list->setExportCallback(function (&$row) { $row->change = Utils::money_format($row->change, '.', '', false); }); return $list; } } | > > > > > > > > > > | 382 383 384 385 386 387 388 389 390 391 392 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 419 420 421 | $reverse = 1; $columns = Account::LIST_COLUMNS; unset($columns['line_label'], $columns['sum'], $columns['debit'], $columns['credit']); $columns['line_reference']['label'] = 'Réf. paiement'; $columns['change']['select'] = sprintf('SUM(l.credit) * %d', $reverse); $columns['change']['label'] = 'Montant'; $columns['code_analytical']['select'] = 'GROUP_CONCAT(b.code, \',\')'; $columns['id_analytical']['select'] = 'GROUP_CONCAT(l.id_analytical, \',\')'; $tables = 'acc_transactions_lines l INNER JOIN acc_transactions t ON t.id = l.id_transaction INNER JOIN acc_accounts a ON a.id = l.id_account LEFT JOIN acc_accounts b ON b.id = l.id_analytical'; $conditions = sprintf('t.type = %s AND t.id_year = %d', $type, $year_id); $sum = 0; $list = new DynamicList($columns, $tables, $conditions); $list->orderBy('date', true); $list->setCount('COUNT(DISTINCT t.id)'); $list->groupBy('t.id'); $list->setModifier(function (&$row) { $row->date = \DateTime::createFromFormat('!Y-m-d', $row->date); if (isset($row->id_analytical, $row->code_analytical)) { $row->code_analytical = array_combine(explode(',', $row->id_analytical), explode(',', $row->code_analytical)); } else { $row->code_analytical = []; } }); $list->setExportCallback(function (&$row) { $row->change = Utils::money_format($row->change, '.', '', false); $row->code_analytical = implode(', ', $row->code_analytical); }); return $list; } } |
Modified src/include/lib/Garradin/Upgrade.php from [4f1247ba58] to [5d82aa7d3c].
︙ | ︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | if (version_compare($v, '1.0.3', '<')) { // Missing trigger $db->begin(); $db->import(ROOT . '/include/data/1.0.3_migration.sql'); $db->commit(); } if (version_compare($v, '1.1.0', '<=')) { // Missing trigger $db->beginSchemaUpdate(); $attachments = $db->getAssoc('SELECT id, nom FROM fichiers;'); | > > > > > > > > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | if (version_compare($v, '1.0.3', '<')) { // Missing trigger $db->begin(); $db->import(ROOT . '/include/data/1.0.3_migration.sql'); $db->commit(); } if (version_compare($v, '1.0.6', '<')) { // Missing trigger $db->begin(); $db->import(ROOT . '/include/data/1.0.6_migration.sql'); $db->commit(); } if (version_compare($v, '1.1.0', '<=')) { // Missing trigger $db->beginSchemaUpdate(); $attachments = $db->getAssoc('SELECT id, nom FROM fichiers;'); |
︙ | ︙ |
Modified src/templates/acc/accounts/simple.tpl from [97c4fe6c8a] to [7717c0c7db].
︙ | ︙ | |||
35 36 37 38 39 40 41 | {/if} <td class="num"><a href="{$admin_url}acc/transactions/details.php?id={$line.id}">#{$line.id}</a></td> <td>{$line.date|date_short}</td> <td class="money">{$line.change|abs|raw|money}</td> <td>{$line.reference}</td> <th>{$line.label}</th> <td>{$line.line_reference}</td> | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | {/if} <td class="num"><a href="{$admin_url}acc/transactions/details.php?id={$line.id}">#{$line.id}</a></td> <td>{$line.date|date_short}</td> <td class="money">{$line.change|abs|raw|money}</td> <td>{$line.reference}</td> <th>{$line.label}</th> <td>{$line.line_reference}</td> <td class="num">{foreach from=$line.code_analytical item="code" key="id"}<a href="{$admin_url}acc/reports/statement.php?analytical={$id}">{$code}</a> {/foreach}</td> <td class="actions"> {if $line.type == Entities\Accounting\Transaction::TYPE_DEBT && ($line.status & Entities\Accounting\Transaction::STATUS_WAITING)} {linkbutton shape="check" label="Régler cette dette" href="!acc/transactions/new.php?payoff_for=%d"|args:$line.id} {elseif $line.type == Entities\Accounting\Transaction::TYPE_CREDIT && ($line.status & Entities\Accounting\Transaction::STATUS_WAITING)} {linkbutton shape="export" label="Régler cette créance" href="!acc/transactions/new.php?payoff_for=%d"|args:$line.id} {/if} |
︙ | ︙ |
Modified src/templates/acc/transactions/new.tpl from [5dd8c5b01f] to [49e96a9c33].
︙ | ︙ | |||
44 45 46 47 48 49 50 | </dl> </fieldset> {/if} <fieldset> <legend>Informations</legend> <dl> | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | </dl> </fieldset> {/if} <fieldset> <legend>Informations</legend> <dl> {input type="date" name="date" label="Date" required=1 source=$transaction} {input type="text" name="label" label="Libellé" required=1 source=$transaction} {input type="text" name="reference" label="Numéro de pièce comptable" help="Numéro de facture, de note de frais, etc."} </dl> <dl data-types="all-but-advanced"> {input type="money" name="amount" label="Montant" required=1 default=$amount} </dl> </fieldset> |
︙ | ︙ |
Modified src/templates/acc/years/new.tpl from [847d4ab122] to [c8bd7f28b5].
︙ | ︙ | |||
11 12 13 14 15 16 17 | <form method="post" action="{$self_url}" data-focus="1"> <fieldset> <legend>Commencer un nouvel exercice</legend> <dl> {input type="select_groups" options=$charts name="id_chart" label="Plan comptable" required=true} | | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | <form method="post" action="{$self_url}" data-focus="1"> <fieldset> <legend>Commencer un nouvel exercice</legend> <dl> {input type="select_groups" options=$charts name="id_chart" label="Plan comptable" required=true} <dd class="help">Il ne sera pas possible de modifier ou supprimer un compte du plan comptable si le compte est utilisé dans un exercice clôturé.<br /> Si vous souhaitez modifier le plan comptable pour ce nouvel exercice, il est recommandé de créer un nouveau plan comptable, recopié à partir de l'ancien plan comptable. Ainsi tous les comptes seront modifiables et supprimables.</dd> <dd class="help">{linkbutton shape="settings" label="Gestion des plans comptables" href="!acc/charts/"}</dd> {input type="text" name="label" label="Libellé" required=true default=$label} {input type="date" label="Début de l'exercice" name="start_date" required=true default=$start_date} {input type="date" label="Fin de l'exercice" name="end_date" required=true default=$end_date} </dl> </fieldset> <p class="submit"> {csrf_field key="acc_years_new"} {button type="submit" name="new" label="Créer ce nouvel exercice" shape="right" class="main"} </p> </form> {include file="admin/_foot.tpl"} |
Modified src/templates/common/search/advanced.tpl from [e8576fd3d6] to [4a40d92d55].
︙ | ︙ | |||
15 16 17 18 19 20 21 | <dl> {input type="textarea" name="sql_query" cols="100" rows="10" required=1 label="Requête SQL" help="Si aucune limite n'est précisée, une limite de 100 résultats sera appliquée." default=$sql_query} {if $session->canAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN)} {input type="checkbox" name="unprotected" value=1 label="Autoriser l'accès à toutes les tables de la base de données" default=$is_unprotected} <dd class="help">Attention : en cochant cette case vous autorisez la requête à lire toutes les données de toutes les tables de la base de données !</dd> {/if} | < < | | | 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 | <dl> {input type="textarea" name="sql_query" cols="100" rows="10" required=1 label="Requête SQL" help="Si aucune limite n'est précisée, une limite de 100 résultats sera appliquée." default=$sql_query} {if $session->canAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN)} {input type="checkbox" name="unprotected" value=1 label="Autoriser l'accès à toutes les tables de la base de données" default=$is_unprotected} <dd class="help">Attention : en cochant cette case vous autorisez la requête à lire toutes les données de toutes les tables de la base de données !</dd> {/if} <dd class="help"> <details> <summary class="block help">Schéma SQL des tables</summary> <pre class="block help">{foreach from=$schema item="table"}{$table}<br />{/foreach}</pre> </details> </dd> </dl> <p class="submit"> {button type="submit" name="run" label="Exécuter" shape="search" class="main"} <input type="hidden" name="id" value="{$search.id}" /> {if $search.id} {button name="save" value=1 type="submit" label="Enregistrer : %s"|args:$search.intitule|truncate:40:"…":true shape="upload"} {button name="save_new" value=1 type="submit" label="Enregistrer nouvelle recherche" shape="plus"} {else} {button name="save" value=1 type="submit" label="Enregistrer cette recherche" shape="upload"} {/if} {if $session->canAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN)} {linkbutton href="!config/advanced/sql.php" target="_blank" shape="menu" label="Voir le schéma SQL complet"} {/if} </p> {elseif !$sql_query} <legend>Rechercher</legend> <div class="queryBuilder" id="queryBuilder"></div> <p class="actions"> <label>Trier par |
︙ | ︙ |
Modified src/www/admin/acc/transactions/new.php from [091eecbafa] to [d8191985b4].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | $accounts = $chart->accounts(); $transaction = new Transaction; $lines = [[], []]; $amount = 0; $payoff_for = qg('payoff_for') ?: f('payoff_for'); // Quick pay-off for debts and credits, directly from a debt/credit details page if ($id = $payoff_for) { $payoff_for = $transaction->payOffFrom($id); if (!$payoff_for) { throw new UserException('Écriture inconnue'); } | > > > > > > > > > > > > | 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 | $accounts = $chart->accounts(); $transaction = new Transaction; $lines = [[], []]; $amount = 0; $payoff_for = qg('payoff_for') ?: f('payoff_for'); $date = new \DateTime; if ($session->get('acc_last_date')) { $date = \DateTime::createFromFormat('!d/m/Y', $session->get('acc_last_date')); } if (!$date || ($date < $current_year->start_date || $date > $current_year->end_date)) { $date = $current_year->start_date; } $transaction->date = $date; // Quick pay-off for debts and credits, directly from a debt/credit details page if ($id = $payoff_for) { $payoff_for = $transaction->payOffFrom($id); if (!$payoff_for) { throw new UserException('Écriture inconnue'); } |
︙ | ︙ | |||
74 75 76 77 78 79 80 | Utils::redirect(Utils::getSelfURI(false) . '?ok=' . $transaction->id()); } catch (UserException $e) { $form->addError($e->getMessage()); } } | < < < < < < < < < < < | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | Utils::redirect(Utils::getSelfURI(false) . '?ok=' . $transaction->id()); } catch (UserException $e) { $form->addError($e->getMessage()); } } $tpl->assign(compact('transaction', 'payoff_for', 'amount', 'lines')); $tpl->assign('payoff_targets', implode(':', [Account::TYPE_BANK, Account::TYPE_CASH, Account::TYPE_OUTSTANDING])); $tpl->assign('ok', (int) qg('ok')); $tpl->assign('types_details', Transaction::getTypesDetails()); $tpl->assign('chart_id', $chart->id()); $tpl->assign('analytical_accounts', ['' => '-- Aucun'] + $accounts->listAnalytical()); $tpl->display('acc/transactions/new.tpl'); |
Modified src/www/admin/acc/years/import.php from [24c537169a] to [2d7d375a16].
︙ | ︙ | |||
11 12 13 14 15 16 17 | $year_id = (int) qg('id') ?: CURRENT_YEAR_ID; if ($year_id === CURRENT_YEAR_ID) { $year = $current_year; } else { $year = Years::get($year_id); | | > | | < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | $year_id = (int) qg('id') ?: CURRENT_YEAR_ID; if ($year_id === CURRENT_YEAR_ID) { $year = $current_year; } else { $year = Years::get($year_id); } if (!$year) { throw new UserException("L'exercice demandé n'existe pas."); } if (qg('export')) { CSV::export( qg('export'), sprintf('Export comptable - %s - %s', Config::getInstance()->get('nom_asso'), $year->label), Transactions::export($year->id()) |
︙ | ︙ |
Modified src/www/admin/acc/years/new.php from [0cf57e6106] to [089708c6e5].
1 2 3 4 5 6 7 8 9 10 11 12 | <?php namespace Garradin; use Garradin\Accounting\Years; use Garradin\Accounting\Charts; use Garradin\Services\Fees; use Garradin\Entities\Accounting\Year; require_once __DIR__ . '/../../_inc.php'; $session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_ADMIN); | | < | | | | | | | | | | | | | < | | < < < < < < < > | 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 | <?php namespace Garradin; use Garradin\Accounting\Years; use Garradin\Accounting\Charts; use Garradin\Services\Fees; use Garradin\Entities\Accounting\Year; require_once __DIR__ . '/../../_inc.php'; $session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_ADMIN); $form->runIf('new', function () { $year = new Year; $year->importForm(); $year->save(); if ($old_id = qg('from')) { $old = Years::get((int) $old_id); $changed = Fees::updateYear($old, $year); if (!$changed) { Utils::redirect(ADMIN_URL . 'acc/years/?msg=UPDATE_FEES'); } } if (Years::countClosed()) { Utils::redirect(ADMIN_URL . 'acc/years/balance.php?id=' . $year->id()); } }, 'acc_years_new', '!acc/years/'); $new_dates = Years::getNewYearDates(); $tpl->assign('start_date', $new_dates[0]); $tpl->assign('end_date', $new_dates[1]); $tpl->assign('label', sprintf('Exercice %d', $new_dates[0]->format('Y'))); $tpl->assign('charts', Charts::listByCountry()); $tpl->display('acc/years/new.tpl'); |
Modified src/www/admin/membres/import.php from [1a127ec678] to [ec0f7e7826].
︙ | ︙ | |||
38 39 40 41 42 43 44 | if (f('cancel')) { $csv->clear(); Utils::redirect(Utils::getSelfURI(false)); } $form->runIf(f('import') && $csv->loaded(), function () use ($csv, $import, $user) { | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | if (f('cancel')) { $csv->clear(); Utils::redirect(Utils::getSelfURI(false)); } $form->runIf(f('import') && $csv->loaded(), function () use ($csv, $import, $user) { $csv->setTranslationTable(f('translation_table') ?? []); $csv->skip((int)f('skip_first_line')); $import->fromCustomCSV($csv, $user->id); $csv->clear(); }, $csrf_key, ADMIN_URL . 'membres/import.php?ok'); $form->runIf(f('import') && f('type') == 'garradin' && !empty($_FILES['upload']['tmp_name']), function () use ($import, $user) { $import->fromGarradinCSV($_FILES['upload']['tmp_name'], $user->id); |
︙ | ︙ |