浏览代码

adapt dolibarr api service for the version 14 of dolibarr

Olivier Massot 1 年之前
父节点
当前提交
5aef6adcb1
共有 1 个文件被更改,包括 11 次插入5 次删除
  1. 11 5
      src/Service/Dolibarr/DolibarrApiService.php

+ 11 - 5
src/Service/Dolibarr/DolibarrApiService.php

@@ -34,7 +34,13 @@ class DolibarrApiService extends ApiRequestService
         // impossible to retrieve a society by its extrafield 2iopen_organization_id (thanks dolibarr), so
         // we need to store the organization id in two fields: 2iopen_organization_id and ref_int :(
         try {
-            return $this->getJsonContent("thirdparties" , [ "limit" => "1", "sqlfilters" => "ref_int=" . $organizationId])[0];
+            return $this->getJsonContent(
+                "thirdparties" ,
+                [
+                    "limit" => "1",
+                    "sqlfilters" => "(ef.2iopen_organization_id:=:" . $organizationId . ")"
+                ]
+            )[0];
         } catch (HttpException $e) {
             if ($e->getStatusCode() === 404) {
                 // /!\ The dolibarr API will return a 404 error if no results are found...
@@ -55,7 +61,7 @@ class DolibarrApiService extends ApiRequestService
         try {
             return $this->getJsonContent(
                 "contracts",
-                ["limit" => "1", "sqlfilters" => "statut=1", "thirdparty_ids" => $socId]
+                ["limit" => "1", "sqlfilters" => "statut:=:1", "thirdparty_ids" => $socId]
             )[0];
         } catch (HttpException $e) {
             if ($e->getStatusCode() === 404) {
@@ -77,7 +83,7 @@ class DolibarrApiService extends ApiRequestService
         try {
             return $this->getJsonContent(
                 "invoices",
-                ["sortfield" => "datef", "sortorder" => "DESC", "limit" => 5, "sqlfilters" => "fk_soc=" . $socId]);
+                ["sortfield" => "datef", "sortorder" => "DESC", "limit" => 5, "sqlfilters" => "fk_soc:=:" . $socId]);
         } catch (HttpException $e) {
             if ($e->getStatusCode() === 404) {
                 // /!\ The dolibarr API will return a 404 error if no results are found...
@@ -97,7 +103,7 @@ class DolibarrApiService extends ApiRequestService
     {
         return $this->getJsonContent(
             "thirdparties",
-            ["limit" => "1000000", "sqlfilters" => "client=1"]
+            ["limit" => "1000000", "sqlfilters" => "client:=:1"]
         );
     }
 
@@ -135,7 +141,7 @@ class DolibarrApiService extends ApiRequestService
         // et dolibarr est pas content :(
         try {
             return $this->getJsonContent(
-                "contacts?limit=1000&t.statut=1&thirdparty_ids=" . $socId . "&sqlfilters=(te.2iopen_person_id%3A%3E%3A0)"
+                "contacts?limit=1000&t.statut=1&thirdparty_ids=" . $socId . "&sqlfilters:=:(te.2iopen_person_id%3A%3E%3A0)"
             );
         } catch (HttpException $e) {
             if ($e->getStatusCode() === 404) {