From 1f2ad8efbf57a40852d22adb00054819e5ba9411 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2022 01:13:53 +0200 Subject: [PATCH] FIX API reception return error 500 --- htdocs/api/class/api.class.php | 8 ++++++++ htdocs/core/lib/functions2.lib.php | 2 +- htdocs/reception/class/reception.class.php | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 32d691400d6..6561355edbe 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -160,6 +160,8 @@ class DolibarrApi unset($object->statuts_short); unset($object->statuts_logo); unset($object->statuts_long); + unset($object->statutshorts); + unset($object->statutshort); unset($object->labelStatus); unset($object->labelStatusShort); @@ -181,6 +183,7 @@ class DolibarrApi unset($object->picto); unset($object->fieldsforcombobox); + unset($object->regeximgext); unset($object->skip_update_total); unset($object->context); @@ -256,6 +259,11 @@ class DolibarrApi if (!empty($object->thirdparty) && is_object($object->thirdparty)) { $this->_cleanObjectDatas($object->thirdparty); } + + if (!empty($object->product) && is_object($object->product)) { + $this->_cleanObjectDatas($object->product); + } + return $object; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index ac051fd92e0..9808fbb28b9 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2655,7 +2655,7 @@ function getModuleDirForApiClass($moduleobject) $moduledirforclass = 'fichinter'; } elseif ($moduleobject == 'mos') { $moduledirforclass = 'mrp'; - } elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms'))) { + } elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms', 'receptions'))) { $moduledirforclass = preg_replace('/s$/', '', $moduleobject); } diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7244fdcb60b..e3434a9a298 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -456,8 +456,8 @@ class Reception extends CommonObject $this->brouillon = 1; } - $file = $conf->reception->dir_output."/".get_exdir($this->id, 2, 0, 0, $this, 'reception')."/".$this->id.".pdf"; - $this->pdf_filename = $file; + //$file = $conf->reception->dir_output."/".get_exdir(0, 0, 0, 1, $this, 'reception')."/".$this->id.".pdf"; + //$this->pdf_filename = $file; // Tracking url $this->getUrlTrackingStatus($obj->tracking_number); @@ -1177,6 +1177,8 @@ class Reception extends CommonObject $line = new CommandeFournisseurDispatch($this->db); $line->fetch($obj->rowid); + + // TODO Remove or keep this ? $line->fetch_product(); $sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent';