Vincent GUFFON 4 yıl önce
ebeveyn
işleme
a7b3a8e46c

+ 50 - 45
composer.lock

@@ -167,16 +167,16 @@
         },
         },
         {
         {
             "name": "blackfire/php-sdk",
             "name": "blackfire/php-sdk",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/blackfireio/php-sdk.git",
                 "url": "https://github.com/blackfireio/php-sdk.git",
-                "reference": "4901b67f73af5e4e3e056ebfd42cf0f1e5d490c6"
+                "reference": "ef112f9b49c9936523f997555548513e3a223f5a"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/blackfireio/php-sdk/zipball/4901b67f73af5e4e3e056ebfd42cf0f1e5d490c6",
-                "reference": "4901b67f73af5e4e3e056ebfd42cf0f1e5d490c6",
+                "url": "https://api.github.com/repos/blackfireio/php-sdk/zipball/ef112f9b49c9936523f997555548513e3a223f5a",
+                "reference": "ef112f9b49c9936523f997555548513e3a223f5a",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -188,11 +188,15 @@
                 "friends-of-behat/mink-browserkit-driver": "^1.4",
                 "friends-of-behat/mink-browserkit-driver": "^1.4",
                 "friends-of-behat/mink-extension": "^2.5",
                 "friends-of-behat/mink-extension": "^2.5",
                 "guzzlehttp/psr7": "^1.6",
                 "guzzlehttp/psr7": "^1.6",
+                "illuminate/console": "^8.61",
+                "illuminate/queue": "^8.61",
+                "illuminate/support": "^8.61",
                 "phpunit/phpunit": "^9.5",
                 "phpunit/phpunit": "^9.5",
                 "psr/http-message": "^1.0",
                 "psr/http-message": "^1.0",
                 "symfony/browser-kit": "^5.1",
                 "symfony/browser-kit": "^5.1",
                 "symfony/framework-bundle": "^5.1",
                 "symfony/framework-bundle": "^5.1",
                 "symfony/http-client": "^5.1",
                 "symfony/http-client": "^5.1",
+                "symfony/messenger": "^5.1",
                 "symfony/panther": "^1.0",
                 "symfony/panther": "^1.0",
                 "symfony/phpunit-bridge": "^5.2"
                 "symfony/phpunit-bridge": "^5.2"
             },
             },
@@ -204,7 +208,7 @@
             "type": "library",
             "type": "library",
             "extra": {
             "extra": {
                 "branch-alias": {
                 "branch-alias": {
-                    "dev-master": "1.26.x-dev"
+                    "dev-master": "1.27.x-dev"
                 }
                 }
             },
             },
             "autoload": {
             "autoload": {
@@ -234,9 +238,9 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/blackfireio/php-sdk/issues",
                 "issues": "https://github.com/blackfireio/php-sdk/issues",
-                "source": "https://github.com/blackfireio/php-sdk/tree/v1.26.0"
+                "source": "https://github.com/blackfireio/php-sdk/tree/v1.27.0"
             },
             },
-            "time": "2021-07-06T15:44:19+00:00"
+            "time": "2021-09-23T14:57:25+00:00"
         },
         },
         {
         {
             "name": "composer/ca-bundle",
             "name": "composer/ca-bundle",
@@ -1960,16 +1964,16 @@
         },
         },
         {
         {
             "name": "giggsey/libphonenumber-for-php",
             "name": "giggsey/libphonenumber-for-php",
-            "version": "8.12.32",
+            "version": "8.12.33",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/giggsey/libphonenumber-for-php.git",
                 "url": "https://github.com/giggsey/libphonenumber-for-php.git",
-                "reference": "b13fcfd3ebfef44486fc0bd1f830737047205ae3"
+                "reference": "554116cea0dec3cdf0ca1deb045df59b3a6385b0"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/b13fcfd3ebfef44486fc0bd1f830737047205ae3",
-                "reference": "b13fcfd3ebfef44486fc0bd1f830737047205ae3",
+                "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/554116cea0dec3cdf0ca1deb045df59b3a6385b0",
+                "reference": "554116cea0dec3cdf0ca1deb045df59b3a6385b0",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -2029,7 +2033,7 @@
                 "issues": "https://github.com/giggsey/libphonenumber-for-php/issues",
                 "issues": "https://github.com/giggsey/libphonenumber-for-php/issues",
                 "source": "https://github.com/giggsey/libphonenumber-for-php"
                 "source": "https://github.com/giggsey/libphonenumber-for-php"
             },
             },
-            "time": "2021-09-10T14:29:11+00:00"
+            "time": "2021-09-22T12:21:13+00:00"
         },
         },
         {
         {
             "name": "giggsey/locale",
             "name": "giggsey/locale",
@@ -2141,16 +2145,16 @@
         },
         },
         {
         {
             "name": "laminas/laminas-code",
             "name": "laminas/laminas-code",
-            "version": "4.4.2",
+            "version": "4.4.3",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/laminas/laminas-code.git",
                 "url": "https://github.com/laminas/laminas-code.git",
-                "reference": "54251ab2b16c41c6980387839496b235f5f6e10b"
+                "reference": "bb324850d09dd437b6acb142c13e64fdc725b0e1"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/laminas/laminas-code/zipball/54251ab2b16c41c6980387839496b235f5f6e10b",
-                "reference": "54251ab2b16c41c6980387839496b235f5f6e10b",
+                "url": "https://api.github.com/repos/laminas/laminas-code/zipball/bb324850d09dd437b6acb142c13e64fdc725b0e1",
+                "reference": "bb324850d09dd437b6acb142c13e64fdc725b0e1",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -2204,7 +2208,7 @@
                     "type": "community_bridge"
                     "type": "community_bridge"
                 }
                 }
             ],
             ],
-            "time": "2021-07-09T11:58:40+00:00"
+            "time": "2021-09-21T13:40:23+00:00"
         },
         },
         {
         {
             "name": "lcobucci/clock",
             "name": "lcobucci/clock",
@@ -2821,16 +2825,16 @@
         },
         },
         {
         {
             "name": "phpdocumentor/type-resolver",
             "name": "phpdocumentor/type-resolver",
-            "version": "1.4.0",
+            "version": "1.5.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/phpDocumentor/TypeResolver.git",
                 "url": "https://github.com/phpDocumentor/TypeResolver.git",
-                "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0"
+                "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
-                "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
+                "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f",
+                "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -2838,7 +2842,8 @@
                 "phpdocumentor/reflection-common": "^2.0"
                 "phpdocumentor/reflection-common": "^2.0"
             },
             },
             "require-dev": {
             "require-dev": {
-                "ext-tokenizer": "*"
+                "ext-tokenizer": "*",
+                "psalm/phar": "^4.8"
             },
             },
             "type": "library",
             "type": "library",
             "extra": {
             "extra": {
@@ -2864,9 +2869,9 @@
             "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
             "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
             "support": {
             "support": {
                 "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
                 "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
-                "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0"
+                "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0"
             },
             },
-            "time": "2020-09-17T18:55:26+00:00"
+            "time": "2021-09-17T15:28:14+00:00"
         },
         },
         {
         {
             "name": "psr/cache",
             "name": "psr/cache",
@@ -4367,16 +4372,16 @@
         },
         },
         {
         {
             "name": "symfony/flex",
             "name": "symfony/flex",
-            "version": "v1.15.4",
+            "version": "v1.16.1",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/symfony/flex.git",
                 "url": "https://github.com/symfony/flex.git",
-                "reference": "9a22ef2a75609a4d3717db784d923a7a6b347bc5"
+                "reference": "701891891209e70fb60e5ff3a5cd62216d66d7ab"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/flex/zipball/9a22ef2a75609a4d3717db784d923a7a6b347bc5",
-                "reference": "9a22ef2a75609a4d3717db784d923a7a6b347bc5",
+                "url": "https://api.github.com/repos/symfony/flex/zipball/701891891209e70fb60e5ff3a5cd62216d66d7ab",
+                "reference": "701891891209e70fb60e5ff3a5cd62216d66d7ab",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -4387,13 +4392,13 @@
                 "composer/composer": "^1.0.2|^2.0",
                 "composer/composer": "^1.0.2|^2.0",
                 "symfony/dotenv": "^4.4|^5.0",
                 "symfony/dotenv": "^4.4|^5.0",
                 "symfony/filesystem": "^4.4|^5.0",
                 "symfony/filesystem": "^4.4|^5.0",
-                "symfony/phpunit-bridge": "^4.4|^5.0",
+                "symfony/phpunit-bridge": "^4.4.12|^5.0",
                 "symfony/process": "^3.4|^4.4|^5.0"
                 "symfony/process": "^3.4|^4.4|^5.0"
             },
             },
             "type": "composer-plugin",
             "type": "composer-plugin",
             "extra": {
             "extra": {
                 "branch-alias": {
                 "branch-alias": {
-                    "dev-main": "1.13-dev"
+                    "dev-main": "1.16-dev"
                 },
                 },
                 "class": "Symfony\\Flex\\Flex"
                 "class": "Symfony\\Flex\\Flex"
             },
             },
@@ -4415,7 +4420,7 @@
             "description": "Composer plugin for Symfony",
             "description": "Composer plugin for Symfony",
             "support": {
             "support": {
                 "issues": "https://github.com/symfony/flex/issues",
                 "issues": "https://github.com/symfony/flex/issues",
-                "source": "https://github.com/symfony/flex/tree/v1.15.4"
+                "source": "https://github.com/symfony/flex/tree/v1.16.1"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -4431,7 +4436,7 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2021-09-13T14:49:33+00:00"
+            "time": "2021-09-23T14:52:29+00:00"
         },
         },
         {
         {
             "name": "symfony/framework-bundle",
             "name": "symfony/framework-bundle",
@@ -7396,16 +7401,16 @@
         },
         },
         {
         {
             "name": "twig/twig",
             "name": "twig/twig",
-            "version": "v3.3.2",
+            "version": "v3.3.3",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/twigphp/Twig.git",
                 "url": "https://github.com/twigphp/Twig.git",
-                "reference": "21578f00e83d4a82ecfa3d50752b609f13de6790"
+                "reference": "a27fa056df8a6384316288ca8b0fa3a35fdeb569"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/twigphp/Twig/zipball/21578f00e83d4a82ecfa3d50752b609f13de6790",
-                "reference": "21578f00e83d4a82ecfa3d50752b609f13de6790",
+                "url": "https://api.github.com/repos/twigphp/Twig/zipball/a27fa056df8a6384316288ca8b0fa3a35fdeb569",
+                "reference": "a27fa056df8a6384316288ca8b0fa3a35fdeb569",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -7415,7 +7420,7 @@
             },
             },
             "require-dev": {
             "require-dev": {
                 "psr/container": "^1.0",
                 "psr/container": "^1.0",
-                "symfony/phpunit-bridge": "^4.4.9|^5.0.9"
+                "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0"
             },
             },
             "type": "library",
             "type": "library",
             "extra": {
             "extra": {
@@ -7456,7 +7461,7 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/twigphp/Twig/issues",
                 "issues": "https://github.com/twigphp/Twig/issues",
-                "source": "https://github.com/twigphp/Twig/tree/v3.3.2"
+                "source": "https://github.com/twigphp/Twig/tree/v3.3.3"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -7468,7 +7473,7 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2021-05-16T12:14:13+00:00"
+            "time": "2021-09-17T08:44:23+00:00"
         },
         },
         {
         {
             "name": "vincent/foselastica",
             "name": "vincent/foselastica",
@@ -7744,16 +7749,16 @@
     "packages-dev": [
     "packages-dev": [
         {
         {
             "name": "nikic/php-parser",
             "name": "nikic/php-parser",
-            "version": "v4.12.0",
+            "version": "v4.13.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/nikic/PHP-Parser.git",
                 "url": "https://github.com/nikic/PHP-Parser.git",
-                "reference": "6608f01670c3cc5079e18c1dab1104e002579143"
+                "reference": "50953a2691a922aa1769461637869a0a2faa3f53"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143",
-                "reference": "6608f01670c3cc5079e18c1dab1104e002579143",
+                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53",
+                "reference": "50953a2691a922aa1769461637869a0a2faa3f53",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -7794,9 +7799,9 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/nikic/PHP-Parser/issues",
                 "issues": "https://github.com/nikic/PHP-Parser/issues",
-                "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0"
+                "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0"
             },
             },
-            "time": "2021-07-21T10:44:31+00:00"
+            "time": "2021-09-20T12:20:58+00:00"
         },
         },
         {
         {
             "name": "symfony/maker-bundle",
             "name": "symfony/maker-bundle",

+ 30 - 0
src/ApiResources/Profile/AccessProfile.php

@@ -55,6 +55,12 @@ class AccessProfile
     #[Groups('access_profile_read')]
     #[Groups('access_profile_read')]
     private ?array $historical=[];
     private ?array $historical=[];
 
 
+    #[Groups('access_profile_read')]
+    private bool $isGuardian = false;
+
+    #[Groups('access_profile_read')]
+    private bool $isPayor = false;
+
     #[Groups('access_profile_read')]
     #[Groups('access_profile_read')]
     private ?OrganizationProfile $organization = null;
     private ?OrganizationProfile $organization = null;
 
 
@@ -168,6 +174,30 @@ class AccessProfile
         return $this;
         return $this;
     }
     }
 
 
+    public function getIsGuardian(): bool
+    {
+        return $this->isGuardian;
+    }
+
+    public function setIsGuardian(bool $isGuardian): self
+    {
+        $this->isGuardian = $isGuardian;
+
+        return $this;
+    }
+
+    public function getIsPayor(): bool
+    {
+        return $this->isPayor;
+    }
+
+    public function setIsPayor(bool $isPayor): self
+    {
+        $this->isPayor = $isPayor;
+
+        return $this;
+    }
+
     public function getMultiAccesses(): Collection
     public function getMultiAccesses(): Collection
     {
     {
         return $this->multiAccesses;
         return $this->multiAccesses;

+ 15 - 1
src/ApiResources/Profile/OrganizationProfile.php

@@ -42,6 +42,9 @@ class OrganizationProfile
     #[Groups('access_profile_read')]
     #[Groups('access_profile_read')]
     private ?array $parents = [];
     private ?array $parents = [];
 
 
+    #[Groups('access_profile_read')]
+    private bool $showAdherentList = false;
+
     public function getId(): ?int
     public function getId(): ?int
     {
     {
         return $this->id;
         return $this->id;
@@ -139,7 +142,6 @@ class OrganizationProfile
         return $this;
         return $this;
     }
     }
 
 
-
     public function getParents(): array
     public function getParents(): array
     {
     {
         return $this->parents;
         return $this->parents;
@@ -150,4 +152,16 @@ class OrganizationProfile
         $this->parents[] = $parent;
         $this->parents[] = $parent;
         return $this;
         return $this;
     }
     }
+
+    public function getShowAdherentList(): bool
+    {
+        return $this->showAdherentList;
+    }
+
+    public function setShowAdherentList(bool $showAdherentList): self
+    {
+        $this->showAdherentList = $showAdherentList;
+
+        return $this;
+    }
 }
 }

+ 95 - 0
src/Entity/Access/Access.php

@@ -5,6 +5,8 @@ namespace App\Entity\Access;
 
 
 use ApiPlatform\Core\Annotation\ApiResource;
 use ApiPlatform\Core\Annotation\ApiResource;
 use ApiPlatform\Core\Annotation\ApiSubresource;
 use ApiPlatform\Core\Annotation\ApiSubresource;
+use App\Entity\Billing\AccessIntangible;
+use App\Entity\Billing\AccessPayer;
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\OrganizationLicence;
 use App\Entity\Organization\OrganizationLicence;
 use App\Repository\Access\AccessRepository;
 use App\Repository\Access\AccessRepository;
@@ -98,6 +100,15 @@ class Access implements UserInterface
     #[ORM\InverseJoinColumn(name: 'children_id', referencedColumnName: 'id')]
     #[ORM\InverseJoinColumn(name: 'children_id', referencedColumnName: 'id')]
     private Collection $children;
     private Collection $children;
 
 
+    #[ORM\OneToMany(mappedBy: 'accessPayer', targetEntity: AccessPayer::class, cascade: ['persist'], orphanRemoval: true)]
+    private Collection $billingPayers;
+
+    #[ORM\OneToMany(mappedBy: 'accessReceiver', targetEntity: AccessPayer::class, cascade: ['persist'], orphanRemoval: true)]
+    private Collection $billingReceivers;
+
+    #[ORM\OneToMany(mappedBy: 'access', targetEntity: AccessIntangible::class, cascade: ['persist'], orphanRemoval: true)]
+    private Collection $accessIntangibles;
+
     #[Pure] public function __construct()
     #[Pure] public function __construct()
     {
     {
         $this->personActivity = new ArrayCollection();
         $this->personActivity = new ArrayCollection();
@@ -106,6 +117,9 @@ class Access implements UserInterface
         $this->personalizedLists = new ArrayCollection();
         $this->personalizedLists = new ArrayCollection();
         $this->guardians = new ArrayCollection();
         $this->guardians = new ArrayCollection();
         $this->children = new ArrayCollection();
         $this->children = new ArrayCollection();
+        $this->billingPayers = new ArrayCollection();
+        $this->billingReceivers = new ArrayCollection();
+        $this->accessIntangibles = new ArrayCollection();
     }
     }
 
 
     public function getId(): ?int
     public function getId(): ?int
@@ -339,6 +353,87 @@ class Access implements UserInterface
         return $this;
         return $this;
     }
     }
 
 
+    public function getBillingPayers(): Collection
+    {
+        return $this->billingPayers;
+    }
+
+    public function addBillingPayer(AccessPayer $billingPayer): self
+    {
+        if (!$this->billingPayers->contains($billingPayer)) {
+            $this->billingPayers[] = $billingPayer;
+            $billingPayer->setAccessPayer($this);
+        }
+
+        return $this;
+    }
+
+    public function removeBillingPayer(AccessPayer $billingPayer): self
+    {
+        if ($this->billingPayers->removeElement($billingPayer)) {
+            // set the owning side to null (unless already changed)
+            if ($billingPayer->getAccessPayer() === $this) {
+                $billingPayer->setAccessPayer(null);
+            }
+        }
+
+        return $this;
+    }
+
+    public function getBillingReceivers(): Collection
+    {
+        return $this->billingReceivers;
+    }
+
+    public function addBillingReceiver(AccessPayer $billingReceiver): self
+    {
+        if (!$this->billingReceivers->contains($billingReceiver)) {
+            $this->billingReceivers[] = $billingReceiver;
+            $billingReceiver->setAccessReceiver($this);
+        }
+
+        return $this;
+    }
+
+    public function removeBillingReceiver(AccessPayer $billingPayer): self
+    {
+        if ($this->billingReceivers->removeElement($billingPayer)) {
+            // set the owning side to null (unless already changed)
+            if ($billingPayer->getAccessReceiver() === $this) {
+                $billingPayer->setAccessReceiver(null);
+            }
+        }
+
+        return $this;
+    }
+
+    public function getAccessIntangibles(): Collection
+    {
+        return $this->accessIntangibles;
+    }
+
+    public function addAccessIntangible(AccessIntangible $accessIntangibles): self
+    {
+        if (!$this->accessIntangibles->contains($accessIntangibles)) {
+            $this->accessIntangibles[] = $accessIntangibles;
+            $accessIntangibles->setAccess($this);
+        }
+
+        return $this;
+    }
+
+    public function removeAccessIntangible(AccessIntangible $accessIntangibles): self
+    {
+        if ($this->accessIntangibles->removeElement($accessIntangibles)) {
+            // set the owning side to null (unless already changed)
+            if ($accessIntangibles->getAccess() === $this) {
+                $accessIntangibles->setAccess(null);
+            }
+        }
+
+        return $this;
+    }
+
     #[Pure] public function getUserIdentifier(): string
     #[Pure] public function getUserIdentifier(): string
     {
     {
         return $this->person->getUsername();
         return $this->person->getUsername();

+ 30 - 0
src/Entity/Billing/AbstractBillingIntangible.php

@@ -0,0 +1,30 @@
+<?php
+declare(strict_types=1);
+
+namespace App\Entity\Billing;
+
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * Enregistrement d'un produit à facturer par une Organization, un Access ou un EducationalProject
+ * Classe de base de @see AccessIntangible, EducationalProjectIntangible
+ */
+
+#[ORM\Entity]
+#[ORM\Table(name: 'BillingIntangible')]
+#[ORM\InheritanceType('SINGLE_TABLE')]
+#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
+#[ORM\DiscriminatorMap([
+    'access' => 'AccessIntangible'
+])]
+abstract class AbstractBillingIntangible{
+    #[ORM\Id]
+    #[ORM\Column]
+    #[ORM\GeneratedValue]
+    private ?int $id = null;
+
+    public function getId(): ?int
+    {
+        return $this->id;
+    }
+}

+ 30 - 0
src/Entity/Billing/AbstractBillingPayer.php

@@ -0,0 +1,30 @@
+<?php
+declare(strict_types=1);
+
+namespace App\Entity\Billing;
+
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * Fais le lien entre l'Access qui règle la facture et l'Access ou
+ * l'EducationalProject concerné par la facture
+ * Classe de base de @see  AccessPayer, EducationalProjectPayer
+ */
+#[ORM\Entity]
+#[ORM\Table(name: 'BillingPayer')]
+#[ORM\InheritanceType('SINGLE_TABLE')]
+#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
+#[ORM\DiscriminatorMap([
+    'access' => 'AccessPayer'
+])]
+abstract class AbstractBillingPayer{
+    #[ORM\Id]
+    #[ORM\Column]
+    #[ORM\GeneratedValue]
+    private ?int $id = null;
+
+    public function getId(): ?int
+    {
+        return $this->id;
+    }
+}

+ 31 - 0
src/Entity/Billing/AccessIntangible.php

@@ -0,0 +1,31 @@
+<?php
+declare(strict_types=1);
+
+namespace App\Entity\Billing;
+
+use ApiPlatform\Core\Annotation\ApiResource;
+use App\Entity\Access\Access;
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * Enregistrement d'un produit à facturer par un Access
+ */
+#[ApiResource]
+#[ORM\Entity(repositoryClass: AccessIntangible::class)]
+class AccessIntangible extends AbstractBillingIntangible
+{
+    #[ORM\ManyToOne(inversedBy: 'accessIntangibles')]
+    private ?Access $access = null;
+
+    public function setAccess(?Access $access): self
+    {
+        $this->access = $access;
+
+        return $this;
+    }
+
+    public function getAccess(): ?Access
+    {
+        return $this->access;
+    }
+}

+ 49 - 0
src/Entity/Billing/AccessPayer.php

@@ -0,0 +1,49 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Entity\Billing;
+
+use ApiPlatform\Core\Annotation\ApiResource;
+use App\Repository\Billing\AccessPayerRepository;
+use App\Entity\Access\Access;
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * Fais le lien entre l'Access qui règle la facture et l'Access concerné
+ *
+ */
+#[ApiResource]
+#[ORM\Entity(repositoryClass: AccessPayerRepository::class)]
+class AccessPayer extends AbstractBillingPayer
+{
+    #[ORM\ManyToOne(inversedBy: 'billingPayers')]
+    private ?Access $accessPayer = null;
+
+    #[ORM\ManyToOne(inversedBy: 'billingReceivers')]
+    private ?Access $accessReceiver = null;
+
+    public function setAccessPayer(?Access $accessPayer): self
+    {
+        $this->accessPayer = $accessPayer;
+
+        return $this;
+    }
+
+    public function getAccessPayer():?Access
+    {
+        return $this->accessPayer;
+    }
+
+    public function setAccessReceiver(?Access $accessReceiver): self
+    {
+        $this->accessReceiver = $accessReceiver;
+
+        return $this;
+    }
+
+    public function getAccessReceiver():?Access
+    {
+        return $this->accessReceiver;
+    }
+}

+ 16 - 0
src/Repository/Billing/AccessIntangibleRepository.php

@@ -0,0 +1,16 @@
+<?php
+declare(strict_types=1);
+
+namespace App\Repository\Billing;
+
+use App\Entity\Billing\AccessIntangible;
+use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
+use Doctrine\Persistence\ManagerRegistry;
+
+final class AccessIntangibleRepository extends ServiceEntityRepository
+{
+    public function __construct(ManagerRegistry $registry)
+    {
+        parent::__construct($registry, AccessIntangible::class);
+    }
+}

+ 16 - 0
src/Repository/Billing/AccessPayerRepository.php

@@ -0,0 +1,16 @@
+<?php
+declare(strict_types=1);
+
+namespace App\Repository\Billing;
+
+use App\Entity\Billing\AccessPayer;
+use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
+use Doctrine\Persistence\ManagerRegistry;
+
+final class AccessPayerRepository extends ServiceEntityRepository
+{
+    public function __construct(ManagerRegistry $registry)
+    {
+        parent::__construct($registry, AccessPayer::class);
+    }
+}

+ 7 - 1
src/Service/Access/AccessProfileCreator.php

@@ -71,7 +71,13 @@ class AccessProfileCreator
             ->setIsAdminAccess($access->getAdminAccess())
             ->setIsAdminAccess($access->getAdminAccess())
             ->setRoles($this->accessUtils->getAllRoles($access))
             ->setRoles($this->accessUtils->getAllRoles($access))
             ->setHistorical($access->getHistorical())
             ->setHistorical($access->getHistorical())
-            ->setOrganization($this->organizationProfileCreator->createCompleteOrganizationProfile($access->getOrganization()));
+            ->setOrganization($this->organizationProfileCreator->createCompleteOrganizationProfile($access->getOrganization()))
+            ->setIsGuardian(!$access->getChildren()->isEmpty())
+            ->setIsPayor(
+                !$access->getBillingPayers()->isEmpty() ||
+                ($access->getBillingReceivers()->isEmpty() && $access->getChildren()->isEmpty() && !$access->getAccessIntangibles()->isEmpty())
+            )
+            ;
     }
     }
 
 
     /**
     /**

+ 3 - 0
src/Service/Organization/OrganizationProfileCreator.php

@@ -5,6 +5,8 @@ namespace App\Service\Organization;
 
 
 use App\ApiResources\Profile\OrganizationProfile;
 use App\ApiResources\Profile\OrganizationProfile;
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Organization;
+use App\Enum\Organization\PrincipalTypeEnum;
+use App\Enum\Organization\TypeEstablishmentDetailEnum;
 use App\Service\Network\Tree;
 use App\Service\Network\Tree;
 use App\Service\Security\Module;
 use App\Service\Security\Module;
 use App\Test\Service\Organization\OrganizationProfileCreatorTest;
 use App\Test\Service\Organization\OrganizationProfileCreatorTest;
@@ -32,6 +34,7 @@ class OrganizationProfileCreator
         $organizationProfile->setModules($this->module->getOrganizationModules($organization));
         $organizationProfile->setModules($this->module->getOrganizationModules($organization));
         $organizationProfile->setProduct($organization->getSettings()->getProduct());
         $organizationProfile->setProduct($organization->getSettings()->getProduct());
         $organizationProfile->setHasChildren($organization->getNetworkOrganizationChildren()->count() > 1);
         $organizationProfile->setHasChildren($organization->getNetworkOrganizationChildren()->count() > 1);
+        $organizationProfile->setShowAdherentList($organization->getParameters()->getShowAdherentList() && $organization->getPrincipalType() != PrincipalTypeEnum::ARTISTIC_EDUCATION_ONLY());
 
 
         foreach ($organization->getNetworkOrganizations() as $networkOrganization){
         foreach ($organization->getNetworkOrganizations() as $networkOrganization){
             $organizationProfile->addNetwork($networkOrganization->getNetwork()->getName());
             $organizationProfile->addNetwork($networkOrganization->getNetwork()->getName());

+ 58 - 0
tests/Service/Access/AccessProfileCreatorTest.php

@@ -4,6 +4,8 @@ namespace App\Test\Service\Access;
 use App\ApiResources\Profile\AccessProfile;
 use App\ApiResources\Profile\AccessProfile;
 use App\ApiResources\Profile\OrganizationProfile;
 use App\ApiResources\Profile\OrganizationProfile;
 use App\Entity\Access\Access;
 use App\Entity\Access\Access;
+use App\Entity\Billing\AccessIntangible;
+use App\Entity\Billing\AccessPayer;
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Organization;
 use App\Entity\Person\Person;
 use App\Entity\Person\Person;
 use App\Repository\Access\AccessRepository;
 use App\Repository\Access\AccessRepository;
@@ -81,4 +83,60 @@ class AccessProfileCreatorTest extends TestCase
         $accessProfile = $this->accessProfileCreator->createLightAccessProfile($this->access);
         $accessProfile = $this->accessProfileCreator->createLightAccessProfile($this->access);
         $this->assertInstanceOf(AccessProfile::class, $accessProfile);
         $this->assertInstanceOf(AccessProfile::class, $accessProfile);
     }
     }
+
+    public function testIsGuardian(){
+        $childrenMock = $this->getMockBuilder(Access::class)->disableOriginalConstructor()->getMock();
+        $this->access->addChild($childrenMock);
+
+        $accessProfile = $this->accessProfileCreator->createCompleteAccessProfile($this->access);
+        $this->assertTrue($accessProfile->getIsGuardian());
+    }
+
+    public function testIsNotGuardian(){
+        $accessProfile = $this->accessProfileCreator->createCompleteAccessProfile($this->access);
+        $this->assertFalse($accessProfile->getIsGuardian());
+    }
+
+    public function testIsPayorWithBillingPayer(){
+        $accessPayerMock = $this->getMockBuilder(AccessPayer::class)->disableOriginalConstructor()->getMock();
+        $this->access->addBillingPayer($accessPayerMock);
+
+        $accessProfile = $this->accessProfileCreator->createCompleteAccessProfile($this->access);
+        $this->assertTrue($accessProfile->getIsPayor());
+    }
+
+    public function testIsPayorWithAccessIntangible(){
+        $accessIntangibleMock = $this->getMockBuilder(AccessIntangible::class)->disableOriginalConstructor()->getMock();
+        $this->access->addAccessIntangible($accessIntangibleMock);
+
+        $accessProfile = $this->accessProfileCreator->createCompleteAccessProfile($this->access);
+        $this->assertTrue($accessProfile->getIsPayor());
+    }
+
+    public function testIsNotPayor(){
+        $accessProfile = $this->accessProfileCreator->createCompleteAccessProfile($this->access);
+        $this->assertFalse($accessProfile->getIsPayor());
+    }
+
+    public function testIsNotPayorWithAccessIntangibleBecauseChildren(){
+        $accessIntangibleMock = $this->getMockBuilder(AccessIntangible::class)->disableOriginalConstructor()->getMock();
+        $this->access->addAccessIntangible($accessIntangibleMock);
+
+        $childrenMock = $this->getMockBuilder(Access::class)->disableOriginalConstructor()->getMock();
+        $this->access->addChild($childrenMock);
+
+        $accessProfile = $this->accessProfileCreator->createCompleteAccessProfile($this->access);
+        $this->assertFalse($accessProfile->getIsPayor());
+    }
+
+    public function testIsNotPayorWithAccessIntangibleBecauseBillingReceivers(){
+        $accessIntangibleMock = $this->getMockBuilder(AccessIntangible::class)->disableOriginalConstructor()->getMock();
+        $this->access->addAccessIntangible($accessIntangibleMock);
+
+        $accessPayerMock = $this->getMockBuilder(AccessPayer::class)->disableOriginalConstructor()->getMock();
+        $this->access->addBillingReceiver($accessPayerMock);
+
+        $accessProfile = $this->accessProfileCreator->createCompleteAccessProfile($this->access);
+        $this->assertFalse($accessProfile->getIsPayor());
+    }
 }
 }

+ 44 - 17
tests/Service/Organization/OrganizationProfileCreatorTest.php

@@ -5,6 +5,7 @@ use App\ApiResources\Profile\OrganizationProfile;
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Parameters;
 use App\Entity\Organization\Parameters;
 use App\Entity\Organization\Settings;
 use App\Entity\Organization\Settings;
+use App\Enum\Organization\PrincipalTypeEnum;
 use App\Service\Network\Tree;
 use App\Service\Network\Tree;
 use App\Service\Organization\OrganizationProfileCreator;
 use App\Service\Organization\OrganizationProfileCreator;
 use App\Service\Security\Module;
 use App\Service\Security\Module;
@@ -13,14 +14,39 @@ use PHPUnit\Framework\TestCase;
 class OrganizationProfileCreatorTest extends TestCase
 class OrganizationProfileCreatorTest extends TestCase
 {
 {
     private Organization  $organization;
     private Organization  $organization;
+    private Module $moduleMock;
+    private Tree $treeMock;
+    private OrganizationProfileCreator $organizationProfileCreator;
 
 
     public function setUp():void
     public function setUp():void
     {
     {
         $this->organization = new Organization();
         $this->organization = new Organization();
+
+        $this->moduleMock = $this->getMockBuilder(Module::class)->disableOriginalConstructor()->getMock();
+        $this->moduleMock
+            ->method('getOrganizationModules')
+            ->with($this->organization)
+            ->willReturn(["MODULE_A", "MODULE_B"]);
+
+        $this->treeMock = $this->getMockBuilder(Tree::class)->disableOriginalConstructor()->getMock();
+        $parent = new Organization();
+        $parent->setName('Parent');
+        $parent->setParameters(new Parameters());
+        $this->treeMock
+            ->method('findAllParentsAndSortByType')
+            ->with($this->organization)
+            ->willReturn([$parent, $parent]);
+
+        $this->organizationProfileCreator = new OrganizationProfileCreator($this->moduleMock,$this->treeMock);
+
+        $this->organization->setPrincipalType(PrincipalTypeEnum::ARTISTIC_EDUCATION_ONLY());
         $settings = new Settings();
         $settings = new Settings();
         $settings->setProduct('adminassos');
         $settings->setProduct('adminassos');
+        $parameters = new Parameters();
+        $parameters->setShowAdherentList(true);
+
         $this->organization
         $this->organization
-            ->setParameters(new Parameters())
+            ->setParameters($parameters)
             ->setSettings($settings)
             ->setSettings($settings)
             ->setName('Foo')
             ->setName('Foo')
         ;
         ;
@@ -30,24 +56,25 @@ class OrganizationProfileCreatorTest extends TestCase
      * @see OrganizationProfileCreator::createCompleteOrganizationProfile()
      * @see OrganizationProfileCreator::createCompleteOrganizationProfile()
      */
      */
     public function testCreateCompleteOrganizationProfile(){
     public function testCreateCompleteOrganizationProfile(){
-        $moduleMock = $this->getMockBuilder(Module::class)->disableOriginalConstructor()->getMock();
-        $moduleMock
-            ->method('getOrganizationModules')
-            ->with($this->organization)
-            ->willReturn(["MODULE_A", "MODULE_B"]);
+        $organizationProfile = $this->organizationProfileCreator->createCompleteOrganizationProfile($this->organization);
+        $this->assertInstanceOf(OrganizationProfile::class, $organizationProfile);
+    }
 
 
-        $treeMock = $this->getMockBuilder(Tree::class)->disableOriginalConstructor()->getMock();
-        $parent = new Organization();
-        $parent->setName('Parent');
-        $parent->setParameters(new Parameters());
-        $treeMock
-            ->method('findAllParentsAndSortByType')
-            ->with($this->organization)
-            ->willReturn([$parent, $parent]);
+    public function testCreateOrganizationProfileWithoutAdherentListBecauseOfPrincipalType(){
+        $organizationProfile = $this->organizationProfileCreator->createCompleteOrganizationProfile($this->organization);
+        $this->assertFalse($organizationProfile->getShowAdherentList());
+    }
 
 
-        $organizationProfileCreator = new OrganizationProfileCreator($moduleMock,$treeMock);
-        $organizationProfile = $organizationProfileCreator->createCompleteOrganizationProfile($this->organization);
+    public function testCreateOrganizationProfileWithoutAdherentList(){
+        $this->organization->setPrincipalType(PrincipalTypeEnum::ARTISTIC_PRACTICE_ONLY());
+        $this->organization->getParameters()->setShowAdherentList(false);
+        $organizationProfile = $this->organizationProfileCreator->createCompleteOrganizationProfile($this->organization);
+        $this->assertFalse($organizationProfile->getShowAdherentList());
+    }
 
 
-        $this->assertInstanceOf(OrganizationProfile::class, $organizationProfile);
+    public function testCreateOrganizationProfileWithAdherentList(){
+        $this->organization->setPrincipalType(PrincipalTypeEnum::ARTISTIC_PRACTICE_ONLY());
+        $organizationProfile = $this->organizationProfileCreator->createCompleteOrganizationProfile($this->organization);
+        $this->assertTrue($organizationProfile->getShowAdherentList());
     }
     }
 }
 }