From 17da80832513e19d9efc40a4a7eec117aab45de4 Mon Sep 17 00:00:00 2001 From: Neil Orley Date: Fri, 8 Sep 2017 14:35:44 +0200 Subject: [PATCH 1/6] FIX wrong basePath in the swagger view Behind a reverse proxy the basePath seems to be in http. Forcing the basePath to DOL_MAIN_URL_ROOT fixes the problem. --- htdocs/api/class/api.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 40e00d01ffd..79793b0f8de 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -56,7 +56,7 @@ class DolibarrApi $this->db = $db; $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); $this->r = new Restler($production_mode, $refreshCache); - + $this->r->setBaseUrls(DOL_MAIN_URL_ROOT); $this->r->setAPIVersion(1); } From f68d31d7c591da55f231e16ebdc65d171ea39572 Mon Sep 17 00:00:00 2001 From: Neil Orley Date: Tue, 12 Sep 2017 17:45:02 +0200 Subject: [PATCH 2/6] Add of $urlwithroot in the setBaseUrls function, to use Dolibarr external domain name in the configuration file --- htdocs/api/class/api.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 79793b0f8de..36eb7c1d7d2 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -56,7 +56,7 @@ class DolibarrApi $this->db = $db; $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); $this->r = new Restler($production_mode, $refreshCache); - $this->r->setBaseUrls(DOL_MAIN_URL_ROOT); + $this->r->setBaseUrls(DOL_MAIN_URL_ROOT, $urlwithroot); $this->r->setAPIVersion(1); } From caf4ca74517f1dc0f748bd6df315b2cca7d70c15 Mon Sep 17 00:00:00 2001 From: Neil Orley Date: Tue, 19 Sep 2017 16:56:27 +0200 Subject: [PATCH 3/6] FIX Implementation of a Luracast recommandation for the REST api server (#7370) --- htdocs/api/class/api.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 36eb7c1d7d2..d76759532dc 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -48,7 +48,7 @@ class DolibarrApi */ function __construct($db, $cachedir='', $refreshCache=false) { - global $conf; + global $conf, $dolibarr_main_url_root; if (empty($cachedir)) $cachedir = $conf->api->dir_temp; Defaults::$cacheDirectory = $cachedir; @@ -57,6 +57,8 @@ class DolibarrApi $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); $this->r = new Restler($production_mode, $refreshCache); $this->r->setBaseUrls(DOL_MAIN_URL_ROOT, $urlwithroot); + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $this->r->setAPIVersion(1); } From d5966f944fac0834fbab0ea1cb561b55d9fa0ebf Mon Sep 17 00:00:00 2001 From: Neil Orley Date: Tue, 19 Sep 2017 16:58:09 +0200 Subject: [PATCH 4/6] FIX Implementation of a Luracast recommandation for the REST api server (#7370) --- htdocs/api/class/api.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index d76759532dc..55b728d2a80 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -56,9 +56,9 @@ class DolibarrApi $this->db = $db; $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); $this->r = new Restler($production_mode, $refreshCache); - $this->r->setBaseUrls(DOL_MAIN_URL_ROOT, $urlwithroot); - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $this->r->setBaseUrls($urlwithroot); $this->r->setAPIVersion(1); } From cc7aee6c3e5618855e43f95f38adb3b899c260d1 Mon Sep 17 00:00:00 2001 From: Neil Orley Date: Tue, 19 Sep 2017 16:59:19 +0200 Subject: [PATCH 5/6] FIX Implementation of a Luracast recommandation for the REST api server (#7370) --- htdocs/api/class/api.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 55b728d2a80..dcda8255e7c 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -58,7 +58,7 @@ class DolibarrApi $this->r = new Restler($production_mode, $refreshCache); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - $this->r->setBaseUrls($urlwithroot); + $this->r->setBaseUrls(DOL_MAIN_URL_ROOT, $urlwithroot); $this->r->setAPIVersion(1); } From 03ffbe55ce6f6f696f915d770008cc842f3ec46c Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 21 Sep 2017 11:34:19 +0200 Subject: [PATCH 6/6] fix ressource list --- htdocs/resource/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index c4d783739c0..98efb786f72 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -237,7 +237,7 @@ print "\n"; print ''; if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); -if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"t.code","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"ty.label","",$param,"",$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {