update code toward php8 compliance

This commit is contained in:
Philippe GRAND 2022-09-24 14:44:16 +02:00
parent 2a5b91e3a2
commit 1dc58f9684
4 changed files with 9 additions and 9 deletions

View File

@ -1420,7 +1420,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
if ($idprod) {
$prodser->fetch($idprod);
// If a predefined product and multilang and on other lang, we renamed label with label translated
if (!empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) {
if (getDolGlobalInt('MAIN_MULTILANGS') && ($outputlangs->defaultlang != $langs->defaultlang)) {
$translatealsoifmodified = (!empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED)); // By default if value was modified manually, we keep it (no translation because we don't have it)
// TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation

View File

@ -74,7 +74,7 @@ function product_prepare_head($object)
}
// Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) {
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$object->id;
$head[$h][1] = $langs->trans("Translation");
$head[$h][2] = 'translation';

View File

@ -305,7 +305,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
// Description
if ($objp->fk_product > 0) {
// Define output language
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$object = new $origin($db);
$object->fetch($origin_id);
$object->fetch_thirdparty();

View File

@ -230,7 +230,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote'));
}
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -261,7 +261,7 @@ class modProduct extends DolibarrModules
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text'));
}
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
@ -280,7 +280,7 @@ class modProduct extends DolibarrModules
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
}
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
@ -295,7 +295,7 @@ class modProduct extends DolibarrModules
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
}
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
@ -309,7 +309,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
}
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
@ -905,7 +905,7 @@ class modProduct extends DolibarrModules
'pr.date_price'=>'2020-12-31');
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
if (getDolGlobalInt('MAIN_MULTILANGS')) {
// Import translations of product names and descriptions
$r++;
$this->import_code[$r] = $this->rights_class.'_languages';