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/card.php b/htdocs/contrat/card.php index 25d1186c5c9..de8401a5ce6 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -185,7 +185,7 @@ if (empty($reshook)) { $mesg = $object->error; } } elseif ($action == 'confirm_unsign' && $confirm == 'yes' && $user->hasRight('contract', 'creer')) { - $result = $object->setSignedStatus($user, $object::SIGNED_STATUSES['STATUS_NO_SIGNATURE'], 0, 'CONTRACT_MODIFY'); + $result = $object->setSignedStatus($user, Contrat::$SIGNED_STATUSES['STATUS_NO_SIGNATURE'], 0, 'CONTRACT_MODIFY'); if ($result >= 0) { header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); exit; @@ -2291,7 +2291,7 @@ if ($action == 'create') { // Sign if ($object->status > Contrat::STATUS_DRAFT) { - if ($object->signed_status != Contrat::SIGNED_STATUSES['STATUS_SIGNED_ALL']) { + if ($object->signed_status != Contrat::$SIGNED_STATUSES['STATUS_SIGNED_ALL']) { print '
' . $langs->trans("ContractSign") . '
'; } else { print '
' . $langs->trans("ContractUnsign") . '
'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 1c740316446..6fb297e5684 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -42,6 +42,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonsignedobject.class.php'; /** * Class to manage contracts + * @property int $signed_status + * @static array $SIGNED_STATUSES */ class Contrat extends CommonObject { @@ -170,12 +172,6 @@ class Contrat extends CommonObject */ public $date_contrat; - /** - * Status of the contract (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll) - * @var int - */ - public $signed_status = 0; - /** * @var int */ @@ -299,17 +295,6 @@ class Contrat extends CommonObject const STATUS_VALIDATED = 1; const STATUS_CLOSED = 2; - /** - * Signed statuses dictionary. Label used as key for string localizations. - */ - const SIGNED_STATUSES = [ - 'STATUS_NO_SIGNATURE' => 0, - 'STATUS_SIGNED_SENDER' => 1, - 'STATUS_SIGNED_RECEIVER' => 2, - 'STATUS_SIGNED_RECEIVER_ONLINE' => 3, - 'STATUS_SIGNED_ALL' => 9 // To handle future kind of signature (ex: tripartite contract) - ]; - /** * Constructor * 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/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 15f78298b0c..e5367297bb6 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -435,7 +435,7 @@ if ($action == "importSignature") { // We should just create an image file with the signature. } $user = new User($db); - $object->setSignedStatus($user, $object::SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'], 0, 'CONTRACT_MODIFY'); + $object->setSignedStatus($user, Contrat::$SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'], 0, 'CONTRACT_MODIFY'); } } elseif ($mode == 'fichinter') { require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; @@ -571,7 +571,7 @@ if ($action == "importSignature") { // We should just create an image file with the signature. } $user = new User($db); - $object->setSignedStatus($user, $object::SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'], 0, 'FICHINTER_MODIFY'); + $object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'], 0, 'FICHINTER_MODIFY'); } } elseif ($mode == "societe_rib") { $langs->load('withdrawals'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a26fa443496..4dca2d3fd02 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12639,7 +12639,7 @@ function getFieldErrorIcon($fieldValidationErrorMsg) * @param string $url the url for link * @param string $id attribute id of button * @param int<-2,2> $status 0 no user rights, 1 active, 2 current action or selected, -1 Feature Disabled, -2 disable Other reason use param $helpText as tooltip help - * @param array $params various params for future : recommended rather than adding more function arguments + * @param array $params various parameters for future : recommended rather than adding more function arguments * @return string html button */ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array()) diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index 0e7b04d97c3..08b00231c9d 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -1073,11 +1073,11 @@ class pdf_vinci extends ModelePDFMo } } - if (!empty($object->date_approve)) { + if (!empty($object->date_start_planned)) { $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("MoDate")." : ".dol_print_date($object->date_approve, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("MoDate")." : ".dol_print_date($object->date_start_planned, "day", false, $outputlangs, true), '', 'R'); } else { $posy += 5; $pdf->SetXY($posx, $posy); 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/card.php b/htdocs/fichinter/card.php index 9d696401441..509d6cf8878 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -228,7 +228,7 @@ if (empty($reshook)) { $mesg = $object->error; } } elseif ($action == 'confirm_unsign' && $confirm == 'yes' && $permissiontoadd) { - $result = $object->setSignedStatus($user, $object::SIGNED_STATUSES['STATUS_NO_SIGNATURE'], 0, 'FICHINTER_MODIFY'); + $result = $object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES['STATUS_NO_SIGNATURE'], 0, 'FICHINTER_MODIFY'); if ($result >= 0) { if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { // Define output language @@ -1807,7 +1807,7 @@ if ($action == 'create') { // Sign if ($object->statut > Fichinter::STATUS_DRAFT) { - if ($object->signed_status != Fichinter::SIGNED_STATUSES['STATUS_SIGNED_ALL']) { + if ($object->signed_status != Fichinter::$SIGNED_STATUSES['STATUS_SIGNED_ALL']) { print ''; } else { print ''; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index b379fa7a62f..f07554ad600 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonsignedobject.class.php'; /** * Class to manage interventions + * @property int $signed_status + * @static array $SIGNED_STATUSES */ class Fichinter extends CommonObject { @@ -151,12 +153,6 @@ class Fichinter extends CommonObject */ public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate - /** - * Signed Status of the intervention (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll) - * @var int - */ - public $signed_status = 0; - /** * @var string description */ @@ -208,17 +204,6 @@ class Fichinter extends CommonObject */ const STATUS_CLOSED = 3; - /** - * Signed statuses dictionary. Label used as key for string localizations. - */ - const SIGNED_STATUSES = [ - 'STATUS_NO_SIGNATURE' => 0, - 'STATUS_SIGNED_SENDER' => 1, - 'STATUS_SIGNED_RECEIVER' => 2, - 'STATUS_SIGNED_RECEIVER_ONLINE' => 3, - 'STATUS_SIGNED_ALL' => 9 // To handle future kind of signature (ex: tripartite contract) - ]; - /** * Date delivery * @var null|int|'' Delivery int @@ -429,7 +414,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..2d0241ae5f6 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -474,11 +474,6 @@ class FactureFournisseur extends CommonInvoice if (! $this->type) { $this->type = self::TYPE_STANDARD; } - if (!empty(GETPOST('ref_supplier'))) { - $this->ref_supplier = trim($this->ref_supplier); - } else { - $this->ref_supplier = trim($this->ref_supplier . '_' . ($_facrec->nb_gen_done + 1)); - } $this->note_public = trim($this->note_public); $this->note_private = trim($this->note_private); $this->note_private = dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->title)); @@ -499,6 +494,7 @@ class FactureFournisseur extends CommonInvoice // For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice if ($_facrec->frequency > 0) { + $this->ref_supplier = trim($this->ref_supplier . '_' . ($_facrec->nb_gen_done + 1)); dol_syslog("This is a recurring invoice so we set date_last_gen and next date_when"); if (empty($_facrec->date_when)) { $_facrec->date_when = $now; @@ -1257,10 +1253,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 +1274,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/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1b5edf77e7c..3aeac657350 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -997,9 +997,13 @@ if ($id > 0 || !empty($ref)) { } // Qty to dispatch - print ''; - print ''.img_picto($langs->trans("Reset"), 'eraser', 'class="pictofixedwidth opacitymedium"').''; - print ''; + print ''; + if ($remaintodispatch>0) { + $btnLabel = $langs->trans("Fill").' : '.$remaintodispatch; + print ''; + } + print ''; + print ''; print ''; print ''; @@ -1136,6 +1140,11 @@ if ($id > 0 || !empty($ref)) { $("select[name^=entrepot_]").val(fk_default_warehouse).change(); }); + $(".auto-fill-qty").on("click touchstart", function(e){ + e.preventDefault(); + $("input[name="+$(this).data("rowname")+"]").val($(this).data("value")).trigger("change"); + }); + $("#autoreset").click(function() { $(".qtydispatchinput").each(function(){ id = $(this).attr("id"); @@ -1154,7 +1163,8 @@ if ($id > 0 || !empty($ref)) { }); }); - $(".resetline").click(function(){ + $(".resetline").click(function(e){ + e.preventDefault(); id = $(this).attr("id"); id = id.split("reset_"); console.log("Reset trigger for id = qty_"+id[1]); 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/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7b2930044c3..ccde48cade0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2419,7 +2419,7 @@ class Societe extends CommonObject // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise"; $sql .= " (entity, datec, fk_soc, remise_client, note, fk_user_author)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; + $sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; $sql .= " '".$this->db->escape($note)."',"; $sql .= " ".((int) $user->id); $sql .= ")"; @@ -2480,7 +2480,7 @@ class Societe extends CommonObject // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_supplier"; $sql .= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; + $sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; $sql .= " '".$this->db->escape($note)."',"; $sql .= " ".((int) $user->id); $sql .= ")"; diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 7b41cfa6b2c..95df3a93ebd 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -344,7 +344,7 @@ div.pagination li:first-child a.btnTitle, div.pagination li.paginationafterarrow /* - * BTN LINK + * BTN LINK (used with tag in general but not with