From 15b60e8f3c66d43b22724035c95fd4cef2a7aebc Mon Sep 17 00:00:00 2001 From: vgreb Date: Sun, 21 Dec 2025 19:06:16 +0100 Subject: [PATCH] Tresorerie > Suppression des pages legacy "comptes banque" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A merger après la #2040 --- app/config/packages/backoffice_menu.yaml | 6 - app/config/routing/admin_accounting.yml | 4 - .../admin_accounting_bank_accounts.yml | 4 - htdocs/pages/administration/compta_banque.php | 224 ------------------ .../administration/compta_banque.html | 147 ------------ .../BankAccounts/ListStatementAction.php | 51 ---- .../accounting/bank-accounts/list.html.twig | 132 ----------- .../Admin/Tresorerie/CompteBanques.feature | 22 -- 8 files changed, 590 deletions(-) delete mode 100644 app/config/routing/admin_accounting_bank_accounts.yml delete mode 100644 htdocs/pages/administration/compta_banque.php delete mode 100644 htdocs/templates/administration/compta_banque.html delete mode 100644 sources/AppBundle/Controller/Admin/Accounting/BankAccounts/ListStatementAction.php delete mode 100644 templates/admin/accounting/bank-accounts/list.html.twig delete mode 100644 tests/behat/features/Admin/Tresorerie/CompteBanques.feature diff --git a/app/config/packages/backoffice_menu.yaml b/app/config/packages/backoffice_menu.yaml index 7a53bbcf9..f2fff241c 100644 --- a/app/config/packages/backoffice_menu.yaml +++ b/app/config/packages/backoffice_menu.yaml @@ -224,12 +224,6 @@ parameters: compta_journal: nom: 'Journal' niveau: 'ROLE_ADMIN' - compta_banque: - nom: 'Compte banques' - url: '/admin/accounting/bank-accounts/list' - niveau: 'ROLE_ADMIN' - extra_routes: - - admin_accounting_bank_accounts_list compta_conf_evenement: nom: 'Configuration' niveau: 'ROLE_ADMIN' diff --git a/app/config/routing/admin_accounting.yml b/app/config/routing/admin_accounting.yml index f681c9019..28f5eb33e 100644 --- a/app/config/routing/admin_accounting.yml +++ b/app/config/routing/admin_accounting.yml @@ -6,10 +6,6 @@ admin_accounting_membership_fee: resource: "admin_accounting/membership_fee.yml" prefix: /membership-fee -admin_accounting_bank_accounts: - resource: "admin_accounting_bank_accounts.yml" - prefix: /bank-accounts - admin_accounting_journal: resource: "admin_accounting/journal.yml" prefix: /journal diff --git a/app/config/routing/admin_accounting_bank_accounts.yml b/app/config/routing/admin_accounting_bank_accounts.yml deleted file mode 100644 index 2c0defba6..000000000 --- a/app/config/routing/admin_accounting_bank_accounts.yml +++ /dev/null @@ -1,4 +0,0 @@ -admin_accounting_bank_accounts_list: - path: /list - defaults: - _controller: AppBundle\Controller\Admin\Accounting\BankAccounts\ListStatementAction diff --git a/htdocs/pages/administration/compta_banque.php b/htdocs/pages/administration/compta_banque.php deleted file mode 100644 index 1c91aeb7f..000000000 --- a/htdocs/pages/administration/compta_banque.php +++ /dev/null @@ -1,224 +0,0 @@ -assign('action', $action); - -$compte = isset($_GET['compte']) && $_GET['compte'] ? $_GET['compte'] : 1; - -$compta = new Comptabilite($bdd); - -$id_periode = isset($_GET['id_periode']) && $_GET['id_periode'] ? $_GET['id_periode'] : ""; - -$id_periode = $compta->obtenirPeriodeEnCours($id_periode); -$smarty->assign('id_periode', $id_periode); - -$listPeriode = $compta->obtenirListPeriode(); -$smarty->assign('listPeriode', $listPeriode); - -$listeComptes = $compta->obtenirListeComptesActifs(); -$smarty->assign('listeComptes', $listeComptes); -$smarty->assign('compte_id', $compte); - -if ($action == 'lister') { - $periode_debut = $listPeriode[$id_periode - 1]['date_debut']; - $periode_fin = $listPeriode[$id_periode - 1]['date_fin']; - - $smarty->assign('compteurLigne', 1); - - $journal = $compta->obtenirJournalBanque($compte, $periode_debut, $periode_fin); - $smarty->assign('journal', $journal); - - $sousTotal = $compta->obtenirSousTotalJournalBanque($periode_debut, $periode_fin, $compte); - $smarty->assign('sousTotal', $sousTotal); - - $total = $compta->obtenirTotalJournalBanque($periode_debut, $periode_fin, $compte); - $smarty->assign('total', $total); -} elseif ($action == 'exporter') { - $periode_debut = $listPeriode[$id_periode - 1]['date_debut']; - $periode_fin = $listPeriode[$id_periode - 1]['date_fin']; - - $journal = $compta->obtenirJournalBanque($compte, $periode_debut, $periode_fin); - $sousTotal = $compta->obtenirSousTotalJournalBanque($periode_debut, $periode_fin, $compte); - setlocale(LC_TIME, 'fr_FR.utf8', 'fra'); - - //require_once 'PEAR/PHPExcel.php'; - $workbook = new Spreadsheet(); - - for ($i = 1; $i < 13; $i++) { - $compteurLigne[$i] = 4; - $sheet = $workbook->createSheet($i); - $sheet->setTitle('Mois de ' . strftime('%B %Y', mktime(0, 0, 0, $i, 1, (int) date('Y', strtotime((string) $periode_debut))))); - $sheet->setCellValue('A1', - 'Mois de ' . strftime('%B %Y', mktime(0, 0, 0, $i, 1, (int) date('Y', strtotime((string) $periode_debut))))); - $sheet->setCellValue('A3', 'Date'); - $sheet->setCellValue('B3', 'Opération'); - $sheet->setCellValue('C3', 'Description'); - $sheet->setCellValue('D3', 'Événement'); - $sheet->setCellValue('E3', 'Catégorie'); - $sheet->setCellValue('F3', 'Dépense'); - $sheet->setCellValue('G3', 'Recette'); - $sheet->setCellValue('H3', 'Commentaire'); - $sheet->setCellValue('I3', 'Justificatif'); - $sheet->setCellValue('J3', 'Nom du justificatif'); - $sheet->setCellValue('K3', 'Nom du compte'); - } - foreach ($journal as $ecriture) { - $sheet = $workbook->getSheet($ecriture['mois']); - $sheet->setCellValue('A' . $compteurLigne[$ecriture['mois']], date('d/m/Y', strtotime((string) $ecriture['date_regl']))); - $sheet->setCellValue('B' . $compteurLigne[$ecriture['mois']], $ecriture['reglement']); - $sheet->setCellValue('C' . $compteurLigne[$ecriture['mois']], $ecriture['description']); - $sheet->setCellValue('D' . $compteurLigne[$ecriture['mois']], $ecriture['evenement']); - $sheet->setCellValue('E' . $compteurLigne[$ecriture['mois']], $ecriture['categorie']); - if ($ecriture['idoperation'] == 1) { - $sheet->setCellValue('F' . $compteurLigne[$ecriture['mois']], $ecriture['montant']); - } else { - $sheet->setCellValue('G' . $compteurLigne[$ecriture['mois']], $ecriture['montant']); - } - $sheet->setCellValue('H' . $compteurLigne[$ecriture['mois']], $ecriture['comment']); - $sheet->setCellValue('I' . $compteurLigne[$ecriture['mois']], $ecriture['attachment_required'] ? 'Oui' : 'Non'); - $sheet->setCellValue('J' . $compteurLigne[$ecriture['mois']], $ecriture['attachment_filename']); - $sheet->setCellValue('K' . $compteurLigne[$ecriture['mois']], $ecriture['compta_compte_nom_compte']); - $compteurLigne[$ecriture['mois']]++; - } - for ($i = 1; $i < 13; $i++) { - $sheet = $workbook->getSheet($i); - - $sheet->getStyle('A1')->applyFromArray([ - 'font' => [ - 'size' => 12, - 'bold' => true, - 'name' => 'Ubuntu', - ], - ]); - $sheet->getStyle('A3:K3')->applyFromArray([ - 'font' => [ - 'size' => 10, - 'bold' => true, - 'name' => 'Ubuntu', - ], - 'alignment' => ['horizontal' => Alignment::HORIZONTAL_CENTER], - 'borders' => [ - 'allborders' => [ - 'style' => Border::BORDER_THIN, - 'color' => ['rgb' => 'FF666666'], - ], - ], - ]); - $sheet->getStyle('A4:K' . ($compteurLigne[$i] + 1))->applyFromArray([ - 'font' => [ - 'size' => 10, - 'name' => 'Ubuntu', - ], - 'borders' => [ - 'allborders' => [ - 'style' => Border::BORDER_THIN, - 'color' => ['rgb' => 'FF666666'], - ], - ], - ]); - $sheet->getStyle('J3:I200')->applyFromArray(['alignment' => ['horizontal' => Alignment::HORIZONTAL_CENTER]]); - - $sheet->setCellValue('E' . $compteurLigne[$i], 'TOTAL'); - $sheet->setCellValue('F' . $compteurLigne[$i], $sousTotal[$i]['debit']); - $sheet->setCellValue('G' . $compteurLigne[$i], $sousTotal[$i]['credit']); - $sheet->setCellValue('E' . ($compteurLigne[$i] + 1), 'SOLDE'); - $sheet->setCellValue('F' . ($compteurLigne[$i] + 1), $sousTotal[$i]['dif']); - $sheet->mergeCells('F' . ($compteurLigne[$i] + 1) . ':G' . ($compteurLigne[$i] + 1)); - - $sheet->getStyle('A' . $compteurLigne[$i] . ':J' . ($compteurLigne[$i] + 1))->applyFromArray([ - 'font' => [ - 'size' => 10, - 'bold' => true, - 'name' => 'Ubuntu', - ], - ]); - $sheet->getStyle('F' . ($compteurLigne[$i] + 1))->getAlignment()->applyFromArray(['horizontal' => Alignment::HORIZONTAL_CENTER]); - - $sheet->getStyle('F4:G200')->applyFromArray(['numberformat' => ['code' => NumberFormat::FORMAT_NUMBER_00]]); - - $sheet->getColumnDimension('A')->setWidth(8); - $sheet->getColumnDimension('C')->setWidth(36); - $sheet->getColumnDimension('D')->setWidth(12); - $sheet->getColumnDimension('E')->setWidth(12); - $sheet->getPageSetup()->setPaperSize(PageSetup::PAPERSIZE_A4); - $sheet->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); - $sheet->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 3); - $sheet->getHeaderFooter()->setOddFooter('&CPage &P de &N'); - - $objDrawing = new Drawing(); - $objDrawing->setName('Logo_AFUP'); - $objDrawing->setDescription('Logo_AFUP'); - $objDrawing->setPath(__DIR__ . '/../../templates/administration/images/logo_afup.png'); - $objDrawing->setCoordinates('H1'); - $objDrawing->setHeight(35); - $objDrawing->setWidth(70); - $objDrawing->setWorksheet($sheet); - } - //$workbook->removeSheetByIndex(0); - - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="compta_afup_' . date('Y', strtotime((string) $periode_debut)) . '.xlsx"'); - header('Cache-Control: max-age=0'); - - $writer = new Xlsx($workbook); - $writer->save('php://output'); - exit(); -} elseif ($action === 'download_attachments') { - /** - * Export all attachments in a zipball - */ - - try { - // Get the year - $year = date('Y', strtotime((string) $listPeriode[$id_periode - 1]['date_debut'])); - - // Create the zip - $zipFilename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'afup_justificatifs-' . $year . '.zip'; - $zip = new ZipArchive(); - $ret = $zip->open($zipFilename, ZipArchive::CREATE); - if ($ret !== true) { - throw new RuntimeException("Impossible to open the Zip archive."); - } else { - for ($month = 1; $month <= 12; $month++) { - $searchDir = sprintf('%d%02d', $year, $month); - $zipDir = sprintf('%d%02d', $year, $month); - $options = [ - 'add_path' => 'afup_justificatifs-' . $year . '/' . $zipDir . '/', - 'remove_all_path' => true, - ]; - $zip->addGlob(AFUP_CHEMIN_RACINE . '/uploads/' . $searchDir . '/*.*', 0, $options); - } - $zip->close(); - - // Download it - header('Content-Type: application/zip'); - header("Content-Transfer-Encoding: Binary"); - header("Content-disposition: attachment; filename=\"" . basename($zipFilename) . "\""); - readfile($zipFilename); - unlink($zipFilename); - exit; - } - } catch (Exception $e) { - header('HTTP/1.1 400 Bad Request'); - header('X-Info: ' . $e->getMessage()); - exit; - } -} diff --git a/htdocs/templates/administration/compta_banque.html b/htdocs/templates/administration/compta_banque.html deleted file mode 100644 index e96fc3058..000000000 --- a/htdocs/templates/administration/compta_banque.html +++ /dev/null @@ -1,147 +0,0 @@ -{if $action == 'lister'} -

Journal de banque

- - - -
- - -
-
- - -
-
-
- - -
-
-
-
-
- - - - - - - - - - - - - - - - {assign var=compteurLigne value=1} - {foreach from=$journal item=ecriture} - - - - - {if $ecriture.idoperation == 1} - - - {else} - - - {/if} - - - {foreach from=$sousTotal item=txt} - {if $ecriture.mois == $txt.mois && $compteurLigne == $txt.nligne } - - - - - - - {assign var=compteurLigne value=0} - {/if} - {/foreach} - - {assign var=compteurLigne value=$compteurLigne+1} - - {foreachelse} - - - - {/foreach} - - - - - - - - - - - - - -
DateOperationDescriptionDépenseRecette 
{$ecriture.date_regl|date_format:"%d/%m/%Y"}{$ecriture.reglement}{$ecriture.description}{$ecriture.montant|floatval|number_format:2:',':' '} {$ecriture.montant|floatval|number_format:2:',':' '} - - - -
- Sous Total - - {if $txt.debit}{$txt.debit|floatval|number_format:2:',':' '}{else}0,00{/if} - - {if $txt.credit}{$txt.credit|floatval|number_format:2:',':' '}{else}0,00{/if} - - {$txt.dif|floatval|number_format:2:',':' '} -
Aucune ecriture actuellement
- -
-
- {$total.debit|floatval|number_format:2:',':' '} -
- - Total débit - -
-
-
-
- {$total.credit|floatval|number_format:2:',':' '} -
- - Total crédit - -
-
 
-
-
- {$total.dif|floatval|number_format:2:',':' '} -
- - Solde - -
-
 
- -
-{/if} diff --git a/sources/AppBundle/Controller/Admin/Accounting/BankAccounts/ListStatementAction.php b/sources/AppBundle/Controller/Admin/Accounting/BankAccounts/ListStatementAction.php deleted file mode 100644 index 616fb5e38..000000000 --- a/sources/AppBundle/Controller/Admin/Accounting/BankAccounts/ListStatementAction.php +++ /dev/null @@ -1,51 +0,0 @@ -query->has('periodId') ? $request->query->getInt('periodId') : null; - $accountId = $request->query->getInt('accountId', 1); - $period = $this->invoicingPeriodRepository->getCurrentPeriod($periodId); - $formPeriod = $this->createForm(InvoicingPeriodType::class, $period); - $periods = $this->invoicingPeriodRepository->getAll(); - - $accounts = $this->accountRepository->getActiveAccounts(); - $start = $period->getStartDate()->format('Y-m-d'); - $end = $period->getEndDate()->format('Y-m-d'); - $statements = $this->comptabilite->obtenirJournalBanque($accountId, $start, $end); - $subTotal = $this->comptabilite->obtenirSousTotalJournalBanque($start, $end, $accountId); - $total = $this->comptabilite->obtenirTotalJournalBanque($start, $end, $accountId); - - return new Response($this->twig->render('admin/accounting/bank-accounts/list.html.twig', [ - 'periods' => $periods, - 'periodId' => $period->getId(), - 'formPeriod' => $formPeriod->createView(), - 'accounts' => $accounts, - 'accountId' => $accountId, - 'statements' => $statements, - 'subTotal' => $subTotal, - 'total' => $total, - ])); - } -} diff --git a/templates/admin/accounting/bank-accounts/list.html.twig b/templates/admin/accounting/bank-accounts/list.html.twig deleted file mode 100644 index b5c6c3a30..000000000 --- a/templates/admin/accounting/bank-accounts/list.html.twig +++ /dev/null @@ -1,132 +0,0 @@ -{% extends 'admin/base_with_header.html.twig' %} - -{% block content %} - -

Journal de banque

- - -
- - {% include 'admin/accounting/invoicing-period.form.html.twig' with {form: formPeriod, url: path('admin_accounting_accounts_list')} %} - - - - - - - - - - - - - - - - {% set cptLines = 1 %} - {% if statements|length > 0 %} - {% for line in statements %} - - - - - {% if line.idoperation == 1 %} - - - {% else %} - - - {% endif %} - - - {% for txt in subTotal %} - {% if line.mois == txt.mois and cptLines == txt.nligne %} - - - - - - - {% set cptLines = 0 %} - {% endif %} - {% endfor %} - {% set cptLines = cptLines + 1 %} - {% endfor %} - - - {% else %} - - - - {% endif %} - - - - - - - - - - - - - -
DateOperationDescriptionDépenseRecette 
{{ line.date_regl|date("d/m/Y") }}{{ line.reglement}}{{ line.description}}{{ line.montant|number_format(2, ',',' ') }} {{ line.montant|number_format(2, ',', ' ') }} - - - -
- Sous Total - - {{ txt.debit|default(0)|number_format(2, ',', ' ') }} - - {{ txt.credit|default(0)|number_format(2, ',', ' ') }} - - {{ txt.dif|number_format(2, ',',' ') }} -
Aucune ecriture actuellement
- -
-
- {{ total.debit|number_format(2, ',', ' ') }} -
- - Total débit - -
-
-
-
- {{ total.credit|number_format(2, ',', ' ') }} -
- - Total crédit - -
-
 
-
-
- {{ total.dif|number_format(2, ',', ' ') }} -
- - Solde - -
-
 
- -
- -{% endblock %} diff --git a/tests/behat/features/Admin/Tresorerie/CompteBanques.feature b/tests/behat/features/Admin/Tresorerie/CompteBanques.feature deleted file mode 100644 index f6ebdb875..000000000 --- a/tests/behat/features/Admin/Tresorerie/CompteBanques.feature +++ /dev/null @@ -1,22 +0,0 @@ -Feature: Administration - Trésorerie - Compte banques - - @reloadDbWithTestData - Scenario: Compte banques voir le journal de banque - Given I am logged in as admin and on the Administration - When I follow "Compte banques" - Then the ".content h2" element should contain "Journal de banque" - Then I should see "Carte Bleue Une recette qui rapporte 1 000,00" - Then I should see "Carte Bleue Une dépense très utile 500,00" - Then I should see "Sous Total 500,00 1 000,00 500,00" - Then I should see "Carte Bleue Une dépense très utile 500,00" - Then I should see "Sous Total 100,00 0,00 400,00" - Then I should see "600,00 Total débit" - Then I should see "1 000,00 Total crédit" - Then I should see "400,00 solde" - - @reloadDbWithTestData - Scenario: Compte banques Export Excel - Given I am logged in as admin and on the Administration - When I follow "Compte banques" - And I follow "Export XLSX" - Then the response header "Content-disposition" should match '#filename="compta_afup_(.*).xlsx"#'