Olivier Massot преди 3 години
родител
ревизия
80528c1408

+ 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+'],

+ 1 - 1
src/Repository/Cotisation/CotisationApiResourcesRepository.php

@@ -30,7 +30,7 @@ class CotisationApiResourcesRepository
         $result = $query->getOneOrNullResult();
 
         if (!empty($result)) {
-            return $result['oa_miscellaneous_state_sta'];
+            return intval($result['oa_miscellaneous_state_sta']);
         }
         return null;
     }

+ 2 - 0
src/Service/Dolibarr/DolibarrService.php

@@ -44,6 +44,7 @@ class DolibarrService extends ApiRequestService
                 ["limit" => "1", "sqlfilters" => "statut=1", "thirdparty_ids=" . $socId => null]
             )[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 [];
         }
     }