diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index b337a0922f8..51d9aac95eb 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -7,6 +7,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2017 Rui Strecht * Copyright (C) 2023 Nick Fragoulis + * 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 @@ -92,7 +93,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) activateModulesRequiredByCountry($mysoc->country_code); } - $tmparray = getState(GETPOSTINT('state_id'), 'all', $db, $langs, 0); + $tmparray = getState(GETPOSTINT('state_id'), 'all', $db, 0, $langs, 0); if (!empty($tmparray['id'])) { $mysoc->state_id = $tmparray['id']; $mysoc->state_code = $tmparray['code']; diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index 6a9b14a4e1d..4ee6a4c170c 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2023 Eric Seigne + * 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 @@ -57,7 +58,7 @@ $rawData = file_get_contents('php://input'); $jsonData = json_decode($rawData, true); if (is_null($jsonData)) { - dol_print_error('data with format JSON valide.'); + dol_print_error($db, 'data with format JSON valide.'); } $ai = new Ai($db); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4952b0dfd50..00e1c2a0336 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1136,7 +1136,7 @@ class Commande extends CommonOrder $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } } else { - dol_print_error($resqlcontact); + dol_print_error($this->db, $resqlcontact); } } diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 4dab4a912a0..8267e6db702 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -6,6 +6,7 @@ * Copyright (C) 2017 Patrick Delcroix * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2022 Alexandre Spangaro + * 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 @@ -312,7 +313,7 @@ if (empty($numref)) { // If not cash account and can be reconciliate if ($user->hasRight('banque', 'consolidate')) { - $buttonreconcile = ''.$titletoconciliatemanual.''; + $buttonreconcile = ''.$titletoconciliatemanual.''; } else { $buttonreconcile = ''.$titletoconciliatemanual.''; } @@ -323,7 +324,7 @@ if (empty($numref)) { if ($user->hasRight('banque', 'consolidate')) { $newparam = $param; $newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam); - $buttonreconcile .= ' '.$titletoconciliateauto.''; + $buttonreconcile .= ' '.$titletoconciliateauto.''; } else { $buttonreconcile .= ' '.$titletoconciliateauto.''; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2dfdd3b3765..79dc2385983 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -776,7 +776,7 @@ class Facture extends CommonInvoice $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } } else { - dol_print_error($resqlcontact); + dol_print_error($this->db, $resqlcontact); } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ffa89264f87..985587f09df 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1135,7 +1135,7 @@ class Contrat extends CommonObject $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } } else { - dol_print_error($resqlcontact); + dol_print_error($this->db, $resqlcontact); } } } @@ -1731,7 +1731,7 @@ class Contrat extends CommonObject $localtaxes_type = getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); $tvatx = preg_replace('/\s*\(.*\)/', '', $tvatx); // Remove code into vatrate. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, (float) price2num($tvatx), $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 3db1703c034..6186e1552ff 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -309,7 +309,7 @@ abstract class CommonDocGenerator $mysoc->country = $outputlangs->transnoentitiesnoconv("Country".$mysoc->country_code); } if (empty($mysoc->state) && !empty($mysoc->state_code)) { - $mysoc->state = getState($mysoc->state_code, 0); + $mysoc->state = getState($mysoc->state_code, '0'); } $logotouse = $conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; @@ -365,7 +365,7 @@ abstract class CommonDocGenerator $object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code); } if (empty($object->state) && !empty($object->state_code)) { - $object->state = getState($object->state_code, 0); + $object->state = getState($object->state_code, '0'); } $array_thirdparty = array( @@ -431,7 +431,7 @@ abstract class CommonDocGenerator $object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code); } if (empty($object->state) && !empty($object->state_code)) { - $object->state = getState($object->state_code, 0); + $object->state = getState($object->state_code, '0'); } $array_contact = array( diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index b6d0f99afb5..05909cfa610 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -877,7 +877,7 @@ class FormProjets extends Form } $out .= ''; } else { - dol_print_error($this->db->lasterror); + dol_print_error($this->db, $this->db->lasterror); return ''; } } @@ -929,7 +929,7 @@ class FormProjets extends Form $out .= ''; } } else { - dol_print_error($this->db->lasterror); + dol_print_error($this->db, $this->db->lasterror); return ''; } diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index c4f78b7f91f..5a31f520a17 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 MDW + * 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 @@ -290,9 +291,9 @@ class RssParser xml_set_object($xmlparser, $this); // @phan-suppress-next-line PhanUndeclaredFunctionInCallable - xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); + xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); // @phpstan-ignore-line // @phan-suppress-next-line PhanUndeclaredFunctionInCallable - xml_set_character_data_handler($xmlparser, 'feed_cdata'); + xml_set_character_data_handler($xmlparser, 'feed_cdata'); // @phpstan-ignore-line $status = xml_parse($xmlparser, $str, false); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 39fa548bce6..55c25b17f5c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2659,7 +2659,7 @@ function dol_get_fiche_end($notab = 0) * @param CommonObject $object Object to show * @param string $paramid Name of parameter to use to name the id into the URL next/previous link * @param string $morehtml More html content to output just before the nav bar - * @param int $shownav Show Condition (navigation is shown if value is 1) + * @param int|bool $shownav Show Condition (navigation is shown if value is 1 or true) * @param string $fieldid Name of the field in DB to use to select next et previous (we make the select max and min on this field). Use 'none' for no prev/next search. * @param string $fieldref Name of the field (object->ref) to use to select next et previous * @param string $morehtmlref More html to show after the ref (see $morehtmlleft for before) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index d6e86ee5985..141961e0da7 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -1,11 +1,12 @@ - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2017 Charlie Benke - * Copyright (C) 2017 ATM-CONSULTING - * Copyright (C) 2024 MDW +/* Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2017 Charlie Benke + * Copyright (C) 2017 ATM-CONSULTING + * Copyright (C) 2024 MDW + * 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 @@ -246,7 +247,7 @@ function invoice_admin_prepare_head() /** * Return array head with list of tabs to view object information. * - * @param Facture $object Invoice object + * @param FactureRec $object Invoice model object * @return array head array with tabs */ function invoice_rec_prepare_head($object) diff --git a/htdocs/core/lib/phpsessionindb.lib.php b/htdocs/core/lib/phpsessionindb.lib.php index f856ac71c90..65db9c661e2 100644 --- a/htdocs/core/lib/phpsessionindb.lib.php +++ b/htdocs/core/lib/phpsessionindb.lib.php @@ -1,5 +1,6 @@ + * 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 @@ -244,4 +245,4 @@ function dolSessionGC($max_lifetime) } // Call to register user call back functions. -session_set_save_handler("dolSessionOpen", "dolSessionClose", "dolSessionRead", "dolSessionWrite", "dolSessionDestroy", "dolSessionGC"); +session_set_save_handler("dolSessionOpen", "dolSessionClose", "dolSessionRead", "dolSessionWrite", "dolSessionDestroy", "dolSessionGC"); // @phpstan-ignore-line diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index aefd2718508..0c9bf197866 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -99,19 +99,22 @@ class mod_commande_saphir extends ModeleNumRefCommandes */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $old_code_type = $mysoc->typent_code; - $mysoc->code_client = 'CCCCCCCCCC'; - $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, null); - $mysoc->code_client = $old_code_client; - $mysoc->typent_code = $old_code_type; + require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $order = new Commande($db); + $order->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, $order); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } + return $numExample; } diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index b6669961cd0..c1b46e768fa 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -104,16 +104,22 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; + require_once DOL_DOCUMENT_ROOT . '/delivery/class/delivery.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $delivery = new Delivery($db); + $delivery->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, $delivery); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } + return $numExample; } diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index c8781cdd2cc..50d33d378d3 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -404,6 +404,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } // Make substitutions into odt of thirdparty if ($socobject->element == 'contact') { + /** @var Contact $socobject */ $tmparray = $this->get_substitutionarray_contact($socobject, $outputlangs); } else { $tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 4d85f303169..44111872971 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -97,19 +97,22 @@ class mod_expedition_ribera extends ModelNumRefExpedition */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $old_code_type = $mysoc->typent_code; - $mysoc->code_client = 'CCCCCCCCCC'; - $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; - $mysoc->typent_code = $old_code_type; + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $shipment = new Expedition($db); + $shipment->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, $shipment); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } + return $numExample; } diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index 63938b77da2..daecb8cf37f 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -170,7 +170,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport $sqlbis = 'UPDATE '.MAIN_DB_PREFIX.'expensereport SET ref_number_int = '.((int) $ref_number_int).' WHERE rowid = '.((int) $object->id); $resqlbis = $db->query($sqlbis); if (!$resqlbis) { - dol_print_error($resqlbis); + dol_print_error($db, $resqlbis); exit; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index a9a1cdf9ac8..38c26923098 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -11,7 +11,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Anthony Berton * Copyright (C) 2022 Charlene Benke - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * 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 @@ -211,7 +211,7 @@ class pdf_crabe extends ModelePDFFactures $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); // Show Draft Watermark - if ($object->statut == $object::STATUS_DRAFT && (getDolGlobalString('FACTURE_DRAFT_WATERMARK'))) { + if ($object->status == $object::STATUS_DRAFT && (getDolGlobalString('FACTURE_DRAFT_WATERMARK'))) { $this->watermark = getDolGlobalString('FACTURE_DRAFT_WATERMARK'); } @@ -1254,13 +1254,13 @@ class pdf_crabe extends ModelePDFFactures $useonlinepayment = count($validpaymentmethod); } - if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { + if ($object->status != Facture::STATUS_DRAFT && $useonlinepayment) { require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); + $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); @@ -1902,7 +1902,7 @@ class pdf_crabe extends ModelePDFFactures } } $title .= ' '.$outputlangs->convToOutputCharset($object->ref); - if ($object->statut == $object::STATUS_DRAFT) { + if ($object->status == $object::STATUS_DRAFT) { $pdf->SetTextColor(128, 0, 0); $title .= ' - '.$outputlangs->transnoentities("NotValidated"); } @@ -1916,7 +1916,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref); - if ($object->statut == $object::STATUS_DRAFT) { + if ($object->status == $object::STATUS_DRAFT) { $pdf->SetTextColor(128, 0, 0); $textref .= ' - '.$outputlangs->transnoentities("NotValidated"); } diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 4b4ce446060..3f20ead4a82 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1455,13 +1455,13 @@ class pdf_octopus extends ModelePDFFactures } - if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { + if ($object->status != Facture::STATUS_DRAFT && $useonlinepayment) { require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); + $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 0cfa725a1ef..45ac0a25dc3 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1362,7 +1362,7 @@ class pdf_sponge extends ModelePDFFactures $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); + $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 3fe523af548..9ea2ff99633 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2024 MDW + * 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 @@ -99,7 +100,7 @@ class modAgenda extends DolibarrModules $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); } } else { - dol_print_error($this->db->lasterror()); + dol_print_error($this->db, $this->db->lasterror()); } // New pages on tabs diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php index fe2948e1ea5..f9df0cf2ae7 100644 --- a/htdocs/core/modules/mrp/mod_mo_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -66,12 +66,12 @@ class mod_mo_advanced extends ModeleNumRefMos $form = new Form($db); - $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; - $texte .= '
'; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $texte .= ''; + $text = $langs->trans('GenericNumRefModelDesc')."
\n"; + $text .= ''; + $text .= ''; + $text .= ''; + $text .= ''; + $text .= '
'; $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo")); $tooltip .= $langs->trans("GenericMaskCodes2"); @@ -80,17 +80,17 @@ class mod_mo_advanced extends ModeleNumRefMos $tooltip .= $langs->trans("GenericMaskCodes5"); // Parametrage du prefix - $texte .= ''; - $texte .= ''; + $text .= ''; + $text .= ''; - $texte .= ''; + $text .= ''; - $texte .= ''; + $text .= ''; - $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'   
'; - $texte .= '
'; + $text .= ''; + $text .= ''; - return $texte; + return $text; } /** @@ -100,19 +100,23 @@ class mod_mo_advanced extends ModeleNumRefMos */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $old_code_type = $mysoc->typent_code; - $mysoc->code_client = 'CCCCCCCCCC'; - $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; - $mysoc->typent_code = $old_code_type; + require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + + $mo = new Mo($db); + $mo->initAsSpecimen(); + $product = new Product($db); + $product->initAsSpecimen(); + + + $numExample = $this->getNextValue($product, $mo); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } + return $numExample; } @@ -125,7 +129,7 @@ class mod_mo_advanced extends ModeleNumRefMos */ public function getNextValue($objprod, $object) { - global $db, $conf; + global $db; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 6ed05b3e728..84c2b39658a 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010 Regis Houssin * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -109,16 +109,22 @@ class mod_project_universal extends ModeleNumRefProjects */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $project = new Project($db); + $project->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, $project); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } + return $numExample; } @@ -131,7 +137,7 @@ class mod_project_universal extends ModeleNumRefProjects */ public function getNextValue($objsoc, $project) { - global $db, $conf; + global $db, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -139,7 +145,7 @@ class mod_project_universal extends ModeleNumRefProjects $mask = getDolGlobalString('PROJECT_UNIVERSAL_MASK'); if (!$mask) { - $this->error = 'NotConfigured'; + $this->error = $langs->trans('NotConfigured'); return 0; } diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php index 91772195411..9f7f83883a0 100644 --- a/htdocs/core/modules/propale/mod_propale_saphir.php +++ b/htdocs/core/modules/propale/mod_propale_saphir.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) + * 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 @@ -106,19 +107,21 @@ class mod_propale_saphir extends ModeleNumRefPropales */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $old_code_type = $mysoc->typent_code; - $mysoc->code_client = 'CCCCCCCCCC'; - $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; - $mysoc->typent_code = $old_code_type; + require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $propal = new Propal($db); + $propal->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + $numExample = $this->getNextValue($thirdparty, $propal); if (!$numExample) { - $numExample = 'NotConfigured'; + $numExample = $langs->trans('NotConfigured'); } + return $numExample; } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 3addf2c8c22..d6247a50d43 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -5,9 +5,9 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2023 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2023 William Mead + * Copyright (C) 2024 MDW * * 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 @@ -911,7 +911,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders * Show total to pay * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param CommandeFournisseur $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Object langs @@ -1465,7 +1465,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders /** * Define Array Column Field * - * @param object $object common object + * @param CommandeFournisseur $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index a5304052548..6679263afb7 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -107,12 +107,17 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; + require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $supplierorder = new CommandeFournisseur($db); + $supplierorder->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, $supplierorder); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); @@ -129,7 +134,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders */ public function getNextValue($objsoc, $object) { - global $db, $conf; + global $db, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -137,7 +142,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders $mask = getDolGlobalString("COMMANDE_FOURNISSEUR_ORCHIDEE_MASK"); if (!$mask) { - $this->error = 'NotConfigured'; + $this->error = $langs->trans('NotConfigured'); return 0; } diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index f78640fb41f..13a6948fb1a 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -907,8 +907,8 @@ class pdf_zenith extends ModelePDFSupplierProposal /** * Show total to pay * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param SupplierProposal $object Object supplier proposal * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Object langs @@ -1167,7 +1167,7 @@ class pdf_zenith extends ModelePDFSupplierProposal * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param CommandeFournisseur $object Object to show + * @param SupplierProposal $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return float|int Return topshift value @@ -1435,7 +1435,7 @@ class pdf_zenith extends ModelePDFSupplierProposal * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param CommandeFournisseur $object Object to show + * @param SupplierProposal $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1451,7 +1451,7 @@ class pdf_zenith extends ModelePDFSupplierProposal /** * Define Array Column Field * - * @param Object $object common object + * @param SupplierProposal $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index 59f37537851..3b79a6d0f19 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Regis Houssin + * 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 @@ -67,12 +68,12 @@ class mod_ticket_universal extends ModeleNumRefTicket $form = new Form($db); - $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; - $texte .= '
'; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $texte .= ''; + $text = $langs->trans('GenericNumRefModelDesc')."
\n"; + $text .= ''; + $text .= ''; + $text .= ''; + $text .= ''; + $text .= '
'; $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Ticket"), $langs->transnoentities("Ticket")); $tooltip .= $langs->trans("GenericMaskCodes2"); @@ -81,17 +82,17 @@ class mod_ticket_universal extends ModeleNumRefTicket $tooltip .= $langs->trans("GenericMaskCodes5"); // Prefix settings - $texte .= ''; - $texte .= ''; + $text .= ''; + $text .= ''; - $texte .= ''; + $text .= ''; - $texte .= ''; + $text .= ''; - $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'   
'; - $texte .= '
'; + $text .= ''; + $text .= ''; - return $texte; + return $text; } /** @@ -101,16 +102,22 @@ class mod_ticket_universal extends ModeleNumRefTicket */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; + require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $ticket = new Ticket($db); + $ticket->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, $ticket); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } + return $numExample; } @@ -123,7 +130,7 @@ class mod_ticket_universal extends ModeleNumRefTicket */ public function getNextValue($objsoc, $ticket) { - global $db, $conf; + global $db, $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -131,7 +138,7 @@ class mod_ticket_universal extends ModeleNumRefTicket $mask = getDolGlobalString("TICKET_UNIVERSAL_MASK"); if (!$mask) { - $this->error = 'NotConfigured'; + $this->error = $langs->trans('NotConfigured'); return 0; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index f6a327d5a03..57b80393617 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1972,7 +1972,7 @@ class ExpenseReport extends CommonObject } $vatrate = preg_replace('/\*/', '', $vatrate); - $tmp = calcul_price_total($qty, $up, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); + $tmp = calcul_price_total($qty, $up, 0, (float) price2num($vatrate), -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); $this->line->value_unit = $up; @@ -2238,10 +2238,9 @@ class ExpenseReport extends CommonObject } $vatrate = preg_replace('/\*/', '', $vatrate); - $tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); - //var_dump($vatrate);var_dump($localtaxes_type);var_dump($tmp);exit; + $tmp = calcul_price_total($qty, $value_unit, 0, (float) price2num($vatrate), -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); // calcul total of line - //$total_ttc = price2num($qty*$value_unit, 'MT'); + // $total_ttc = price2num($qty*$value_unit, 'MT'); $tx_tva = 1 + (float) $vatrate / 100; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 267fdc49bfc..c734af74e7c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -16,7 +16,7 @@ * Copyright (C) 2016-2022 Charlene Benke * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2022 Vincent de Grandpré @@ -2844,7 +2844,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Origin country code print ''.$langs->trans("Origin").''.getCountry($object->country_id, 0, $db); if (!empty($object->state_id)) { - print ' - '.getState($object->state_id, 0, $db); + print ' - '.getState($object->state_id, '0', $db); } print ''; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 6132e5460d7..af2c3dbc047 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -16,6 +16,7 @@ * Copyright (C) 2020-2023 Alexandre Spangaro * Copyright (C) 2024 MDW * Copyright (C) 2024 Benjamin Falière + * 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 @@ -2155,7 +2156,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['p.fk_state']['checked'])) { print ''; if (!empty($obj->fk_state)) { - print getState($obj->fk_state, 0, $db); + print getState($obj->fk_state, '0', $db); } print ''; if (!$i) { diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 3a1106b0e9c..9432db225f9 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Florian Henry + * 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 @@ -219,8 +220,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a94c09cf119..99a9927990a 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021 Waël Almoman * Copyright (C) 2022 Udo Tamm @@ -453,7 +453,7 @@ if (empty($reshook) && $action == 'add') { // It is not so important because a test is done on return of payment validation. } - $urlback = getOnlinePaymentUrl(0, 'member', $adh->ref, price2num(GETPOST('amount', 'alpha'), 'MT'), '', 0); + $urlback = getOnlinePaymentUrl(0, 'member', $adh->ref, (float) price2num(GETPOST('amount', 'alpha'), 'MT'), '', 0); if (GETPOST('email')) { $urlback .= '&email='.urlencode(GETPOST('email')); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 14893c24135..5896b5be527 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -20,7 +20,7 @@ * Copyright (C) 2022 ButterflyOfFire * Copyright (C) 2023 Alexandre Janniaux * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * 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 @@ -4390,8 +4390,8 @@ class Societe extends CommonObject } else { // For backward compatibility dol_syslog("Your setup of State has an old syntax (entity=".$conf->entity."). Go in Home - Setup - Organization then Save should remove this error.", LOG_ERR); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - $state_code = getState($state_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore - $state_label = getState($state_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore + $state_code = getState($state_id, '2', $this->db); // This need a SQL request, but it's the old feature that should not be used anymore + $state_label = getState($state_id, '0', $this->db); // This need a SQL request, but it's the old feature that should not be used anymore } } $this->state_id = $state_id; @@ -4502,6 +4502,7 @@ class Societe extends CommonObject $this->code_client = 'CC-'.dol_print_date($now, 'dayhourlog'); $this->code_fournisseur = 'SC-'.dol_print_date($now, 'dayhourlog'); + $this->typent_code = 'TE_OTHER'; $this->capital = 10000; $this->client = 1; $this->prospect = 1; diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 82bb50d8519..434248a4277 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -198,7 +198,7 @@ print dol_get_fiche_head($head, 'contact', $langs->trans("ThirdParty"), 0, 'comp $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); +dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 1); print dol_get_fiche_end(); diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index ce79aa23b7a..138f1ceb633 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -3,7 +3,7 @@ * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov * Copyright (C) 2018-2022 Thibault FOUCART - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -94,15 +94,15 @@ if ($action == 'setvalue' && $user->admin) { if (!($result > 0)) { $error++; } - $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_PAYMENTS", GETPOSTINT('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_PAYMENTS", (string) GETPOSTINT('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'), 'chaine', 0, '', $conf->entity); if (!($result > 0)) { $error++; } - $result = dolibarr_set_const($db, "STRIPE_USER_ACCOUNT_FOR_ACTIONS", GETPOSTINT('STRIPE_USER_ACCOUNT_FOR_ACTIONS'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "STRIPE_USER_ACCOUNT_FOR_ACTIONS", (string) GETPOSTINT('STRIPE_USER_ACCOUNT_FOR_ACTIONS'), 'chaine', 0, '', $conf->entity); if (!($result > 0)) { $error++; } - $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOSTINT('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", (string) GETPOSTINT('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS'), 'chaine', 0, '', $conf->entity); if (!($result > 0)) { $error++; } @@ -160,7 +160,7 @@ if ($action == 'setvalue' && $user->admin) { if ($action == "setlive") { $liveenable = GETPOSTINT('value'); - $res = dolibarr_set_const($db, "STRIPE_LIVE", $liveenable, 'yesno', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "STRIPE_LIVE", (string) $liveenable, 'yesno', 0, '', $conf->entity); if ($res > 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -239,7 +239,7 @@ if (empty($conf->stripeconnect->enabled)) { //global $dolibarr_main_instance_unique_id; //$url .= '&securitykey='.dol_hash('stripeipn-'.$dolibarr_main_instance_unique_id.'-'.$conf->global->STRIPE_TEST_PUBLISHABLE_KEY, 'md5'); $out .= ''; - $out .= ajax_autoselect("onlinetestwebhookurl", 0); + $out .= ajax_autoselect("onlinetestwebhookurl"); print '
'.$out; print ''; if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index f9410e9a237..4ab28ee409b 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -249,7 +249,7 @@ $stringtoshow .= ''; $stringtoshow .= ''; $stringtoshow .= ''; $stringtoshow .= $langs->trans("Year").' '; -$stringtoshow .= ''; +$stringtoshow .= ''; $stringtoshow .= ''; $stringtoshow .= ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 98b3a24b2fa..311a49fd352 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3830,7 +3830,7 @@ class User extends CommonObject } dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG); - $this->users = dol_sort_array($this->users, 'fullname', 'asc', true, false, 1); + $this->users = dol_sort_array($this->users, 'fullname', 'asc', 1, 0, 1); //var_dump($this->users); diff --git a/htdocs/variants/lib/variants.lib.php b/htdocs/variants/lib/variants.lib.php index 609ea6cb1a1..03356c6cbc4 100644 --- a/htdocs/variants/lib/variants.lib.php +++ b/htdocs/variants/lib/variants.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2022 Open-Dsi + * 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 @@ -25,8 +26,8 @@ /** * Prepare array with list of tabs * - * @param Product $object Object related to tabs - * @return array Array of tabs to show + * @param ProductAttribute $object Object related to tabs + * @return array Array of tabs to show */ function productAttributePrepareHead($object) { diff --git a/htdocs/webportal/class/context.class.php b/htdocs/webportal/class/context.class.php index 9272071f228..b76ff6017ca 100644 --- a/htdocs/webportal/class/context.class.php +++ b/htdocs/webportal/class/context.class.php @@ -546,7 +546,7 @@ class Context dol_syslog(__METHOD__ . ' Try to add a message in stack, but value to add is empty message', LOG_WARNING); } else { if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) { - dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages'); + dol_print_error(null, 'Bad parameter style=' . $style . ' for setEventMessages'); } if (empty($mesgs)) { $this->setEventMessage($mesg, $style); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4c660fa7741..3e2c708b978 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -29,7 +29,7 @@ parameters: checkAlwaysTrueInstanceof: false checkAlwaysTrueStrictComparison: false checkClassCaseSensitivity: true - checkFunctionArgumentTypes: false + checkFunctionArgumentTypes: true checkFunctionNameCase: true checkArgumentsPassedByReference: false checkMaybeUndefinedVariables: false @@ -60,6 +60,64 @@ parameters: - '#Constructor of class .* has an unused parameter #' - '#Dead catch - Exception is never thrown in the try block#' - '#.*phan-var#' + - '#\$httpStatusCode of class Luracast\\Restler\\RestException constructor expects string, int given.#' + - '#expects \(callable#' + - '#expects bool#' + - '#expects bool, int given.#' + - '#expects bool, string given.#' + - '#expects int#' + - '#expects int<-2, 2>, bool given.#' + - '#expects int<0, 1>, false given.#' + - '#expects int, string given.#' + - '#expects int, float given.#' + - '#expects int, bool given.#' + - '#expects int, false given.#' + - '#expects int, true given.#' + - '#expects int, array\|string given.#' + - '#expects int<0, 1>, '''' given.#' + - '#expects float\|string#' + - '#expects float\|null#' + - '#expects float, string given.#' + - '#expects string#' + - '#expects string, int given.#' + - '#expects string, \(float\|int\) given.#' + - '#expects string, array given.#' + - '#expects string, float given.#' + - '#expects string, true given.#' + - '#expects string, null given.#' + - '#expects string, int<0, 10> given.#' + - '#expects string, DateTime given.#' + - '#expects array#' + - '#expects array, string given.#' + - '#expects array, null given.#' + - '#expects array, null given.#' + - '#expects array, string given.#' + - '#expects resource#' + - '#expects resource, object given.#' + - '#expects object#' + - '#expects Adherent#' + - '#expects BOM#' + - '#expects Contrat#' + - '#expects FTP\\Connection#' + - '#expects Holiday#' + - '#expects LDAP\\Connection#' + - '#expects MultiCurrency#' + - '#expects Productlot#' + - '#expects Facture#' + - '#expects FactureFournisseur#' + - '#expects Paiement#' + - '#expects PgSql\\Result#' + - '#expects RecruitmentJobPosition#' + - '#expects RemiseCheque#' + - '#expects Societe#' + - '#expects SupplierProposal#' + - '#expects Translate#' + - '#expects User#' + - '#expects CommonObjectLine#' + - '#dol_eval expects#' + - '#check_authentication expects#' + - '#colorHexToHsl expects#' + - '#dolGetButtonTitle expects#' internalErrorsCountLimit: 50 cache: nodesByFileCountMax: 512 diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index a1b859d644f..f1f5ae6793a 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -1,9 +1,10 @@ #!/usr/bin/env php - * Copyright (C) 2005-2013 Laurent Destailleur - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2013 Juanjo Menent + * 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 @@ -79,18 +80,19 @@ if ($mode != 'confirm') { $conf->global->MAIN_DISABLE_ALL_MAILS = 1; } +/** @var DoliDB $db */ + $sql = "SELECT DISTINCT c.ref, c.fk_soc, cd.date_fin_validite, cd.total_ttc, cd.description as description, p.label as plabel, s.rowid, s.nom as name, s.email, s.default_lang,"; $sql .= " u.rowid as uid, u.lastname, u.firstname, u.email, u.lang"; $sql .= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."contrat AS c, ".MAIN_DB_PREFIX."contratdet AS cd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product AS p ON p.rowid = cd.fk_product, ".MAIN_DB_PREFIX."societe_commerciaux AS sc, ".MAIN_DB_PREFIX."user AS u"; $sql .= " WHERE s.rowid = c.fk_soc AND c.rowid = cd.fk_contrat AND c.statut > 0 AND cd.statut<5"; if (is_numeric($duration_value)) { - $sql .= " AND cd.date_fin_validite < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'"; + $sql .= " AND cd.date_fin_validite < '".$db->idate(dol_time_plus_duree($now, (int) $duration_value, "d"))."'"; } $sql .= " AND sc.fk_soc = s.rowid AND sc.fk_user = u.rowid"; $sql .= " ORDER BY u.email ASC, s.rowid ASC, c.ref ASC"; // Order by email to allow one message per email -// print $sql; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -112,7 +114,7 @@ if ($resql) { if (($obj->email != $oldemail || $obj->uid != $olduid) || $oldemail == 'none') { // Break onto sales representative (new email or uid) if (dol_strlen($oldemail) && $oldemail != 'none') { - sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldsalerepresentative, $duration_value); + sendEmailTo($mode, $oldemail, $message, price2num($total), $oldlang, $oldsalerepresentative, (int) $duration_value); } else { if ($oldemail != 'none') { print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n"; @@ -160,7 +162,7 @@ if ($resql) { // Si il reste des envois en buffer if ($foundtoprocess) { if (dol_strlen($oldemail) && $oldemail != 'none') { // Break onto email (new email) - sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldsalerepresentative, $duration_value); + sendEmailTo($mode, $oldemail, $message, price2num($total), $oldlang, $oldsalerepresentative, (int) $duration_value); } else { if ($oldemail != 'none') { print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n"; diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 187db69db7c..dccc05e33c4 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2016 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI + * 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 @@ -106,7 +107,7 @@ $user = new User($db); if (!empty($login)) { $user->fetch('', $login); } - +/** @var DoliDB $db */ // We get list of emailing id to process $sql = "SELECT m.rowid, m.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index ea892b8d804..c45f686116b 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -1,9 +1,10 @@ #!/usr/bin/env php - * Copyright (C) 2005-2013 Laurent Destailleur - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2013 Juanjo Menent + * 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 @@ -88,6 +89,8 @@ if (!empty($dolibarr_main_db_readonly)) { exit(1); } +/** @var DoliDB $db */ + $sql = "SELECT f.ref, f.total_ttc, f.date_lim_reglement as due_date,"; $sql .= " s.rowid as sid, s.nom as name, s.email, s.default_lang"; if ($targettype == 'contacts') { @@ -100,10 +103,10 @@ if ($targettype == 'contacts') { $sql .= " WHERE f.fk_statut = 1 AND f.paye = 0"; $sql .= " AND f.fk_soc = s.rowid"; if (is_numeric($duration_value2)) { - $sql .= " AND f.date_lim_reglement >= '".$db->idate(dol_time_plus_duree($now, $duration_value2, "d"))."'"; + $sql .= " AND f.date_lim_reglement >= '".$db->idate(dol_time_plus_duree($now, (int) $duration_value2, "d"))."'"; } if (is_numeric($duration_value)) { - $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'"; + $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, (int) $duration_value, "d"))."'"; } if ($targettype == 'contacts') { $sql .= " AND s.rowid = sp.fk_soc"; @@ -155,7 +158,7 @@ if ($resql) { if ($startbreak) { // Break onto sales representative (new email or cid) if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) { - envoi_mail($mode, $oldemail, $message, $total, $oldlang, $oldtarget); + envoi_mail($mode, $oldemail, $message, price2num($total), $oldlang, $oldtarget); $trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid; } else { if ($oldemail != 'none') { @@ -209,7 +212,7 @@ if ($resql) { // Si il reste des envois en buffer if ($foundtoprocess) { if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) { // Break onto email (new email) - envoi_mail($mode, $oldemail, $message, $total, $oldlang, $oldtarget); + envoi_mail($mode, $oldemail, $message, price2num($total), $oldlang, $oldtarget); $trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid; } else { if ($oldemail != 'none') {