From 0f1b63ec9b5f897759fd1cdfe8d0ed92f2121b53 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 27 Oct 2022 14:38:37 +0200 Subject: [PATCH 01/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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 221ce01cdcf3ff89075f95a21f9957b4e45bfddd Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Nov 2022 08:02:56 +0100 Subject: [PATCH 10/11] 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 886fa7a8121cc8aba49024a86b2fd3791f2a6a3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2022 14:57:02 +0100 Subject: [PATCH 11/11] 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 ''.$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 ''; // Bank Account