From 8a4613176cc00e98c1fabe3b6548032ea9814ee0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 16:20:35 +0100 Subject: [PATCH] Fix warnings --- htdocs/compta/facture/list.php | 2 +- htdocs/core/class/conf.class.php | 2 +- htdocs/core/class/html.form.class.php | 26 ++++++++++++------- htdocs/core/class/html.formfile.class.php | 2 +- .../modules/facture/doc/pdf_crabe.modules.php | 2 +- .../facture/doc/pdf_sponge.modules.php | 2 +- .../generate/modGeneratePassPerso.class.php | 2 +- .../class/expensereport.class.php | 8 +++++- htdocs/fourn/facture/card-rec.php | 4 +-- htdocs/hrm/position_note.php | 2 +- htdocs/mrp/mo_production.php | 2 +- .../stocktransfer/stocktransfer_card.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/ticket/card.php | 2 +- .../class/ProductCombination.class.php | 2 +- qodana.yaml | 5 ++-- 16 files changed, 40 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 698f131aa09..afc31d7efe3 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -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; // Search for tag/category ($searchCategoryCustomerList is an array of ID) if (!empty($searchCategoryCustomerList)) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 4bc04a27037..56e9e88b1dc 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -235,7 +235,7 @@ class Conf // Common arrays $this->cache = array(); - $this->modules = array();; + $this->modules = array(); $this->modules_parts = array( 'css' => array(), 'js' => array(), diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d796643d20c..8c333775f0e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3618,7 +3618,7 @@ class Form // 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 // "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 . "\n";; + $out .= $optstart . ' data-html="'.dol_escape_htmltag($optlabel).'">' . $optlabel . "\n"; array_push( $outarray, array('key'=>$outkey, @@ -7219,12 +7219,15 @@ class Form $this->db->free($result); - if (empty($outputmode)) return $out; + if (empty($outputmode)) { + return $out; + } return $outarray; } else { dol_print_error($this->db); - return array(); } + + return array(); } /** @@ -7422,12 +7425,15 @@ class Form $this->db->free($result); - if (empty($outputmode)) return $out; + if (empty($outputmode)) { + return $out; + } return $outarray; } else { dol_print_error($this->db); - return array(); } + + return array(); } /** @@ -7444,9 +7450,7 @@ class Form protected function constructProjectListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '') { $outkey = ''; - $outval = ''; $outref = ''; - $outlabel = ''; $outtype = ''; $label = $objp->label; @@ -7462,7 +7466,6 @@ class Form $opt .= $objp->ref; $objRef = $objp->ref; if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '$1', $objRef, 1); - $outval .= $objRef; $opt .= "\n"; $optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype); @@ -7642,12 +7645,15 @@ class Form $this->db->free($result); - if (empty($outputmode)) return $out; + if (empty($outputmode)) { + return $out; + } return $outarray; } else { dol_print_error($this->db); - return array(); } + + return array(); } /** diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index bc06d1517dc..7f5c2887e8b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -837,7 +837,7 @@ class FormFile } // Show file name with link to download - $imgpreview = $this->showPreview($file, $modulepart, $relativepath, 0, $param);; + $imgpreview = $this->showPreview($file, $modulepart, $relativepath, 0, $param); $out .= ''; if ($imgpreview) { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 7e29855dd2a..ecbaf280047 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -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); } else { $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)) { $posy += $hautcadre; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 2227dba791d..9200b554d3c 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -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); } else { $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)) { $posy += $hautcadre; diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php index e0dd2046020..491ab9757e8 100644 --- a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php +++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php @@ -212,7 +212,7 @@ class modGeneratePassPerso extends ModeleGenPassword $password_a = preg_split('//u', $password, 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); /* $password_a = str_split($password); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 781073a3e88..80fcefc7b68 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1553,7 +1553,7 @@ class ExpenseReport extends CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= " SET fk_statut = ".self::STATUS_CANCELED.", fk_user_cancel = ".((int) $fuser->id); $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); dol_syslog(get_class($this)."::set_cancel", LOG_DEBUG); @@ -1585,6 +1585,7 @@ class ExpenseReport extends CommonObject } else { 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 0; } /** @@ -2813,8 +2816,11 @@ class ExpenseReportLine extends CommonObjectLine $this->rule_warning_message = $objp->rule_warning_message; $this->db->free($result); + + return $this->id; } else { dol_print_error($this->db); + return -1; } } diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index ead5a5f8ea8..fcfaaf2d3d6 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -107,8 +107,8 @@ $extrafields->fetch_name_optionals_label($object->table_element); $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 -$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 +$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 $usercanread = $user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire; $usercancreate = $user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer; diff --git a/htdocs/hrm/position_note.php b/htdocs/hrm/position_note.php index a816692b86c..a6f4874a3a9 100644 --- a/htdocs/hrm/position_note.php +++ b/htdocs/hrm/position_note.php @@ -29,7 +29,7 @@ // Load Dolibarr environment 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/lib/hrm_position.lib.php'; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index b5856b81a99..00d474b4ce9 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -157,7 +157,7 @@ if (empty($reshook)) { // Line to produce $moline->fk_mo = $object->id; - $moline->qty = GETPOST('qtytoadd', 'int'); ; + $moline->qty = GETPOST('qtytoadd', 'int'); $moline->fk_product = GETPOST('productidtoadd', 'int'); if (GETPOST('addconsumelinebutton')) { $moline->role = 'toconsume'; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 54384ae0b3f..2df2123d00b 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -763,7 +763,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $productlot = new Productlot($db); if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) { print $productlot->getNomUrl(1); - } elseif (!empty($line->batch)) print $line->batch.' '.img_warning($langs->trans('BatchNotFound'));; + } elseif (!empty($line->batch)) print $line->batch.' '.img_warning($langs->trans('BatchNotFound')); } print ''; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 088f0b10055..fde19bf63ce 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -533,7 +533,7 @@ if ($search_sale == -2) { } elseif ($search_sale > 0) { $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; // Search for tag/category ($searchCategoryCustomerList is an array of ID) if (!empty($searchCategoryCustomerList)) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index c40f8d91da7..a5f36b5d60f 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -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); // 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); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index cc767449e75..23bdfcc9441 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -506,7 +506,7 @@ class ProductCombination if ($child->label == $parent->label) { // This will trigger only at variant creation time $varlabel = $this->getCombinationLabel($this->fk_product_child); - $child->label = $parent->label.$varlabel; ; + $child->label = $parent->label.$varlabel; } diff --git a/qodana.yaml b/qodana.yaml index e2e8c9af4ab..772cb2e3411 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -46,10 +46,11 @@ exclude: - name: PhpUnusedPrivateMethodInspection - name: PhpUnusedPrivateFieldInspection - name: PhpExpressionAlwaysNullInspection - - name: PhpIfWithCommonPartsInspection + - name: PhpIfWithCommonPartsInspection - name: PhpTernaryExpressionCanBeReducedToShortVersionInspection - - name: PhpExpressionWithSameOperandsInspection + - name: PhpExpressionWithSameOperandsInspection - name: PhpInArrayCanBeReplacedWithComparisonInspection - name: PhpUnusedAliasInspection - name: PhpPossiblePolymorphicInvocationInspection + - name: PhpRegExpRedundantModifierInspection \ No newline at end of file