From d375aca2c852085141cfa724d2aca095bab168ca Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Nov 2022 11:29:52 +0100 Subject: [PATCH 01/14] 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 02/14] 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 2112403d07395defc5c291757241b4cc9396b7da Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 8 Nov 2022 03:21:47 +0100 Subject: [PATCH 03/14] 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 04/14] 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 05/14] 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 06/14] 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 725e75fbc95d55fb5aeffb65879037c787556f98 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 8 Nov 2022 14:59:22 +0100 Subject: [PATCH 07/14] 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 08/14] 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 09/14] 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 10/14] 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 11/14] 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 12/14] 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 13/14] 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 14/14] 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++; } }
'; print $langs->trans("InitialMessage"); print ''; - if ($user->rights->ticket->manage) { + if ($user->hasRight("ticket", "manage")) { print ''.img_edit($langs->trans('Modify')).''; } print '