From 77d6b9510bb26449a4b774d5ae3d527d366ee2cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 13:04:11 +0100 Subject: [PATCH] Clean code --- .../class/accountancycategory.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 34 +++++++++---------- htdocs/commande/class/commande.class.php | 24 ++++++------- htdocs/compta/ajaxpayment.php | 2 +- htdocs/compta/bank/class/bankcateg.class.php | 4 +-- htdocs/compta/facture/class/facture.class.php | 10 +++--- .../facture/class/paymentterm.class.php | 4 +-- .../cheque/class/remisecheque.class.php | 4 +-- .../class/paymentsocialcontribution.class.php | 15 ++++---- htdocs/compta/tva/class/paymentvat.class.php | 19 ++++------- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 14 ++++---- htdocs/core/class/ccountry.class.php | 4 +-- htdocs/core/class/cstate.class.php | 15 ++++---- htdocs/core/class/ctypent.class.php | 6 ++-- htdocs/cron/class/cronjob.class.php | 14 ++++---- htdocs/don/class/paymentdonation.class.php | 2 +- .../class/paymentexpensereport.class.php | 2 +- .../class/fournisseur.commande.class.php | 10 +++--- .../fournisseur.commande.dispatch.class.php | 4 +-- .../fourn/class/fournisseur.facture.class.php | 10 +++--- htdocs/loan/class/loanschedule.class.php | 8 ++--- htdocs/loan/class/paymentloan.class.php | 6 ++-- htdocs/product/class/productbatch.class.php | 6 ++-- .../class/productcustomerprice.class.php | 4 +-- .../class/price_expression.class.php | 2 +- htdocs/resource/class/dolresource.class.php | 4 +-- htdocs/salaries/class/paymentsalary.class.php | 6 ++-- .../class/supplier_proposal.class.php | 22 ++++++------ htdocs/ticket/class/ticket.class.php | 4 +-- qodana.yaml | 5 +-- 31 files changed, 131 insertions(+), 137 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 68662ccb610..2f6c71dde7f 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -353,7 +353,7 @@ class AccountancyCategory // extends CommonObject $sql .= " formula=".(isset($this->formula) ? "'".$this->db->escape($this->formula)."'" : "null").","; $sql .= " position=".(isset($this->position) ? $this->position : "null").","; $sql .= " fk_country=".(isset($this->fk_country) ? $this->fk_country : "null").","; - $sql .= " active=".(isset($this->active) ? $this->active : "null").""; + $sql .= " active=".(isset($this->active) ? $this->active : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1b3df25c7d2..963cbc92465 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1752,7 +1752,7 @@ class Propal extends CommonObject $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").","; - $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; + $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -4444,17 +4444,17 @@ class PropaleLigne extends CommonObjectLine $sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'"; $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'"; $sql .= ", qty='".price2num($this->qty)."'"; - $sql .= ", subprice=".price2num($this->subprice).""; - $sql .= ", remise_percent=".price2num($this->remise_percent).""; - $sql .= ", price=".(float) price2num($this->price).""; // TODO A virer - $sql .= ", remise=".(float) price2num($this->remise).""; // TODO A virer + $sql .= ", subprice=".price2num($this->subprice); + $sql .= ", remise_percent=".price2num($this->remise_percent); + $sql .= ", price=".(float) price2num($this->price); // TODO A virer + $sql .= ", remise=".(float) price2num($this->remise); // TODO A virer $sql .= ", info_bits='".$this->db->escape($this->info_bits)."'"; if (empty($this->skip_update_total)) { - $sql .= ", total_ht=".price2num($this->total_ht).""; - $sql .= ", total_tva=".price2num($this->total_tva).""; - $sql .= ", total_ttc=".price2num($this->total_ttc).""; - $sql .= ", total_localtax1=".price2num($this->total_localtax1).""; - $sql .= ", total_localtax2=".price2num($this->total_localtax2).""; + $sql .= ", total_ht=".price2num($this->total_ht); + $sql .= ", total_tva=".price2num($this->total_tva); + $sql .= ", total_ttc=".price2num($this->total_ttc); + $sql .= ", total_localtax1=".price2num($this->total_localtax1); + $sql .= ", total_localtax2=".price2num($this->total_localtax2); } $sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null"); $sql .= ", buy_price_ht=".price2num($this->pa_ht); @@ -4470,10 +4470,10 @@ class PropaleLigne extends CommonObjectLine $sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); // Multicurrency - $sql .= ", multicurrency_subprice=".price2num($this->multicurrency_subprice).""; - $sql .= ", multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; - $sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; - $sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + $sql .= ", multicurrency_subprice=".price2num($this->multicurrency_subprice); + $sql .= ", multicurrency_total_ht=".price2num($this->multicurrency_total_ht); + $sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva); + $sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc); $sql .= " WHERE rowid = ".((int) $this->id); @@ -4520,9 +4520,9 @@ class PropaleLigne extends CommonObjectLine // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."propaldet SET"; - $sql .= " total_ht=".price2num($this->total_ht, 'MT').""; - $sql .= ",total_tva=".price2num($this->total_tva, 'MT').""; - $sql .= ",total_ttc=".price2num($this->total_ttc, 'MT').""; + $sql .= " total_ht=".price2num($this->total_ht, 'MT'); + $sql .= ",total_tva=".price2num($this->total_tva, 'MT'); + $sql .= ",total_ttc=".price2num($this->total_ttc, 'MT'); $sql .= " WHERE rowid = ".((int) $this->rowid); dol_syslog("PropaleLigne::update_total", LOG_DEBUG); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f90fac176dc..19390d06f2f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3352,7 +3352,7 @@ class Commande extends CommonOrder $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").","; - $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; + $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); @@ -4625,14 +4625,14 @@ class OrderLine extends CommonOrderLine $sql .= " , localtax2_type='".$this->db->escape($this->localtax2_type)."'"; $sql .= " , qty=".price2num($this->qty); $sql .= " , ref_ext='".$this->db->escape($this->ref_ext)."'"; - $sql .= " , subprice=".price2num($this->subprice).""; - $sql .= " , remise_percent=".price2num($this->remise_percent).""; - $sql .= " , price=".price2num($this->price).""; // TODO A virer - $sql .= " , remise=".price2num($this->remise).""; // TODO A virer + $sql .= " , subprice=".price2num($this->subprice); + $sql .= " , remise_percent=".price2num($this->remise_percent); + $sql .= " , price=".price2num($this->price); // TODO A virer + $sql .= " , remise=".price2num($this->remise); // TODO A virer if (empty($this->skip_update_total)) { - $sql .= " , total_ht=".price2num($this->total_ht).""; - $sql .= " , total_tva=".price2num($this->total_tva).""; - $sql .= " , total_ttc=".price2num($this->total_ttc).""; + $sql .= " , total_ht=".price2num($this->total_ht); + $sql .= " , total_tva=".price2num($this->total_tva); + $sql .= " , total_ttc=".price2num($this->total_ttc); $sql .= " , total_localtax1=".price2num($this->total_localtax1); $sql .= " , total_localtax2=".price2num($this->total_localtax2); } @@ -4650,10 +4650,10 @@ class OrderLine extends CommonOrderLine $sql .= " , fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); // Multicurrency - $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; - $sql .= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; - $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; - $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice); + $sql .= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht); + $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva); + $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc); $sql .= " WHERE rowid = ".((int) $this->rowid); diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index aeb8d164928..b566f77bcde 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -109,7 +109,7 @@ if ($currentInvId) { // Here to breakdown $result -= $amountToBreakdown; // And canceled substraction has been replaced by breakdown } // else there's no need to calc anything, just reset the field (result is still < 0) } - $toJsonArray['amount_'.$currentInvId] = price2num($currentAmount).""; // Param will exist only if an img has been clicked + $toJsonArray['amount_'.$currentInvId] = price2num($currentAmount); // Param will exist only if an img has been clicked } $toJsonArray['makeRed'] = ($totalRemaining < price2num($result) || price2num($result) < 0) ? true : false; diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index 1795704d4ff..581bc5fd1da 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -80,7 +80,7 @@ class BankCateg // extends CommonObject $sql .= "label"; $sql .= ", entity"; $sql .= ") VALUES ("; - $sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").""; + $sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'"); $sql .= ", ".((int) $conf->entity); $sql .= ")"; @@ -169,7 +169,7 @@ class BankCateg // extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."bank_categ SET"; - $sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").""; + $sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); $sql .= " AND entity = ".$conf->entity; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 87d28de8756..ea5ad10eb2f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6375,11 +6375,11 @@ class FactureLigne extends CommonInvoiceLine // Update line in database $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET"; - $sql .= " total_ht=".price2num($this->total_ht).""; - $sql .= ",total_tva=".price2num($this->total_tva).""; - $sql .= ",total_localtax1=".price2num($this->total_localtax1).""; - $sql .= ",total_localtax2=".price2num($this->total_localtax2).""; - $sql .= ",total_ttc=".price2num($this->total_ttc).""; + $sql .= " total_ht=".price2num($this->total_ht); + $sql .= ",total_tva=".price2num($this->total_tva); + $sql .= ",total_localtax1=".price2num($this->total_localtax1); + $sql .= ",total_localtax2=".price2num($this->total_localtax2); + $sql .= ",total_ttc=".price2num($this->total_ttc); $sql .= " WHERE rowid = ".((int) $this->rowid); dol_syslog(get_class($this)."::update_total", LOG_DEBUG); diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 3ad533b6d3b..4da9dbb1559 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -137,7 +137,7 @@ class PaymentTerm // extends CommonObject $sql .= " ".(!isset($this->libelle_facture) ? 'NULL' : "'".$this->db->escape($this->libelle_facture)."'").","; $sql .= " ".(!isset($this->type_cdr) ? 'NULL' : "'".$this->db->escape($this->type_cdr)."'").","; $sql .= " ".(!isset($this->nbjour) ? 'NULL' : "'".$this->db->escape($this->nbjour)."'").","; - $sql .= " ".(!isset($this->decalage) ? 'NULL' : "'".$this->db->escape($this->decalage)."'").""; + $sql .= " ".(!isset($this->decalage) ? 'NULL' : "'".$this->db->escape($this->decalage)."'"); $sql .= ")"; $this->db->begin(); @@ -316,7 +316,7 @@ class PaymentTerm // extends CommonObject $sql .= " libelle_facture=".(isset($this->libelle_facture) ? "'".$this->db->escape($this->libelle_facture)."'" : "null").","; $sql .= " type_cdr=".(isset($this->type_cdr) ? $this->type_cdr : "null").","; $sql .= " nbjour=".(isset($this->nbjour) ? $this->nbjour : "null").","; - $sql .= " decalage=".(isset($this->decalage) ? $this->decalage : "null").""; + $sql .= " decalage=".(isset($this->decalage) ? $this->decalage : "null"); $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 3fb82f05cb9..e193939cdd6 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -190,8 +190,8 @@ class RemiseCheque extends CommonObject if ($this->id > 0 && $this->errno == 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql .= " SET ref='(PROV".$this->id.")'"; - $sql .= " WHERE rowid=".((int) $this->id).""; + $sql .= " SET ref = '(PROV".$this->id.")'"; + $sql .= " WHERE rowid=".((int) $this->id); $resql = $this->db->query($sql); if (!$resql) { diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 0bf402c6c21..73d101d7ae6 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -365,20 +365,17 @@ class PaymentSocialContribution extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET"; - - $sql .= " fk_charge=".(isset($this->fk_charge) ? $this->fk_charge : "null").","; + $sql .= " fk_charge=".(isset($this->fk_charge) ? ((int) $this->fk_charge) : "null").","; $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').","; - $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").","; - $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? $this->fk_typepaiement : "null").","; + $sql .= " amount=".(isset($this->amount) ? price2num($this->amount) : "null").","; + $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").","; $sql .= " num_paiement=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").","; $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").","; - $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; - $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; - - + $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").","; + $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").","; + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index ec951d8d72d..fcc241c728d 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -366,27 +366,22 @@ class PaymentVAT extends CommonObject $this->fk_user_modif = (int) $this->fk_user_modif; } - - // Check parameters // Put here code to add control on parameters values // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."payment_vat SET"; - - $sql .= " fk_tva=".(isset($this->fk_tva) ? $this->fk_tva : "null").","; + $sql .= " fk_tva=".(isset($this->fk_tva) ? ((int) $this->fk_tva) : "null").","; $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').","; - $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").","; - $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? $this->fk_typepaiement : "null").","; - $sql .= " num_paiement=".(isset($this->num_paiement) ? "'".$this->db->escape($this->num_paiement)."'" : "null").","; + $sql .= " amount=".(isset($this->amount) ? (float) price2num($this->amount) : "null").","; + $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").","; + $sql .= " num_paiement=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").","; $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").","; - $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; - $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; - - + $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").","; + $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").","; + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index d6efb35ef2f..dffba34d59b 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -226,7 +226,7 @@ class Tva extends CommonObject $sql .= " label='".$this->db->escape($this->label)."',"; $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " fk_user_creat=".((int) $this->fk_user_creat).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? $this->fk_user_modif : $user->id).""; + $sql .= " fk_user_modif=".((int) ($this->fk_user_modif > 0 ? $this->fk_user_modif : $user->id)); $sql .= " WHERE rowid=".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4352364452b..f473d3ce0de 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1368,8 +1368,8 @@ class Contrat extends CommonObject $sql .= " fk_commercial_suivi=".(isset($this->fk_commercial_suivi) ? $this->fk_commercial_suivi : "null").","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; - $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; - //$sql.= " extraparams=".(isset($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null").""; + $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); + //$sql.= " extraparams=".(isset($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -3434,11 +3434,11 @@ class ContratLigne extends CommonObjectLine // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET"; - $sql .= " total_ht=".price2num($this->total_ht, 'MT').""; - $sql .= ",total_tva=".price2num($this->total_tva, 'MT').""; - $sql .= ",total_localtax1=".price2num($this->total_localtax1, 'MT').""; - $sql .= ",total_localtax2=".price2num($this->total_localtax2, 'MT').""; - $sql .= ",total_ttc=".price2num($this->total_ttc, 'MT').""; + $sql .= " total_ht=".price2num($this->total_ht, 'MT'); + $sql .= ",total_tva=".price2num($this->total_tva, 'MT'); + $sql .= ",total_localtax1=".price2num($this->total_localtax1, 'MT'); + $sql .= ",total_localtax2=".price2num($this->total_localtax2, 'MT'); + $sql .= ",total_ttc=".price2num($this->total_ttc, 'MT'); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update_total", LOG_DEBUG); diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 7b46b0a08b0..cbf4574ec48 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -122,7 +122,7 @@ class Ccountry // extends CommonObject $sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").","; $sql .= " ".(!isset($this->code_iso) ? 'NULL' : "'".$this->db->escape($this->code_iso)."'").","; $sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").","; - $sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'").""; + $sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'"); $sql .= ")"; $this->db->begin(); @@ -239,7 +239,7 @@ class Ccountry // extends CommonObject $sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").","; $sql .= " code_iso=".(isset($this->code_iso) ? "'".$this->db->escape($this->code_iso)."'" : "null").","; $sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; - $sql .= " active=".(isset($this->active) ? $this->active : "null").""; + $sql .= " active=".(isset($this->active) ? $this->active : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index d67b0c25f66..e098de93bd4 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -117,7 +117,7 @@ class Cstate // extends CommonObject $sql .= " ".(!isset($this->rowid) ? 'NULL' : "'".$this->db->escape($this->rowid)."'").","; $sql .= " ".(!isset($this->code_departement) ? 'NULL' : "'".$this->db->escape($this->code_departement)."'").","; $sql .= " ".(!isset($this->nom) ? 'NULL' : "'".$this->db->escape($this->nom)."'").","; - $sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'").""; + $sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'"); $sql .= ")"; $this->db->begin(); @@ -208,22 +208,23 @@ class Cstate // extends CommonObject if (isset($this->code_departement)) { $this->code_departement = trim($this->code_departement); } - if (isset($this->nom)) { - $this->nom = trim($this->nom); + if (isset($this->name)) { + $this->name = trim($this->name); } if (isset($this->active)) { $this->active = trim($this->active); } - // Check parameters - // Put here code to add control on parameters values + if (empty($this->name) && !empty($this->nom)) { + $this->name = $this->nom; + } // Update request $sql = "UPDATE ".$this->db->prefix()."c_departements SET"; $sql .= " code_departement=".(isset($this->code_departement) ? "'".$this->db->escape($this->code_departement)."'" : "null").","; - $sql .= " nom=".(isset($this->nom) ? "'".$this->db->escape($this->nom)."'" : "null").","; - $sql .= " active=".(isset($this->active) ? $this->active : "null").""; + $sql .= " nom=".(isset($this->name) ? "'".$this->db->escape($this->name)."'" : "null").","; + $sql .= " active=".(isset($this->active) ? ((int) $this->active) : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index 324bfcb36a0..3bfae75d7de 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -114,7 +114,7 @@ class Ctypent // extends CommonObject $sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").","; $sql .= " ".(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").","; $sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'").","; - $sql .= " ".(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'").""; + $sql .= " ".(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'"); $sql .= ")"; $this->db->begin(); @@ -227,8 +227,8 @@ class Ctypent // extends CommonObject $sql = "UPDATE ".$this->db->prefix()."c_typent SET"; $sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").","; $sql .= " libelle=".(isset($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : "null").","; - $sql .= " active=".(isset($this->active) ? $this->active : "null").","; - $sql .= " module=".(isset($this->module) ? "'".$this->db->escape($this->module)."'" : "null").""; + $sql .= " active=".(isset($this->active) ? ((int) $this->active) : "null").","; + $sql .= " module=".(isset($this->module) ? "'".$this->db->escape($this->module)."'" : "null"); $sql .= " WHERE id=".$this->id; $this->db->begin(); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index d26c83f4772..b12a2b909cf 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -368,15 +368,15 @@ class Cronjob extends CommonObject $sql .= " ".(!isset($this->datelastresult) || dol_strlen($this->datelastresult) == 0 ? 'NULL' : "'".$this->db->idate($this->datelastresult)."'").","; $sql .= " ".(!isset($this->lastoutput) ? 'NULL' : "'".$this->db->escape($this->lastoutput)."'").","; $sql .= " ".(!isset($this->unitfrequency) ? 'NULL' : "'".$this->db->escape($this->unitfrequency)."'").","; - $sql .= " ".(!isset($this->frequency) ? '0' : $this->frequency).","; - $sql .= " ".(!isset($this->status) ? '0' : $this->status).","; - $sql .= " ".$user->id.","; - $sql .= " ".$user->id.","; + $sql .= " ".(!isset($this->frequency) ? '0' : ((int) $this->frequency)).","; + $sql .= " ".(!isset($this->status) ? '0' : ((int) $this->status)).","; + $sql .= " ".((int) $user->id).","; + $sql .= " ".((int) $user->id).","; $sql .= " ".(!isset($this->note_private) ? 'NULL' : "'".$this->db->escape($this->note_private)."'").","; - $sql .= " ".(!isset($this->nbrun) ? '0' : $this->db->escape($this->nbrun)).","; - $sql .= " ".(empty($this->maxrun) ? '0' : $this->db->escape($this->maxrun)).","; + $sql .= " ".(!isset($this->nbrun) ? '0' : ((int) $this->nbrun)).","; + $sql .= " ".(empty($this->maxrun) ? '0' : ((int) $this->maxrun)).","; $sql .= " ".(!isset($this->libname) ? 'NULL' : "'".$this->db->escape($this->libname)."'").","; - $sql .= " ".(!isset($this->test) ? 'NULL' : "'".$this->db->escape($this->test)."'").""; + $sql .= " ".(!isset($this->test) ? 'NULL' : "'".$this->db->escape($this->test)."'"); $sql .= ")"; $this->db->begin(); diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index b42f5fb4e4d..657a1d32d1a 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -347,7 +347,7 @@ class PaymentDonation extends CommonObject $sql .= " note=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null"); $sql .= " WHERE rowid=".(int) $this->id; $this->db->begin(); diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index e871cba86b3..c0ba86d55ff 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -317,7 +317,7 @@ class PaymentExpenseReport extends CommonObject $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").","; $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null"); $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4fc242bdbcc..0c0cb00129e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1594,7 +1594,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").","; - $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; + $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); @@ -3919,10 +3919,10 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= ($this->fk_unit ? ", fk_unit='".$this->db->escape($this->fk_unit)."'" : ", fk_unit=null"); // Multicurrency - $sql .= ", multicurrency_subprice=".price2num($this->multicurrency_subprice).""; - $sql .= ", multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; - $sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; - $sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + $sql .= ", multicurrency_subprice=".price2num($this->multicurrency_subprice); + $sql .= ", multicurrency_total_ht=".price2num($this->multicurrency_total_ht); + $sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva); + $sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc); $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 7c8e4acb25f..02fbff5b363 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -218,7 +218,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine $sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").","; $sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").","; $sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").","; - $sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'").""; + $sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'"); $sql .= ")"; $this->db->begin(); @@ -396,7 +396,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").","; $sql .= " eatby=".(dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').","; - $sql .= " sellby=".(dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').""; + $sql .= " sellby=".(dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null'); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index adf9fac3bde..74be4d3d6ac 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1259,7 +1259,7 @@ class FactureFournisseur extends CommonInvoice $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").","; - $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; + $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -3692,10 +3692,10 @@ class SupplierInvoiceLine extends CommonObjectLine } // Multicurrency - $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; - $sql .= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; - $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; - $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice); + $sql .= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht); + $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva); + $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc); $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 9beff9dd22e..50314ce99fc 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -334,10 +334,10 @@ class LoanSchedule extends CommonObject $sql .= " num_payment=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; - $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; - $sql .= " fk_payment_loan=".(isset($this->fk_payment_loan) ? $this->fk_payment_loan : "null").","; - $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; + $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").","; + $sql .= " fk_payment_loan=".(isset($this->fk_payment_loan) ? ((int) $this->fk_payment_loan) : "null").","; + $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").","; + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null"); $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 3ce8af01790..be53fa38b3a 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -343,9 +343,9 @@ class PaymentLoan extends CommonObject $sql .= " num_payment=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; - $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; - $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; + $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").","; + $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").","; + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ?((int) $this->fk_user_modif) : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 00d2dc80fee..52a39205b14 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -100,7 +100,7 @@ class Productbatch extends CommonObject $sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").","; // no more used $sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").","; $sql .= " ".(!isset($this->qty) ? 'NULL' : $this->qty).","; - $sql .= " ".(!isset($this->import_key) ? 'NULL' : "'".$this->db->escape($this->import_key)."'").""; + $sql .= " ".(!isset($this->import_key) ? 'NULL' : "'".$this->db->escape($this->import_key)."'"); $sql .= ")"; $this->db->begin(); @@ -204,7 +204,7 @@ class Productbatch extends CommonObject $sql .= " eatby=".(dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').","; $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").","; $sql .= " qty=".(isset($this->qty) ? $this->qty : "null").","; - $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; + $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -244,7 +244,7 @@ class Productbatch extends CommonObject $this->db->begin(); if (!$error) { - $sql = "DELETE FROM ".$this->db->prefix().self::$_table_element.""; + $sql = "DELETE FROM ".$this->db->prefix().self::$_table_element; $sql .= " WHERE rowid=".((int) $this->id); dol_syslog(get_class($this)."::delete", LOG_DEBUG); diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 197816f48ca..6a6fe72a08a 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -227,7 +227,7 @@ class Productcustomerprice extends CommonObject $sql .= " ".(empty($this->localtax2_type) ? "'0'" : "'".$this->db->escape($this->localtax2_type)."'").","; $sql .= " ".(!isset($this->localtax2_tx) ? 'NULL' : (empty($this->localtax2_tx) ? 0 : $this->localtax2_tx)).","; $sql .= " ".((int) $user->id).","; - $sql .= " ".(!isset($this->import_key) ? 'NULL' : "'".$this->db->escape($this->import_key)."'").""; + $sql .= " ".(!isset($this->import_key) ? 'NULL' : "'".$this->db->escape($this->import_key)."'"); $sql .= ")"; $this->db->begin(); @@ -773,7 +773,7 @@ class Productcustomerprice extends CommonObject $sql .= " localtax1_type=".(!empty($this->localtax1_type) ? "'".$this->db->escape($this->localtax1_type)."'" : "'0'").","; $sql .= " localtax2_type=".(!empty($this->localtax2_type) ? "'".$this->db->escape($this->localtax2_type)."'" : "'0'").","; $sql .= " fk_user=".$user->id.","; - $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; + $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index b698c6bf532..b9010f60f18 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -245,7 +245,7 @@ class PriceExpression // Update request $sql = "UPDATE ".$this->db->prefix().$this->table_element." SET"; $sql .= " title = ".(isset($this->title) ? "'".$this->db->escape($this->title)."'" : "''").","; - $sql .= " expression = ".(isset($this->expression) ? "'".$this->db->escape($this->expression)."'" : "''").""; + $sql .= " expression = ".(isset($this->expression) ? "'".$this->db->escape($this->expression)."'" : "''"); $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 515a766263b..99cc586cbb9 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -292,7 +292,7 @@ class Dolresource extends CommonObject $sql .= " description=".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").","; $sql .= " fk_country=".($this->country_id > 0 ? $this->country_id : "null").","; $sql .= " fk_code_type_resource=".(isset($this->fk_code_type_resource) ? "'".$this->db->escape($this->fk_code_type_resource)."'" : "null").","; - $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').""; + $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null'); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -619,7 +619,7 @@ class Dolresource extends CommonObject $sql .= " element_type=".(isset($this->element_type) ? "'".$this->db->escape($this->element_type)."'" : "null").","; $sql .= " busy=".(isset($this->busy) ? $this->busy : "null").","; $sql .= " mandatory=".(isset($this->mandatory) ? $this->mandatory : "null").","; - $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').""; + $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null'); $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 860deaa69f0..029e5732f9b 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -323,9 +323,9 @@ class PaymentSalary extends CommonObject $sql .= " fk_typepayment=".(isset($this->fk_typepayment) ? $this->fk_typepayment : "null").","; $sql .= " num_payment=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").","; $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").","; - $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; - $sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->fk_user_author : "null").","; - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; + $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").","; + $sql .= " fk_user_author=".(isset($this->fk_user_author) ? ((int) $this->fk_user_author) : "null").","; + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 1f95e3de5fd..44ee85ed68e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -3263,15 +3263,15 @@ class SupplierProposalLine extends CommonObjectLine $sql .= " , localtax1_type='".$this->db->escape($this->localtax1_type)."'"; $sql .= " , localtax2_type='".$this->db->escape($this->localtax2_type)."'"; $sql .= " , qty='".price2num($this->qty)."'"; - $sql .= " , subprice=".price2num($this->subprice).""; - $sql .= " , remise_percent=".price2num($this->remise_percent).""; + $sql .= " , subprice=".price2num($this->subprice); + $sql .= " , remise_percent=".price2num($this->remise_percent); $sql .= " , info_bits='".$this->db->escape($this->info_bits)."'"; if (empty($this->skip_update_total)) { - $sql .= " , total_ht=".price2num($this->total_ht).""; - $sql .= " , total_tva=".price2num($this->total_tva).""; - $sql .= " , total_ttc=".price2num($this->total_ttc).""; - $sql .= " , total_localtax1=".price2num($this->total_localtax1).""; - $sql .= " , total_localtax2=".price2num($this->total_localtax2).""; + $sql .= " , total_ht=".price2num($this->total_ht); + $sql .= " , total_tva=".price2num($this->total_tva); + $sql .= " , total_ttc=".price2num($this->total_ttc); + $sql .= " , total_localtax1=".price2num($this->total_localtax1); + $sql .= " , total_localtax2=".price2num($this->total_localtax2); } $sql .= " , fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null"); $sql .= " , buy_price_ht=".price2num($this->pa_ht); @@ -3286,10 +3286,10 @@ class SupplierProposalLine extends CommonObjectLine $sql .= " , fk_unit=".($this->fk_unit ? $this->fk_unit : 'null'); // Multicurrency - $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; - $sql .= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; - $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; - $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice); + $sql .= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht); + $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva); + $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc); $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 960b7555f51..d3a1306c3ce 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -495,7 +495,7 @@ class Ticket extends CommonObject $sql .= " ".(!isset($this->severity_code) ? 'NULL' : "'".$this->db->escape($this->severity_code)."'").","; $sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").","; $sql .= " ".(!isset($this->date_read) || dol_strlen($this->date_read) == 0 ? 'NULL' : "'".$this->db->idate($this->date_read)."'").","; - $sql .= " ".(!isset($this->date_close) || dol_strlen($this->date_close) == 0 ? 'NULL' : "'".$this->db->idate($this->date_close)."'").""; + $sql .= " ".(!isset($this->date_close) || dol_strlen($this->date_close) == 0 ? 'NULL' : "'".$this->db->idate($this->date_close)."'"); $sql .= ", ".((int) $conf->entity); $sql .= ", ".(!isset($this->notify_tiers_at_create) ? '1' : "'".$this->db->escape($this->notify_tiers_at_create)."'"); $sql .= ", ".(!isset($this->ip) ? 'NULL' : "'".$this->db->escape($this->ip)."'"); @@ -978,7 +978,7 @@ class Ticket extends CommonObject $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; $sql .= " date_read=".(dol_strlen($this->date_read) != 0 ? "'".$this->db->idate($this->date_read)."'" : 'null').","; $sql .= " date_last_msg_sent=".(dol_strlen($this->date_last_msg_sent) != 0 ? "'".$this->db->idate($this->date_last_msg_sent)."'" : 'null').","; - $sql .= " date_close=".(dol_strlen($this->date_close) != 0 ? "'".$this->db->idate($this->date_close)."'" : 'null').""; + $sql .= " date_close=".(dol_strlen($this->date_close) != 0 ? "'".$this->db->idate($this->date_close)."'" : 'null'); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/qodana.yaml b/qodana.yaml index ddecbc77414..4ce12440504 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -37,6 +37,7 @@ exclude: - name: PhpExpressionResultUnusedInspection - name: PhpUndefinedClassInspection - name: RegExpSimplifiable - + - name: PhpConditionCanBeReplacedWithMinMaxCallInspection + - name: PhpWrongStringConcatenationInspection + - name: PhpIfWithCommonPartsInspection - \ No newline at end of file