fix : correction des retours de la V0
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
This commit is contained in:
@@ -545,7 +545,6 @@ class SeedCommand extends Command
|
||||
'phone' => '05.49.20.09.10',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'LIOT CHATELLERAULT',
|
||||
'street' => "14 Allée d'Argenson",
|
||||
'street2' => 'ZI Nord',
|
||||
'postalCode' => '86100',
|
||||
@@ -560,7 +559,6 @@ class SeedCommand extends Command
|
||||
'phone' => '05.49.02.65.27',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'ARNAULT EURL',
|
||||
'street' => 'Moulin du Guéret',
|
||||
'street2' => 'B.P 30425',
|
||||
'postalCode' => '86100',
|
||||
@@ -575,7 +573,6 @@ class SeedCommand extends Command
|
||||
'phone' => '06.80.14.18.82',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'EARL DES GONNIERES',
|
||||
'street' => "27 Route d'Ingrandes",
|
||||
'street2' => 'Les Gonnières',
|
||||
'postalCode' => '86220',
|
||||
@@ -590,7 +587,6 @@ class SeedCommand extends Command
|
||||
'phone' => '05.49.86.17.95',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'EARL LESIGNY BABY',
|
||||
'street' => '2 Lieu Dit Les Bouquins',
|
||||
'street2' => null,
|
||||
'postalCode' => '86270',
|
||||
@@ -605,7 +601,6 @@ class SeedCommand extends Command
|
||||
'phone' => '03.85.24.25.50',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'FEDER',
|
||||
'street' => 'Molaise',
|
||||
'street2' => null,
|
||||
'postalCode' => '71120',
|
||||
@@ -620,7 +615,6 @@ class SeedCommand extends Command
|
||||
'phone' => '05.49.86.57.24',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => "GAEC DE L'ESPOIR",
|
||||
'street' => 'La Moujonnerie',
|
||||
'street2' => null,
|
||||
'postalCode' => '86450',
|
||||
@@ -635,7 +629,6 @@ class SeedCommand extends Command
|
||||
'phone' => '05.49.23.51.66',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'GRAVELEAU',
|
||||
'street' => '3, Le Jeu',
|
||||
'street2' => null,
|
||||
'postalCode' => '86220',
|
||||
@@ -650,7 +643,6 @@ class SeedCommand extends Command
|
||||
'phone' => '05.49.52.77.10',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'LORTHOLARY',
|
||||
'street' => 'Ferme de Geniec',
|
||||
'street2' => null,
|
||||
'postalCode' => '86550',
|
||||
@@ -665,7 +657,6 @@ class SeedCommand extends Command
|
||||
'phone' => '05.65.67.89.46',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'NATERA',
|
||||
'street' => 'Bd des Balquières',
|
||||
'street2' => 'BP 3220',
|
||||
'postalCode' => '12032',
|
||||
@@ -675,12 +666,11 @@ class SeedCommand extends Command
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'SCEA des Bariollières',
|
||||
'name' => 'SCEA DES BARIOLLIÈRES',
|
||||
'email' => 'elisregnier@gmail.com',
|
||||
'phone' => '06.09.37.65.61',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'SCEA des Bariollières',
|
||||
'street' => '2 rue des Barriollières',
|
||||
'street2' => null,
|
||||
'postalCode' => '86220',
|
||||
@@ -695,7 +685,6 @@ class SeedCommand extends Command
|
||||
'phone' => null,
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'SCEA SENE',
|
||||
'street' => '3 Route de la Roche Posay',
|
||||
'street2' => 'Les Girouettes',
|
||||
'postalCode' => '86100',
|
||||
@@ -710,7 +699,6 @@ class SeedCommand extends Command
|
||||
'phone' => '02.51.67.17.98',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'TERRENA',
|
||||
'street' => 'La Blanchardière',
|
||||
'street2' => null,
|
||||
'postalCode' => '44522',
|
||||
@@ -725,7 +713,6 @@ class SeedCommand extends Command
|
||||
'phone' => '05.49.19.44.33',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'TRICHERIE COOPERATIVE',
|
||||
'street' => 'B.P n°2',
|
||||
'street2' => null,
|
||||
'postalCode' => '86490',
|
||||
@@ -735,12 +722,11 @@ class SeedCommand extends Command
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'TURPAULT Muriel',
|
||||
'name' => 'TURPAULT MURIEL',
|
||||
'email' => null,
|
||||
'phone' => null,
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'TURPAULT Muriel',
|
||||
'street' => '23Bis Rue Marcel Pagnol',
|
||||
'street2' => null,
|
||||
'postalCode' => '86100',
|
||||
@@ -755,7 +741,6 @@ class SeedCommand extends Command
|
||||
'phone' => '0675446004',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'EARL DE LA MENAUDIERE',
|
||||
'street' => '1 la menaudière',
|
||||
'street2' => null,
|
||||
'postalCode' => '86450',
|
||||
@@ -770,7 +755,6 @@ class SeedCommand extends Command
|
||||
'phone' => '0675030304',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'SARL ERBS',
|
||||
'street' => 'les rodières ',
|
||||
'street2' => null,
|
||||
'postalCode' => '86230',
|
||||
@@ -811,7 +795,6 @@ class SeedCommand extends Command
|
||||
'email' => 'eurl.arnault86@orange.fr',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'ARNAULT EURL',
|
||||
'street' => 'Moulin du Guéret',
|
||||
'street2' => 'B.P 30425',
|
||||
'postalCode' => '86100',
|
||||
@@ -826,7 +809,6 @@ class SeedCommand extends Command
|
||||
'email' => 'sandra.robineaux@covilim.com',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'COVILIM',
|
||||
'street' => 'Rue de Nexon',
|
||||
'street2' => null,
|
||||
'postalCode' => '87000',
|
||||
@@ -836,12 +818,11 @@ class SeedCommand extends Command
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Les producteurs de la marche (LPM)',
|
||||
'name' => 'LES PRODUCTEURS DE LA MARCHE (LPM)',
|
||||
'phone' => '05.55.63.04.53',
|
||||
'email' => 'f.legalliard@lpmcoop.fr',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'Les producteurs de la marche (LPM)',
|
||||
'street' => 'Malonze',
|
||||
'street2' => null,
|
||||
'postalCode' => '23300',
|
||||
@@ -856,7 +837,6 @@ class SeedCommand extends Command
|
||||
'email' => 'contact86@lortholarybetail.com',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'LORTHOLARY BETAIL',
|
||||
'street' => 'FERME DE GENIEC',
|
||||
'street2' => null,
|
||||
'postalCode' => '86550',
|
||||
@@ -871,7 +851,6 @@ class SeedCommand extends Command
|
||||
'email' => 'scouillaud@terrena.fr',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'TERRENA',
|
||||
'street' => 'LA NOELLE',
|
||||
'street2' => 'BP 20199',
|
||||
'postalCode' => '44155',
|
||||
@@ -961,7 +940,7 @@ class SeedCommand extends Command
|
||||
{
|
||||
$addressRepo = $this->entityManager->getRepository(Address::class);
|
||||
$address = $addressRepo->findOneBy([
|
||||
'label' => $addressData['label'],
|
||||
'street' => $addressData['street'],
|
||||
'postalCode' => $addressData['postalCode'],
|
||||
]);
|
||||
if (!$address) {
|
||||
@@ -971,7 +950,6 @@ class SeedCommand extends Command
|
||||
++$this->updated;
|
||||
}
|
||||
$address
|
||||
->setLabel($addressData['label'])
|
||||
->setStreet($addressData['street'])
|
||||
->setStreet2($addressData['street2'])
|
||||
->setPostalCode($addressData['postalCode'])
|
||||
|
||||
@@ -108,7 +108,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '05.49.20.09.10',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'LIOT CHATELLERAULT',
|
||||
'street' => "14 Allée d'Argenson",
|
||||
'street2' => 'ZI Nord',
|
||||
'postalCode' => '86100',
|
||||
@@ -123,7 +122,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '05.49.02.65.27',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'ARNAULT EURL',
|
||||
'street' => 'Moulin du Guéret',
|
||||
'street2' => 'B.P 30425',
|
||||
'postalCode' => '86100',
|
||||
@@ -138,7 +136,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '06.80.14.18.82',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'EARL DES GONNIERES',
|
||||
'street' => "27 Route d'Ingrandes",
|
||||
'street2' => 'Les Gonnières',
|
||||
'postalCode' => '86220',
|
||||
@@ -153,7 +150,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '05.49.86.17.95',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'EARL LESIGNY BABY',
|
||||
'street' => '2 Lieu Dit Les Bouquins',
|
||||
'street2' => null,
|
||||
'postalCode' => '86270',
|
||||
@@ -168,7 +164,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '03.85.24.25.50',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'FEDER',
|
||||
'street' => 'Molaise',
|
||||
'street2' => null,
|
||||
'postalCode' => '71120',
|
||||
@@ -183,7 +178,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '05.49.86.57.24',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => "GAEC DE L'ESPOIR",
|
||||
'street' => 'La Moujonnerie',
|
||||
'street2' => null,
|
||||
'postalCode' => '86450',
|
||||
@@ -198,7 +192,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '05.49.23.51.66',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'GRAVELEAU',
|
||||
'street' => '3, Le Jeu',
|
||||
'street2' => null,
|
||||
'postalCode' => '86220',
|
||||
@@ -213,7 +206,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '05.49.52.77.10',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'LORTHOLARY',
|
||||
'street' => 'Ferme de Geniec',
|
||||
'street2' => null,
|
||||
'postalCode' => '86550',
|
||||
@@ -228,7 +220,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '05.65.67.89.46',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'NATERA',
|
||||
'street' => 'Bd des Balquières',
|
||||
'street2' => 'BP 3220',
|
||||
'postalCode' => '12032',
|
||||
@@ -238,12 +229,11 @@ class ReferenceFixtures extends Fixture
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'SCEA des Bariollières',
|
||||
'name' => 'SCEA DES BARIOLLIÈRES',
|
||||
'email' => 'elisregnier@gmail.com',
|
||||
'phone' => '06.09.37.65.61',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'SCEA des Bariollières',
|
||||
'street' => '2 rue des Barriollières',
|
||||
'street2' => null,
|
||||
'postalCode' => '86220',
|
||||
@@ -258,7 +248,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => null,
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'SCEA SENE',
|
||||
'street' => '3 Route de la Roche Posay',
|
||||
'street2' => 'Les Girouettes',
|
||||
'postalCode' => '86100',
|
||||
@@ -273,7 +262,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '02.51.67.17.98',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'TERRENA',
|
||||
'street' => 'La Blanchardière',
|
||||
'street2' => null,
|
||||
'postalCode' => '44522',
|
||||
@@ -288,7 +276,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '05.49.19.44.33',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'TRICHERIE COOPERATIVE',
|
||||
'street' => 'B.P n°2',
|
||||
'street2' => null,
|
||||
'postalCode' => '86490',
|
||||
@@ -298,12 +285,11 @@ class ReferenceFixtures extends Fixture
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'TURPAULT Muriel',
|
||||
'name' => 'TURPAULT MURIEL',
|
||||
'email' => null,
|
||||
'phone' => null,
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'TURPAULT Muriel',
|
||||
'street' => '23Bis Rue Marcel Pagnol',
|
||||
'street2' => null,
|
||||
'postalCode' => '86100',
|
||||
@@ -318,7 +304,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '0675446004',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'EARL DE LA MENAUDIERE',
|
||||
'street' => '1 la menaudière',
|
||||
'street2' => null,
|
||||
'postalCode' => '86450',
|
||||
@@ -333,7 +318,6 @@ class ReferenceFixtures extends Fixture
|
||||
'phone' => '0675030304',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'SARL ERBS',
|
||||
'street' => 'les rodières ',
|
||||
'street2' => null,
|
||||
'postalCode' => '86230',
|
||||
@@ -352,10 +336,9 @@ class ReferenceFixtures extends Fixture
|
||||
;
|
||||
|
||||
foreach ($supplierData['addresses'] as $addressData) {
|
||||
$addressKey = sprintf('%s|%s', $addressData['label'], $addressData['postalCode']);
|
||||
$addressKey = sprintf('%s|%s', $addressData['street'], $addressData['postalCode']);
|
||||
if (!isset($addressIndex[$addressKey])) {
|
||||
$addressIndex[$addressKey] = new Address()
|
||||
->setLabel($addressData['label'])
|
||||
->setStreet($addressData['street'])
|
||||
->setStreet2($addressData['street2'])
|
||||
->setPostalCode($addressData['postalCode'])
|
||||
@@ -378,7 +361,6 @@ class ReferenceFixtures extends Fixture
|
||||
'email' => 'eurl.arnault86@orange.fr',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'ARNAULT EURL',
|
||||
'street' => 'Moulin du Guéret',
|
||||
'street2' => 'B.P 30425',
|
||||
'postalCode' => '86100',
|
||||
@@ -393,7 +375,6 @@ class ReferenceFixtures extends Fixture
|
||||
'email' => 'sandra.robineaux@covilim.com',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'COVILIM',
|
||||
'street' => 'Rue de Nexon',
|
||||
'street2' => null,
|
||||
'postalCode' => '87000',
|
||||
@@ -403,12 +384,11 @@ class ReferenceFixtures extends Fixture
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Les producteurs de la marche (LPM)',
|
||||
'name' => 'LES PRODUCTEURS DE LA MARCHE (LPM)',
|
||||
'phone' => '05.55.63.04.53',
|
||||
'email' => 'f.legalliard@lpmcoop.fr',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'Les producteurs de la marche (LPM)',
|
||||
'street' => 'Malonze',
|
||||
'street2' => null,
|
||||
'postalCode' => '23300',
|
||||
@@ -423,7 +403,6 @@ class ReferenceFixtures extends Fixture
|
||||
'email' => 'contact86@lortholarybetail.com',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'LORTHOLARY BETAIL',
|
||||
'street' => 'FERME DE GENIEC',
|
||||
'street2' => null,
|
||||
'postalCode' => '86550',
|
||||
@@ -438,7 +417,6 @@ class ReferenceFixtures extends Fixture
|
||||
'email' => 'scouillaud@terrena.fr',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'TERRENA',
|
||||
'street' => 'LA NOELLE',
|
||||
'street2' => 'BP 20199',
|
||||
'postalCode' => '44155',
|
||||
@@ -457,10 +435,9 @@ class ReferenceFixtures extends Fixture
|
||||
;
|
||||
|
||||
foreach ($customerData['addresses'] as $addressData) {
|
||||
$addressKey = sprintf('%s|%s', $addressData['label'], $addressData['postalCode']);
|
||||
$addressKey = sprintf('%s|%s', $addressData['street'], $addressData['postalCode']);
|
||||
if (!isset($addressIndex[$addressKey])) {
|
||||
$addressIndex[$addressKey] = new Address()
|
||||
->setLabel($addressData['label'])
|
||||
->setStreet($addressData['street'])
|
||||
->setStreet2($addressData['street2'])
|
||||
->setPostalCode($addressData['postalCode'])
|
||||
|
||||
@@ -46,9 +46,9 @@ class Address
|
||||
#[Groups(['address:read', 'supplier:read', 'customer:read', 'shipment:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 120)]
|
||||
#[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read', 'shipment:read', 'address:write'])]
|
||||
private string $label = '';
|
||||
#[ORM\Column(length: 120, nullable: true)]
|
||||
#[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read', 'shipment:read'])]
|
||||
private ?string $label = null;
|
||||
|
||||
#[ORM\Column(length: 180)]
|
||||
#[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read', 'shipment:read', 'address:write'])]
|
||||
@@ -93,12 +93,12 @@ class Address
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
public function setLabel(string $label): self
|
||||
public function setLabel(?string $label): self
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class Carrier
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->name = mb_strtoupper($name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,11 @@ class Customer
|
||||
#[Groups(['customer:read', 'customer:write', 'shipment:read'])]
|
||||
private ?string $phone = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(name: 'created_by', nullable: true)]
|
||||
#[Groups(['customer:read', 'customer:write'])]
|
||||
private ?User $createdBy = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Address>
|
||||
*/
|
||||
@@ -85,7 +90,7 @@ class Customer
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->name = mb_strtoupper($name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -114,6 +119,18 @@ class Customer
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedBy(): ?User
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
public function setCreatedBy(?User $createdBy): self
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAddresses(): Collection
|
||||
{
|
||||
return $this->addresses;
|
||||
|
||||
@@ -8,6 +8,7 @@ use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
|
||||
use ApiPlatform\Metadata\ApiFilter;
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Delete;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
@@ -47,6 +48,9 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||
normalizationContext: ['groups' => ['reception:read']],
|
||||
denormalizationContext: ['groups' => ['reception:write']],
|
||||
),
|
||||
new Delete(
|
||||
requirements: ['id' => '\d+'],
|
||||
),
|
||||
new Get(
|
||||
uriTemplate: '/receptions/weigh',
|
||||
openapi: new OpenApiOperation(
|
||||
@@ -96,7 +100,10 @@ class Reception
|
||||
|
||||
#[ORM\Column(name: 'date_reception', type: 'datetime_immutable')]
|
||||
#[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
|
||||
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
|
||||
#[Context(
|
||||
normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i'],
|
||||
denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'],
|
||||
)]
|
||||
private ?DateTimeImmutable $receptionDate = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
@@ -259,6 +266,14 @@ class Reception
|
||||
|
||||
public function setReceptionDate(?DateTimeImmutable $receptionDate): self
|
||||
{
|
||||
if (null !== $receptionDate && null !== $this->receptionDate) {
|
||||
// Préserve l'heure existante quand seule la date est mise à jour
|
||||
$receptionDate = $receptionDate->setTime(
|
||||
(int) $this->receptionDate->format('H'),
|
||||
(int) $this->receptionDate->format('i'),
|
||||
(int) $this->receptionDate->format('s'),
|
||||
);
|
||||
}
|
||||
$this->receptionDate = $receptionDate;
|
||||
|
||||
return $this;
|
||||
@@ -457,8 +472,16 @@ class Reception
|
||||
#[ORM\PrePersist]
|
||||
public function initializeReceptionDate(): void
|
||||
{
|
||||
$now = new DateTimeImmutable();
|
||||
if (null === $this->receptionDate) {
|
||||
$this->receptionDate = new DateTimeImmutable();
|
||||
$this->receptionDate = $now;
|
||||
} else {
|
||||
// Préserve la date choisie mais utilise l'heure courante
|
||||
$this->receptionDate = $this->receptionDate->setTime(
|
||||
(int) $now->format('H'),
|
||||
(int) $now->format('i'),
|
||||
(int) $now->format('s'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
|
||||
use ApiPlatform\Metadata\ApiFilter;
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Delete;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
@@ -47,6 +48,9 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||
normalizationContext: ['groups' => ['shipment:read']],
|
||||
denormalizationContext: ['groups' => ['shipment:write']],
|
||||
),
|
||||
new Delete(
|
||||
requirements: ['id' => '\d+'],
|
||||
),
|
||||
new Get(
|
||||
uriTemplate: '/shipments/weigh',
|
||||
openapi: new OpenApiOperation(
|
||||
@@ -102,7 +106,10 @@ class Shipment
|
||||
|
||||
#[ORM\Column(name: 'shipment_date', type: 'datetime_immutable')]
|
||||
#[Groups(['shipment:read', 'shipment:write'])]
|
||||
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
|
||||
#[Context(
|
||||
normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i'],
|
||||
denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'],
|
||||
)]
|
||||
private ?DateTimeImmutable $shipmentDate = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
@@ -245,6 +252,13 @@ class Shipment
|
||||
|
||||
public function setShipmentDate(?DateTimeImmutable $shipmentDate): void
|
||||
{
|
||||
if (null !== $shipmentDate && null !== $this->shipmentDate) {
|
||||
$shipmentDate = $shipmentDate->setTime(
|
||||
(int) $this->shipmentDate->format('H'),
|
||||
(int) $this->shipmentDate->format('i'),
|
||||
(int) $this->shipmentDate->format('s'),
|
||||
);
|
||||
}
|
||||
$this->shipmentDate = $shipmentDate;
|
||||
}
|
||||
|
||||
@@ -303,6 +317,21 @@ class Shipment
|
||||
}
|
||||
}
|
||||
|
||||
#[ORM\PrePersist]
|
||||
public function initializeShipmentDate(): void
|
||||
{
|
||||
$now = new DateTimeImmutable();
|
||||
if (null === $this->shipmentDate) {
|
||||
$this->shipmentDate = $now;
|
||||
} else {
|
||||
$this->shipmentDate = $this->shipmentDate->setTime(
|
||||
(int) $now->format('H'),
|
||||
(int) $now->format('i'),
|
||||
(int) $now->format('s'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[ORM\PostPersist]
|
||||
public function initializeIdentificationNumber(PostPersistEventArgs $args): void
|
||||
{
|
||||
|
||||
@@ -61,6 +61,11 @@ class Supplier
|
||||
#[Groups(['supplier:read', 'reception:read', 'supplier:write'])]
|
||||
private ?string $phone = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(name: 'created_by', nullable: true)]
|
||||
#[Groups(['supplier:read', 'supplier:write'])]
|
||||
private ?User $createdBy = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Address>
|
||||
*/
|
||||
@@ -87,7 +92,7 @@ class Supplier
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->name = mb_strtoupper($name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -116,6 +121,18 @@ class Supplier
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedBy(): ?User
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
public function setCreatedBy(?User $createdBy): self
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Address>
|
||||
*/
|
||||
|
||||
@@ -61,11 +61,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
#[Groups(['user:read', 'user-login:read', 'reception:read', 'shipment:read'])]
|
||||
#[Groups(['user:read', 'user-login:read', 'reception:read', 'shipment:read', 'supplier:read', 'customer:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 180, unique: true)]
|
||||
#[Groups(['user:read', 'user:write', 'user-login:read', 'reception:read', 'shipment:read'])]
|
||||
#[Groups(['user:read', 'user:write', 'user-login:read', 'reception:read', 'shipment:read', 'supplier:read', 'customer:read'])]
|
||||
private string $username = '';
|
||||
|
||||
#[ORM\Column(type: 'json')]
|
||||
|
||||
Reference in New Issue
Block a user