Debug v17

This commit is contained in:
Laurent Destailleur 2022-12-04 13:37:13 +01:00
parent 24d7a72b06
commit a34f69012e
3 changed files with 15 additions and 6 deletions

View File

@ -8066,8 +8066,10 @@ abstract class CommonObject
$out .= '<!-- commonobject:showOptionals --> '; $out .= '<!-- commonobject:showOptionals --> ';
$out .= "\n"; $out .= "\n";
$nbofextrafieldsshown = 0;
$extrafields_collapse_num = ''; $extrafields_collapse_num = '';
$e = 0; $e = 0; // var to manage the modulo (odd/even)
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $label) { foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $label) {
// Show only the key field in params // Show only the key field in params
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) { if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) {
@ -8151,6 +8153,8 @@ abstract class CommonObject
break; break;
} }
$nbofextrafieldsshown++;
// Output value of the current field // Output value of the current field
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
$extrafields_collapse_num = ''; $extrafields_collapse_num = '';
@ -8247,7 +8251,7 @@ abstract class CommonObject
$out .= '<td class="titlefieldcreate wordbreak'; $out .= '<td class="titlefieldcreate wordbreak';
} elseif ($display_type == 'line') { } elseif ($display_type == 'line') {
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="fieldline_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >'; $out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="fieldline_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
$out .= '<div style="display: inline-block; padding-right:4px" class="titlefieldcreate wordbreak'; $out .= '<div style="display: inline-block; padding-right:4px" class="wordbreak';
} }
//$out .= "titlefield"; //$out .= "titlefield";
//if (GETPOST('action', 'restricthtml') == 'create') $out.='create'; //if (GETPOST('action', 'restricthtml') == 'create') $out.='create';
@ -8305,6 +8309,7 @@ abstract class CommonObject
} else { } else {
$out .= ($display_type=='card' ? '</tr>' : '</div>'); $out .= ($display_type=='card' ? '</tr>' : '</div>');
} }
$e++; $e++;
} }
} }
@ -8315,6 +8320,10 @@ abstract class CommonObject
} }
$out .= '<!-- commonobject:showOptionals end --> '."\n"; $out .= '<!-- commonobject:showOptionals end --> '."\n";
if (empty($nbofextrafieldsshown)) {
$out = '';
}
} }
} }

View File

@ -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 // 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 !) // of using supplier invoices (this is a very bad idea !)
if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT)) { if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT)) {
$title = ' title="'.$langs->trans('VATIsNotUsed').'"'; $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
$disabled = true; $disabled = true;
} }
} }
@ -6375,7 +6375,7 @@ class Form
if (!$options_only) { if (!$options_only) {
$return .= '</select>'; $return .= '</select>';
//$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 { } else {
$return .= $this->error; $return .= $this->error;

View File

@ -6283,7 +6283,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
if ($idprod > 0) { if ($idprod > 0) {
// Load product // Load product
$product = new Product($db); $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 ($mysoc->country_code == $thirdpartytouse->country_code) { // If country to consider is ours
if ($idprodfournprice > 0) { // We want vat for product for a "supplier" object 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 (!$found) {
if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) { 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 = "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 .= " 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)."'"; $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code = '".$db->escape($thirdpartytouse->country_code)."'";