From 100bfb921f0cdb97ed919ce858e8804ecc3bd68d Mon Sep 17 00:00:00 2001 From: Langlais115 Date: Fri, 15 May 2020 10:25:56 +0200 Subject: [PATCH 1/2] Fix #13805 Add proper type check to "seuil_stock_alerte" parameter. --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bb2a1652d8f..7b6892552d1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1015,7 +1015,7 @@ class Product extends CommonObject $sql .= ", volume = ".($this->volume != '' ? "'".$this->db->escape($this->volume)."'" : 'null'); $sql .= ", volume_units = ".($this->volume_units != '' ? "'".$this->db->escape($this->volume_units)."'" : 'null'); $sql .= ", fk_default_warehouse = ".($this->fk_default_warehouse > 0 ? $this->db->escape($this->fk_default_warehouse) : 'null'); - $sql .= ", seuil_stock_alerte = ".((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->db->escape($this->seuil_stock_alerte)."'" : "null"); + $sql .= ", seuil_stock_alerte = ".((isset($this->seuil_stock_alerte) && is_numeric($this->seuil_stock_alerte)) ? (int) $this->seuil_stock_alerte : 'null'); $sql .= ", description = '".$this->db->escape($this->description)."'"; $sql .= ", url = ".($this->url ? "'".$this->db->escape($this->url)."'" : 'null'); $sql .= ", customcode = '".$this->db->escape($this->customcode)."'"; From 9699ee7263ec8b591b569251c78d5932dd630da2 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Fri, 15 May 2020 11:55:31 +0000 Subject: [PATCH 2/2] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/accountancy/bookkeeping/balance.php | 16 ++++---- htdocs/compta/accounting-files.php | 12 +++--- htdocs/core/class/interfaces.class.php | 2 +- htdocs/core/lib/date.lib.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 2 +- .../modules/rapport/pdf_paiement.class.php | 28 +++++++------- .../class/emailcollector.class.php | 2 +- htdocs/takepos/invoice.php | 2 +- htdocs/takepos/phone.php | 38 +++++++++---------- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 85562ebc268..f443fded501 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -296,23 +296,23 @@ if ($action != 'export_csv') } print ''; - if(!empty($show_subgroup)) + if (!empty($show_subgroup)) { // Permet d'afficher le compte comptable if (empty($displayed_account) || $root_account_description != $displayed_account) { // Affiche un Sous-Total par compte comptable if ($displayed_account != "") { - print '' . $langs->trans("SubTotal") . ':'; - print '' . price($sous_total_debit) . ''; - print '' . price($sous_total_credit) . ''; - print '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print ''.$langs->trans("SubTotal").':'; + print ''.price($sous_total_debit).''; + print ''.price($sous_total_credit).''; + print ''.price(price2num($sous_total_credit - $sous_total_debit)).''; print "\n"; print ''; } // Show first line of a break print ''; - print '' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . ''; + print ''.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').''; print ''; $displayed_account = $root_account_description; @@ -337,9 +337,9 @@ if ($action != 'export_csv') $sous_total_credit += $line->credit; } - if(!empty($show_subgroup)) + if (!empty($show_subgroup)) { - print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_debit - $sous_total_credit)) . ''; + print ''.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_debit - $sous_total_credit)).''; print "\n"; print ''; } diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index f9bc453d999..6b9be4d285c 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -712,11 +712,11 @@ if (!empty($date_start) && !empty($date_stop)) print ''.$data['paid'].''; // Total ET - print ''.price($data['sens']?$data['amount_ht']:-$data['amount_ht'])."\n"; + print ''.price($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'])."\n"; // Total IT - print ''.price($data['sens']?$data['amount_ttc']:-$data['amount_ttc'])."\n"; + print ''.price($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'])."\n"; // Total VAT - print ''.price($data['sens']?$data['amount_vat']:-$data['amount_vat'])."\n"; + print ''.price($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'])."\n"; print ''.$data['thirdparty_name']."\n"; @@ -758,9 +758,9 @@ if (!empty($date_start) && !empty($date_stop)) // Balance print ''; print ''.$langs->trans('Total').''; - print ''.price(price2num($totalET_credit+$totalET_debit, 'MT')).''; - print ''.price(price2num($totalIT_credit+$totalIT_debit, 'MT')).''; - print ''.price(price2num($totalVAT_credit+$totalVAT_debit, 'MT')).''; + print ''.price(price2num($totalET_credit + $totalET_debit, 'MT')).''; + print ''.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).''; + print ''.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).''; print ''; print "\n"; } diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 9302ed09afb..7c010ea742c 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -379,7 +379,7 @@ class Interfaces print 'Error: Trigger '.$modName.' does not extends DolibarrTriggers
'; } } - catch(Exception $e) { + catch (Exception $e) { print $e->getMessage(); } diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index a751f584564..b44d7260e97 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -910,7 +910,7 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, if ($numholidays == 1) return 0; } - $nbOpenDay=$lastday; + $nbOpenDay = $lastday; if ($inhour == 1) $nbOpenDay = ($nbOpenDay * 24); return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 384c4fc3a7e..24811ad854d 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2302,7 +2302,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (preg_match('/experimental/i', $version)) $versiontrans .= 'warning'; if (preg_match('/deprecated/i', $version)) $versiontrans .= 'warning'; if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { - print 'getVersion(1).'">'; + print 'getVersion(1).'">'; print $this->getVersion(1); print ''; } diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 024310abb09..103d0fdffba 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -465,14 +465,14 @@ class pdf_paiement if ($yp > $this->tab_height - 15) { $pdf->SetFillColor(255, 255, 255); - $pdf->Rect($this->marge_gauche +1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite -3, $this->line_height, 'F', array(), array()); + $pdf->Rect($this->marge_gauche + 1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite - 3, $this->line_height, 'F', array(), array()); $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); $pdf->SetFont('', 'B', $default_font_size - 1); - $pdf->SetXY($this->posxdate -1, $this->tab_top + 10 + $yp); + $pdf->SetXY($this->posxdate - 1, $this->tab_top + 10 + $yp); $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('SubTotal')." : ", 0, 'R', 1); - $pdf->SetXY($this->posxpaymentamount -1, $this->tab_top + 10 + $yp); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount +1, $this->line_height, price($total_page), 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount - 1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount + 1, $this->line_height, price($total_page), 0, 'R', 1); $pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFillColor(220, 220, 220); $page++; @@ -523,19 +523,19 @@ class pdf_paiement } // Add line to add total by payment mode if mode reglement for nex line change - if ((($this->doc_type == 'client' && !empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) || ($this->doc_type == 'fourn' && !empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD))) && ($mod != $lines[$j+1][2])) + if ((($this->doc_type == 'client' && !empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) || ($this->doc_type == 'fourn' && !empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD))) && ($mod != $lines[$j + 1][2])) { $pdf->SetFillColor(245, 245, 245); - $pdf->Rect($this->marge_gauche +1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite -3, $this->line_height, 'F', array(), array()); + $pdf->Rect($this->marge_gauche + 1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite - 3, $this->line_height, 'F', array(), array()); $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); - $pdf->SetXY($this->posxdate -1, $this->tab_top + 10 + $yp); + $pdf->SetXY($this->posxdate - 1, $this->tab_top + 10 + $yp); $pdf->SetFont('', 'I', $default_font_size - 1); $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('Total').' '.$mod." : ", 0, 'R', 1); - $pdf->SetXY($this->posxpaymentamount -1, $this->tab_top + 10 + $yp); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount +1, $this->line_height, price($total_mod), 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount - 1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount + 1, $this->line_height, price($total_mod), 0, 'R', 1); $pdf->SetFont('', '', $default_font_size - 1); - $mod = $lines[$j+1][2]; + $mod = $lines[$j + 1][2]; $total_mod = 0; $yp = $yp + 5; if ($yp > $this->tab_height - 5) @@ -551,14 +551,14 @@ class pdf_paiement } $total += $total_page; $pdf->SetFillColor(255, 255, 255); - $pdf->Rect($this->marge_gauche +1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite -3, $this->line_height, 'F', array(), array()); + $pdf->Rect($this->marge_gauche + 1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite - 3, $this->line_height, 'F', array(), array()); $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); - $pdf->SetXY($this->posxdate -1, $this->tab_top + 10 + $yp); + $pdf->SetXY($this->posxdate - 1, $this->tab_top + 10 + $yp); $pdf->SetFont('', 'B'); $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('Total')." : ", 0, 'R', 1); - $pdf->SetXY($this->posxpaymentamount -1, $this->tab_top + 10 + $yp); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount +1, $this->line_height, price($total), 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount - 1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount + 1, $this->line_height, price($total), 0, 'R', 1); $pdf->SetFillColor(220, 220, 220); } } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 2bc6d6db962..bf1a4e26de7 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1092,7 +1092,7 @@ class EmailCollector extends CommonObject $i++; $header = imap_fetchheader($connection, $imapemail, 0); - $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines + $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines $matches = array(); preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $header, $matches); $headers = array_combine($matches[1], $matches[2]); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3d6cec96319..16012022dc9 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -625,7 +625,7 @@ $(document).ready(function() { else selectedline=this.id; selectedtext=$('#'+selectedline).find("td:first").html(); '; -if ($action=="productinfo"){ +if ($action == "productinfo") { $prod = new Product($db); $prod->fetch($idproduct); print "".$prod->label."
"; @@ -83,7 +83,7 @@ if ($action=="productinfo"){ print '
'; print ''; } -elseif ($action=="editline"){ +elseif ($action == "editline") { $placeid = GETPOST('placeid', 'int'); $selectedline = GETPOST('selectedline', 'int'); $invoice = new Facture($db); @@ -99,8 +99,8 @@ elseif ($action=="editline"){ print "
".$prod->description; print "
".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).""; print '
'; - print ''; - print ''; + print ''; + print ''; print ''; } } @@ -168,11 +168,11 @@ $( document ).ready(function() { function LoadPlace(placeid){ place=placeid; @@ -197,11 +197,11 @@ function AddProduct(placeid, productid){ function AddProductConfirm(placeid, productid){ place=placeid;
'.strtoupper(substr($langs->trans('Floors'), 0, 3)).''; print ''; print ''; print ''; } - else{ + else { print ''; print ''; print '';