From 0f1b63ec9b5f897759fd1cdfe8d0ed92f2121b53 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 27 Oct 2022 14:38:37 +0200 Subject: [PATCH 01/30] fix: cannot edit propal note --- htdocs/core/tpl/notes.tpl.php | 1 + htdocs/modulebuilder/template/class/myobject.class.php | 2 +- htdocs/user/class/user.class.php | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 0430ec16e0e..f4ae0386807 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -64,6 +64,7 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) { // Special cases if ($module == 'propal') { $permission = $user->hasRight("propale", "creer"); + var_dump($user->hasRight("propale", "creer")); } elseif ($module == 'supplier_proposal') { $permission = $user->hasRight("supplier_proposal", "creer"); } elseif ($module == 'fichinter') { diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index a350fc4a8d6..e9eb2167b13 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -995,7 +995,7 @@ class MyObject extends CommonObject $langs->load("mymodule@mymodule"); if (empty($conf->global->MYMODULE_MYOBJECT_ADDON)) { - $conf->global->MYMODULE_MYOBJECT_ADDON = 'mod_myobject_standard'; + $conf->global->MYMODULE_MYOBJECT_ADDON = 'mod_dolipadbaes_standard'; } if (!empty($conf->global->MYMODULE_MYOBJECT_ADDON)) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index e57fc387bc7..9db6e80e4d6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -686,6 +686,7 @@ class User extends CommonObject 'shipping' => 'expedition', 'task' => 'task@projet', 'fichinter' => 'ficheinter', + 'propale' => 'propal', 'inventory' => 'stock', 'invoice' => 'facture', 'invoice_supplier' => 'fournisseur', @@ -718,8 +719,6 @@ class User extends CommonObject $permlevel1 = $tmp[0]; } - //var_dump($module); - //var_dump($this->rights->$module); if (!in_array($module, $conf->modules)) { return 0; } From 346d6cec5a4155b73087e1b67b5a06705df7962a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 27 Oct 2022 14:40:16 +0200 Subject: [PATCH 02/30] fix: cannot edit propal note --- htdocs/core/tpl/notes.tpl.php | 1 - htdocs/modulebuilder/template/class/myobject.class.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index f4ae0386807..0430ec16e0e 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -64,7 +64,6 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) { // Special cases if ($module == 'propal') { $permission = $user->hasRight("propale", "creer"); - var_dump($user->hasRight("propale", "creer")); } elseif ($module == 'supplier_proposal') { $permission = $user->hasRight("supplier_proposal", "creer"); } elseif ($module == 'fichinter') { diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index e9eb2167b13..a350fc4a8d6 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -995,7 +995,7 @@ class MyObject extends CommonObject $langs->load("mymodule@mymodule"); if (empty($conf->global->MYMODULE_MYOBJECT_ADDON)) { - $conf->global->MYMODULE_MYOBJECT_ADDON = 'mod_dolipadbaes_standard'; + $conf->global->MYMODULE_MYOBJECT_ADDON = 'mod_myobject_standard'; } if (!empty($conf->global->MYMODULE_MYOBJECT_ADDON)) { From 15b19840fb8f224d7fca9b48a7c3a7d41eb99783 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 27 Oct 2022 14:40:47 +0200 Subject: [PATCH 03/30] fix: cannot edit propal note --- htdocs/user/class/user.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9db6e80e4d6..bad796b966f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -719,6 +719,8 @@ class User extends CommonObject $permlevel1 = $tmp[0]; } + //var_dump($module); + //var_dump($this->rights->$module); if (!in_array($module, $conf->modules)) { return 0; } From 589df5e63dea803868b3a159c75be4cca8b77cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Thu, 27 Oct 2022 16:13:11 +0200 Subject: [PATCH 04/30] check if contact is active before creating associated ticket --- htdocs/public/ticket/create_ticket.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index f2b72693a13..e81d9802aac 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -145,8 +145,19 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { // Le premier contact trouvé est utilisé pour déterminer le contact suivi $contacts = $object->searchContactByEmail($origin_email); + // Ensure that contact is active and select first active contact + $cid = 0; + foreach ($contacts as $key => $contact) { + if ($contact->statut !== "1") { + $cid = $key + 1; + } else { + break; + } + } + + // Option to require email exists to create ticket - if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) { + if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[$cid]->socid) { $error++; array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); $action = ''; @@ -198,8 +209,8 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { } if (is_array($contacts) and count($contacts) > 0) { - $object->fk_soc = $contacts[0]->socid; - $usertoassign = $contacts[0]->id; + $object->fk_soc = $contacts[$cid]->socid; + $usertoassign = $contacts[$cid]->id; } $ret = $extrafields->setOptionalsFromPost(null, $object); From 634348d0483158489107fa9da2aff7f82e136658 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 01:02:52 +0100 Subject: [PATCH 05/30] Update create_ticket.php --- htdocs/public/ticket/create_ticket.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index e81d9802aac..0e6515bedd2 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -148,9 +148,8 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { // Ensure that contact is active and select first active contact $cid = 0; foreach ($contacts as $key => $contact) { - if ($contact->statut !== "1") { - $cid = $key + 1; - } else { + if ((int) $contact->statut == 1) { + $cid = $key; break; } } From 414b183eadf547df2c5db76afe85b253fc7eac3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 01:07:31 +0100 Subject: [PATCH 06/30] Update create_ticket.php --- htdocs/public/ticket/create_ticket.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 0e6515bedd2..ec47aaf4b18 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -146,7 +146,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { $contacts = $object->searchContactByEmail($origin_email); // Ensure that contact is active and select first active contact - $cid = 0; + $cid = -1; foreach ($contacts as $key => $contact) { if ((int) $contact->statut == 1) { $cid = $key; @@ -156,7 +156,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { // Option to require email exists to create ticket - if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[$cid]->socid) { + if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && ($cid <= 0 || empty($contacts[$cid]->socid))) { $error++; array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); $action = ''; From 870ffb6ddaf627aa513714a440d16c604cfc04b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 01:10:17 +0100 Subject: [PATCH 07/30] Update create_ticket.php --- htdocs/public/ticket/create_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index ec47aaf4b18..60d10f012fc 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -207,7 +207,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { $object->fk_soc = $searched_companies[0]->id; } - if (is_array($contacts) and count($contacts) > 0) { + if (is_array($contacts) && count($contacts) > 0) { $object->fk_soc = $contacts[$cid]->socid; $usertoassign = $contacts[$cid]->id; } From bcfcbf19ec8c6a1750e66ef6137f9bdfbb250164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 2 Nov 2022 14:11:37 +0100 Subject: [PATCH 08/30] strictly inferior, please --- htdocs/public/ticket/create_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 60d10f012fc..1b96cc5ebd6 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -156,7 +156,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { // Option to require email exists to create ticket - if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && ($cid <= 0 || empty($contacts[$cid]->socid))) { + if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && ($cid < 0 || empty($contacts[$cid]->socid))) { $error++; array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); $action = ''; From d375aca2c852085141cfa724d2aca095bab168ca Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Nov 2022 11:29:52 +0100 Subject: [PATCH 09/30] fix bad SQL parenthesis in notification --- htdocs/core/ajax/check_notifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 35d10af49b6..4f5290b8826 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -152,7 +152,7 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id; $sql .= ' WHERE a.code <> "AC_OTH_AUTO"'; $sql .= ' AND ('; - $sql .= " (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; + $sql .= " ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; $sql .= ' )'; } else { $sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id; From 578b63fea6ae48ee54c05168b767d4f009e06ce4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Nov 2022 05:16:18 +0100 Subject: [PATCH 10/30] NEW Accountancy - Add a graphic option to enable lettering function --- htdocs/accountancy/admin/index.php | 35 +++++++++++++++++++++++++++++ htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 36 insertions(+) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 8236b83eb3d..385c105451e 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -247,6 +247,20 @@ if ($action == 'setdisablebindingonexpensereports') { } } +if ($action == 'setenablelettering') { + $setenablelettering = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View @@ -466,6 +480,27 @@ print ''; print ''; +// Lettering params +print ''; +print ''; +print ''; +print "\n"; + +print ''; +print ''; +if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { + print ''; +} else { + print ''; +} +print ''; + +print '
'.$langs->trans('Options').' '.$langs->trans('Lettering').'
'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
'; + print '
'; print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 40482298e63..2582b6e3c90 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -335,6 +335,7 @@ NumberOfAccountancyMovements=Number of movements ACCOUNTING_DISABLE_BINDING_ON_SALES=Disable binding & transfer in accountancy on sales (customer invoices will not be taken into account in accounting) ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountancy on purchases (vendor invoices will not be taken into account in accounting) ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) +ACCOUNTING_ENABLE_LETTERING=Enable the lettering function in the accounting ## Export NotifiedExportDate=Flag exported lines as Exported (to modify a line, you will need to delete the whole transaction and re-transfert it into accounting) From 221ce01cdcf3ff89075f95a21f9957b4e45bfddd Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Nov 2022 08:02:56 +0100 Subject: [PATCH 11/30] FIX Accountancy - Better warning for situation invoice in index --- htdocs/accountancy/index.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 18277eb6751..73bdccc1dba 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -81,12 +81,7 @@ $help_url = ''; llxHeader('', $langs->trans("AccountancyArea"), $help_url); -if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) { - print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy'); - - print ''.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."\n"; - print "
"; -} elseif ($conf->accounting->enabled) { +if ($conf->accounting->enabled) { $step = 0; $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) @@ -111,15 +106,17 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S '; } - print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); + if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) { + print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")); + print "
"; + } + print '
'; // hideobject is to start hidden print "
\n"; print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; if (!empty($user->rights->accounting->chartofaccount)) { - print "
\n"; print "
\n"; - print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; print '
'; print "
\n"; From e512c9aeee8519ad03339fd2a10f7e05b4cedd29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Nov 2022 14:04:01 +0100 Subject: [PATCH 12/30] Fix trans --- htdocs/core/class/utils.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 9a330c7aba5..007d34491d6 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -161,6 +161,7 @@ class Utils } if ($count > 0) { + $langs->load("admin"); $this->output = $langs->trans("PurgeNDirectoriesDeleted", $countdeleted); if ($count > $countdeleted) { $this->output .= '
'.$langs->trans("PurgeNDirectoriesFailed", ($count - $countdeleted)); From a16c50593d53956a8439f12fae23009e4dfebfe6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Nov 2022 15:13:51 +0100 Subject: [PATCH 13/30] Fix dark theme mode --- htdocs/theme/eldy/global.inc.php | 13 ++++++++++--- htdocs/theme/md/style.css.php | 10 +++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a73eb67fccb..300c3cbf90d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1966,7 +1966,7 @@ td.showDragHandle { .side-nav-vert { position: sticky; top: 0px; - z-index: 1001; + z-index: 1005; } global->THEME_DARKMODEENABLED)) { ?> @@ -5354,10 +5354,17 @@ td.cal_other_month { /* ============================================================================== */ -/* Ajax - Liste deroulante de l'autocompletion */ +/* Ajax - Combo list for autocompletion */ /* ============================================================================== */ -.ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff !important; } +.ui-widget-content { + border: solid 1px rgba(0,0,0,.3); + background: var(--colorbackbody) !important; + color: var(--colortext) !important; +} +/*.ui-widget-header { + background: var(--colorbacktitle); +}*/ .ui-autocomplete-loading { background: white url() right center no-repeat; } .ui-autocomplete { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 50fff15b8f0..18a22d997da 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2118,7 +2118,7 @@ body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block .side-nav-vert { position: sticky; top: 0px; - z-index: 1001; + z-index: 1005; } @@ -5188,10 +5188,14 @@ td.cal_other_month { /* ============================================================================== */ -/* Ajax - Liste deroulante de l'autocompletion */ +/* Ajax - Combo list for autocompletion */ /* ============================================================================== */ -.ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff !important; } +.ui-widget-content { + border: solid 1px rgba(0,0,0,.3); + background: var(--colorbackbody) !important; + color: var(--colortext) !important; +} .ui-autocomplete-loading { background: white url() right center no-repeat; } .ui-autocomplete { From 2112403d07395defc5c291757241b4cc9396b7da Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 8 Nov 2022 03:21:47 +0100 Subject: [PATCH 14/30] NEW VAT - Admin - Add information on deadline day for submission of VAT declaration --- htdocs/admin/taxes.php | 18 ++++++++++++------ htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index ccdbedc1f89..d903bc2d32f 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2015-2018 Alexandre Spangaro +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2015-2022 Alexandre Spangaro * * 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 @@ -22,7 +22,7 @@ /** * \file htdocs/admin/taxes.php * \ingroup tax - * \brief Page de configuration du module tax + * \brief Page to setup module tax */ // Load Dolibarr environment @@ -116,6 +116,8 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_INFO_VAT_RETURN", GETPOST("MAIN_INFO_VAT_RETURN", 'alpha'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_TVA_DAY_DEADLINE_SUBMISSION", GETPOST("deadline_day_vat", 'int'), 'chaine', 0, '', $conf->entity); + if (!$error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -179,6 +181,10 @@ if (empty($mysoc->tva_assuj)) { } print ''; + print ''; + print ''; + print ''; + print ''; print '
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index dae72d3d703..45345695d54 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2338,3 +2338,4 @@ DesktopsOnly=Desktops only DesktopsAndSmartphones=Desktops et smartphones AllowOnlineSign=Allow online signing AllowExternalDownload=Allow external download (without login, using a shared link) +DeadlineDayVATSubmission=Deadline day for vat submission on the next month From 9d1793b45414042839ea35ace1c4092c44491b4f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 8 Nov 2022 03:40:38 +0100 Subject: [PATCH 15/30] FIX Accountancy - Journal - HTML in title --- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/accountancy/journal/expensereportsjournal.php | 2 +- htdocs/accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/accountancy/journal/variousjournal.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 5c099922af4..3a2f4c40750 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1034,7 +1034,7 @@ if (empty($action) || $action == 'view') { $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); - llxHeader('', $title); + llxHeader('', dol_string_nohtmltag($title)); $nom = $title; $builddate = dol_now(); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 7db2df72979..68e7ebda6ae 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -498,7 +498,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! if (empty($action) || $action == 'view') { $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); - llxHeader('', $title); + llxHeader('', dol_string_nohtmltag($title)); $nom = $title; $nomlink = ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index c3592b8c9de..248b0e41267 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -758,7 +758,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! if (empty($action) || $action == 'view') { $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); - llxHeader('', $title); + llxHeader('', dol_string_nohtmltag($title)); $nom = $title; $nomlink = ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 7ae8b3ca1c0..624b5a22335 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -701,7 +701,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! if (empty($action) || $action == 'view') { $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); - llxHeader('', $title); + llxHeader('', dol_string_nohtmltag($title)); $nom = $title; $nomlink = ''; diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index f822daa540c..b58953043ff 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -187,7 +187,7 @@ if ($object->nature == 2) { $title = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 2, 1, '', 1); -llxHeader('', $title); +llxHeader('', dol_string_nohtmltag($title)); $nom = $title; $nomlink = ''; From f2a518d8ea1917b28eff2508be52da42c4c756cd Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 8 Nov 2022 04:29:48 +0100 Subject: [PATCH 16/30] NEW Invoice - Add french mention on pdf when vat debit option is on --- .../modules/facture/doc/pdf_crabe.modules.php | 12 ++++++++++++ .../modules/facture/doc/pdf_sponge.modules.php | 16 ++++++++++++++-- htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 3d7da995e6f..39d833de6cc 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1176,6 +1176,18 @@ class pdf_crabe extends ModelePDFFactures $posy = $pdf->GetY(); } + // Show if Option VAT debit option is on also if transmitter is french + // Decret n°2099-1299 2022-10-07 + // French mention : "Option pour le paiement de la taxe d'après les débits" + if ($this->emetteur->country_code == 'FR') { + if ($conf->global->TAX_MODE == 1) { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1); + + $posy = $pdf->GetY() + 1; + } + } + // Show online payment link if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') { $useonlinepayment = 0; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index da278cb45ac..e11cd90bc43 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1259,7 +1259,7 @@ class pdf_sponge extends ModelePDFFactures $posy = $pdf->GetY() + 1; } - // Show payment mode + // Show payment mode if (!empty($object->mode_reglement_code) && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { @@ -1286,7 +1286,19 @@ class pdf_sponge extends ModelePDFFactures $posy = $pdf->GetY(); } - // Show online payment link + // Show if Option VAT debit option is on also if transmitter is french + // Decret n°2099-1299 2022-10-07 + // French mention : "Option pour le paiement de la taxe d'après les débits" + if ($this->emetteur->country_code == 'FR') { + if ($conf->global->TAX_MODE == 1) { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1); + + $posy = $pdf->GetY() + 1; + } + } + + // Show online payment link if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') { $useonlinepayment = 0; if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) { diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index f13baf06446..2551f92af53 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -625,3 +625,4 @@ PaymentRegisteredAndInvoiceSetToPaid=Payment registered and invoice %s set to pa SendEmailsRemindersOnInvoiceDueDate=Send reminder by email for unpaid invoices MakePaymentAndClassifyPayed=Record payment BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status) +MentionVATDebitOptionIsOn=Option to pay tax based on debits diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 15a7901a2e9..9b375d8ce1b 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -622,3 +622,4 @@ PaymentRegisteredAndInvoiceSetToPaid=Paiement enregistré et facture %s passée SendEmailsRemindersOnInvoiceDueDate=Envoyer un rappel par e-mail pour les factures impayées MakePaymentAndClassifyPayed=Enregistrer un paiement BulkPaymentNotPossibleForInvoice=L'enregistrement de paiements en masse n'est pas possible pour la facture %s (mauvais type de facture ou statut) +MentionVATDebitOptionIsOn=Option pour le paiement de la taxe d'après les débits From 98cbd9663ea5280db79f3e8b82afae130e9f750c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 8 Nov 2022 04:30:37 +0100 Subject: [PATCH 17/30] Remove french translation for transifex --- htdocs/langs/fr_FR/bills.lang | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 9b375d8ce1b..15a7901a2e9 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -622,4 +622,3 @@ PaymentRegisteredAndInvoiceSetToPaid=Paiement enregistré et facture %s passée SendEmailsRemindersOnInvoiceDueDate=Envoyer un rappel par e-mail pour les factures impayées MakePaymentAndClassifyPayed=Enregistrer un paiement BulkPaymentNotPossibleForInvoice=L'enregistrement de paiements en masse n'est pas possible pour la facture %s (mauvais type de facture ou statut) -MentionVATDebitOptionIsOn=Option pour le paiement de la taxe d'après les débits From af6a708523684391e684e1df96e0c44943628ed4 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 8 Nov 2022 14:20:09 +0100 Subject: [PATCH 18/30] FIX : Missing $object for online signature link build --- htdocs/core/lib/signature.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 1dbefb5719a..c59acbea209 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -59,7 +59,7 @@ function showOnlineSignatureUrl($type, $ref) */ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1) { - global $conf, $db, $langs, $dolibarr_main_url_root; + global $conf, $object, $dolibarr_main_url_root; $ref = str_replace(' ', '', $ref); $out = ''; From 725e75fbc95d55fb5aeffb65879037c787556f98 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 8 Nov 2022 14:59:22 +0100 Subject: [PATCH 19/30] massaction to affect users on projects --- htdocs/core/actions_massactions.inc.php | 54 +++++++++++++++++++++++++ htdocs/core/tpl/massactions_pre.tpl.php | 38 +++++++++++++++++ htdocs/langs/en_US/main.lang | 5 +++ htdocs/langs/fr_FR/main.lang | 5 +++ htdocs/projet/list.php | 8 +++- 5 files changed, 108 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 02d4215b963..b83c30d15b6 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1323,6 +1323,60 @@ if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiont } } +if (!$error && ($action == 'affectuser' && $confirm == 'yes') && $permissiontoadd) { + $db->begin(); + + $usertoaffect=GETPOST('usertoaffect'); + $projectrole=GETPOST('projectrole'); + $tasksrole=GETPOST('tasksrole'); + if (!empty($usertoaffect)) { + foreach ($toselect as $toselectid) { + $result = $object->fetch($toselectid); + //var_dump($contcats);exit; + if ($result > 0) { + $res = $object->add_contact($usertoaffect, $projectrole, 'internal'); + if ($res >= 0) { + $taskstatic = new Task($db); + $task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0); + + foreach ($task_array as $task) { + $tasksToAffect = new Task($db); + $result = $tasksToAffect->fetch($task->id); + if ($result > 0) { + $res = $tasksToAffect->add_contact($usertoaffect, $tasksrole, 'internal'); + if ($res < 0) { + setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors'); + } + } + } + $nbok++; + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + break; + } + } + } else { + setEventMessage('UserNotFound', 'errors'); + $error++; + } + + if (!$error) { + if ($nbok > 1) { + setEventMessages($langs->trans("RecordsModified", $nbok), null); + } else { + setEventMessages($langs->trans("RecordsModified", $nbok), null); + } + $db->commit(); + $toselect=array(); + } else { + $db->rollback(); + } +} + if (!$error && ($massaction == 'enable' || ($action == 'enable' && $confirm == 'yes')) && $permissiontoadd) { $db->begin(); diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 1e48fc4d5a0..7657fe21e96 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -113,6 +113,44 @@ if ($massaction == 'presetsupervisor') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmSetSupervisor"), $langs->trans("ConfirmSetSupervisorQuestion", count($toselect)), "setsupervisor", $formquestion, 1, 0, 200, 500, 1); } +if ($massaction == 'preaffectuser') { + $formquestion = array(); + + $valuefielduser = '
'; + $valuefielduser .= img_picto('', 'user').' '; + $valuefielduser .= $form->select_dolusers('', 'usertoaffect', 1, $arrayofselected, 0, '', 0, $object->entity, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); + $valuefielduser .= '
'; + + $valuefieldprojrole = '
'; + $valuefieldprojrole .= $formcompany->selectTypeContact($object, '', 'projectrole', 'internal', 'position', 0, 'widthcentpercentminusx maxwidth300', 0); + $valuefieldprojrole .= '
'; + + $valuefieldtasksrole = '
'; + $valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic, '', 'tasksrole', 'internal', 'position', 0, 'widthcentpercentminusx maxwidth300', 0); + $valuefieldtasksrole .= '
'; + + $formquestion[] = array( + 'type' => 'other', + 'name' => 'usertoaffect', + 'label' => $langs->trans("User"), + 'value' => $valuefielduser + ); + $formquestion[] = array( + 'type' => 'other', + 'name' => 'projectrole', + 'label' => $langs->trans("ProjectRole"), + 'value' => $valuefieldprojrole + ); + + $formquestion[] = array( + 'type' => 'other', + 'name' => 'tasksrole', + 'label' => $langs->trans("TasksRole"), + 'value' => $valuefieldtasksrole + ); + + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAffectUser"), $langs->trans("ConfirmAffectUserQuestion", count($toselect)), "affectuser", $formquestion, 1, 0, 200, 500, 1); +} if ($massaction == 'presend') { $langs->load("mails"); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6f849e39be1..2b86c2d3e65 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1146,12 +1146,17 @@ UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility AffectTag=Affect Tag +AffectUser=Affect User SetSupervisor=Set Supervisor CreateExternalUser=Create external user ConfirmAffectTag=Bulk Tag Affect +ConfirmAffectUser=Bulk User Affect +ProjectRole=Role assigned on each project +TasksRole=Role assigned on each task of each project ConfirmSetSupervisor=Bulk Supervisor Set ConfirmUpdatePrice=Choose a increase/decrease price rate ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected record(s)? +ConfirmAffectUserQuestion=Are you sure you want to affect users to the %s selected record(s)? ConfirmSetSupervisorQuestion=Are you sure you want to set supervisor to the %s selected record(s)? ConfirmUpdatePriceQuestion=Are you sure you want to update the price of the %s selected record(s)? CategTypeNotFound=No tag type found for type of records diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 39d857ae0e8..eb787cb279d 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -1146,13 +1146,18 @@ UpdateForAllLines=Mise à jour de toutes les lignes OnHold=En attente Civility=Civilité AffectTag=Affecter un tag/catégorie +AffectUser=Affecter un utilisateur SetSupervisor=Choisir un superviseur CreateExternalUser=Créer utilisateur externe ConfirmAffectTag=Affecter les tags en masse ConfirmSetSupervisor=Choisir un superviseur en masse +ConfirmAffectUser=Affecter les utilisateurs en masse +ProjectRole=Role attribué pour chaque projet +TasksRole=Role attribué pour chaque tâche de chaque projet ConfirmUpdatePrice=Choisir un pourcentage de hausse/baisse des prix ConfirmAffectTagQuestion=Êtes-vous sur de vouloir affecter ces catégories aux %s lignes sélectionnées ? ConfirmSetSupervisorQuestion=Êtes-vous sur de vouloir affecter ce superviseur aux %s lignes sélectionnées ? +ConfirmAffectUserQuestion=Êtes-vous sur de vouloir affecter cet utilisateur aux %s lignes sélectionnées ? ConfirmUpdatePriceQuestion=Êtes-vous sur de vouloir mettre à jour les prix des %s lignes sélectionnées ? CategTypeNotFound=Aucun type de tag trouvé pour ce type d'enregistrements Rate=Taux diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index d3a5a203487..007934cde40 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; if (isModEnabled('categorie')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; @@ -355,8 +357,9 @@ if (empty($reshook)) { */ $form = new Form($db); - +$formcompany = new FormCompany($db); $companystatic = new Societe($db); +$taskstatic = new Task($db); $formother = new FormOther($db); $formproject = new FormProjets($db); @@ -802,6 +805,7 @@ $arrayofmassactions = array( //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->projet->creer) { $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close"); + $arrayofmassactions['preaffectuser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AffectUser"); } if ($user->rights->projet->supprimer) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); @@ -809,7 +813,7 @@ if ($user->rights->projet->supprimer) { if (isModEnabled('category') && $user->rights->projet->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } -if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) { +if (in_array($massaction, array('presend', 'predelete', 'preaffecttag', "preaffectuser"))) { $arrayofmassactions = array(); } From 26107fab209d04060eafce42879398c8fc71a7a8 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 8 Nov 2022 15:02:51 +0100 Subject: [PATCH 20/30] quote issue --- htdocs/projet/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 007934cde40..dd184bb1f3d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -358,6 +358,7 @@ if (empty($reshook)) { $form = new Form($db); $formcompany = new FormCompany($db); + $companystatic = new Societe($db); $taskstatic = new Task($db); $formother = new FormOther($db); @@ -813,7 +814,7 @@ if ($user->rights->projet->supprimer) { if (isModEnabled('category') && $user->rights->projet->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } -if (in_array($massaction, array('presend', 'predelete', 'preaffecttag', "preaffectuser"))) { +if (in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preaffectuser'))) { $arrayofmassactions = array(); } From 73b857c1b3ab3e754e94848457738622947f95dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Tue, 8 Nov 2022 16:21:32 +0100 Subject: [PATCH 21/30] FIX: Add Missing "LibStatut" hook in propal, commande, facture --- htdocs/comm/propal/class/propal.class.php | 10 +++++++++- htdocs/commande/class/commande.class.php | 15 ++++++++++++++- htdocs/core/class/commoninvoice.class.php | 18 +++++++++++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f36b8027461..06bd79ea618 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3243,7 +3243,7 @@ class Propal extends CommonObject public function LibStatut($status, $mode = 1) { // phpcs:enable - global $conf; + global $conf, $hookmanager; // Init/load array of translation of status if (empty($this->labelStatus) || empty($this->labelStatusShort)) { @@ -3273,7 +3273,15 @@ class Propal extends CommonObject } elseif ($status == self::STATUS_BILLED) { $statusType = 'status6'; } + + $parameters = array('status' => $status, 'mode' => $mode); + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 54e50baa9f7..b43b29a43cc 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3591,7 +3591,7 @@ class Commande extends CommonOrder public function LibStatut($status, $billed, $mode, $donotshowbilled = 0) { // phpcs:enable - global $langs, $conf; + global $langs, $conf, $hookmanager; $billedtext = ''; if (empty($donotshowbilled)) { @@ -3636,6 +3636,19 @@ class Commande extends CommonOrder $mode = 0; } + $parameters = array( + 'status' => $status, + 'mode' => $mode, + 'billed' => $billed, + 'donotshowbilled' => $donotshowbilled + ); + + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip)); } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index f6edbd3f8d4..af143b324c4 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -532,7 +532,7 @@ abstract class CommonInvoice extends CommonObject public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1) { // phpcs:enable - global $langs; + global $langs, $hookmanager; $langs->load('bills'); if ($type == -1) { @@ -576,6 +576,22 @@ abstract class CommonInvoice extends CommonObject $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaid'); } } + + $parameters = array( + 'status' => $status, + 'mode' => $mode, + 'paye' => $paye, + 'alreadypaid' => $alreadypaid, + 'type' => $type + ); + + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } From 89876d8d529899d1b552bbeb102eb823872145a6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 8 Nov 2022 15:24:05 +0000 Subject: [PATCH 22/30] Fixing style errors. --- htdocs/comm/propal/class/propal.class.php | 8 ++++---- htdocs/commande/class/commande.class.php | 18 +++++++++--------- htdocs/core/class/commoninvoice.class.php | 20 ++++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 06bd79ea618..005fdfa77bb 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3273,15 +3273,15 @@ class Propal extends CommonObject } elseif ($status == self::STATUS_BILLED) { $statusType = 'status6'; } - - $parameters = array('status' => $status, 'mode' => $mode); + + $parameters = array('status' => $status, 'mode' => $mode); $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook - if ($reshook > 0) { + if ($reshook > 0) { return $hookmanager->resPrint; } - + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b43b29a43cc..e0275eb4308 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3636,19 +3636,19 @@ class Commande extends CommonOrder $mode = 0; } - $parameters = array( - 'status' => $status, - 'mode' => $mode, - 'billed' => $billed, - 'donotshowbilled' => $donotshowbilled - ); + $parameters = array( + 'status' => $status, + 'mode' => $mode, + 'billed' => $billed, + 'donotshowbilled' => $donotshowbilled + ); - $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook - if ($reshook > 0) { + if ($reshook > 0) { return $hookmanager->resPrint; } - + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip)); } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index af143b324c4..8cc9f944ef1 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -576,18 +576,18 @@ abstract class CommonInvoice extends CommonObject $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaid'); } } - - $parameters = array( - 'status' => $status, - 'mode' => $mode, - 'paye' => $paye, - 'alreadypaid' => $alreadypaid, - 'type' => $type - ); - $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + $parameters = array( + 'status' => $status, + 'mode' => $mode, + 'paye' => $paye, + 'alreadypaid' => $alreadypaid, + 'type' => $type + ); - if ($reshook > 0) { + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { return $hookmanager->resPrint; } From a215717991051d206fedf65731077c7e946cd9fb Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 8 Nov 2022 16:27:04 +0100 Subject: [PATCH 23/30] Fix : php 8.1 warnings in ticket --- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/core/class/html.formticket.class.php | 21 ++++++++++++------- htdocs/public/ticket/create_ticket.php | 6 +++--- htdocs/public/ticket/list.php | 6 ++++-- htdocs/public/ticket/view.php | 5 +++-- htdocs/ticket/class/actions_ticket.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- 7 files changed, 26 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f4b7f1b2bfb..a133e3cc314 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1317,7 +1317,7 @@ class ActionComm extends CommonObject dol_syslog(get_class()."::getActions", LOG_DEBUG); require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($db); + $hookmanager = new HookManager($this->db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendadao')); diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 0e5e6ff9e7c..214413b8f1b 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1270,7 +1270,7 @@ class FormTicket // Define output language $outputlangs = $langs; $newlang = ''; - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($this->param['langsmodels'])) { $newlang = $this->param['langsmodels']; } if (!empty($newlang)) { @@ -1281,7 +1281,7 @@ class FormTicket // Get message template for $this->param["models"] into c_email_templates $arraydefaultmessage = -1; - if ($this->param['models'] != 'none') { + if (isset($this->param['models']) && $this->param['models'] != 'none') { $model_id = 0; if (array_key_exists('models_id', $this->param)) { $model_id = (int) $this->param["models_id"]; @@ -1323,7 +1323,7 @@ class FormTicket // Define output language $outputlangs = $langs; $newlang = ''; - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($this->param['langsmodels'])) { $newlang = $this->param['langsmodels']; } if (!empty($newlang)) { @@ -1380,7 +1380,12 @@ class FormTicket print ''; print ''; print ''; - print ''; + if (!empty($this->trackid)) { + print ''; + } else { + print ''; + $keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id; // track_id instead of trackid + } foreach ($this->param as $key => $value) { print ''; } @@ -1392,7 +1397,7 @@ class FormTicket $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); } - $result = $formmail->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs); + $result = $formmail->fetchAllEMailTemplate(!empty($this->param["models"]) ? $this->param["models"] : "", $user, $outputlangs); if ($result < 0) { setEventMessages($this->error, $this->errors, 'errors'); } @@ -1404,7 +1409,7 @@ class FormTicket print ''; // External users can't send message email - if ($user->rights->ticket->write && !$user->socid) { + if ($user->hasRight("ticket", "write") && !$user->socid) { $ticketstat = new Ticket($this->db); $res = $ticketstat->fetch('', '', $this->track_id); @@ -1556,7 +1561,7 @@ class FormTicket // Deal with format differences between message and signature (text / HTML) if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $this->substit['__USER_SIGNATURE__'] = dol_nl2br($this->substit['__USER_SIGNATURE__']); - } elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { + } elseif (!dol_textishtml($defaultmessage) && isset($this->substit['__USER_SIGNATURE__']) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); } if (GETPOSTISSET("message") && !GETPOST('modelselected')) { @@ -1569,7 +1574,7 @@ class FormTicket } print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 3a6adeb6c20..6c195c16704 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1666,7 +1666,7 @@ class Ticket extends CommonObject */ public function loadCacheMsgsTicket() { - if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) { + if (!empty($this->cache_msgs_ticket) && is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) { return 0; } From 3255c420ab4de197acee633bef7e3b0aab35cc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Nov 2022 14:45:26 +0100 Subject: [PATCH 24/30] delete extrafields when deleting ecmfiles --- htdocs/ecm/class/ecmfiles.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 3f4df8b847b..0e3f872cefd 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -751,7 +751,16 @@ class EcmFiles extends CommonObject } // If you need to delete child tables to, you can insert them here + if (!$error) { + $sql = "DELETE FROM " . $this->db->prefix() . $this->table_element. "_extrafields"; + $sql .= " WHERE fk_object = ".((int) $this->id); + $resql = $this->db->query($sql); + if (!$resql) { + $this->errors[] = $this->db->lasterror(); + $error++; + } + } if (!$error) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' WHERE rowid='.((int) $this->id); From 1871872c1621944cdfbe5035e459c35604d1b132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Nov 2022 14:53:42 +0100 Subject: [PATCH 25/30] clean code --- htdocs/ecm/class/ecmfiles.class.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 0e3f872cefd..46d83cefaa8 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -752,11 +752,8 @@ class EcmFiles extends CommonObject // If you need to delete child tables to, you can insert them here if (!$error) { - $sql = "DELETE FROM " . $this->db->prefix() . $this->table_element. "_extrafields"; - $sql .= " WHERE fk_object = ".((int) $this->id); - - $resql = $this->db->query($sql); - if (!$resql) { + $result = $this->deleteExtraFields(); + if (!$result) { $this->errors[] = $this->db->lasterror(); $error++; } From ac5eb8b9ae77ea578299185b9319d5bc291e0aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Nov 2022 14:55:41 +0100 Subject: [PATCH 26/30] clean code --- htdocs/ecm/class/ecmfiles.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 46d83cefaa8..ab7b13aba90 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -754,7 +754,7 @@ class EcmFiles extends CommonObject if (!$error) { $result = $this->deleteExtraFields(); if (!$result) { - $this->errors[] = $this->db->lasterror(); + dol_syslog(get_class($this)."::delete error ".$this->error, LOG_ERR); $error++; } } From a8bd198a21f801ea8cf84df460d2c020fbd07835 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2022 12:26:48 +0100 Subject: [PATCH 27/30] FIX Subscription must be stopped when max of attendees reached. --- htdocs/public/eventorganization/attendee_new.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index e0ad4a0420b..4dabf1f6c91 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -103,14 +103,16 @@ if ($type == 'global') { $errmsg .= $project->error; $errors = array_merge($errors, $project->errors); } else { - $sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."projet"; - $sql .= " WHERE ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee = ".((int) $project->id); + $sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee"; + $sql .= " WHERE fk_project = ".((int) $project->id); - $resql = $db->query($resql); + $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj) { $currentnbofattendees = $obj->nb; + } else { + dol_print_error($db); } } } From 64b8f96ebb6c82407f335715adfb0606b5ff7c93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2022 14:41:19 +0100 Subject: [PATCH 28/30] Prepare 16.0.2 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index c8978db3778..17c6ad187af 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '16.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '16.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From fa07964b4b74eeac095b929fc9140a5aef22a8f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2022 14:53:28 +0100 Subject: [PATCH 29/30] Prepare 16.0.2 --- ChangeLog | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0c9e93454f2..321d6a29276 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,47 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 16.0.2 compared to 16.0.1 ***** + +FIX: 16.0 - computed extrafields are not displayed if the object has no other extrafields +FIX: #22538 +FIX: Accountancy - Review of Winfic - eWinfic - Winsis compta export format +FIX: add loadRoleMode on getlinearray +FIX: Autosearch on takepos was broken +FIX: avoid access forbidden with numeric ref +FIX: avoid error, check of product fetch is already check before +FIX: avoid error, fetch of product is mandatory (by id or by ref) +FIX: avoid unnecessary multiple calculation (#22637) +FIX: bug on selected value for select_bom() function +FIX: can not set prospect status "Do not contact" +FIX: change in the communication status of the prospect +FIX: check $id, already checked before +FIX: closed warehouse for shipping +FIX: extrafields_add tpl for stock movement +FIX: the request SQL for transversal user, the join on usergroup table must be with getEntity('usergroup') +FIX: Import of contact when there is duplicate thirdparties +FIX: Import of socialnetwork field +FIX: input selector is wrong with PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES usage +FIX: install wizard error management +FIX: just add integer +FIX: Missing $object for online signature link build +FIX: missing quote +FIX: only modify hidden checkbox/multislected extrafields on update if they are provided in request +FIX: php doc +FIX: private message ticket become public if edit action +FIX: remove > 0 and -1 +FIX: remove db object to avoid error with postgresql +FIX: Search ambigous field on MO list +FIX: Search on social networks +FIX: Subscription must be stopped when max of attendees reached. +FIX: supplier price update: missing error reporting +FIX: travis & stickler feedbacks +FIX: we must be able to select only bom of a specific product + several fixes on select_bom() function +FIX: wrong perm check +FIX: wrong typo, remove quote +FIX: wrong var typo + + ***** ChangeLog for 16.0.1 compared to 16.0.0 ***** FIX: #16476 on massaction the pdf generation is not using the t… From 886fa7a8121cc8aba49024a86b2fd3791f2a6a3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2022 14:57:02 +0100 Subject: [PATCH 30/30] Fix phpcs --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 8457acf1348..c017df5df97 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1655,7 +1655,7 @@ if ($action == 'create') { // Mode of payment print ''; // Bank Account
'; print $langs->trans("InitialMessage"); print ''; - if ($user->rights->ticket->manage) { + if ($user->hasRight("ticket", "manage")) { print ''.img_edit($langs->trans('Modify')).''; } print '
'.$langs->trans('PaymentMode').''; print img_picto('', 'bank'); - $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id','int') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print '