From a5635825f34ffbf6c4697a765349371ae5b85122 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 14 Nov 2019 12:09:32 +0100 Subject: [PATCH 1/2] FIX : wrong invoice id for fetchObjetctLinked --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f35281f73d6..9f13313ffe1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -875,7 +875,7 @@ class Facture extends CommonInvoice } elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) { - $this->fetchObjectLinked('', '', $facture->id, 'facture'); + $this->fetchObjectLinked('', '', $this->id, 'facture'); foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) { From 918f476c2b802f6770fb5f127ffe5091c765e7f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2019 19:02:12 +0100 Subject: [PATCH 2/2] Fix backport fix not checking mandatory extrafields of type select --- htdocs/core/class/extrafields.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b3c257bfaaa..5b171d70bfb 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1830,7 +1830,7 @@ class ExtraFields function setOptionalsFromPost($extralabels, &$object, $onlykey='') { global $_POST, $langs; - $nofillrequired='';// For error when required field left blank + $nofillrequired=0;// For error when required field left blank $error_field_required = array(); if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; @@ -1861,8 +1861,9 @@ class ExtraFields if ($this->attributes[$object->table_element]['required'][$key]) // Value is required { // Check if empty without using GETPOST, value can be alpha, int, array, etc... - if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') - || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) + if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') + || (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') + || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; $nofillrequired++;