diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 64de4ac3d29..08be6da1dc4 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -399,7 +399,7 @@ class PaymentSocialContribution extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET"; $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 .= " tms=".(dol_strlen((string) $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) ? price2num($this->amount) : "null").","; $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").","; diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index acfa60d5020..5f2098ce80e 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -400,7 +400,7 @@ class PaymentVAT extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."payment_vat SET"; $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 .= " tms=".(dol_strlen((string) $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) ? (float) price2num($this->amount) : "null").","; $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").","; diff --git a/htdocs/contrat/class/contratligne.class.php b/htdocs/contrat/class/contratligne.class.php index 0fc139493d9..a836b560922 100644 --- a/htdocs/contrat/class/contratligne.class.php +++ b/htdocs/contrat/class/contratligne.class.php @@ -953,7 +953,7 @@ class ContratLigne extends CommonObjectLine $this->commentaire = $comment; $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".((int) $this->statut).","; - $sql .= " date_ouverture = ".(dol_strlen($this->date_start_real) != 0 ? "'".$this->db->idate($this->date_start_real)."'" : "null").","; + $sql .= " date_ouverture = ".(dol_strlen((string) $this->date_start_real) != 0 ? "'".$this->db->idate($this->date_start_real)."'" : "null").","; if ($date_end >= 0) { $sql .= " date_fin_validite = ".(dol_strlen($this->date_end) != 0 ? "'".$this->db->idate($this->date_end)."'" : "null").","; } diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 0dc4dd39198..290f129d237 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -345,7 +345,7 @@ class PaymentDonation extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET"; $sql .= " fk_donation=".(isset($this->fk_donation) ? $this->fk_donation : "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 .= " tms=".(dol_strlen((string) $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_typepayment=".(isset($this->fk_typepayment) ? $this->fk_typepayment : "null").","; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 4e958b9f04d..6a105f6cf5b 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -337,7 +337,7 @@ class EcmFiles extends CommonObject $sql .= ' '.(!isset($this->gen_or_uploaded) ? 'NULL' : "'".$this->db->escape($this->gen_or_uploaded)."'").','; $sql .= ' '.(!isset($this->extraparams) ? 'NULL' : "'".$this->db->escape($this->extraparams)."'").','; $sql .= " '".$this->db->idate($this->date_c)."',"; - $sql .= ' '.(!isset($this->date_m) || dol_strlen($this->date_m) == 0 ? 'NULL' : "'".$this->db->idate($this->date_m)."'").','; + $sql .= ' '.(!isset($this->date_m) || dol_strlen((string) $this->date_m) == 0 ? 'NULL' : "'".$this->db->idate($this->date_m)."'").','; $sql .= ' '.(!isset($this->fk_user_c) ? $user->id : $this->fk_user_c).','; $sql .= ' '.(!isset($this->fk_user_m) ? 'NULL' : $this->fk_user_m).','; $sql .= ' '.(!isset($this->acl) ? 'NULL' : "'".$this->db->escape($this->acl)."'").','; @@ -732,7 +732,7 @@ class EcmFiles extends CommonObject $sql .= ' gen_or_uploaded = '.(isset($this->gen_or_uploaded) ? "'".$this->db->escape($this->gen_or_uploaded)."'" : "null").','; $sql .= ' extraparams = '.(isset($this->extraparams) ? "'".$this->db->escape($this->extraparams)."'" : "null").','; $sql .= ' date_c = '.(!isset($this->date_c) || dol_strlen($this->date_c) != 0 ? "'".$this->db->idate($this->date_c)."'" : 'null').','; - //$sql .= ' tms = '.(! isset($this->date_m) || dol_strlen($this->date_m) != 0 ? "'".$this->db->idate($this->date_m)."'" : 'null').','; // Field automatically updated + //$sql .= ' tms = '.(! isset($this->date_m) || dol_strlen((string) $this->date_m) != 0 ? "'".$this->db->idate($this->date_m)."'" : 'null').','; // Field automatically updated $sql .= ' fk_user_m = '.($this->fk_user_m > 0 ? $this->fk_user_m : $user->id).','; $sql .= ' acl = '.(isset($this->acl) ? "'".$this->db->escape($this->acl)."'" : "null").','; $sql .= ' src_object_id = '.($this->src_object_id > 0 ? $this->src_object_id : "null").','; diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 100c7e5ab93..b3680728043 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -340,7 +340,7 @@ class PaymentExpenseReport extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET"; $sql .= " fk_expensereport=".(isset($this->fk_expensereport) ? $this->fk_expensereport : "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 .= " tms=".(dol_strlen((string) $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_typepayment=".(isset($this->fk_typepayment) ? $this->fk_typepayment : "null").","; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index b379fa7a62f..3884f3c8d55 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -429,7 +429,7 @@ class Fichinter extends CommonObject if (!is_numeric($this->duration)) { $this->duration = 0; } - if (!dol_strlen($this->fk_project)) { + if (!dol_strlen((string) $this->fk_project)) { $this->fk_project = 0; } if (isset($this->ref_client)) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ab69fbeceb9..a9dfa539beb 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1257,10 +1257,10 @@ class FactureFournisseur extends CommonInvoice $sql .= " type=".(isset($this->type) ? ((int) $this->type) : "null").","; $sql .= " subtype=".((int) $this->subtype).","; $sql .= " fk_soc=".(isset($this->socid) ? ((int) $this->socid) : "null").","; - $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; - $sql .= " datef=".(dol_strlen($this->date) != 0 ? "'".$this->db->idate($this->date)."'" : 'null').","; - if (dol_strlen($this->tms) != 0) { - $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; + $sql .= " datec=".(dol_strlen((string) $this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; + $sql .= " datef=".(dol_strlen((string) $this->date) != 0 ? "'".$this->db->idate($this->date)."'" : 'null').","; + if (dol_strlen((string) $this->tms) != 0) { + $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; } $sql .= " libelle=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; $sql .= " paye=".(isset($this->paid) ? ((int) $this->paid) : "0").","; @@ -1278,7 +1278,7 @@ class FactureFournisseur extends CommonInvoice $sql .= " vat_reverse_charge = ".($this->vat_reverse_charge != '' ? ((int) $this->db->escape($this->vat_reverse_charge)) : 0).","; $sql .= " fk_projet=".(!empty($this->fk_project) ? ((int) $this->fk_project) : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : "null").","; - $sql .= " date_lim_reglement=".(dol_strlen($this->date_echeance) != 0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').","; + $sql .= " date_lim_reglement=".(dol_strlen((string) $this->date_echeance) != 0 ? "'".$this->db->idate($this->date_echeance)."'" : '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 .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").","; diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 58e7b4966e8..7e5d2f4f428 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -333,7 +333,7 @@ class LoanSchedule extends CommonObject $sql .= " fk_loan=".(isset($this->fk_loan) ? $this->fk_loan : "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 .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').","; $sql .= " amount_capital=".(isset($this->amount_capital) ? $this->amount_capital : "null").","; $sql .= " amount_insurance=".(isset($this->amount_insurance) ? $this->amount_insurance : "null").","; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 6435942fe03..d8b461ad7d8 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -368,7 +368,7 @@ class PaymentLoan extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."payment_loan SET"; $sql .= " fk_loan=".(isset($this->fk_loan) ? $this->fk_loan : "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 .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').","; $sql .= " amount_capital=".(isset($this->amount_capital) ? $this->amount_capital : "null").","; $sql .= " amount_insurance=".(isset($this->amount_insurance) ? $this->amount_insurance : "null").","; diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 1f3c1319780..8e9a7d13da3 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -782,7 +782,7 @@ class ProductCustomerPrice extends CommonObject $sql .= " entity=".$conf->entity.","; $sql .= " datec='".$this->db->idate(dol_now())."',"; - $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; + $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").","; $sql .= " fk_soc=".(isset($this->fk_soc) ? $this->fk_soc : "null").","; $sql .= " ref_customer=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : "null").","; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 3558da35647..916579c2b4b 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2019 Juanjo Menent * Copyright (C) 2023 Vincent de Grandpré + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -227,7 +228,7 @@ if ($sall) { $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); } // if the type is not 1, we show all products (type = 0,2,3) -if (dol_strlen($type)) { +if (dol_strlen((string) $type)) { if ($type == 1) { $sql .= " AND p.fk_product_type = '1'"; } else { diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index f43993f4e19..218f0bf4eb8 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -7,6 +7,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 Juanjo Menent * Copyright (C) 2021 Noé Cendrier + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -296,7 +297,7 @@ if ($search_all) { $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $search_all); } // if the type is not 1, we show all products (type = 0,2,3) -if (dol_strlen($type)) { +if (dol_strlen((string) $type)) { if ($type == 1) { $sql .= " AND p.fk_product_type = '1'"; } else { diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index d3fac5d41e2..ec4a5247dc0 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -306,13 +306,13 @@ class Productlot extends CommonObject } if ($checkSellByMandatory) { - if (!isset($sellBy) || dol_strlen($sellBy) == 0) { + if (!isset($sellBy) || dol_strlen((string) $sellBy) == 0) { // error : sell by is mandatory $errorMsgArr[] = $langs->trans('ErrorFieldRequired', $langs->transnoentities('SellByDate')); } } if ($checkEatByMandatory) { - if (!isset($eatBy) || dol_strlen($eatBy) == 0) { + if (!isset($eatBy) || dol_strlen((string) $eatBy) == 0) { // error : eat by is mandatory $errorMsgArr[] = $langs->trans('ErrorFieldRequired', $langs->transnoentities('EatByDate')); } @@ -606,7 +606,7 @@ class Productlot extends CommonObject $sql .= ' qc_frequency = '.(!empty($this->qc_frequency) ? (int) $this->qc_frequency : 'null').','; $sql .= ' lifetime = '.(!empty($this->lifetime) ? (int) $this->lifetime : 'null').','; $sql .= ' datec = ' . (!isset($this->datec) || dol_strlen($this->datec) != 0 ? "'" . $this->db->idate($this->datec) . "'" : 'null') . ','; - $sql .= ' tms = ' . (dol_strlen($this->tms) != 0 ? "'" . $this->db->idate($this->tms) . "'" : "'" . $this->db->idate(dol_now()) . "'") . ','; + $sql .= ' tms = ' . (dol_strlen((string) $this->tms) != 0 ? "'" . $this->db->idate($this->tms) . "'" : "'" . $this->db->idate(dol_now()) . "'") . ','; $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 .= ' import_key = ' . (isset($this->import_key) ? $this->import_key : "null"); diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index b65e8e04262..fce36a3a633 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -354,7 +354,7 @@ class ProductStockEntrepot extends CommonObject // Update request $sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET'; - $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").','; + $sql .= ' tms = '.(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").','; $sql .= ' fk_product = '.(isset($this->fk_product) ? $this->fk_product : "null").','; $sql .= ' fk_entrepot = '.(isset($this->fk_entrepot) ? $this->fk_entrepot : "null").','; $sql .= ' seuil_stock_alerte = '.(isset($this->seuil_stock_alerte) ? $this->seuil_stock_alerte : "null").','; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 70d1c2a87ca..b72e01943ce 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -4,7 +4,7 @@ * Copyright (C) 2014 Regis Houssin * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2016 ATM Consulting - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2021 Ferran Marcet * Copyright (C) 2021 Antonin MARCHAL * Copyright (C) 2024 MDW @@ -387,7 +387,7 @@ if ($sall) { $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); } // if the type is not 1, we show all products (type = 0,2,3) -if (dol_strlen($type)) { +if (dol_strlen((string) $type)) { if ($type == 1) { $sql .= ' AND p.fk_product_type = 1'; } else { diff --git a/htdocs/reception/class/receptionlinebatch.class.php b/htdocs/reception/class/receptionlinebatch.class.php index 26d77de5b3c..7fd0e258669 100644 --- a/htdocs/reception/class/receptionlinebatch.class.php +++ b/htdocs/reception/class/receptionlinebatch.class.php @@ -415,7 +415,7 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; $sql .= " comment=".(isset($this->comment) ? "'".$this->db->escape($this->comment)."'" : "null").","; $sql .= " status=".(isset($this->status) ? $this->status : "null").","; - $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; + $sql .= " tms=".(dol_strlen((string) $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'); diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index cb106b7afeb..84c2d87c249 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -752,7 +752,7 @@ class Dolresource extends CommonObject $sql .= " element_type = ".(isset($this->element_type) ? "'".$this->db->escape($this->element_type)."'" : "null").","; $sql .= " busy = ".(isset($this->busy) ? (int) $this->busy : "null").","; $sql .= " mandatory = ".(isset($this->mandatory) ? (int) $this->mandatory : "null").","; - $sql .= " tms = ".(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null'); + $sql .= " tms = ".(dol_strlen((string) $this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null'); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 15cf12789ac..dfbee083f66 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -440,7 +440,7 @@ class PaymentSalary extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET"; $sql .= " fk_salary=".(isset($this->fk_salary) ? $this->fk_salary : "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 .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " datep=".(dol_strlen($this->datepaye) != 0 ? "'".$this->db->idate($this->datepaye)."'" : 'null').","; $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").","; $sql .= " fk_typepayment=".(isset($this->fk_typepayment) ? $this->fk_typepayment : "null").","; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index b164438e1e4..f569115af04 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -571,8 +571,8 @@ class Ticket extends CommonObject $sql .= " ".(empty($this->category_code) || $this->category_code == '-1' ? 'NULL' : "'".$this->db->escape($this->category_code)."'").","; $sql .= " ".(!isset($this->severity_code) ? 'NULL' : "'".$this->db->escape($this->severity_code)."'").","; $sql .= " ".(!isDolTms($this->datec) ? '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_read) || dol_strlen((string) $this->date_read) == 0 ? 'NULL' : "'".$this->db->idate($this->date_read)."'").","; + $sql .= " ".(!isset($this->date_close) || dol_strlen((string) $this->date_close) == 0 ? 'NULL' : "'".$this->db->idate($this->date_close)."'"); $sql .= ", ".((int) $this->entity); $sql .= ", ".(!isset($this->notify_tiers_at_create) ? 1 : ((int) $this->notify_tiers_at_create)); $sql .= ", '".$this->db->escape($this->model_pdf)."'"; @@ -1108,10 +1108,10 @@ class Ticket extends CommonObject $sql .= " category_code=".(isset($this->category_code) ? "'".$this->db->escape($this->category_code)."'" : "null").","; $sql .= " severity_code=".(isset($this->severity_code) ? "'".$this->db->escape($this->severity_code)."'" : "null").","; $sql .= " datec=".(isDolTms($this->datec) ? "'".$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_read=".(dol_strlen((string) $this->date_read) != 0 ? "'".$this->db->idate($this->date_read)."'" : 'null').","; + $sql .= " date_last_msg_sent=".(dol_strlen((string) $this->date_last_msg_sent) != 0 ? "'".$this->db->idate($this->date_last_msg_sent)."'" : 'null').","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").","; - $sql .= " date_close=".(dol_strlen($this->date_close) != 0 ? "'".$this->db->idate($this->date_close)."'" : 'null'); + $sql .= " date_close=".(dol_strlen((string) $this->date_close) != 0 ? "'".$this->db->idate($this->date_close)."'" : 'null'); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index ad3449cf761..a36082a4ec0 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -218,9 +218,9 @@ class Website extends CommonObject $sql .= ' '.(!isset($this->fk_default_home) ? 'NULL' : $this->fk_default_home).','; $sql .= ' '.(!isset($this->virtualhost) ? 'NULL' : "'".$this->db->escape($this->virtualhost)."'").","; $sql .= ' '.(!isset($this->fk_user_creat) ? $user->id : $this->fk_user_creat).','; - $sql .= ' '.(!isset($this->date_creation) || dol_strlen($this->date_creation) == 0 ? 'NULL' : "'".$this->db->idate($this->date_creation)."'").","; + $sql .= ' '.(!isset($this->date_creation) || dol_strlen((string) $this->date_creation) == 0 ? 'NULL' : "'".$this->db->idate($this->date_creation)."'").","; $sql .= ' '.((int) $this->position).","; - $sql .= ' '.(!isset($this->date_modification) || dol_strlen($this->date_modification) == 0 ? 'NULL' : "'".$this->db->idate($this->date_modification)."'"); + $sql .= ' '.(!isset($this->date_modification) || dol_strlen((string) $this->date_modification) == 0 ? 'NULL' : "'".$this->db->idate($this->date_modification)."'"); $sql .= ')'; $this->db->begin(); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index fe73c449322..8b9a9198ce2 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -77,7 +77,6 @@ parameters: - '#on array{url: mixed} in empty\(\) does not exist.#' - '#dol_copy expects string, int given#' - '#dol_getIdFromCode expects string, int given#' - - '#dol_strlen expects string, int given#' - '#EvalMath::trigger\(\) expects string, int given#' - '#get_next_value expects string, int given#' - '#pdf_writeLinkedObjects expects string, int given#'