update code toward php8 compliance
This commit is contained in:
parent
afe918c76b
commit
90c923a94b
@ -106,7 +106,7 @@ if ($action == 'fetch' && !empty($id)) {
|
||||
$thirdpartytemp->fetch($socid);
|
||||
|
||||
//Load translation description and label
|
||||
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)) {
|
||||
$newlang = $thirdpartytemp->default_lang;
|
||||
|
||||
if (!empty($newlang)) {
|
||||
|
||||
@ -1203,7 +1203,7 @@ class Product extends CommonObject
|
||||
$this->id = $id;
|
||||
|
||||
// Multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
if ($this->setMultiLangs($user) < 0) {
|
||||
$this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql;
|
||||
return -2;
|
||||
@ -2495,7 +2495,7 @@ class Product extends CommonObject
|
||||
$this->fetch_optionals();
|
||||
|
||||
// Multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && empty($ignore_lang_load)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($ignore_lang_load)) {
|
||||
$this->getMultiLangs();
|
||||
}
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."propal_merge_pdf_product(";
|
||||
$sql .= "fk_product,";
|
||||
$sql .= "file_name,";
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$sql .= "lang,";
|
||||
}
|
||||
$sql .= "fk_user_author,";
|
||||
@ -116,7 +116,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->fk_product) ? 'NULL' : ((int) $this->fk_product)).",";
|
||||
$sql .= " ".(!isset($this->file_name) ? 'NULL' : "'".$this->db->escape($this->file_name)."'").",";
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$sql .= " ".(!isset($this->lang) ? 'NULL' : "'".$this->db->escape($this->lang)."'").",";
|
||||
}
|
||||
$sql .= " ".((int) $user->id).",";
|
||||
@ -186,7 +186,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->file_name = $obj->file_name;
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$this->lang = $obj->lang;
|
||||
}
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
@ -233,7 +233,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
|
||||
$sql .= " FROM ".$this->db->prefix()."propal_merge_pdf_product as t";
|
||||
$sql .= " WHERE t.fk_product = ".((int) $product_id);
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($lang)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($lang)) {
|
||||
$sql .= " AND t.lang = '".$this->db->escape($lang)."'";
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
|
||||
$line->fk_product = $obj->fk_product;
|
||||
$line->file_name = $obj->file_name;
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$line->lang = $obj->lang;
|
||||
}
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
@ -258,7 +258,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
$line->import_key = $obj->import_key;
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$this->lines[$obj->file_name.'_'.$obj->lang] = $line;
|
||||
} else {
|
||||
$this->lines[$obj->file_name] = $line;
|
||||
@ -311,7 +311,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
|
||||
$sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").",";
|
||||
$sql .= " file_name=".(isset($this->file_name) ? "'".$this->db->escape($this->file_name)."'" : "null").",";
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$sql .= " lang=".(isset($this->lang) ? "'".$this->db->escape($this->lang)."'" : "null").",";
|
||||
}
|
||||
$sql .= " fk_user_mod=".$user->id;
|
||||
@ -403,7 +403,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."propal_merge_pdf_product";
|
||||
$sql .= " WHERE fk_product = ".((int) $product_id);
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($lang_id)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($lang_id)) {
|
||||
$sql .= " AND lang = '".$this->db->escape($lang_id)."'";
|
||||
}
|
||||
|
||||
|
||||
@ -157,12 +157,12 @@ if ($action == 'search') {
|
||||
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type as type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
|
||||
$sql .= ' p.fk_product_type, p.tms as datem, p.tobatch';
|
||||
$sql .= ', p.tosell as status, p.tobuy as status_buy';
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$sql .= ', pl.label as labelm, pl.description as descriptionm';
|
||||
}
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON p.rowid = cp.fk_product';
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND lang='".($current_lang)."'";
|
||||
}
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
@ -170,7 +170,7 @@ if ($action == 'search') {
|
||||
// For natural search
|
||||
$params = array('p.ref', 'p.label', 'p.description', 'p.note');
|
||||
// multilang
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$params[] = 'pl.label';
|
||||
$params[] = 'pl.description';
|
||||
$params[] = 'pl.note';
|
||||
@ -682,7 +682,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
print '<td>'.$productstatic->getNomUrl(1, '', 24).'</td>';
|
||||
$labeltoshow = $objp->label;
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->labelm)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($objp->labelm)) {
|
||||
$labeltoshow = $objp->labelm;
|
||||
}
|
||||
|
||||
|
||||
@ -692,7 +692,7 @@ if ($action == 'create') {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) { // si l'option est active
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) { // si l'option est active
|
||||
$sql = "SELECT label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sql .= " WHERE fk_product = ".((int) $objp->rowid);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user