120058049c
Auto Tag Develop / tag (push) Successful in 7s
Dernier wagon de la stack back M1. ERP-60 = polish stack + couverture de tests PHPUnit NON dépendante des rôles métier (cf. spec § 7 / § 8.1). ## Phase 0 — polish stack (déjà mergé dans les branches basses via rebase) - ERP-59 : route sidebar `/clients` (au lieu de `/commercial/clients`), cohérente avec `/suppliers`. - One-liner pagination Client abandonné : `pagination_client_enabled: true` est déjà le défaut global → `?pagination=false` marche déjà sur `/api/clients` (décision P7). ## Phase 1 — tests (combler les trous, zéro duplication) 8 nouvelles suites couvrant les RG non encore testées par ERP-55/56/57/58 : - `ClientFormulaireMainTest` — RG-1.02 (téléphone secondaire, max 2). - `ClientAddressTest` — RG-1.06/07/08 + RG-1.11 (CHECK BDD prospect/billing). - `ClientUniquenessTest` — RG-1.15/1.17 (Q4 : SIREN/email NON uniques). - `ClientArchiveTest` — **RG-1.23 : 409 restauration en conflit (gap P1)**. - `ClientAuditTest` — RG-1.27 (created* figés / updatedBy modificateur) + iban/bic présents dans le diff audité. - `ClientMigrationTest` — index partiel unique `uq_client_company_name_active` (1 seul) ; pas d'index siren/email. - `ClientSecurityTest` — 401 anonyme + 403 sans `commercial.clients.view`. - `ClientPatchStrictTest` — RG-1.28 (403 strict mix de groupes, fonctionnel). Cahier de test complet (mapping de TOUTES les RG → test) : `docs/specs/M1-clients/cahier-test-back-M1.md`. ## Délégué à ERP-74 (#493) Matrice RBAC différenciée (bureau/compta/commerciale/usine) + RG-1.04 fonctionnel — exigent les rôles métier seedés après le merge de la stack. ## Gaps documentés (cahier) - RG-1.29 validation écriture (catégorie type sur adresse → 422) non implémentée back (hors § 8.1, ticket test-only). - Violations CHECK adresse → rejet (≥400) sans mapping fin 422 (amélioration possible). ## Vérifs `make db-reset && make php-cs-fixer-allow-risky && make test` → **421 tests OK, 1386 assertions, 0 risky**. Nouveaux tests : 17, 71 assertions. --------- Co-authored-by: Matthieu <contact@malio.fr> Reviewed-on: #38 Co-authored-by: THOLOT DECHENE Matthieu <matthieu@yuno.malio.fr> Co-committed-by: THOLOT DECHENE Matthieu <matthieu@yuno.malio.fr>
106 lines
2.9 KiB
PHP
106 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Module\Commercial\Domain\Entity;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Get;
|
|
use ApiPlatform\Metadata\GetCollection;
|
|
use App\Module\Commercial\Infrastructure\Doctrine\DoctrineBankRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Serializer\Attribute\Groups;
|
|
|
|
/**
|
|
* Banque selectionnable pour le reglement par virement (Societe Generale,
|
|
* CIC, Credit Agricole) : referentiel statique seede par la migration M1 et
|
|
* re-seede en dev/test par CommercialReferentialFixtures.
|
|
*
|
|
* Lecture seule au M1 (HP-M2-2) : GetCollection + Get uniquement (ERP-56),
|
|
* permission commercial.clients.view ; POST/PATCH/DELETE -> 405. Pas de
|
|
* Timestampable/Blamable (referentiel statique whiteliste dans
|
|
* EntitiesAreTimestampableBlamableTest::EXCLUDED). Le groupe
|
|
* `client:read:accounting` permet l'embarquement dans la reponse Client.
|
|
*/
|
|
#[ApiResource(
|
|
operations: [
|
|
new GetCollection(
|
|
security: "is_granted('commercial.clients.view')",
|
|
normalizationContext: ['groups' => ['bank:read']],
|
|
// Tri par defaut spec M1 § 4.7 : position ASC puis label ASC.
|
|
order: ['position' => 'ASC', 'label' => 'ASC'],
|
|
// ERP-72 : pagination serveur + toggle ?pagination=false (cf. TvaMode).
|
|
paginationClientEnabled: true,
|
|
),
|
|
new Get(
|
|
security: "is_granted('commercial.clients.view')",
|
|
normalizationContext: ['groups' => ['bank:read']],
|
|
),
|
|
],
|
|
security: "is_granted('commercial.clients.view')",
|
|
)]
|
|
#[ORM\Entity(repositoryClass: DoctrineBankRepository::class)]
|
|
#[ORM\Table(name: 'bank')]
|
|
#[ORM\UniqueConstraint(name: 'uq_bank_code', columns: ['code'])]
|
|
class Bank
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
#[Groups(['bank:read', 'client:read:accounting'])]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 30)]
|
|
#[Groups(['bank:read', 'client:read:accounting'])]
|
|
private ?string $code = null;
|
|
|
|
#[ORM\Column(length: 120)]
|
|
#[Groups(['bank:read', 'client:read:accounting'])]
|
|
private ?string $label = null;
|
|
|
|
#[ORM\Column(options: ['default' => 0])]
|
|
#[Groups(['bank:read'])]
|
|
private int $position = 0;
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getCode(): ?string
|
|
{
|
|
return $this->code;
|
|
}
|
|
|
|
public function setCode(string $code): static
|
|
{
|
|
$this->code = $code;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getLabel(): ?string
|
|
{
|
|
return $this->label;
|
|
}
|
|
|
|
public function setLabel(string $label): static
|
|
{
|
|
$this->label = $label;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPosition(): int
|
|
{
|
|
return $this->position;
|
|
}
|
|
|
|
public function setPosition(int $position): static
|
|
{
|
|
$this->position = $position;
|
|
|
|
return $this;
|
|
}
|
|
}
|