3fe0f676f6
Auto Tag Develop / tag (push) Successful in 11s
Ticket Lesstime #139 (M3 — Répertoire prestataires, position 1.9). DoD back avant le front : suite PHPUnit consolidée sur la matrice § 8.1 + captures JSON réelles dans la spec § 4.0.bis. ## Contenu - **Fix réfs comptables** : `provider:read:accounting` ajouté sur `TvaMode`/`PaymentDelay`/`PaymentType`/`Bank` — sans ça elles sortaient en IRI nu dans le détail prestataire (réplique du fix ERP-92 du M2, piège #1 § 4.0.bis). - **`ProviderSerializationContractTest`** (13 tests) : gating RIB/scalaires par omission, réfs compta en objet `{id,code,label}`, `isArchived`, embed categories/sites liste+détail, sous-collections, enveloppe AP4 ; `testDodReferenceJsonShape` dumpe le JSON réel (`PROVIDER_DOD_DUMP=1`). - **`ProviderAuditTest`** (5 tests) : create/update/archive (`technique.Provider`), iban/bic dans le diff (`technique.ProviderRib`, pas dAuditIgnore), trace M2M `sites`. - **`ProviderListTest`** étendu : `?pagination=false`, anti-N+1, filtre `?typeCode=PRESTATAIRE`. - **`ProviderRbacGatingTest`** étendu : restauration en conflit de nom → 409 (RG-3.14). - **`ProviderFixtures`** (§ 8.4) : démo idempotente (complet VIREMENT+banque+RIB, LCR+RIB, CHEQUE multi-cat, minimal, archivé) répartie sur sites 86/17/82 ; skip en env `test`. - Helper `seedCompleteProvider` ; spec § 4.0.bis : gabarits remplacés par les captures réelles (liste + détail avec/sans accounting.view). ## Vérifications - `make php-cs-fixer-allow-risky` → 0 fichier - `make test` → OK, 677 tests, 3328 assertions (garde-fous globaux verts) ## Notes - MR stackée sur ERP-138 (base = sa branche). - Fixtures démo exercées en dev via `make fixtures` (autowiring vérifié). --------- Co-authored-by: Matthieu <contact@malio.fr> Reviewed-on: #100
108 lines
3.4 KiB
PHP
108 lines
3.4 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\DoctrinePaymentDelayRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Serializer\Attribute\Groups;
|
|
|
|
/**
|
|
* Delai de reglement applique a un client (15 jours, 30 jours, a reception) :
|
|
* 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 ;
|
|
* `supplier:read:accounting` dans la reponse Fournisseur (M2, ERP-92 — § 4.0) ;
|
|
* `provider:read:accounting` dans la reponse Prestataire (M3, ERP-139 — § 4.0.bis).
|
|
*/
|
|
#[ApiResource(
|
|
operations: [
|
|
new GetCollection(
|
|
security: "is_granted('commercial.clients.view') or is_granted('commercial.suppliers.view')",
|
|
normalizationContext: ['groups' => ['payment_delay: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') or is_granted('commercial.suppliers.view')",
|
|
normalizationContext: ['groups' => ['payment_delay:read']],
|
|
),
|
|
],
|
|
security: "is_granted('commercial.clients.view') or is_granted('commercial.suppliers.view')",
|
|
)]
|
|
#[ORM\Entity(repositoryClass: DoctrinePaymentDelayRepository::class)]
|
|
#[ORM\Table(name: 'payment_delay')]
|
|
#[ORM\UniqueConstraint(name: 'uq_payment_delay_code', columns: ['code'])]
|
|
class PaymentDelay
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
#[Groups(['payment_delay:read', 'client:read:accounting', 'supplier:read:accounting', 'provider:read:accounting'])]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 30)]
|
|
#[Groups(['payment_delay:read', 'client:read:accounting', 'supplier:read:accounting', 'provider:read:accounting'])]
|
|
private ?string $code = null;
|
|
|
|
#[ORM\Column(length: 120)]
|
|
#[Groups(['payment_delay:read', 'client:read:accounting', 'supplier:read:accounting', 'provider:read:accounting'])]
|
|
private ?string $label = null;
|
|
|
|
#[ORM\Column(options: ['default' => 0])]
|
|
#[Groups(['payment_delay: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;
|
|
}
|
|
}
|