58cbfe4437
Auto Tag Develop / tag (push) Successful in 6s
ERP-90 — Étape 3/7 M2 fournisseurs (stack sur ERP-89). ## Périmètre - **5 permissions** `commercial.suppliers.*` (view / manage / accounting.view / accounting.manage / archive) dans `CommercialModule::permissions()`. - **3 sources RBAC synchronisées** (règle ABSOLUE n°8, même commit) : - `config/sidebar.php` — item `/suppliers` + `commercial.suppliers.view` - `frontend/tests/e2e/_fixtures/personas.ts` — persona `user-full` - `SeedE2ECommand.php` — miroir back - **Assignation par rôle** dans `RbacSeeder::MATRIX` (§ 2.9, idempotent) : - Bureau : view + manage - Compta : view + accounting.view + accounting.manage - Commerciale : view + manage - Usine : aucune - archive : Admin seul - **Sécurité des référentiels** (`tva_modes` / `payment_delays` / `payment_types` / `banks`) élargie : `view client OR view fournisseur` (§ 4.7). ## Vérifications - `app:sync-permissions` (+5) et `app:seed-rbac --with-demo-users` (idempotent) OK - `make test` : 499 tests verts - `make php-cs-fixer-allow-risky` : 0 fix - `make nuxt-test` : 234 tests verts --------- Co-authored-by: Matthieu <contact@malio.fr> Reviewed-on: #69 Co-authored-by: THOLOT DECHENE Matthieu <matthieu@yuno.malio.fr> Co-committed-by: THOLOT DECHENE Matthieu <matthieu@yuno.malio.fr>
106 lines
3.0 KiB
PHP
106 lines
3.0 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') or is_granted('commercial.suppliers.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') or is_granted('commercial.suppliers.view')",
|
|
normalizationContext: ['groups' => ['bank:read']],
|
|
),
|
|
],
|
|
security: "is_granted('commercial.clients.view') or is_granted('commercial.suppliers.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;
|
|
}
|
|
}
|