From 7eddf43aefa626db67aa4748074216ba3447a449 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 23 Jun 2021 17:33:02 +0200 Subject: [PATCH 1/3] FIX List and Create Companies Left Menus --- htdocs/core/menus/init_menu_auguria.sql | 4 ++-- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index ec75b35073c..a4485bcb8b6 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -76,8 +76,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Third parties insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&leftmenu=thirdparties', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 02eb3c77d4d..c92bc298197 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -353,3 +353,6 @@ INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (14,'MAINFREIGHT', 'Mainfreight', NULL, 'https://www.mainfreight.com/track?{TRACKID}', 0); +UPDATE llx_menu SET perms = '$user->rights->societe->creer' WHERE titre = 'MenuNewThirdParty' AND url = '/societe/card.php?mainmenu=companies&action=create'; +UPDATE llx_menu SET url = '/societe/list.php?mainmenu=companies&leftmenu=thirdparties' WHERE titre = 'List' AND url = '/societe/list.php?mainmenu=companies&action=create'; + From c3cbd295422cfcc4015548b3b4bcb27423d242eb Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 27 Jun 2021 09:04:47 +0200 Subject: [PATCH 2/3] Fix #17836 : order delay warning in list was wrong, date_commande is deprecated --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4890f1c0a2e..3712a6eea1b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4054,7 +4054,7 @@ class Commande extends CommonOrder $now = dol_now(); - return max($this->date_commande, $this->date_livraison) < ($now - $conf->commande->client->warning_delay); + return max($this->date, $this->date_livraison) < ($now - $conf->commande->client->warning_delay); } /** From fa28a02d748a3845cab7379104cc58e9ec37e698 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 28 Jun 2021 11:03:22 +0200 Subject: [PATCH 3/3] FIX update contact birthday alert --- htdocs/contact/class/contact.class.php | 56 ++++++++++++-------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ac415afce6c..7febbf32fc0 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -740,38 +740,32 @@ class Contact extends CommonObject $this->error = $this->db->lasterror(); } - // Mis a jour alerte birthday - if ($this->birthday_alert) - { - //check existing - $sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; - $result_check = $this->db->query($sql_check); - if (!$result_check || ($this->db->num_rows($result_check) < 1)) - { - //insert - $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) "; - $sql .= "VALUES (1,".$this->db->escape($id).",".$user->id.")"; - $result = $this->db->query($sql); - if (!$result) - { - $error++; - $this->error = $this->db->lasterror(); + if ($user) { + // Mis a jour alerte birthday + if ($this->birthday_alert) { + //check existing + $sql_check = "SELECT rowid FROM " . MAIN_DB_PREFIX . "user_alert WHERE type=1 AND fk_contact=" . $this->db->escape($id) . " AND fk_user=" . $user->id; + $result_check = $this->db->query($sql_check); + if (!$result_check || ($this->db->num_rows($result_check) < 1)) { + //insert + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_alert(type,fk_contact,fk_user) "; + $sql .= "VALUES (1," . $this->db->escape($id) . "," . $user->id . ")"; + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->error = $this->db->lasterror(); + } + } else { + $result = true; + } + } else { + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_alert "; + $sql .= "WHERE type=1 AND fk_contact=" . $this->db->escape($id) . " AND fk_user=" . $user->id; + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->error = $this->db->lasterror(); } - } - else - { - $result = true; - } - } - else - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert "; - $sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; - $result = $this->db->query($sql); - if (!$result) - { - $error++; - $this->error = $this->db->lasterror(); } }