From d3f352fe10beadaa6fdf5b8f383445c3cf372895 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Dec 2020 15:52:00 +0100 Subject: [PATCH 1/2] Fix log --- htdocs/api/class/api_login.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index cb2fdd54d66..75fa4b60b89 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -132,7 +132,7 @@ class Login 'code' => 200, 'token' => $token, 'entity' => $tmpuser->entity, - 'message' => 'Welcome '.$login.($reset ? ' - Token is new' : ' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.') + 'message' => 'Welcome '.$login.($reset ? ' - Token is new' : ' - This is your token (recorded for your user). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.') ) ); } From 9007e7be2a52e3e4661e123c4e3637ddc0584897 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Dec 2020 16:13:45 +0100 Subject: [PATCH 2/2] Fix sql for postgresql --- htdocs/core/modules/modStock.class.php | 9 ++++++--- test/phpunit/RestAPIUserTest.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index da18f2faf11..c15f041d21d 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -294,12 +294,15 @@ class modStock extends DolibarrModules include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM ('.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'product_batch as pb)'; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product_batch as pb'; + $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps ON ps.rowid = pb.fk_product_stock'; + $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = ps.fk_product'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl ON pl.fk_product = p.rowid AND pl.batch = pb.batch'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot_extrafields as extra ON extra.fk_object = pl.rowid,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'entrepot as e'; - $this->export_sql_end[$r] .= ' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid AND ps.rowid = pb.fk_product_stock'; - $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; } + $this->export_sql_end[$r] .= ' WHERE ps.fk_entrepot = e.rowid'; + $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; + } // Export of stock movements $r++; diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index a937bdbd9f8..2bce51e2a05 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -130,7 +130,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertNotNull($object, "Parsing of json result must not be null"); $this->assertEquals('200', $object['success']['code']); $this->api_key = $object['success']['token'];