Skip to content

Commit

Permalink
afup#1428 tests unitaire + fonctionnels qualification comptable
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Jan 21, 2024
1 parent c1fc2a2 commit 2efdfc3
Show file tree
Hide file tree
Showing 9 changed files with 468 additions and 123 deletions.
1 change: 1 addition & 0 deletions db/migrations/20240120222107_compta_regle.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function change()
`vat` VARCHAR(7) NULL,
`category_id` TINYINT(5) NULL,
`event_id` TINYINT(5) NULL,
`mode_regl_id` TINYINT(5) NULL,
`attachment_required` TINYINT(2) NULL,
PRIMARY KEY (`id`)
);
Expand Down
166 changes: 166 additions & 0 deletions db/seeds/ComptaRegle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?php

use AppBundle\Model\ComptaCategorie;
use AppBundle\Model\ComptaEvenement;
use AppBundle\Model\ComptaModeReglement;
use Phinx\Seed\AbstractSeed;

class ComptaRegle extends AbstractSeed
{
public function run()
{

$data = [
[
'id' => 1,
'label' => 'VIR sprd.net',
'condition' => 'VIR SEPA sprd.net AG',
'is_credit' => '1',
'mode_regl_id' => ComptaEvenement::ASSOCIATION_AFUP,
'vat' => null,
'category_id' => ComptaCategorie::GOODIES,
'event_id' => ComptaEvenement::ASSOCIATION_AFUP,
'attachment_required' => null,
],
[
'id' => 2,
'label' => 'CB COM AFUP',
'condition' => '*CB COM AFUP ',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::PRELEVEMENT,
'vat' => null,
'category_id' => ComptaCategorie::FRAIS_DE_COMPTE,
'event_id' => ComptaEvenement::GESTION,
'attachment_required' => null,
],
[
'id' => 3,
'label' => 'COTIS ASSOCIATIS ESSENTIEL',
'condition' => '* COTIS ASSOCIATIS ESSENTIEL',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::PRELEVEMENT,
'vat' => null,
'category_id' => ComptaCategorie::FRAIS_DE_COMPTE,
'event_id' => ComptaEvenement::GESTION,
'attachment_required' => null,
],
[
'id' => 4,
'label' => 'URSSAF',
'condition' => 'PRLV URSSAF',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::PRELEVEMENT,
'vat' => null,
'category_id' => ComptaCategorie::CHARGES_SOCIALES,
'event_id' => ComptaEvenement::GESTION,
'attachment_required' => null,
],
[
'id' => 5,
'label' => 'DGFIP',
'condition' => 'PRLV B2B DGFIP',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::PRELEVEMENT,
'vat' => null,
'category_id' => ComptaCategorie::PRELEVEMENT_SOURCE,
'event_id' => ComptaEvenement::GESTION,
'attachment_required' => null,
],
[
'id' => 6,
'label' => 'MALAKOFF HUMANIS',
'condition' => 'PRLV A3M - RETRAITE - MALAKOFF HUMANIS',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::PRELEVEMENT,
'vat' => null,
'category_id' => ComptaCategorie::CHARGES_SOCIALES,
'event_id' => ComptaEvenement::GESTION,
'attachment_required' => null,
],
[
'id' => 7,
'label' => 'Online SAS',
'condition' => 'PRLV Online SAS -',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::PRELEVEMENT,
'vat' => null,
'category_id' => ComptaCategorie::OUTILS,
'event_id' => ComptaEvenement::ASSOCIATION_AFUP,
'attachment_required' => null,
],
[
'id' => 8,
'label' => 'meetup.org',
'condition' => 'CB MEETUP ORG',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::PRELEVEMENT,
'vat' => null,
'category_id' => ComptaCategorie::MEETUP,
'event_id' => ComptaEvenement::ASSOCIATION_AFUP,
'attachment_required' => 1,
],
[
'id' => 9,
'label' => 'POINT TRANSACTION SYSTEM',
'condition' => 'PRLV POINT TRANSACTION SYSTEM -',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::PRELEVEMENT,
'vat' => null,
'category_id' => ComptaCategorie::FRAIS_DE_COMPTE,
'event_id' => ComptaEvenement::ASSOCIATION_AFUP,
'attachment_required' => 1,
],
[
'id' => 10,
'label' => 'Mailchimp',
'condition' => 'CB MAILCHIMP FACT',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::CB,
'vat' => null,
'category_id' => ComptaCategorie::MAILCHIMP,
'event_id' => ComptaEvenement::ASSOCIATION_AFUP,
'attachment_required' => 1,
],
[
'id' => 11,
'label' => 'AWS',
'condition' => 'CB AWS EMEA FACT',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::CB,
'vat' => null,
'category_id' => ComptaCategorie::OUTILS,
'event_id' => ComptaEvenement::ASSOCIATION_AFUP,
'attachment_required' => 1,
],
[
'id' => 12,
'label' => 'gandi.net',
'condition' => 'CB GANDI FACT',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::CB,
'vat' => null,
'category_id' => ComptaCategorie::GANDI,
'event_id' => ComptaEvenement::ASSOCIATION_AFUP,
'attachment_required' => 1,
],
[
'id' => 13,
'label' => 'Twilio',
'condition' => 'CB GANDI FACT',
'is_credit' => 0,
'mode_regl_id' => ComptaModeReglement::CB,
'vat' => null,
'category_id' => ComptaCategorie::OUTILS,
'event_id' => ComptaEvenement::ASSOCIATION_AFUP,
'attachment_required' => 1,
],
];

$table = $this->table('compta_regle');
$table->truncate();

$table
->insert($data)
->save();
}
}
7 changes: 5 additions & 2 deletions htdocs/pages/administration/compta_conf_regle.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Afup\Site\Comptabilite\Comptabilite;
use Afup\Site\Utils\Logs;
use AppBundle\Controller\LegacyController;
use AppBundle\Model\ComptaModeReglement;

/** @var LegacyController $this */

Expand Down Expand Up @@ -35,10 +36,12 @@
$formulaire->addElement('header', '', '');
$formulaire->addElement('text', 'label', 'Nom de la règle', array('size' => 30, 'maxlength' => 255));
$formulaire->addElement('text', 'condition', 'Condition', array('size' => 30, 'maxlength' => 255));
$formulaire->addElement('select', 'is_credit', 'Sens', array(null => 'Les deux', '1' => 'Crédit', '0' => 'Débit'));
$formulaire->addElement('select', 'vat', 'Taux de TVA', array('0' => 'Non soumis', '5.50' => '5.5%', '10.00' => '10%', '20.00' => '20%'));
$formulaire->addElement('select', 'is_credit', 'Crédit/débit ?', array(null => 'Les deux', '1' => 'Crédit', '0' => 'Débit'));
$formulaire->addElement('select', 'mode_regl_id', 'Mode de règlement', array_merge([null => 'N.C.'], ComptaModeReglement::list()));
$formulaire->addElement('select', 'vat', 'Taux de TVA', array('0' => 'N.C.', '5_5' => '5.5%', '10' => '10%', '20' => '20%'));
$formulaire->addElement('select', 'category_id', 'Catégorie', $compta->obtenirListCategories());
$formulaire->addElement('select', 'event_id', 'Évènement', $compta->obtenirListEvenements());
$formulaire->addElement('select', 'attachment_required', 'Justificatif obligatoire ?', array(null => 'N.C.', '1' => 'Oui', '0' => 'Non'));

$formulaire->addRule('label' , 'Nom manquant' , 'required');
$formulaire->addRule('condition' , 'Condition manquante' , 'required');
Expand Down
20 changes: 19 additions & 1 deletion htdocs/templates/administration/compta_conf_regle.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ <h2>Configuration des règles</h2>
<thead>
<tr>
<th>Règle</th>
<th>Condition</th>
<th></th>
</tr>
</thead>
<tbody>
{foreach from=$data item=regle}
<tr>
<td>{$regle.label}</td>
<td>
<code>{$regle.condition}</code>
</td>
<td style="text-align: right">
<a href="index.php?page=compta_conf_regle&amp;action=modifier&amp;id={$regle.id}"
data-position="left center"
Expand All @@ -42,7 +46,6 @@ <h2>Configuration des règles</h2>
</tbody>
</table>
</div>

{else}
{if $action == 'ajouter'}
<h2>Ajouter une règle</h2>
Expand All @@ -51,3 +54,18 @@ <h2>Modifier une règle</h2>
{/if}
{include file="formulaire.html"}
{/if}

{literal}
<style>
code {
font-family: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
background: #EEE;
border: 1px solid #999;
line-height: 1;
word-wrap: break-word;
padding: .1rem .2rem;
border-radius: .2rem;
font-size: 10px;
}
</style>
{/literal}
Loading

0 comments on commit 2efdfc3

Please sign in to comment.