Explorar el Código

Merge branch 'release/0.2.1'

Vincent GUFFON hace 3 años
padre
commit
6d9fca1851

+ 6 - 1
src/ApiResources/Mobyt/MobytUserStatus.php

@@ -15,7 +15,12 @@ use Symfony\Component\Serializer\Annotation\Groups;
     collectionOperations:[],
     itemOperations: [
         'get' => [
-            'security' => 'is_granted("ROLE_TEXTO") and object.getOrganizationId() == user.getOrganization().getId()',
+            '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") or
+                            is_granted("ROLE_TEXTO")
+                           ) and object.getOrganizationId() == user.getOrganization().getId()',
             'method' => 'GET',
             'path' => '/mobyt/status/{organizationId}',
             'requirements' => ['organizationId' => '\d+'],

+ 3 - 1
src/Service/Dolibarr/DolibarrService.php

@@ -41,9 +41,10 @@ class DolibarrService extends ApiRequestService
         try {
             return $this->getJsonContent(
                 "contracts",
-                ["limit" => "1", "sqlfilters" => "statut=1", "thirdparty_ids=" . $socId => null]
+                ["limit" => "1", "sqlfilters" => "statut=1", "thirdparty_ids" => $socId]
             )[0];
         } catch (NotFoundHttpException) {
+            // /!\ The dolibarr API will return a 404 error if no contract is found...
             return null;
         }
     }
@@ -60,6 +61,7 @@ class DolibarrService extends ApiRequestService
                 "invoices",
                 ["sortfield" => "datef", "sortorder" => "DESC", "limit" => 5, "sqlfilters" => "fk_soc=" . $socId]);
         } catch (NotFoundHttpException) {
+            // /!\ The dolibarr API will return a 404 error if no invoices are found...
             return [];
         }
     }