From 4cf6394f01d2dc2d40c38433c7c7732043f215d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Tue, 25 Feb 2025 15:43:21 +0100 Subject: [PATCH 01/23] FIX(ticket): Notification email without public interface Remove link to public interface from automatic notification email if not enabled. --- .../interface_50_modTicket_TicketEmail.class.php | 14 +++++++++----- htdocs/langs/en_US/ticket.lang | 3 ++- htdocs/langs/fr_FR/ticket.lang | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 00fce02d2c8..7cea13e58d4 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -1,8 +1,8 @@ - * 2016 Christophe Battarel - * Copyright (C) 2023 Benjamin Falière + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2023-2025 Benjamin Falière * * 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 @@ -427,9 +427,13 @@ class InterfaceTicketEmail extends DolibarrTriggers } $message_customer .= '

'.$langs->trans('Message').' :

'.$message.'


'; - $url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'view.php?track_id='.$object->track_id; - $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; - $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; + if (!empty(getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE'))) { + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; + $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; + } else { + $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmailNoInterface').'

'; + } $from = (empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM.' ').'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 00b1b34d492..d0bbcafe01e 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -136,7 +136,7 @@ TicketsActivatePublicInterfaceHelp=Public interface allow any visitors to create TicketsAutoAssignTicket=Automatically assign the user who created the ticket TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket. TicketNumberingModules=Tickets numbering module -TicketsModelModule=Document templates for tickets +TicketsModelModule=Document templates for tickets TicketNotifyTiersAtCreation=Notify third party at creation TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is added to a ticket @@ -308,6 +308,7 @@ TicketNewEmailBodyInfosTrackUrl=You can view the progress of the ticket by click TicketNewEmailBodyInfosTrackUrlCustomer=You can view the progress of the ticket in the specific interface by clicking the following link TicketCloseEmailBodyInfosTrackUrlCustomer=You can consult the history of this ticket by clicking the following link TicketEmailPleaseDoNotReplyToThisEmail=Please do not reply directly to this email! Use the link to reply into the interface. +TicketEmailPleaseDoNotReplyToThisEmailNoInterface=Please do not reply directly to this email! TicketPublicInfoCreateTicket=This form allows you to record a support ticket in our management system. TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe your question. Provide the most information possible to allow us to correctly identify your request. TicketPublicMsgViewLogIn=Please enter ticket tracking ID diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index 6e849456452..9f9d39ad1b9 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -288,7 +288,7 @@ NoLogForThisTicket=Pas encore de log pour ce ticket TicketLogAssignedTo=Ticket %s assigné à %s TicketLogPropertyChanged=Ticket %s modifié: classification de %s à %s TicketLogClosedBy=Ticket %s clôt par %s -TicketLogReopen=Ticket %s ré-ouvert +TicketLogReopen=Ticket %s ré-ouvert # # Public pages @@ -310,6 +310,7 @@ TicketNewEmailBodyInfosTrackUrl=Vous pouvez voir la progression du ticket en cli TicketNewEmailBodyInfosTrackUrlCustomer=Vous pouvez voir la progression du ticket en cliquant sur le lien ci-dessus. TicketCloseEmailBodyInfosTrackUrlCustomer=Vous pouvez consulter l'historique de ce ticket en cliquant sur le lien suivant TicketEmailPleaseDoNotReplyToThisEmail=Merci de ne pas répondre directement à ce courriel ! Utilisez le lien pour répondre via l'interface. +TicketEmailPleaseDoNotReplyToThisEmailNoInterface=Merci de ne pas répondre directement à ce courriel ! TicketPublicInfoCreateTicket=Ce formulaire vous permet d'enregistrer un ticket dans notre système de gestion. TicketPublicPleaseBeAccuratelyDescribe=Veuillez décrire précisément votre question. Fournissez le plus d'informations possible pour nous permettre d'identifier correctement votre demande. TicketPublicMsgViewLogIn=Merci d'entrer le code de suivi du ticket From 0c573812e955fe1ec2ed0c5f3e56005e9d2a9714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Tue, 25 Feb 2025 16:03:07 +0100 Subject: [PATCH 02/23] Remove empty on getDolGlobalString() --- .../core/triggers/interface_50_modTicket_TicketEmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 7cea13e58d4..ebd4ef77069 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -427,7 +427,7 @@ class InterfaceTicketEmail extends DolibarrTriggers } $message_customer .= '

'.$langs->trans('Message').' :

'.$message.'


'; - if (!empty(getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE'))) { + if (getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE')) { $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; From db56e5c8ea81f20248ebbcd92c2ebcdd5ee3c1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Tue, 25 Feb 2025 21:09:59 +0100 Subject: [PATCH 03/23] Replace getDolGlobalString by getDolGlobalInt --- .../core/triggers/interface_50_modTicket_TicketEmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index ebd4ef77069..1ecd3729925 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -427,7 +427,7 @@ class InterfaceTicketEmail extends DolibarrTriggers } $message_customer .= '

'.$langs->trans('Message').' :

'.$message.'


'; - if (getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE')) { + if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; From 4272cfa7e4e3849a775055dd7363fce808623d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Wed, 26 Feb 2025 10:06:43 +0100 Subject: [PATCH 04/23] Restore url public ticket --- .../core/triggers/interface_50_modTicket_TicketEmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 1ecd3729925..78911c88564 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -428,7 +428,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer .= '

'.$langs->trans('Message').' :

'.$message.'


'; if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'view.php?track_id='.$object->track_id; $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; } else { From 13d2806f0c3ec1ee1c7f2dc28267cd9ab777dd1a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 27 Feb 2025 08:57:13 +0100 Subject: [PATCH 05/23] FIX invalid input syntax for type integer: '(PROV)' --- htdocs/core/modules/member/mod_member_simple.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/member/mod_member_simple.php b/htdocs/core/modules/member/mod_member_simple.php index 9381e030018..cd04d29ff16 100644 --- a/htdocs/core/modules/member/mod_member_simple.php +++ b/htdocs/core/modules/member/mod_member_simple.php @@ -92,6 +92,7 @@ class mod_member_simple extends ModeleNumRefMembers $sql = "SELECT MAX(CAST(ref AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent"; $sql .= " WHERE entity = ".$conf->entity; + $resql = $db->query($sql); if ($resql) { $row = $db->fetch_row($resql); @@ -125,6 +126,7 @@ class mod_member_simple extends ModeleNumRefMembers $sql = "SELECT MAX(CAST(ref AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent"; $sql .= " WHERE entity = ".(int) $conf->entity; + $sql .= " AND ref != '(PROV)'"; $resql = $db->query($sql); if ($resql) { From 0d834b2c05af457cc8e4023cc50b7f156590cc97 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 27 Feb 2025 13:44:37 +0100 Subject: [PATCH 06/23] Debug v21, the type small was only if no url provided --- htdocs/categories/class/categorie.class.php | 4 ++-- htdocs/core/class/html.form.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 4347bec42b4..94366e3b683 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1527,11 +1527,11 @@ class Categorie extends CommonObject $linkend = ''; $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } elseif ($url == 'none') { - $link = ''; + $link = ''; $linkend = ''; $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } else { - $w[] = ''.($addpicto ? img_object('', 'category') : '').$cat->label.''; + $w[] = ''.($addpicto ? img_object('', 'category') : '').$cat->label.''; } } $newcategwithpath = preg_replace('/colortoreplace/', $forced_color, implode(''.$sep.'', $w)); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e5c9dbd0b5f..08f9d25188f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9544,7 +9544,7 @@ class Form * * @param int $id Id of object * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. - * @param int<0,1> $rendermode 0=Default, use multiselect. 1=Emulate multiselect (recommended) + * @param int<0,1> $rendermode 0=Default, use multiselect (deprecated). 1=Emulate multiselect (recommended) * @param int<0,1> $nolink 1=Do not add html links * @return string String with categories */ From eb1d4f4eda3eae1ea477986bd0605e13a82b28cc Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 27 Feb 2025 13:46:34 +0100 Subject: [PATCH 07/23] Fix url encode --- htdocs/categories/class/categorie.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 94366e3b683..568d9629157 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1523,7 +1523,7 @@ class Categorie extends CommonObject } if ($url == '') { - $link = ''; + $link = ''; $linkend = ''; $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } elseif ($url == 'none') { @@ -1531,7 +1531,7 @@ class Categorie extends CommonObject $linkend = ''; $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } else { - $w[] = ''.($addpicto ? img_object('', 'category') : '').$cat->label.''; + $w[] = ''.($addpicto ? img_object('', 'category') : '').$cat->label.''; } } $newcategwithpath = preg_replace('/colortoreplace/', $forced_color, implode(''.$sep.'', $w)); From de1622fd6b0f4ea4c96398a5d37b1d473f98cdd8 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 27 Feb 2025 14:16:53 +0100 Subject: [PATCH 08/23] Prepare 21.0 --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 149ca74cfd7..c17176bdf11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -144,6 +144,8 @@ NEW: vat rate with department in dict (#31628) (#31627) NEW: When we export data of unlaterable log, we add an unalterable line in logs NEW Add option THEME_STICKY_TOPMENU = 'scrollleftmenu_after_mainpage' (or 'disabled') NEW value for FICHINTER_DISABLE_DETAILS. If FICHINTER_DISABLE_DETAILS is set to '2' details are disabled only on intervention list. +SEC: security avoid RCE using -'- sequence to pass --checkpoint-action parameter in tar command. +SEC: FIX Security path transversal with modulepart=medias (viewimage.php and download.php) PERF: Reduce nb of requests into num_public_holiday PERF: Reduce size for VCF files and virtualcard qrcode From c82b0c1d19dea46f6056390010f17d5282f6d4df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Feb 2025 15:25:22 +0100 Subject: [PATCH 09/23] Update mod_member_simple.php --- htdocs/core/modules/member/mod_member_simple.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/member/mod_member_simple.php b/htdocs/core/modules/member/mod_member_simple.php index cd04d29ff16..5fcca4f153d 100644 --- a/htdocs/core/modules/member/mod_member_simple.php +++ b/htdocs/core/modules/member/mod_member_simple.php @@ -126,7 +126,7 @@ class mod_member_simple extends ModeleNumRefMembers $sql = "SELECT MAX(CAST(ref AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent"; $sql .= " WHERE entity = ".(int) $conf->entity; - $sql .= " AND ref != '(PROV)'"; + $sql .= " AND ref <> '(PROV)'"; $resql = $db->query($sql); if ($resql) { From 80bd6c8400676bac0ce60de50785f84c3ae353df Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 27 Feb 2025 16:21:09 +0100 Subject: [PATCH 10/23] Fix depracted %patch rpm command --- build/rpm/dolibarr_fedora.spec | 2 +- build/rpm/dolibarr_generic.spec | 2 +- build/rpm/dolibarr_mandriva.spec | 2 +- build/rpm/dolibarr_opensuse.spec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index f17cf690160..f160c0181c7 100644 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -69,7 +69,7 @@ cui hai bisogno ed essere facile da usare. #---- prep %prep %setup -q -%patch0 -p0 -b .patch +%patch 0 -p0 -b .patch diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index b0ac7d65e80..9cac07dc854 100644 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -111,7 +111,7 @@ cui hai bisogno ed essere facile da usare. #---- prep %prep %setup -q -%patch0 -p0 -b .patch +%patch 0 -p0 -b .patch #---- build diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index e1d70e7de93..61e2b498e34 100644 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -68,7 +68,7 @@ cui hai bisogno ed essere facile da usare. #---- prep %prep %setup -q -%patch0 -p0 -b .patch +%patch 0 -p0 -b .patch diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 7a8e42664e5..3d1255d7cce 100644 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -70,7 +70,7 @@ cui hai bisogno ed essere facile da usare. #---- prepo %prep %setup -q -%patch0 -p0 -b .patch +%patch 0 -p0 -b .patch #---- build From 4180c57939cf637595482c9fe4c666b00f114772 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 27 Feb 2025 16:24:55 +0100 Subject: [PATCH 11/23] Fix rpm --- build/rpm/dolibarr_fedora.spec | 1 - build/rpm/dolibarr_generic.spec | 1 - build/rpm/dolibarr_mandriva.spec | 1 - build/rpm/dolibarr_opensuse.spec | 1 - 4 files changed, 4 deletions(-) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index f160c0181c7..58996b66784 100644 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -222,7 +222,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/supplier_proposal -%_datadir/dolibarr/htdocs/support %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/takepos %_datadir/dolibarr/htdocs/ticket diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 9cac07dc854..36cdaea3fc6 100644 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -303,7 +303,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/supplier_proposal -%_datadir/dolibarr/htdocs/support %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/takepos %_datadir/dolibarr/htdocs/ticket diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 61e2b498e34..4cc01f3beab 100644 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -220,7 +220,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/supplier_proposal -%_datadir/dolibarr/htdocs/support %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/takepos %_datadir/dolibarr/htdocs/ticket diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 3d1255d7cce..3e708fe8347 100644 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -230,7 +230,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/supplier_proposal -%_datadir/dolibarr/htdocs/support %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/takepos %_datadir/dolibarr/htdocs/ticket From 39cd4fcb9ee165a3f472f38163d3a6befe748893 Mon Sep 17 00:00:00 2001 From: Kamel Khelifa Date: Thu, 27 Feb 2025 16:43:42 +0100 Subject: [PATCH 12/23] FIX : Show true error when send notify email at validate expense report --- htdocs/expensereport/card.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index d85f44c29f5..c02a83497c0 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -460,10 +460,15 @@ if (empty($reshook)) { setEventMessages($mesg, null, 'mesgs'); } else { $langs->load("other"); - if ($mailfile->error) { + if (!empty($mailfile->error) || !empty($mailfile->errors)) { $mesg = ''; - $mesg .= $langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); - $mesg .= '
'.$mailfile->error; + $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($emailFrom), dol_escape_htmltag($emailTo)); + if (!empty($mailfile->error)) { + $mesg .= '
' . $mailfile->error; + } + if (!empty($mailfile->errors) && is_array($mailfile->errors)) { + $mesg .= '
' . implode('
', $mailfile->errors); + } setEventMessages($mesg, null, 'errors'); } else { setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); From e8fa26ff91dfb045fb8bc4c616ccfb97d0876a93 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 28 Feb 2025 11:52:18 +0100 Subject: [PATCH 13/23] FIX avoid error if "workstation" module not enabled --- htdocs/bom/tpl/objectline_edit.tpl.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index f36c8bcd100..4bd2fd84570 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -158,10 +158,12 @@ if ($filtertype != 1) { print $formproduct->selectMeasuringUnits("fk_unit", "time", ($line->fk_unit) ? $line->fk_unit : '', 0, 0); print ''; - $coldisplay++; - print ''; - print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1); - print ''; + if (isModEnabled("workstation")) { + $coldisplay++; + print ''; + print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1); + print ''; + } $coldisplay++; print ''; From 0b98fd57d367f8d2a1d6586bc267d10e9e8e8cfb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Feb 2025 19:35:11 +0100 Subject: [PATCH 14/23] Debug v21 --- htdocs/bookmarks/bookmarks.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 0034df39904..a17f0bd77cb 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -91,8 +91,8 @@ function printDropdownBookmarksList() $newbtn = ''; if ($user->hasRight('bookmark', 'creer')) { if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) { - //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url); - $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); + //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); // With & the GETPOST('url') will fail. + $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); $newbtn .= ''; $newbtn .= img_picto('', 'add', '', 0, 0, 0, '', 'pictofixedwidth paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; } From 71f215b58422cde97b4985ba8a514ade16f41da9 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 1 Mar 2025 17:58:05 +0100 Subject: [PATCH 15/23] Add log to help debug --- htdocs/core/lib/website2.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 0f11bd01a63..01b7bf2843d 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -181,6 +181,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n"; $tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n"; $tplcontent .= "} // Not already loaded\n"; + $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).'");'."\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent .= "ob_start();\n"; From 5a35cf7034a72a0ceb57cd78e7669121cf810f14 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 1 Mar 2025 17:59:22 +0100 Subject: [PATCH 16/23] Prepare content --- htdocs/core/lib/website2.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 01b7bf2843d..97a42090ecd 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -369,6 +369,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n"; $tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n"; $tplcontent .= "} // Not already loaded\n"; + $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).'");'."\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent .= "// END PHP ?>\n"; From dd7baf500571dc4bc78f5198cb2ddc62931113db Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 1 Mar 2025 18:07:10 +0100 Subject: [PATCH 17/23] Debug v21 - log of start page on page only --- htdocs/core/lib/website.lib.php | 4 ++-- htdocs/core/lib/website2.lib.php | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index ae13e84ebe6..cbd68e69502 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -286,12 +286,12 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = 0) global $db, $langs, $conf, $user; global $dolibarr_main_url_root, $dolibarr_main_data_root; global $website; - global $includehtmlcontentopened; + global $includehtmlcontentopened; // $includehtmlcontentopened is the level of includes (start at 1) '@phan-var-force Website $website'; $nbrep = 0; - dol_syslog("dolWebsiteOutput start - contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').' includehtmlcontentopened='.$includehtmlcontentopened); + dol_syslog("dolWebsiteOutput start - contenttype=".$contenttype." containerid=".$containerid.(defined('USEDOLIBARREDITOR') ? ' USEDOLIBARREDITOR=1' : '').(defined('USEDOLIBARRSERVER') ? ' USEDOLIBARRSERVER=1' : '').' includehtmlcontentopened='.$includehtmlcontentopened); //print $containerid.' '.$content; diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 97a42090ecd..dfab41bb786 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -181,7 +181,9 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n"; $tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n"; $tplcontent .= "} // Not already loaded\n"; - $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).'");'."\n"; + if (in_array($objectpage->type_container, array('page', 'blogpost'))) { + $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).'");'."\n"; + } $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent .= "ob_start();\n"; @@ -369,7 +371,9 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n"; $tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n"; $tplcontent .= "} // Not already loaded\n"; - $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).'");'."\n"; + if (in_array($objectpage->type_container, array('page', 'blogpost'))) { + $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).'");'."\n"; + } $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent .= "// END PHP ?>\n"; From db3780d70d4df4b53df7a8ae1a85da32df42d02a Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 1 Mar 2025 18:16:25 +0100 Subject: [PATCH 18/23] Fix doc --- htdocs/core/lib/website.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index cbd68e69502..90ceddd8bcc 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -286,7 +286,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = 0) global $db, $langs, $conf, $user; global $dolibarr_main_url_root, $dolibarr_main_data_root; global $website; - global $includehtmlcontentopened; // $includehtmlcontentopened is the level of includes (start at 1) + global $includehtmlcontentopened; // $includehtmlcontentopened is the level of includes (start at 0 for main page, 1 for first level include, ...) '@phan-var-force Website $website'; $nbrep = 0; From b49b676fcb6ce937ddff1cd9048c855dcb3297da Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 1 Mar 2025 18:37:06 +0100 Subject: [PATCH 19/23] Debug v21 error when failed to write file --- htdocs/core/lib/website.lib.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 90ceddd8bcc..c9844e27f17 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -1573,9 +1573,15 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify dol_mkdir(dirname($filetosave)); $fp = fopen($filetosave, "w"); - fwrite($fp, $tmpgeturl['content']); - fclose($fp); - dolChmod($filetosave); + if ($fp) { + fwrite($fp, $tmpgeturl['content']); + fclose($fp); + dolChmod($filetosave); + } else { + $error++; + setEventMessages('Error failed to open file '.$filetosave.' for writing', null, 'errors'); + $action = 'create'; + } } } } From 71b71b8425cdc1c9c989c0c9d6c68d73afe9a884 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 1 Mar 2025 20:06:03 +0100 Subject: [PATCH 20/23] Show name of page to help debug --- htdocs/core/lib/website2.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index dfab41bb786..74d5276f085 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -181,11 +181,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n"; $tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n"; $tplcontent .= "} // Not already loaded\n"; - if (in_array($objectpage->type_container, array('page', 'blogpost'))) { - $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).'");'."\n"; - } $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; + if (in_array($objectpage->type_container, array('page', 'blogpost'))) { + $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; + } $tplcontent .= "ob_start();\n"; $tplcontent .= "// END PHP ?>\n"; if (getDolGlobalString('WEBSITE_FORCE_DOCTYPE_HTML5')) { @@ -371,11 +371,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n"; $tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n"; $tplcontent .= "} // Not already loaded\n"; - if (in_array($objectpage->type_container, array('page', 'blogpost'))) { - $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).'");'."\n"; - } $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; + if (in_array($objectpage->type_container, array('page', 'blogpost'))) { + $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; + } $tplcontent .= "// END PHP ?>\n"; $tplcontent .= $objectpage->content; From 4d80ee132805e0dc320478411e5835023b0457e1 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sun, 2 Mar 2025 13:43:42 +0100 Subject: [PATCH 21/23] Same nb of - then in dolibarr.log --- htdocs/core/lib/website2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 74d5276f085..b0a6d59b935 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -184,7 +184,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; if (in_array($objectpage->type_container, array('page', 'blogpost'))) { - $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; + $tplcontent .= 'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; } $tplcontent .= "ob_start();\n"; $tplcontent .= "// END PHP ?>\n"; @@ -374,7 +374,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; if (in_array($objectpage->type_container, array('page', 'blogpost'))) { - $tplcontent .= 'dol_syslog("----- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; + $tplcontent .= 'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; } $tplcontent .= "// END PHP ?>\n"; From cc2af5eec0703ab095287f2b97766d6c8a0a7059 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sun, 2 Mar 2025 14:04:27 +0100 Subject: [PATCH 22/23] Debug v21, missing error message --- htdocs/core/lib/files.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 9e74d7daf31..576e2fc0014 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1983,7 +1983,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionor // Move file from temp directory to final directory. A .noexe may also be appended on file name. $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles, $upload_dir); - if (is_numeric($resupload) && $resupload > 0) { // $resupload can be 'ErrorFileAlreadyExists' + if (is_numeric($resupload) && $resupload > 0) { // $resupload can be 'ErrorFileAlreadyExists', 'ErrorFileIsInfectedWithAVirus...' include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $tmparraysize = getDefaultImageSizes(); @@ -2047,7 +2047,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionor if (preg_match('/File is a PDF with javascript inside/', $resupload)) { setEventMessages($langs->trans("ErrorFileIsAnInfectedPDFWithJSInside"), null, 'errors'); } else { - setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); + setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus").'
'.dolGetFirstLineOfText($resupload), null, 'errors'); } } else { // Known error setEventMessages($langs->trans($resupload), null, 'errors'); From 91cf88380ee86774204cb0562b47866920a09704 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sun, 2 Mar 2025 15:14:06 +0100 Subject: [PATCH 23/23] FIX Fatal error when seller is null, fix combo of vat in expense report --- htdocs/core/class/html.form.class.php | 10 ++++++---- htdocs/expensereport/card.php | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0148b7e250a..9d7837bcc26 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6686,7 +6686,7 @@ class Form * Else, default proposed VAT==0. End of rule. * @param bool $options_only Return HTML options lines only (for ajax treatment) * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key - * @param int $type_vat 0=All type, 1=VAT rate sale, 2=VAT rate purchase + * @param int $type_vat 0=All types, 1=VAT rate for sales, 2=VAT rate for purchases * @return string */ public function load_tva($htmlname = 'tauxtva', $selectedrate = '', $societe_vendeuse = null, $societe_acheteuse = null, $idprod = 0, $info_bits = 0, $type = '', $options_only = false, $mode = 0, $type_vat = 0) @@ -6782,12 +6782,14 @@ class Form $num = count($arrayofvatrates); if ($num > 0) { - // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '') + // Define the rate to pre-select (if defaulttx not forced so is -1 or '') if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) { + // Define a default thirdparty to use if the seller or buyer is not defined $tmpthirdparty = new Societe($this->db); + $tmpthirdparty->country_code = $mysoc->country_code; - $defaulttx = get_default_tva($societe_vendeuse, (is_object($societe_acheteuse) ? $societe_acheteuse : $tmpthirdparty), $idprod); - $defaultnpr = get_default_npr($societe_vendeuse, (is_object($societe_acheteuse) ? $societe_acheteuse : $tmpthirdparty), $idprod); + $defaulttx = get_default_tva(is_object($societe_vendeuse) ? $societe_vendeuse : $tmpthirdparty, (is_object($societe_acheteuse) ? $societe_acheteuse : $tmpthirdparty), $idprod); + $defaultnpr = get_default_npr(is_object($societe_vendeuse) ? $societe_vendeuse : $tmpthirdparty, (is_object($societe_acheteuse) ? $societe_acheteuse : $tmpthirdparty), $idprod); if (preg_match('/\((.*)\)/', $defaulttx, $reg)) { $defaultcode = $reg[1]; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index c9e7f65f078..86dec286298 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2595,12 +2595,12 @@ if ($action == 'create') { // Select VAT print ''; - $defaultvat = -1; + $defaultvat = ''; if (getDolGlobalString('EXPENSEREPORT_NO_DEFAULT_VAT')) { // If option to have no default VAT on expense report is on, we force MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; } - print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1); + print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), null, null, 0, 0, '', false, 1); print ''; // Unit price net