| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?php
- declare(strict_types=1);
- namespace App\ApiResources\Dolibarr;
- use ApiPlatform\Core\Annotation\ApiProperty;
- use ApiPlatform\Core\Annotation\ApiResource;
- use Symfony\Component\Serializer\Annotation\Groups;
- /**
- * Données de l'organization retournées par l'API Dolibarr
- * (aussi nommé 'ThirdParty' ou 'Society' dans dolibarr)
- */
- #[ApiResource(
- itemOperations: [
- 'get' => [
- 'security' => '(is_granted("ROLE_ADMIN_CORE") or
- is_granted("ROLE_ADMINISTRATIF_MANAGER_CORE") or
- is_granted("ROLE_PEDAGOGICS_MANAGER_CORE") or
- is_granted("ROLE_FINANCIAL_MANAGER_CORE")
- ) and object.getOrganizationId() == user.getOrganization().getId()',
- 'method' => 'GET',
- 'path' => '/dolibarr/account/{organizationId}',
- 'requirements' => ['organizationId' => '\d+'],
- 'normalization_context' => [
- 'groups' => ['dolibarr_get']
- ],
- ],
- ],
- compositeIdentifier: false,
- )]
- class DolibarrAccount
- {
- #[ApiProperty(identifier: true)]
- #[Groups('dolibarr_get')]
- private int $organizationId;
- /**
- * Dolibarr societies pk
- */
- #[Groups('dolibarr_get')]
- private int $socId;
- /**
- * Opentalent client ref
- */
- #[Groups('dolibarr_get')]
- private string $clientNumber = "";
- /**
- * Opentalent product owned
- */
- #[Groups('dolibarr_get')]
- private string $product = "";
- /**
- * Contract and services currently active
- */
- #[Groups('dolibarr_get')]
- private ?object $contract = null;
- /**
- * Last bills
- */
- #[Groups('dolibarr_get')]
- private array $bills = [];
- public function getOrganizationId(): int
- {
- return $this->organizationId;
- }
- public function setOrganizationId(int $organizationId): void
- {
- $this->organizationId = $organizationId;
- }
- public function getSocId(): int
- {
- return $this->socId;
- }
- public function setSocId(int $socId): void
- {
- $this->socId = $socId;
- }
- public function getClientNumber(): string
- {
- return $this->clientNumber;
- }
- public function setClientNumber(string $clientNumber): void
- {
- $this->clientNumber = $clientNumber;
- }
- public function getProduct(): string
- {
- return $this->product;
- }
- public function setProduct(string $product): void
- {
- $this->product = $product;
- }
- public function getContract(): ?object
- {
- return $this->contract;
- }
- public function setContract(?object $contract): void
- {
- $this->contract = $contract;
- }
- public function getBills(): array
- {
- return $this->bills;
- }
- public function setBills(array $bills): void
- {
- $this->bills = $bills;
- }
- public function addBill(DolibarrBill $bill): void
- {
- $this->bills[] = $bill;
- }
- }
|