diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index eff03b6ca99..d00a4cfc3bc 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -8066,8 +8066,10 @@ abstract class CommonObject
$out .= ' ';
$out .= "\n";
+ $nbofextrafieldsshown = 0;
$extrafields_collapse_num = '';
- $e = 0;
+ $e = 0; // var to manage the modulo (odd/even)
+
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $label) {
// Show only the key field in params
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) {
@@ -8151,6 +8153,8 @@ abstract class CommonObject
break;
}
+ $nbofextrafieldsshown++;
+
// Output value of the current field
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
$extrafields_collapse_num = '';
@@ -8247,7 +8251,7 @@ abstract class CommonObject
$out .= '
';
- $out .= ' ' : ' ');
}
+
$e++;
}
}
@@ -8315,6 +8320,10 @@ abstract class CommonObject
}
$out .= ' '."\n";
+
+ if (empty($nbofextrafieldsshown)) {
+ $out = '';
+ }
}
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index e60eceb17d1..9f0f55220e7 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -6318,7 +6318,7 @@ class Form
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
// of using supplier invoices (this is a very bad idea !)
if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT)) {
- $title = ' title="'.$langs->trans('VATIsNotUsed').'"';
+ $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
$disabled = true;
}
}
@@ -6375,7 +6375,7 @@ class Form
if (!$options_only) {
$return .= '';
- //$return .= ajax_combobox($htmlname); // This break for the moment dynamic autoselection of a value when selecting a product in object lines
+ //$return .= ajax_combobox($htmlname); // This break for the moment the dynamic autoselection of a value when selecting a product in object lines
}
} else {
$return .= $this->error;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index e5810304e6a..7cd16fc2704 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -6283,7 +6283,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
if ($idprod > 0) {
// Load product
$product = new Product($db);
- $result = $product->fetch($idprod);
+ $product->fetch($idprod);
if ($mysoc->country_code == $thirdpartytouse->country_code) { // If country to consider is ours
if ($idprodfournprice > 0) { // We want vat for product for a "supplier" object
@@ -6307,7 +6307,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
if (!$found) {
if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) {
- // If vat of product for the country not found or not defined, we return the first found (sorting on use_default then higher vat of country).
+ // If vat of product for the country not found or not defined, we return the first rate found (sorting on use_default, then on higher vat of country).
$sql = "SELECT t.taux as vat_rate, t.code as default_vat_code";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code = '".$db->escape($thirdpartytouse->country_code)."'";
|