diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index b337a0922f8bb..51d9aac95ebb3 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 @@ 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 6a9b14a4e1d9b..4ee6a4c170cff 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 @@ $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/comm/card.php b/htdocs/comm/card.php index 162425c8037bf..fc5a015e8201a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1210,7 +1210,9 @@ // print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); print $late; print "\n"; - print ''.dol_trunc($objp->refsup, 12)."\n"; + print ''; + print dol_trunc(strtolower(get_class($object)) == strtolower(Client::class) ? $objp->refcus : $objp->refsup, 12); + print "\n"; //print ''.dol_print_date($db->jdate($objp->dc), 'day')."\n"; print ''.dol_print_date($db->jdate($objp->dcon), 'day')."\n"; print ' '; @@ -1422,7 +1424,7 @@ * Latest invoices */ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) { - $sql = 'SELECT f.rowid as facid, f.ref, f.type'; + $sql = 'SELECT f.rowid as facid, f.ref, f.type, f.ref_client'; $sql .= ', f.total_ht'; $sql .= ', f.total_tva'; $sql .= ', f.total_ttc'; @@ -1452,6 +1454,9 @@ if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) { $colspan++; } + if (getDolGlobalString('MAIN_SHOW_REF_CUSTOMER_INVOICES')) { + $colspan++; + } print ''; print ''; print ''; @@ -1466,6 +1471,7 @@ $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; + $facturestatic->ref_client = $objp->ref_client; $facturestatic->type = $objp->type; $facturestatic->total_ht = $objp->total_ht; $facturestatic->total_tva = $objp->total_tva; @@ -1511,6 +1517,11 @@ // $urlsource = '/compta/facture/card.php?id='.$objp->cid; //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''; + if (getDolGlobalString('MAIN_SHOW_REF_CUSTOMER_INVOICES')) { + print ''; + } if ($objp->df > 0) { print ''; } else { @@ -1521,6 +1532,7 @@ } else { print ''; } + print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4952b0dfd50a9..00e1c2a033622 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1136,7 +1136,7 @@ public function create($user, $notrigger = 0) $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 4dab4a912a048..8267e6db7021f 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 not cash account and can be reconciliate if ($user->hasRight('banque', 'consolidate')) { - $buttonreconcile = ''.$titletoconciliatemanual.''; + $buttonreconcile = ''.$titletoconciliatemanual.''; } else { $buttonreconcile = ''.$titletoconciliatemanual.''; } @@ -323,7 +324,7 @@ 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 2dfdd3b376522..79dc23859830d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -776,7 +776,7 @@ public function create(User $user, $notrigger = 0, $forceduedate = 0) $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/facture/list.php b/htdocs/compta/facture/list.php index 87826db56ccd8..22ccb88cdfd57 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -147,8 +147,8 @@ $search_product_category = GETPOST('search_product_category', 'intcomma'); $search_fac_rec_source_title = GETPOST("search_fac_rec_source_title", 'alpha'); -$search_late = GETPOST('search_late'); -if ($search_late == 'late') { +$search_option = GETPOST('search_option'); +if ($search_option == 'late') { $search_status = '1'; } @@ -398,7 +398,7 @@ $toselect = array(); $search_array_options = array(); $search_categ_cus = 0; - $search_late = ''; + $search_option = ''; $socid = 0; } @@ -859,7 +859,7 @@ if ($search_datelimit_end) { $sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'"; } -if ($search_late == 'late') { +if ($search_option == 'late') { $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; } /*if ($search_sale > 0) { @@ -1181,8 +1181,8 @@ if ($show_files) { $param .= '&show_files='.urlencode((string) ($show_files)); } -if ($search_late) { - $param .= "&search_late=".urlencode($search_late); +if ($search_option) { + $param .= "&search_option=".urlencode($search_option); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1322,7 +1322,7 @@ } // alert on due date $moreforfilter .= '
'; -$moreforfilter .= ''; +$moreforfilter .= ''; $moreforfilter .= '
'; $parameters = array(); diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 9442d0e927525..ff93f20f336b1 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -487,22 +487,22 @@ //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end); if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { if ($annee_decalage > $minyear && $case <= $casenow) { - if (!empty($cumulative_ht[$caseprev]) && !empty($cumulative_ht[$case])) { - $percent = (round(($cumulative_ht[$case] - $cumulative_ht[$caseprev]) / $cumulative_ht[$caseprev], 4) * 100); - //print "X $cumulative_ht[$case] - $cumulative_ht[$caseprev] - $cumulative_ht[$caseprev] - $percent X"; + if (!empty($cumulative[$caseprev]) && !empty($cumulative[$case])) { + $percent = (round(($cumulative[$case] - $cumulative[$caseprev]) / $cumulative[$caseprev], 4) * 100); + //print "X $cumulative[$case] - $cumulative[$caseprev] - $cumulative[$caseprev] - $percent X"; print($percent >= 0 ? "+$percent" : "$percent").'%'; } - if (!empty($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) { + if (!empty($cumulative[$caseprev]) && empty($cumulative[$case])) { print '-100%'; } - if (empty($cumulative_ht[$caseprev]) && !empty($cumulative_ht[$case])) { + if (empty($cumulative[$caseprev]) && !empty($cumulative[$case])) { //print '
'; print '-'; } - if (isset($cumulative_ht[$caseprev]) && empty($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) { + if (isset($cumulative[$caseprev]) && empty($cumulative[$caseprev]) && empty($cumulative[$case])) { print '+0%'; } - if (!isset($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) { + if (!isset($cumulative[$caseprev]) && empty($cumulative[$case])) { print '-'; } } else { @@ -627,24 +627,24 @@ // Pourcentage total if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) { - if (!empty($total_ht[$annee - 1]) && !empty($total_ht[$annee])) { - $percent = (round(($total_ht[$annee] - $total_ht[$annee - 1]) / $total_ht[$annee - 1], 4) * 100); + if (!empty($total[$annee - 1]) && !empty($total[$annee])) { + $percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100); print ''; } - if (!empty($total_ht[$annee - 1]) && empty($total_ht[$annee])) { + if (!empty($total[$annee - 1]) && empty($total[$annee])) { print ''; } - if (empty($total_ht[$annee - 1]) && !empty($total_ht[$annee])) { + if (empty($total[$annee - 1]) && !empty($total[$annee])) { print ''; } - if (empty($total_ht[$annee - 1]) && empty($total_ht[$annee])) { + if (empty($total[$annee - 1]) && empty($total[$annee])) { print ''; } } else { print ''; if (!$i) { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 3db1703c03429..6186e1552ff7b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -309,7 +309,7 @@ public function get_substitutionarray_mysoc($mysoc, $outputlangs) $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 @@ public function get_substitutionarray_thirdparty($object, $outputlangs, $array_k $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 @@ public function get_substitutionarray_contact($object, $outputlangs, $array_key $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 b6d0f99afb562..05909cfa6102b 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -877,7 +877,7 @@ public function selectInvoiceAndLine($selectedInvoiceId = 0, $selectedLineId = 0 } $out .= ''; } else { - dol_print_error($this->db->lasterror); + dol_print_error($this->db, $this->db->lasterror); return ''; } } @@ -929,7 +929,7 @@ public function selectInvoiceAndLine($selectedInvoiceId = 0, $selectedLineId = 0 $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 c4f78b7f91fc2..5a31f520a1779 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 @@ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '') 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 39fa548bce689..55c25b17f5c4f 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 d6e86ee59854c..8c0ccde4b6a6a 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) @@ -363,13 +364,15 @@ function getNumberInvoicesPieChart($mode) date_add($datenowadd30, $interval30days); date_add($datenowadd15, $interval15days); - $sql = "SELECT"; - $sql .= " sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub30, 'Y-m-d')."'", 1, 0).") as nblate30"; - $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub15, 'Y-m-d')."'", 1, 0).") as nblate15"; - $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($now, 'Y-m-d')."'", 1, 0).") as nblatenow"; - $sql .= ", sum(".$db->ifsql("f.date_lim_reglement >= '".date_format($now, 'Y-m-d')."' OR f.date_lim_reglement IS NULL", 1, 0).") as nbnotlatenow"; - $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd15, 'Y-m-d')."'", 1, 0).") as nbnotlate15"; - $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd30, 'Y-m-d')."'", 1, 0).") as nbnotlate30"; + $amount_mode = (getDolGlobalInt('FACTURE_VALIDATED_IN_AMOUNT') == 1); + + $sql = "SELECT"; + $sql .= " sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub30, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as late30"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub15, 'Y-m-d')."' AND f.date_lim_reglement >= '".date_format($datenowsub30, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as late15"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($now, 'Y-m-d')."' AND f.date_lim_reglement >= '".date_format($datenowsub15, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as latenow"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement >= '".date_format($now, 'Y-m-d')."' AND f.date_lim_reglement < '".date_format($datenowadd15, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as notlatenow"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement >= '".date_format($datenowadd15, 'Y-m-d')."' AND f.date_lim_reglement < '".date_format($datenowadd30, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as notlate15"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement >= '".date_format($datenowadd30, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as notlate30"; if ($mode == 'customers') { $element = 'invoice'; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; @@ -403,7 +406,7 @@ function getNumberInvoicesPieChart($mode) ,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30) ,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30)); */ - $dataseries[$i] = array($langs->transnoentitiesnoconv('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30); + $dataseries[$i] = array($langs->transnoentitiesnoconv('NbOfOpenInvoices'), $obj->late30, $obj->late15, $obj->latenow, $obj->notlatenow, $obj->notlate15, $obj->notlate30); $i++; } if (!empty($dataseries[0])) { diff --git a/htdocs/core/lib/phpsessionindb.lib.php b/htdocs/core/lib/phpsessionindb.lib.php index f856ac71c90b7..65db9c661e27a 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/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 4776907192f0c..2999eb74ac2e3 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -5,7 +5,8 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * 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 @@ -691,6 +692,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $taskstatic->planned_workload = $lines[$i]->planned_workload; $taskstatic->duration_effective = $lines[$i]->duration_effective; $taskstatic->budget_amount = $lines[$i]->budget_amount; + $taskstatic->billable = $lines[$i]->billable; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -932,6 +934,17 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; } + // Billable + if (count($arrayfields) > 0 && !empty($arrayfields['t.billable']['checked'])) { + print ''; + } + // Extra fields $extrafieldsobjectkey = $taskstatic->table_element; $extrafieldsobjectprefix = 'efpt.'; diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index d050cf0841d4e..ef3ae0a2f98e5 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -631,7 +631,10 @@ function includeContainer($containerref) $tmpoutput = ob_get_contents(); ob_end_clean(); - print "\n".''."\n"; + // We don't print info messages for pages of type library or service + if (!empty($websitepage->type_container) && !in_array($websitepage->type_container, array('library', 'service'))) { + print "\n".''."\n"; + } print preg_replace(array('/^.*]*>/ims', '/<\/body>.*$/ims'), array('', ''), $tmpoutput); if (!$res) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 1ac81b4a5bf4b..7046fa435a034 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -278,7 +278,16 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.'); dolWebsiteIncrementCounter('.$object->id.', "'.$objectpage->type_container.'", '.$objectpage->id.');'."\n"; $tplcontent .= "// END PHP ?>\n"; } else { - $tplcontent .= "\n"; + $tplcontent .= "\n"; + $tplcontent .= $objectpage->content; } diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index aefd2718508eb..0c9bf197866b9 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -99,19 +99,22 @@ public function info($langs) */ 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 b6669961cd051..c1b46e768fa66 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -104,16 +104,22 @@ public function info($langs) */ 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 c8781cdd2cca7..50d33d378d306 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // 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 4d85f30316973..44111872971c8 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -97,19 +97,22 @@ public function info($langs) */ 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 63938b77da209..daecb8cf37fd7 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -170,7 +170,7 @@ public function getNextValue($object) $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 a9a1cdf9ac808..38c26923098d8 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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs, $outputlan $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 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output } } $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 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $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 4b4ce44606055..3f20ead4a8270 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 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlan } - 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 0cfa725a1ef69..45ac0a25dc3cf 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 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlan $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 3fe523af54811..9ea2ff996331f 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 @@ public function __construct($db) $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/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index d58edcf7de269..a34ea519d2ab0 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -266,7 +266,7 @@ public function __construct($db) $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // Add fields for tasks - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription", 'pt.billable'=>"Billable")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask")); // Add extra fields for task $keyforselect = 'projet_task'; diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php index fe2948e1ea5ee..f9df0cf2ae7d0 100644 --- a/htdocs/core/modules/mrp/mod_mo_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -66,12 +66,12 @@ public function info($langs) $form = new Form($db); - $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; - $texte .= '
'; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $texte .= '
'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllBills").''.$num.''.img_picto($langs->trans("Statistics"), 'stats').''; + print $objp->ref_client; + print ''.dol_print_date($db->jdate($objp->df), 'day').'!!!'; print price($objp->total_ht); print '+Inf%'; print($percent >= 0 ? "+$percent" : "$percent").'%'; print '-100%+'.$langs->trans('Inf').'%+0%'; - if (!empty($total_ht[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { + if (!empty($total[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ffa89264f8725..985587f09dfd3 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1135,7 +1135,7 @@ public function create($user) $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 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_star $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/contrat/list.php b/htdocs/contrat/list.php index 10d5c288a3b05..b43e84cdd3090 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -1203,7 +1203,7 @@ } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; + print ''; print $obj->zip; print ''; + if ($lines[$i]->billable) { + print ''.$langs->trans('Yes').''; + } else { + print ''.$langs->trans('No').''; + } + print '
'; + $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 @@ public function info($langs) $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 @@ public function info($langs) */ 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 @@ public function getExample() */ 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 6ed05b3e72899..84c2b39658ae6 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 @@ public function info($langs) */ 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 @@ public function getExample() */ 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 @@ public function getNextValue($objsoc, $project) $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 91772195411ab..9f7f83883a0c6 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 @@ public function info($langs) */ 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 3addf2c8c22d1..d6247a50d4362 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 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) * 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 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) /** * 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 a53040525481b..6679263afb70d 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 @@ public function info($langs) */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; + + require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; + $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 @@ public function getExample() */ 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 @@ public function getNextValue($objsoc, $object) $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 f78640fb41ffc..13a6948fb1a6b 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 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) /** * 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 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ * 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 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) * 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 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) /** * 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 59f3753785197..3b79a6d0f193e 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 @@ public function info($langs) $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 @@ public function info($langs) $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 @@ public function info($langs) */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; + + 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(); - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; + $numExample = $this->getNextValue($thirdparty, $ticket); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } + return $numExample; } @@ -123,7 +130,7 @@ public function getExample() */ 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 @@ public function getNextValue($objsoc, $ticket) $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 f6a327d5a035d..57b80393617f4 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1972,7 +1972,7 @@ public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $d } $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 @@ public function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comment } $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/langs/de_DE/projects.lang b/htdocs/langs/de_DE/projects.lang index a1cf6c11a82f1..a2fe1e07f22c1 100644 --- a/htdocs/langs/de_DE/projects.lang +++ b/htdocs/langs/de_DE/projects.lang @@ -302,3 +302,4 @@ NewLeadbyWeb=Ihre Nachricht bzw. Anfrage wurde erfasst. Wir werden uns so bald w NewLeadForm=Neues Kontaktformular LeadFromPublicForm=Online-Interessent per öffentlichem Formular ExportAccountingReportButtonLabel=Bericht erhalten +Billable = Verrechenbar diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 5c0c2bde5fa01..c93a3744b4cf0 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -310,3 +310,4 @@ MergeTasks=Merge tasks TaskMergeSuccess=Tasks have been merged ErrorTaskIdIsMandatory=Error: Task id is mandatory ErrorsTaskMerge=An error occurred while merging tasks +Billable = Billable diff --git a/htdocs/langs/es_ES/projects.lang b/htdocs/langs/es_ES/projects.lang index 6a3714c1d9df4..89012d12a75c9 100644 --- a/htdocs/langs/es_ES/projects.lang +++ b/htdocs/langs/es_ES/projects.lang @@ -302,3 +302,4 @@ NewLeadbyWeb=Su mensaje o solicitud ha sido grabada. Le responderemos o contacta NewLeadForm=Nuevo formulario de contacto LeadFromPublicForm=Cliente potencial en línea desde un formulario público ExportAccountingReportButtonLabel=Obtener informe +Billable = Billable diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 40df6cbc7b91e..295af5d64b743 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -310,3 +310,4 @@ MergeTasks=Fusionner tâches TaskMergeSuccess=Les tâches ont été fusionnées ErrorTaskIdIsMandatory=Erreur : l'ID de tâche est obligatoire ErrorsTaskMerge=Une erreur s'est produite lors de la fusion des tâches +Billable = Facturable diff --git a/htdocs/langs/it_IT/projects.lang b/htdocs/langs/it_IT/projects.lang index 7458811858d9a..80cb0a69404f9 100644 --- a/htdocs/langs/it_IT/projects.lang +++ b/htdocs/langs/it_IT/projects.lang @@ -302,3 +302,4 @@ NewLeadbyWeb=Il tuo messaggio o richiesta è stato registrato. Ti risponderemo o NewLeadForm=Nuovo modulo di contatto LeadFromPublicForm=Lead online da modulo pubblico ExportAccountingReportButtonLabel=Get report +Billable = Fatturabile diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 267fdc49bfcb1..c734af74e7cd8 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 @@ // 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 6132e5460d7e9..af2c3dbc047b1 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 @@ 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 3a1106b0e9ca0..9432db225f9fc 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 @@ 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/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1de720670b4a7..8621d3ebbe412 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1169,10 +1169,10 @@ public function getElementCount($type, $tablename, $projectkey = 'fk_projet') } /** - * Delete tasks with no children first, then task with children recursively + * Delete tasks with no children first, then task with children recursively * - * @param User $user User - * @return int Return integer <0 if KO, 1 if OK + * @param User $user User + * @return int Return integer <0 if KO, 1 if OK */ public function deleteTasks($user) { @@ -1193,7 +1193,7 @@ public function deleteTasks($user) $this->getLinesArray($user); if ($deleted && count($this->lines) < $countTasks) { if (count($this->lines)) { - $this->deleteTasks($this->lines); + $this->deleteTasks($user); } } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index df77bf2268e2b..40bb5c1bee614 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -6,7 +6,8 @@ * Copyright (C) 2020 Juanjo Menent * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * 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 @@ -270,6 +271,12 @@ class Task extends CommonObjectLine */ public $task_parent_position; + /** + * Status indicate whether the task is billable (time is meant to be added to invoice) '1' or not '0' + * @var int billable + */ + public $billable = 1; + /** * @var float budget_amount */ @@ -362,6 +369,7 @@ public function create($user, $notrigger = 0) $sql .= ", progress"; $sql .= ", budget_amount"; $sql .= ", priority"; + $sql .= ", billable"; $sql .= ") VALUES ("; $sql .= (!empty($this->entity) ? (int) $this->entity : (int) $conf->entity); $sql .= ", ".((int) $this->fk_project); @@ -379,6 +387,7 @@ public function create($user, $notrigger = 0) $sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? ((int) $this->progress) : 'null'); $sql .= ", ".(($this->budget_amount != '' && $this->budget_amount >= 0) ? ((int) $this->budget_amount) : 'null'); $sql .= ", ".(($this->priority != '' && $this->priority >= 0) ? (int) $this->priority : 'null'); + $sql .= ", ".((int) $this->billable); $sql .= ")"; $this->db->begin(); @@ -456,7 +465,8 @@ public function fetch($id, $ref = '', $loadparentdata = 0) $sql .= " t.priority,"; $sql .= " t.note_private,"; $sql .= " t.note_public,"; - $sql .= " t.rang"; + $sql .= " t.rang,"; + $sql .= " t.billable"; if (!empty($loadparentdata)) { $sql .= ", t2.ref as task_parent_ref"; $sql .= ", t2.rang as task_parent_position"; @@ -508,6 +518,7 @@ public function fetch($id, $ref = '', $loadparentdata = 0) $this->task_parent_ref = $obj->task_parent_ref; $this->task_parent_position = $obj->task_parent_position; } + $this->billable = $obj->billable; // Retrieve all extrafield $this->fetch_optionals(); @@ -595,7 +606,8 @@ public function update($user = null, $notrigger = 0) $sql .= " progress=".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null').","; $sql .= " budget_amount=".(($this->budget_amount != '' && $this->budget_amount >= 0) ? $this->budget_amount : 'null').","; $sql .= " rang=".((!empty($this->rang)) ? ((int) $this->rang) : "0").","; - $sql .= " priority=".((!empty($this->priority)) ? ((int) $this->priority) : "0"); + $sql .= " priority=".((!empty($this->priority)) ? ((int) $this->priority) : "0").","; + $sql .= " billable=".((int) $this->billable); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -1020,6 +1032,7 @@ public function initAsSpecimen() $this->priority = 0; $this->note_private = 'This is a specimen private note'; $this->note_public = 'This is a specimen public note'; + $this->billable = 1; return 1; } @@ -1063,7 +1076,7 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc $sql .= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,"; $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang, t.priority,"; - $sql .= " t.budget_amount,"; + $sql .= " t.budget_amount, t.billable,"; $sql .= " t.note_public, t.note_private,"; $sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount as project_budget_amount"; @@ -1178,7 +1191,7 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc $sql .= " t.datec, t.dateo, t.datee, t.tms,"; $sql .= " t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; $sql .= " t.dateo, t.datee, t.planned_workload, t.rang, t.priority,"; - $sql .= " t.budget_amount,"; + $sql .= " t.budget_amount, t.billable,"; $sql .= " t.note_public, t.note_private,"; $sql .= " s.rowid, s.nom, s.email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; @@ -1273,6 +1286,8 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc $tasks[$i]->thirdparty_name = $obj->thirdparty_name; $tasks[$i]->thirdparty_email = $obj->thirdparty_email; + $tasks[$i]->billable = $obj->billable; + if ($loadextras) { if (!empty($extrafields->attributes['projet']['label'])) { foreach ($extrafields->attributes['projet']['label'] as $key => $val) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ef97960d1262b..f1502d8ee9be0 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -89,6 +89,7 @@ $search_progresscalc = GETPOST('search_progresscalc'); $search_progressdeclare = GETPOST('search_progressdeclare'); $search_task_budget_amount = GETPOST('search_task_budget_amount'); +$search_task_billable = GETPOST('search_task_billable'); $search_date_start_startmonth = GETPOSTINT('search_date_start_startmonth'); $search_date_start_startyear = GETPOSTINT('search_date_start_startyear'); @@ -148,6 +149,7 @@ $progress = GETPOSTINT('progress'); $budget_amount = GETPOSTFLOAT('budget_amount'); +$billable = (GETPOST('billable', 'aZ') == 'yes'? 1 : 0); $label = GETPOST('label', 'alpha'); $description = GETPOST('description', 'restricthtml'); $planned_workloadhour = (GETPOSTISSET('planned_workloadhour') ? GETPOSTINT('planned_workloadhour') : ''); @@ -176,6 +178,7 @@ if ($object->usage_bill_time) { $arrayfields['t.tobill'] = array('label' => $langs->trans("TimeToBill"), 'checked' => 0, 'position' => 11); $arrayfields['t.billed'] = array('label' => $langs->trans("TimeBilled"), 'checked' => 0, 'position' => 12); + $arrayfields['t.billable'] = array('label' => $langs->trans("Billable"), 'checked' => 1, 'position' => 13); } // Extra fields @@ -234,6 +237,7 @@ $search_progresscalc = ''; $search_progressdeclare = ''; $search_task_budget_amount = ''; + $search_task_billable = ''; $toselect = array(); $search_array_options = array(); $search_date_start_startmonth = ""; @@ -315,6 +319,9 @@ if ($search_task_budget_amount) { $morewherefilterarray[] = natural_search('t.budget_amount', $search_task_budget_amount, 1, 1); } +if ($search_task_billable) { + $morewherefilterarray[] = " t.billable = ".($search_task_billable == "yes" ? 1 : 0); +} //var_dump($morewherefilterarray); $morewherefilter = ''; @@ -364,6 +371,7 @@ $task->date_end = $date_end; $task->progress = $progress; $task->budget_amount = $budget_amount; + $task->billable = $billable; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $task); @@ -557,6 +565,9 @@ if ($search_task_budget_amount) { $param .= '&search_task_budget_amount='.urlencode($search_task_budget_amount); } + if ($search_task_billable) { + $param .= '&search_task_billable='.urlencode($search_task_billable); + } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } @@ -796,6 +807,11 @@ } print ''; + // Billable + print ''.$langs->trans("Billable").''; + print $form->selectyesno('billable'); + print ''; + // Date start task print ''.$langs->trans("DateStart").''; print img_picto('', 'action', 'class="pictofixedwidth"'); @@ -1054,6 +1070,12 @@ print ''; } + if (!empty($arrayfields['t.billable']['checked'])) { + print ''; + print $form->selectyesno('search_task_billable', $search_task_billable, 0, false, 1); + print ''; + } + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; print ' '; @@ -1126,6 +1148,10 @@ if (!empty($arrayfields['c.assigned']['checked'])) { print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', ''); } + + if (!empty($arrayfields['t.billable']['checked'])) { + print_liste_field_titre($arrayfields['t.billable']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', ''); + } // Extra fields $disablesortlink = 1; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index fd8585c588dd2..42baa45edc03f 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -3,7 +3,8 @@ * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2018 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * 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 @@ -119,6 +120,7 @@ $object->date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $object->progress = price2num(GETPOST('progress', 'alphanohtml')); $object->budget_amount = GETPOSTFLOAT('budget_amount'); + $object->billable = (GETPOST('billable', 'aZ') == 'yes' ? 1 : 0); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); @@ -509,6 +511,11 @@ print $formother->select_percent($object->progress, 'progress', 0, 5, 0, 100, 1); print ''; + // Billable + print ''.$langs->trans("Billable").''; + print $form->selectyesno('billable', $object->billable); + print ''; + // Description print ''.$langs->trans("Description").''; @@ -682,6 +689,11 @@ } print ''; + // Billable + print ''.$langs->trans("Billable").''; + print ''.($object->billable ? $langs->trans('Yes') : $langs->trans('No')).''; + print ''; + // Other attributes $cols = 3; $parameters = array('socid' => $socid); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 4d020e03ac08d..b65dce3385e5c 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -7,7 +7,8 @@ * Copyright (C) 2018 Frédéric France * Copyright (C) 2019-2021 Christophe Battarel * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * 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 @@ -1573,7 +1574,8 @@ function setDetailVisibility() { $sql .= " u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status,"; $sql .= " il.fk_facture as invoice_id, inv.fk_statut,"; $sql .= " p.fk_soc,s.name_alias,"; - $sql .= " t.invoice_line_id"; + $sql .= " t.invoice_line_id,"; + $sql .= " pt.billable"; // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -2411,6 +2413,7 @@ function setDetailVisibility() { } // Invoiced + $invoiced = false; if (!empty($arrayfields['valuebilled']['checked'])) { print ''; // invoice_id and invoice_line_id if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { @@ -2432,8 +2435,13 @@ function setDetailVisibility() { } } } + $invoiced = true; } else { - print $langs->trans("No"); + if ( intval($task_time->billable) == 1) { + print $langs->trans("No"); + } else { + print $langs->trans("Disabled"); + } } } else { print '' . $langs->trans("NA") . ''; @@ -2485,7 +2493,17 @@ function setDetailVisibility() { $selected = 1; } print ' '; - print ''; + // Disable select if task not billable or already invoiced + $disabled = (intval($task_time->billable) !=1 || $invoiced); + $ctrl = ''; + if ($disabled) { + // If disabled, a dbl-click very close outside the control + // will re-enable it, so that user is not blocked if needed. + print ''.$ctrl.''; + print ''; + } else { + print $ctrl; + } } } } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a94c09cf1192c..99a9927990afc 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 @@ function llxFooterVierge() // 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 14893c241351e..5896b5be52746 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 @@ public function setMysoc(Conf $conf) } 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 @@ public function initAsSpecimen() $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 82bb50d851919..434248a4277e2 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -198,7 +198,7 @@ $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 ce79aa23b7a5e..138f1ceb63383 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 (!($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 == "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 @@ //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 f9410e9a237ad..4ab28ee409b64 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 .= $langs->trans("Year").' '; -$stringtoshow .= ''; +$stringtoshow .= ''; $stringtoshow .= ''; $stringtoshow .= ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 98b3a24b2faba..311a49fd35259 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3830,7 +3830,7 @@ public function get_full_tree($deleteafterid = 0, $filter = '') } 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/user/param_ihm.php b/htdocs/user/param_ihm.php index b546bba719168..a933a7dffaaef 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -26,6 +26,7 @@ // Load Dolibarr environment require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; diff --git a/htdocs/variants/lib/variants.lib.php b/htdocs/variants/lib/variants.lib.php index 609ea6cb1a1be..03356c6cbc4df 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 9272071f22882..b76ff6017ca3f 100644 --- a/htdocs/webportal/class/context.class.php +++ b/htdocs/webportal/class/context.class.php @@ -546,7 +546,7 @@ public function setEventMessages($mesg, $mesgs, $style = 'mesgs') 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 4c660fa7741ec..3e2c708b9783e 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 a1b859d644f52..f1f5ae6793a50 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 @@ $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 (($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 @@ // 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 187db69db7cec..dccc05e33c401 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 @@ 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 ea892b8d804e4..c45f686116bf6 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 @@ 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 @@ $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 ($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 @@ // 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') { diff --git a/test/phpunit/ProjectTest.php b/test/phpunit/ProjectTest.php index 89ab46c146146..152bc0361db38 100644 --- a/test/phpunit/ProjectTest.php +++ b/test/phpunit/ProjectTest.php @@ -165,6 +165,7 @@ public function testTaskCreate($idproject) $localobject = new Task($db); $localobject->initAsSpecimen(); $localobject->fk_project = $idproject; + $localobject->billable = 1; $result = $localobject->create($user); $this->assertLessThan($result, 0);