Fix some php warnings (#28278)

Co-authored-by: Hystepik <lmarcouiller@nltechno.com>
This commit is contained in:
Lucas Marcouiller 2024-02-19 17:57:16 +01:00 committed by GitHub
parent 996a9f4c59
commit f84ae10dbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 13 additions and 11 deletions

View file

@ -46,7 +46,7 @@ if ($id > 0) {
if (empty($object->thirdparty)) {
$object->fetch_thirdparty();
}
$socid = $object->thirdparty->id;
$socid = !empty($object->thirdparty->id) ? $object->thirdparty->id : null;
// Sort & Order fields
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -153,7 +153,7 @@ print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td>';
print $object->getCivilityLabel();
print '</td></tr>';
if ($object->thirdparty->client) {
if (!empty($object->thirdparty->client)) {
$thirdTypeArray['customer'] = $langs->trans("customer");
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
@ -173,7 +173,7 @@ if (isModEnabled('ficheinter') && $user->hasRight('ficheinter', 'lire')) {
$elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions');
}
if ($object->thirdparty->fournisseur) {
if (!empty($object->thirdparty->fournisseur)) {
$thirdTypeArray['supplier'] = $langs->trans("supplier");
if ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
$elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices');
@ -364,7 +364,9 @@ $param .= "&sref=".urlencode($sref);
$param .= "&month=".urlencode($month);
$param .= "&year=".urlencode($year);
$param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr);
$param .= "&socid=".urlencode($socid);
if (!empty($socid)) {
$param .= "&socid=".urlencode($socid);
}
$param .= "&type_element=".urlencode($type_element);
$total_qty = 0;
@ -377,7 +379,7 @@ if ($sql_select) {
$num = $db->num_rows($resql);
$param = "&socid=".urlencode($socid)."&type_element=".urlencode($type_element)."&id=".urlencode($id);
$param = (!empty($socid) ? "&socid=".urlencode($socid) : "")."&type_element=".urlencode($type_element)."&id=".urlencode($id);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}

View file

@ -61,7 +61,7 @@ if ($id) {
if (empty($object->thirdparty)) {
$object->fetch_thirdparty();
}
$socid = $object->thirdparty->id;
$socid = !empty($object->thirdparty->id) ? $object->thirdparty->id : null;
$title = $langs->trans("Projects");
if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
$title = $object->name." - ".$title;

View file

@ -296,7 +296,7 @@ abstract class DoliDB implements Database
$oldsortorder = '';
$return = '';
$fields = explode(',', $sortfield);
$orders = explode(',', $sortorder);
$orders = (!empty($sortorder) ? explode(',', $sortorder) : array());
$i = 0;
foreach ($fields as $val) {
if (!$return) {

View file

@ -1692,7 +1692,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (get_class($filterobj) !== 'User') {
if (is_object($filterobj) && get_class($filterobj) !== 'User') {
$force_filter_contact = false;
} else {
$force_filter_contact = true;

View file

@ -1145,7 +1145,7 @@ class Product extends CommonObject
$this->barcode = (empty($this->barcode) ? '' : trim($this->barcode));
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
$this->accountancy_code_buy_intra = trim($this->accountancy_code_buy_intra);
$this->accountancy_code_buy_intra = (!empty($this->accountancy_code_buy_intra) ? trim($this->accountancy_code_buy_intra) : '');
$this->accountancy_code_buy_export = trim($this->accountancy_code_buy_export);
$this->accountancy_code_sell = trim($this->accountancy_code_sell);
$this->accountancy_code_sell_intra = trim($this->accountancy_code_sell_intra);

View file

@ -2420,7 +2420,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
$positiverates = '0';
}
echo vatrate($positiverates.($line->default_vat_code ? ' ('.$line->default_vat_code.')' : ''), '%', ($line->tva_npr ? $line->tva_npr : $line->recuperableonly));
echo vatrate($positiverates.($line->default_vat_code ? ' ('.$line->default_vat_code.')' : ''), '%', (!empty($line->tva_npr) ? $line->tva_npr : $line->recuperableonly));
print "</td>";

View file

@ -255,7 +255,7 @@ class Societe extends CommonObject
'localtax2_value' =>array('type'=>'double(6,3)', 'label'=>'Localtax2 value', 'enabled'=>1, 'visible'=>-1, 'position'=>355),
'vat_reverse_charge' =>array('type'=>'tinyint(4)', 'label'=>'Vat reverse charge', 'enabled'=>1, 'visible'=>-1, 'position'=>335),
'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>1, 'visible'=>-1, 'position'=>360),
'price_level' =>array('type'=>'integer', 'label'=>'Price level', 'enabled'=>'$conf->global->PRODUIT_MULTIPRICES || $conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES', 'visible'=>-1, 'position'=>365),
'price_level' =>array('type'=>'integer', 'label'=>'Price level', 'enabled'=>'$conf->global->PRODUIT_MULTIPRICES || getDolGlobalString("PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES")', 'visible'=>-1, 'position'=>365),
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=>370),
'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>-1, 'position'=>375),
'fk_barcode_type' =>array('type'=>'integer', 'label'=>'Fk barcode type', 'enabled'=>1, 'visible'=>-1, 'position'=>405),