Skip to content

Commit

Permalink
Fix some php warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Hystepik committed Feb 19, 2024
1 parent fd674e6 commit c327444
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
12 changes: 7 additions & 5 deletions htdocs/contact/consumption.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
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;
Expand Down Expand Up @@ -153,7 +153,7 @@
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');
Expand All @@ -173,7 +173,7 @@
$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');
Expand Down Expand Up @@ -364,7 +364,9 @@
$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;
Expand All @@ -377,7 +379,7 @@

$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);
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/contact/project.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
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;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/db/DoliDB.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function order($sortfield = '', $sortorder = '')
$oldsortorder = '';
$return = '';
$fields = explode(',', $sortfield);
$orders = explode(',', $sortorder);
$orders = (!empty($sortorder) ? explode(',', $sortorder) : array());
$i = 0;
foreach ($fields as $val) {
if (!$return) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/company.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/class/product.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ public function update($id, $user, $notrigger = 0, $action = 'update', $updatety
$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);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/price.php
Original file line number Diff line number Diff line change
Expand Up @@ -2420,7 +2420,7 @@ function on_change() {
$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>";

Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/class/societe.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit c327444

Please sign in to comment.