Fix warnings

This commit is contained in:
Laurent Destailleur 2022-12-28 16:20:35 +01:00
parent f46e634b4b
commit 8a4613176c
16 changed files with 40 additions and 27 deletions

View File

@ -843,7 +843,7 @@ if (!empty($searchCategoryProductList)) {
} }
} }
} }
$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();; $searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
$searchCategoryCustomerOperator = 0; $searchCategoryCustomerOperator = 0;
// Search for tag/category ($searchCategoryCustomerList is an array of ID) // Search for tag/category ($searchCategoryCustomerList is an array of ID)
if (!empty($searchCategoryCustomerList)) { if (!empty($searchCategoryCustomerList)) {

View File

@ -235,7 +235,7 @@ class Conf
// Common arrays // Common arrays
$this->cache = array(); $this->cache = array();
$this->modules = array();; $this->modules = array();
$this->modules_parts = array( $this->modules_parts = array(
'css' => array(), 'css' => array(),
'js' => array(), 'js' => array(),

View File

@ -3618,7 +3618,7 @@ class Form
// Add new entry // Add new entry
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax // "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
// "label" value of json key array is used by jQuery automatically as text for combo box // "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $optstart . ' data-html="'.dol_escape_htmltag($optlabel).'">' . $optlabel . "</option>\n";; $out .= $optstart . ' data-html="'.dol_escape_htmltag($optlabel).'">' . $optlabel . "</option>\n";
array_push( array_push(
$outarray, $outarray,
array('key'=>$outkey, array('key'=>$outkey,
@ -7219,12 +7219,15 @@ class Form
$this->db->free($result); $this->db->free($result);
if (empty($outputmode)) return $out; if (empty($outputmode)) {
return $out;
}
return $outarray; return $outarray;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
return array();
} }
return array();
} }
/** /**
@ -7422,12 +7425,15 @@ class Form
$this->db->free($result); $this->db->free($result);
if (empty($outputmode)) return $out; if (empty($outputmode)) {
return $out;
}
return $outarray; return $outarray;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
return array();
} }
return array();
} }
/** /**
@ -7444,9 +7450,7 @@ class Form
protected function constructProjectListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '') protected function constructProjectListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '')
{ {
$outkey = ''; $outkey = '';
$outval = '';
$outref = ''; $outref = '';
$outlabel = '';
$outtype = ''; $outtype = '';
$label = $objp->label; $label = $objp->label;
@ -7462,7 +7466,6 @@ class Form
$opt .= $objp->ref; $opt .= $objp->ref;
$objRef = $objp->ref; $objRef = $objp->ref;
if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
$outval .= $objRef;
$opt .= "</option>\n"; $opt .= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype); $optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype);
@ -7642,12 +7645,15 @@ class Form
$this->db->free($result); $this->db->free($result);
if (empty($outputmode)) return $out; if (empty($outputmode)) {
return $out;
}
return $outarray; return $outarray;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
return array();
} }
return array();
} }
/** /**

View File

@ -837,7 +837,7 @@ class FormFile
} }
// Show file name with link to download // Show file name with link to download
$imgpreview = $this->showPreview($file, $modulepart, $relativepath, 0, $param);; $imgpreview = $this->showPreview($file, $modulepart, $relativepath, 0, $param);
$out .= '<td class="minwidth200 tdoverflowmax300">'; $out .= '<td class="minwidth200 tdoverflowmax300">';
if ($imgpreview) { if ($imgpreview) {

View File

@ -2083,7 +2083,7 @@ class pdf_crabe extends ModelePDFFactures
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object); $carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object);
} else { } else {
$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs); $carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);; $carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
} }
if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) { if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) {
$posy += $hautcadre; $posy += $hautcadre;

View File

@ -2388,7 +2388,7 @@ class pdf_sponge extends ModelePDFFactures
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object); $carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object);
} else { } else {
$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs); $carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);; $carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
} }
if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) { if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) {
$posy += $hautcadre; $posy += $hautcadre;

View File

@ -212,7 +212,7 @@ class modGeneratePassPerso extends ModeleGenPassword
$password_a = preg_split('//u', $password, null, PREG_SPLIT_NO_EMPTY); $password_a = preg_split('//u', $password, null, PREG_SPLIT_NO_EMPTY);
$maj = preg_split('//u', $this->Maj, null, PREG_SPLIT_NO_EMPTY); $maj = preg_split('//u', $this->Maj, null, PREG_SPLIT_NO_EMPTY);
$num = preg_split('//u', $this->Nb, null, PREG_SPLIT_NO_EMPTY);; $num = preg_split('//u', $this->Nb, null, PREG_SPLIT_NO_EMPTY);
$spe = preg_split('//u', $this->Spe, null, PREG_SPLIT_NO_EMPTY); $spe = preg_split('//u', $this->Spe, null, PREG_SPLIT_NO_EMPTY);
/* /*
$password_a = str_split($password); $password_a = str_split($password);

View File

@ -1553,7 +1553,7 @@ class ExpenseReport extends CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET fk_statut = ".self::STATUS_CANCELED.", fk_user_cancel = ".((int) $fuser->id); $sql .= " SET fk_statut = ".self::STATUS_CANCELED.", fk_user_cancel = ".((int) $fuser->id);
$sql .= ", date_cancel='".$this->db->idate($this->date_cancel)."'"; $sql .= ", date_cancel='".$this->db->idate($this->date_cancel)."'";
$sql .= " ,detail_cancel='".$this->db->escape($detail)."'"; $sql .= ", detail_cancel='".$this->db->escape($detail)."'";
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::set_cancel", LOG_DEBUG); dol_syslog(get_class($this)."::set_cancel", LOG_DEBUG);
@ -1585,6 +1585,7 @@ class ExpenseReport extends CommonObject
} else { } else {
dol_syslog(get_class($this)."::set_cancel expensereport already with cancel status", LOG_WARNING); dol_syslog(get_class($this)."::set_cancel expensereport already with cancel status", LOG_WARNING);
} }
return 0;
} }
/** /**
@ -2179,6 +2180,8 @@ class ExpenseReport extends CommonObject
return -2; return -2;
} }
} }
return 0;
} }
/** /**
@ -2813,8 +2816,11 @@ class ExpenseReportLine extends CommonObjectLine
$this->rule_warning_message = $objp->rule_warning_message; $this->rule_warning_message = $objp->rule_warning_message;
$this->db->free($result); $this->db->free($result);
return $this->id;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
return -1;
} }
} }

View File

@ -107,8 +107,8 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
$permissionnote = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer;; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer; // Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer;; // Used by the include of actions_lineupdonw.inc.php $permissiontoedit = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer; // Used by the include of actions_lineupdonw.inc.php
$usercanread = $user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire; $usercanread = $user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire;
$usercancreate = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer; $usercancreate = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer;

View File

@ -29,7 +29,7 @@
// Load Dolibarr environment // Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';; require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';

View File

@ -157,7 +157,7 @@ if (empty($reshook)) {
// Line to produce // Line to produce
$moline->fk_mo = $object->id; $moline->fk_mo = $object->id;
$moline->qty = GETPOST('qtytoadd', 'int'); ; $moline->qty = GETPOST('qtytoadd', 'int');
$moline->fk_product = GETPOST('productidtoadd', 'int'); $moline->fk_product = GETPOST('productidtoadd', 'int');
if (GETPOST('addconsumelinebutton')) { if (GETPOST('addconsumelinebutton')) {
$moline->role = 'toconsume'; $moline->role = 'toconsume';

View File

@ -763,7 +763,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$productlot = new Productlot($db); $productlot = new Productlot($db);
if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) { if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) {
print $productlot->getNomUrl(1); print $productlot->getNomUrl(1);
} elseif (!empty($line->batch)) print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));; } elseif (!empty($line->batch)) print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));
} }
print '</td>'; print '</td>';
} }

View File

@ -533,7 +533,7 @@ if ($search_sale == -2) {
} elseif ($search_sale > 0) { } elseif ($search_sale > 0) {
$sql .= " AND sc.fk_user = ".((int) $search_sale); $sql .= " AND sc.fk_user = ".((int) $search_sale);
} }
$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();; $searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
$searchCategoryCustomerOperator = 0; $searchCategoryCustomerOperator = 0;
// Search for tag/category ($searchCategoryCustomerList is an array of ID) // Search for tag/category ($searchCategoryCustomerList is an array of ID)
if (!empty($searchCategoryCustomerList)) { if (!empty($searchCategoryCustomerList)) {

View File

@ -1545,7 +1545,7 @@ if ($action == 'create' || $action == 'presend') {
$morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
// Show link to add event (if read and not closed) // Show link to add event (if read and not closed)
$btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; ; $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message";
$url = dol_buildpath('/comm/action/card.php', 1).'?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); $url = dol_buildpath('/comm/action/card.php', 1).'?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id);
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus);

View File

@ -506,7 +506,7 @@ class ProductCombination
if ($child->label == $parent->label) { if ($child->label == $parent->label) {
// This will trigger only at variant creation time // This will trigger only at variant creation time
$varlabel = $this->getCombinationLabel($this->fk_product_child); $varlabel = $this->getCombinationLabel($this->fk_product_child);
$child->label = $parent->label.$varlabel; ; $child->label = $parent->label.$varlabel;
} }

View File

@ -52,4 +52,5 @@ exclude:
- name: PhpInArrayCanBeReplacedWithComparisonInspection - name: PhpInArrayCanBeReplacedWithComparisonInspection
- name: PhpUnusedAliasInspection - name: PhpUnusedAliasInspection
- name: PhpPossiblePolymorphicInvocationInspection - name: PhpPossiblePolymorphicInvocationInspection
- name: PhpRegExpRedundantModifierInspection