From fee5bbf65b4346e40d8a67f84c287d4110945490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 7 Mar 2021 09:12:46 +0100 Subject: [PATCH 1/5] fix usage of else if --- htdocs/admin/tools/listevents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 5e6667c58ad..3cfc3c74db9 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -68,7 +68,7 @@ $nowarray = dol_getdate($now); if (!GETPOSTISSET("date_startmonth")) { $date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], 'tzuserrel'); -} else if (GETPOST("date_startmonth") > 0) { +} elseif (GETPOST("date_startmonth") > 0) { $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth", 'int'), GETPOST("date_startday", 'int'), GETPOST("date_startyear", 'int'), 'tzuserrel'); } else { $date_start = -1; From 4834f5fdf42986bdf402a29994cfd88a33aa5530 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 7 Mar 2021 17:32:43 +0100 Subject: [PATCH 2/5] Fix get thirdparties by barcode or email --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 3e8a6c91f92..27493d14515 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1815,7 +1815,7 @@ class Thirdparties extends DolibarrApi if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } - if ($rowid == 0) { + if ($rowid == 0 && empty($email) && empty($barcode)) { $result = $this->company->initAsSpecimen(); } else { $result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias); From ec8baa6bff9b921e3591036ac22d340017369e39 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:00:19 +0100 Subject: [PATCH 3/5] Update commondocgenerator.class.php #16341 --- htdocs/core/class/commondocgenerator.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 03a5154f23f..ec05ad5d98d 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -798,6 +798,15 @@ abstract class CommonDocGenerator $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs); + // Load product data optional fields to the line -> enables to use "line_product_options_{extrafield}" + if (isset($line->fk_product) && $line->fk_product > 0) + { + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($line->fk_product); + foreach ($tmpproduct->array_options as $key=>$label) + $resarray["line_product_".$key] = $label; + } + return $resarray; } From 77b60d4d1cca0452b368ad8a55bc21ed3489e97f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 16:20:15 +0100 Subject: [PATCH 4/5] Update api_thirdparties.class.php --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 27493d14515..f88668524ac 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1815,7 +1815,7 @@ class Thirdparties extends DolibarrApi if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } - if ($rowid == 0 && empty($email) && empty($barcode)) { + if ($rowid === 0 && empty($email) && empty($barcode)) { $result = $this->company->initAsSpecimen(); } else { $result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias); From 3b9f38caa1f74a00c80a206446eb9501899f531d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 16:22:26 +0100 Subject: [PATCH 5/5] Update api_thirdparties.class.php --- htdocs/societe/class/api_thirdparties.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index f88668524ac..492916935f8 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1793,7 +1793,7 @@ class Thirdparties extends DolibarrApi * * Return an array with thirdparty informations * - * @param int $rowid Id of third party to load + * @param int $rowid Id of third party to load (Use 0 to get a specimen record, use null to use other search criterias) * @param string $ref Reference of third party, name (Warning, this can return several records) * @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr) * @param string $barcode Barcode of third party to load @@ -1815,7 +1815,7 @@ class Thirdparties extends DolibarrApi if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } - if ($rowid === 0 && empty($email) && empty($barcode)) { + if ($rowid === 0) { $result = $this->company->initAsSpecimen(); } else { $result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias);