Index: src/include/lib/Paheko/Accounting/AdvancedSearch.php ================================================================== --- src/include/lib/Paheko/Accounting/AdvancedSearch.php +++ src/include/lib/Paheko/Accounting/AdvancedSearch.php @@ -29,10 +29,16 @@ } $types .= 'END'; return [ + 'line_id' => [ + 'label' => null, + 'type' => 'integer', + 'null' => true, + 'select' => 'l.id', + ], 'id' => [ 'label' => 'Numéro écriture', 'type' => 'integer', 'null' => false, 'select' => 't.id', @@ -273,11 +279,11 @@ $tables = 'acc_transactions AS t INNER JOIN acc_transactions_lines AS l ON l.id_transaction = t.id INNER JOIN acc_accounts AS a ON l.id_account = a.id INNER JOIN acc_years AS y ON t.id_year = y.id LEFT JOIN acc_projects AS p ON l.id_project = p.id'; - return $this->makeList($query, $tables, 'id', true, ['id', 'account_code', 'debit', 'credit']); + return $this->makeList($query, $tables, 'id', true, ['id', 'account_code', 'line_id', 'debit', 'credit']); } public function defaults(): \stdClass { $group = [ Index: src/include/lib/Paheko/AdvancedSearch.php ================================================================== --- src/include/lib/Paheko/AdvancedSearch.php +++ src/include/lib/Paheko/AdvancedSearch.php Index: src/templates/acc/accounts/journal.tpl ================================================================== --- src/templates/acc/accounts/journal.tpl +++ src/templates/acc/accounts/journal.tpl @@ -81,11 +81,11 @@ {foreach from=$list->iterate() item="line"}
{$count} résultats trouvés pour cette recherche.
{$column} | + {if 'line_id' === $column} + {if $is_admin} ++ {/if} + {else} + | {$column} | + {/if} {/foreach}||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{input type="checkbox" name="selected[%s]"|args:$row[$line_id_column] value=$row[$id_column]} | + {/if} + {elseif $id_column === $key}{link href="!acc/transactions/details.php?id=%d"|args:$value label="#%d"|args:$value} | {else}{$value} | {/if} {/foreach}||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+ | + Pour les écritures cochées : + + {csrf_field key="projects_action"} + {button type="submit" formaction="%sacc/transactions/actions.php"|args:$admin_url name="action" value="change_project" shape="plus" label="Ajouter/enlever d'un projet"} + | +
Aucun résultat trouvé pour cette recherche.
Index: src/www/admin/acc/transactions/actions.php ================================================================== --- src/www/admin/acc/transactions/actions.php +++ src/www/admin/acc/transactions/actions.php @@ -8,18 +8,18 @@ require_once __DIR__ . '/../_inc.php'; $session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_ADMIN); -$check = f('check'); +$selected = f('selected'); -if (!$check || !is_array($check)) { +if (!$selected || !is_array($selected)) { throw new UserException('Aucune écriture n\'a été sélectionnée.'); } -$transactions = array_unique(array_values($check)); -$lines = array_keys($check); +$transactions = array_unique(array_values($selected)); +$lines = array_keys($selected); if (f('action') === 'payoff') { Utils::redirect('!acc/transactions/new.php?payoff=' . implode(',', $transactions)); } @@ -51,13 +51,13 @@ Transactions::setProject($id, $transactions, $lines); }, $csrf_key, f('from') ?: ADMIN_URL); $from = f('from'); -$count = count($check); -$extra = compact('check', 'from'); -$tpl->assign(compact('csrf_key', 'check', 'count', 'extra')); +$count = count($selected); +$extra = compact('selected', 'from'); +$tpl->assign(compact('csrf_key', 'selected', 'count', 'extra')); if (f('action') == 'delete') { $tpl->display('acc/transactions/actions_delete.tpl'); }