From 940f77fb61a06f5789242be8b6c5ca35bd705c01 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 5 Sep 2021 12:15:11 +0200 Subject: [PATCH 01/78] fix entity knowledgerecord --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 6b192c4a83e..632317958c5 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -102,7 +102,8 @@ class KnowledgeRecord extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1), 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -119,6 +120,7 @@ class KnowledgeRecord extends CommonObject ); public $rowid; public $ref; + public $entity; public $date_creation; public $tms; public $last_main_doc; From 3ea23d75fec8990e51b638544e36ec0f2c42e2fd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 5 Sep 2021 10:17:23 +0000 Subject: [PATCH 02/78] Fixing style errors. --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 632317958c5..4c718589d7c 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -103,7 +103,7 @@ class KnowledgeRecord extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1), 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -120,7 +120,7 @@ class KnowledgeRecord extends CommonObject ); public $rowid; public $ref; - public $entity; + public $entity; public $date_creation; public $tms; public $last_main_doc; From f4786c8a0afdf13b14c6c8ca03eee689bbc3e075 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Sep 2021 19:46:40 +0200 Subject: [PATCH 03/78] Include ref into label of log history Conflicts: htdocs/holiday/card.php --- htdocs/holiday/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 729b4653f64..3ca389176e7 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -561,11 +561,11 @@ if (empty($reshook)) $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); $newSolde = ($soldeActuel - $nbopenedday); + $label = $langs->transnoentitiesnoconv("Holidays").' - '.$object->ref; - // On ajoute la modification dans le LOG - $result = $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); - if ($result < 0) - { + // The modification is added to the LOG + $result = $object->addLogCP($user->id, $object->fk_user, $label, $newSolde, $object->fk_type); + if ($result < 0) { $error++; setEventMessages(null, $object->errors, 'errors'); } From 77247ec43a3589312727478f00ba73e0301fe788 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Sep 2021 20:35:57 +0200 Subject: [PATCH 04/78] Add date valid/approval --- htdocs/holiday/list.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index f801a685d6a..84ba4a3a9d0 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -568,6 +568,12 @@ if ($resql) print ''; } + // End date + if (!empty($arrayfields['cp.date_valid']['checked'])) { + print ''; + print ''; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -584,7 +590,7 @@ if ($resql) print ''; } - // Create date + // Update date if (!empty($arrayfields['cp.tms']['checked'])) { print ''; @@ -617,6 +623,7 @@ if ($resql) if (!empty($arrayfields['duration']['checked'])) print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100'); if (!empty($arrayfields['cp.date_debut']['checked'])) print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['cp.date_fin']['checked'])) print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['cp.date_valid']['checked'])) print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -733,6 +740,18 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + if (!$i) $totalarray['nbfield']++; + } + /*if (!empty($arrayfields['cp.date_approve']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_approve), 'day'); + print ''; + if (!$i) $totalarray['nbfield']++; + }*/ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; From 1eb4975a761af9bfd20431c2376e85b9cc157da1 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 10 Sep 2021 11:44:58 +0200 Subject: [PATCH 05/78] fix: Bad date creation for project clone --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c5dd1045f03..aca817e0193 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1448,7 +1448,7 @@ class Project extends CommonObject } } - $clone_project->datec = $now; + $clone_project->date_c = $now; if (!$clone_note) { From 2fe85f2a86a2c6002608e816c25ee6d35fca21da Mon Sep 17 00:00:00 2001 From: lainwir3d Date: Sun, 12 Sep 2021 15:47:56 +0400 Subject: [PATCH 06/78] CLOSE #18689 REST API module: add api key generate / modify right. --- htdocs/core/ajax/security.php | 2 +- htdocs/core/modules/modApi.class.php | 14 ++++++++------ htdocs/user/card.php | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index 066e5b7812d..0056120c6bd 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -53,7 +53,7 @@ top_httphead(); // Registering the location of boxes if (isset($_GET['action']) && !empty($_GET['action'])) { - if ($_GET['action'] == 'getrandompassword' && $user->admin) { + if ($_GET['action'] == 'getrandompassword' && ($user->admin || $user->rights->api->apikey->generate)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generic = $_GET['generic'] ? true : false; echo getRandomPassword($generic); diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index ffd274c7096..60145c73e1d 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -134,16 +134,18 @@ class modApi extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module + $this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled) + $r = 0; // Add here list of permission defined by an id, a label, a boolean and two constant strings. // Example: - // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Générer / modifier la clé API des utilisateurs'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'apikey'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'generate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; // Main menu entries diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8d03d1d1cfb..f12060e9f50 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1805,7 +1805,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''."\n"; // API key - if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin)) { + if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->rights->api->apikey->generate)) { print ''.$langs->trans("ApiKey").''; print ''; if (!empty($object->api_key)) { @@ -2328,7 +2328,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "\n"; // API key - if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin)) { + if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->rights->api->apikey->generate)) { print ''.$langs->trans("ApiKey").''; print ''; print ''; From e424df644718e86f4730f37763af059902d3494d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 12 Sep 2021 12:15:33 +0000 Subject: [PATCH 07/78] Fixing style errors. --- htdocs/core/modules/modApi.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index 60145c73e1d..254e3f86983 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -135,7 +135,7 @@ class modApi extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module $this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled) - + $r = 0; // Add here list of permission defined by an id, a label, a boolean and two constant strings. From 3ea617ef6832c0acf9e3d11ebfaa42c929a25e2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Sep 2021 03:07:57 +0200 Subject: [PATCH 08/78] Fix missing trans --- htdocs/langs/en_US/admin.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 936fbcc5941..fb9fcb888ad 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1707,6 +1707,8 @@ FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailin FCKeditorForUserSignature=WYSIWIG creation/edition of user signature FCKeditorForMail=WYSIWIG creation/edition for all mail (except Tools->eMailing) FCKeditorForTicket=WYSIWIG creation/edition for tickets +FCKeditorForNotePublic=WYSIWIG creation/edition for public notes +FCKeditorForNotePrivate=WYSIWIG creation/edition for private notes ##### Stock ##### StockSetup=Stock module setup IfYouUsePointOfSaleCheckModule=If you use the Point of Sale module (POS) provided by default or an external module, this setup may be ignored by your POS module. Most POS modules are designed by default to create an invoice immediately and decrease stock irrespective of the options here. So if you need or not to have a stock decrease when registering a sale from your POS, check also your POS module setup. From ce9a10bd90b925f36bb82fdaaf41f4d8ff6f72d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Sep 2021 03:43:25 +0200 Subject: [PATCH 09/78] Fix description of some options --- htdocs/admin/fckeditor.php | 12 ++++++------ htdocs/core/modules/modFckeditor.class.php | 12 ++++++------ htdocs/langs/en_US/admin.lang | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 3388b649a67..d3c142b8e99 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -47,6 +47,8 @@ if (!$user->admin) { // Constant and translation of the module description $modules = array( + 'NOTE_PUBLIC' => 'FCKeditorForNotePublic', + 'NOTE_PRIVATE' => 'FCKeditorForNotePrivate', 'SOCIETE' => 'FCKeditorForCompany', 'PRODUCTDESC' => 'FCKeditorForProduct', 'DETAILS' => 'FCKeditorForProductDetails', @@ -54,11 +56,11 @@ $modules = array( 'MAILING' => 'FCKeditorForMailing', 'MAIL' => 'FCKeditorForMail', 'TICKET' => 'FCKeditorForTicket', - 'NOTE_PUBLIC' => 'FCKeditorForNotePublic', - 'NOTE_PRIVATE' => 'FCKeditorForNotePrivate', ); // Conditions for the option to be offered $conditions = array( + 'NOTE_PUBLIC' => 1, + 'NOTE_PRIVATE' => 1, 'SOCIETE' => 1, 'PRODUCTDESC' => (!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)), @@ -66,11 +68,11 @@ $conditions = array( 'MAILING' => !empty($conf->mailing->enabled), 'MAIL' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)), 'TICKET' => !empty($conf->ticket->enabled), - 'NOTE_PUBLIC' => 1, - 'NOTE_PRIVATE' => 1, ); // Picto $picto = array( + 'NOTE_PUBLIC' => 'generic', + 'NOTE_PRIVATE' => 'generic', 'SOCIETE' => 'generic', 'PRODUCTDESC' => 'product', 'DETAILS' => 'product', @@ -78,8 +80,6 @@ $picto = array( 'MAILING' => 'email', 'MAIL' => 'email', 'TICKET' => 'ticket', - 'NOTE_PUBLIC' => 'generic', - 'NOTE_PRIVATE' => 'generic', ); diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 7742051989e..480a936f656 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -69,12 +69,12 @@ class modFckeditor extends DolibarrModules // Constants $this->const = array(); - $this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for description and note (except products/services)"); - $this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for products/services description and note"); - $this->const[2] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings"); - $this->const[3] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities"); - $this->const[4] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature"); - $this->const[5] = array("FCKEDITOR_ENABLE_MAIL", "yesno", "1", "WYSIWIG for products details lines for all entities"); + $this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for description and note (except products/services)"); + $this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for products/services description and note"); + $this->const[2] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings"); + $this->const[3] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities"); + $this->const[4] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature"); + $this->const[5] = array("FCKEDITOR_ENABLE_MAIL", "yesno", "1", "WYSIWIG for products details lines for all entities"); $this->const[6] = array("FCKEDITOR_SKIN", "string", "moono-lisa", "Skin by default for fckeditor"); // Boxes diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fb9fcb888ad..ef1c1deb3b5 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1700,15 +1700,15 @@ FreeLegalTextOnDeliveryReceipts=Free text on delivery receipts ##### FCKeditor ##### AdvancedEditor=Advanced editor ActivateFCKeditor=Activate advanced editor for: -FCKeditorForCompany=WYSIWIG creation/edition of elements description and note (except products/services) -FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note +FCKeditorForNotePublic=WYSIWIG creation/edition of the field public notes of elements +FCKeditorForNotePrivate=WYSIWIG creation/edition of the field private notes of elements +FCKeditorForCompany=WYSIWIG creation/edition of the field description of elements (except products/services) +FCKeditorForProduct=WYSIWIG creation/edition of the field description of products/services FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formatting when building PDF files. FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing) FCKeditorForUserSignature=WYSIWIG creation/edition of user signature FCKeditorForMail=WYSIWIG creation/edition for all mail (except Tools->eMailing) FCKeditorForTicket=WYSIWIG creation/edition for tickets -FCKeditorForNotePublic=WYSIWIG creation/edition for public notes -FCKeditorForNotePrivate=WYSIWIG creation/edition for private notes ##### Stock ##### StockSetup=Stock module setup IfYouUsePointOfSaleCheckModule=If you use the Point of Sale module (POS) provided by default or an external module, this setup may be ignored by your POS module. Most POS modules are designed by default to create an invoice immediately and decrease stock irrespective of the options here. So if you need or not to have a stock decrease when registering a sale from your POS, check also your POS module setup. From d464922d717e4015f1ef308ef8f4421ae95b1672 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 13 Sep 2021 09:44:54 +0200 Subject: [PATCH 10/78] fix: LDAP Search LIMIT must be after ORDER BY --- htdocs/user/class/user.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0a352210d41..55be42de5e0 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -455,8 +455,9 @@ class User extends CommonObject } } - if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba - $sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1"; + if ($sid) { + // permet une recherche du user par son SID ActiveDirectory ou Samba + $sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."')"; } elseif ($login) { $sql .= " AND u.login = '".$this->db->escape($login)."'"; } elseif ($email) { @@ -466,6 +467,11 @@ class User extends CommonObject } $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities + if ($sid) { + // permet une recherche du user par son SID ActiveDirectory ou Samba + $sql .= ' '.$this->db->plimit(1); + } + $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); From 4762fd9c2e7bff8cdef7536c6c11693fc0e09353 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 13 Sep 2021 11:22:55 +0200 Subject: [PATCH 11/78] Close #18678 : Implemention of tags/categories KM --- htdocs/categories/class/categorie.class.php | 10 ++++-- htdocs/core/actions_addupdatedelete.inc.php | 9 +++++ .../modules/modKnowledgeManagement.class.php | 13 +++++++ .../install/mysql/migration/14.0.0-15.0.0.sql | 14 ++++++++ .../llx_categorie_ knowledgemanagement.sql | 21 +++++++++++ .../llx_categorie_knowledgemanagement.sql | 20 +++++++++++ .../class/knowledgerecord.class.php | 25 +++++++++++++ .../knowledgerecord_card.php | 35 +++++++++++++++++++ 8 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql create mode 100644 htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ba5515149d4..d5c135279bf 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -58,6 +58,7 @@ class Categorie extends CommonObject const TYPE_ACTIONCOMM = 'actioncomm'; const TYPE_WEBSITE_PAGE = 'website_page'; const TYPE_TICKET = 'ticket'; + const TYPE_KNOWLEDGEMANAGEMENT = 'knowledgemanagement'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -81,7 +82,8 @@ class Categorie extends CommonObject 'warehouse' => 9, 'actioncomm' => 10, 'website_page' => 11, - 'ticket' => 12 + 'ticket' => 12, + 'knowledgemanagement' => 13 ); /** @@ -102,7 +104,8 @@ class Categorie extends CommonObject 9 => 'warehouse', 10 => 'actioncomm', 11 => 'website_page', - 12 => 'ticket' + 12 => 'ticket', + 13 => 'knowledgemanagement' ); /** @@ -146,7 +149,8 @@ class Categorie extends CommonObject 'warehouse'=> 'Entrepot', 'actioncomm' => 'ActionComm', 'website_page' => 'WebsitePage', - 'ticket' => 'Ticket' + 'ticket' => 'Ticket', + 'knowledgemanagement' => 'KnowledgeRecord' ); /** diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 1154252a348..8364c139bae 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -131,6 +131,10 @@ if ($action == 'add' && !empty($permissiontoadd)) { $result = $object->create($user); if ($result > 0) { // Creation OK + if ($conf->categorie->enabled) { + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + } $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation header("Location: ".$urltogo); @@ -229,6 +233,11 @@ if ($action == 'update' && !empty($permissiontoadd)) { } } } + + if ($conf->categorie->enabled) { + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + } } // Fill array 'array_options' with data from add form diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index c3be87963c8..afd20a94a04 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -362,6 +362,19 @@ class modKnowledgeManagement extends DolibarrModules // 0=Menu for internal users, 1=external users, 2=both 'user'=>2 ); + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord', + 'type' => 'left', + 'titre' => 'Categories', + 'mainmenu' => 'ticket', + 'url' => '/categories/index.php?type=13', + 'langs' => 'knowledgemanagement', + 'position' => 112, + 'enabled' => '$conf->knowledgemanagement->enabled', + 'perms' => '$user->rights->knowledgemanagement->knowledgerecord->read', + 'target' => '', + 'user' => 0 + ); /* END MODULEBUILDER LEFTMENU KNOWLEDGERECORD */ diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index fb37c2f94d2..73a52a98220 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -84,3 +84,17 @@ DELETE FROM llx_menu WHERE type = 'top' AND module = 'cashdesk' AND mainmenu = ' INSERT INTO llx_c_action_trigger (code, label, description, elementtype, rang) values ('MEMBER_EXCLUDE', 'Member excluded', 'Executed when a member is excluded', 'member', 27); + +CREATE TABLE llx_categorie_knowledgemanagement +( + fk_categorie integer NOT NULL, + fk_knowledgemanagement integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; + +ALTER TABLE llx_categorie_knowledgemanagement ADD PRIMARY KEY pk_categorie_knowledgemanagement (fk_categorie, fk_knowledgemanagement); +ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_knowledgemanagement (fk_knowledgemanagement); + +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement (rowid); diff --git a/htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql new file mode 100644 index 00000000000..47769643bd5 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql @@ -0,0 +1,21 @@ +-- Copyright (C) 2021 EOXIA +-- +-- 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 +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +ALTER TABLE llx_categorie_knowledgemanagement ADD PRIMARY KEY pk_categorie_knowledgemanagement (fk_categorie, fk_knowledgemanagement); +ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_knowledgemanagement (fk_knowledgemanagement); + +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement (rowid); diff --git a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql new file mode 100644 index 00000000000..9489cca9652 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql @@ -0,0 +1,20 @@ +-- Copyright (C) 2021 EOXIA +-- +-- 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 +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_categorie_knowledgemanagement + fk_categorie integer NOT NULL, + fk_knowledgemanagement integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index df8044c8fc9..6394e22952c 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -456,6 +456,15 @@ class KnowledgeRecord extends CommonObject */ public function delete(User $user, $notrigger = false) { + $error = 0; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".((int) $this->rowid); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->error .= $this->db->lasterror(); + $errorflag = -1; + } return $this->deleteCommon($user, $notrigger); //return $this->deleteCommon($user, $notrigger, 1); } @@ -1036,6 +1045,22 @@ class KnowledgeRecord extends CommonObject return $error; } + + /** + * Sets object to supplied categories. + * + * Deletes object from existing categories not supplied. + * Adds it to non existing supplied categories. + * Existing categories are left untouch. + * + * @param int[]|int $categories Category or categories IDs + * @return void + */ + public function setCategories($categories) + { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + return parent::setCategoriesCommon($categories, Categorie::TYPE_KNOWLEDGEMANAGEMENT); + } } diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 08092696cab..45c821fe9f8 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "ticket", "other")); @@ -191,7 +192,16 @@ if ($action == 'create') { // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + if ($conf->categorie->enabled) { + $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); + if (count($cate_arbo)) { + // Categories + print ''.$langs->trans("Categories").''; + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print ""; + } + } // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; @@ -229,6 +239,24 @@ if (($id || $ref) && $action == 'edit') { // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + if ($conf->categorie->enabled) { + $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); + + if (count($cate_arbo)) { + // Categories + print ''.$langs->trans("Categories").''; + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT); + $arrayselected = array(); + if (is_array($cats)) { + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + } + print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print ""; + } + } // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; @@ -335,6 +363,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //unset($object->fields['fk_soc']); // Hide field already shown in banner include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + // Categories + if ($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); + print ""; + } + // Other attributes. Fields from hook formObjectOptions and Extrafields. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; From 35ca516ef6cbee280a7316c71b95fa4adbca5a6a Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 13 Sep 2021 11:24:43 +0200 Subject: [PATCH 12/78] update knowledgerecord_card --- htdocs/knowledgemanagement/knowledgerecord_card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 45c821fe9f8..4b35e3be1c3 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -192,6 +192,7 @@ if ($action == 'create') { // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + if ($conf->categorie->enabled) { $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); From 977fa996816ffad463b635cc8e7897d119cfbd11 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 13 Sep 2021 11:39:08 +0200 Subject: [PATCH 13/78] update knowledgemanagement.key name --- ...gemanagement.sql => llx_categorie_knowledgemanagement.key.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename htdocs/install/mysql/tables/{llx_categorie_ knowledgemanagement.sql => llx_categorie_knowledgemanagement.key.sql} (100%) diff --git a/htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql rename to htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.key.sql From 3ee258fefc5eee1766933f06ca6ff6ba840f6d63 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 13 Sep 2021 14:08:41 +0200 Subject: [PATCH 14/78] FIX Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50) --- htdocs/accountancy/class/accountancyexport.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 9749cd91d4d..1f987f61602 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -468,7 +468,7 @@ class AccountancyExport /** * Export format : CIEL (Format XIMPORT) * Format since 2003 compatible CIEL version > 2002 / Sage50 - * Last review for this format : 2021/07/28 Alexandre Spangaro (aspangaro@open-dsi.fr) + * Last review for this format : 2021-09-13 Alexandre Spangaro (aspangaro@open-dsi.fr) * * Help : https://sage50c.online-help.sage.fr/aide-technique/ * In sage software | Use menu : "Exchange" > "Importing entries..." @@ -496,7 +496,7 @@ class AccountancyExport $Tab = array(); $Tab['num_ecriture'] = str_pad($data->piece_num, 5); - $Tab['code_journal'] = str_pad($data->code_journal, 2); + $Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2); $Tab['date_ecriture'] = str_pad($date_document, 8, ' ', STR_PAD_LEFT); $Tab['date_echeance'] = str_pad($date_echeance, 8, ' ', STR_PAD_LEFT); $Tab['num_piece'] = str_pad(self::trunc($data->doc_ref, 12), 12); @@ -504,9 +504,9 @@ class AccountancyExport $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25); $Tab['montant'] = str_pad(price2fec(abs($data->debit - $data->credit)), 13, ' ', STR_PAD_LEFT); $Tab['type_montant'] = str_pad($data->sens, 1); - $Tab['vide'] = str_repeat(' ', 18); + $Tab['vide'] = str_repeat(' ', 18); // Analytical accounting - Not managed in Dolibarr $Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34); - $Tab['end'] = 'O2003'; + $Tab['end'] = 'O2003'; // 0 = EUR | 2003 = Format Ciel $Tab['end_line'] = $end_line; From 41f627b80d3daac1290b283b09cd6e5336b6ca5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Sep 2021 16:33:16 +0200 Subject: [PATCH 15/78] Prepare 14.0.3 --- 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 b37d9fdde7c..23852ae4918 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', '14.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '14.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From 0ad8dc28389b65aa4884b79dd04fdc38e4f57e37 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 13 Sep 2021 19:01:25 +0200 Subject: [PATCH 16/78] Update knowledgerecord.class.php --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 4c718589d7c..72ae3c17a5f 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -102,8 +102,8 @@ class KnowledgeRecord extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>20, 'index'=>1), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1), 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), From d7126e8d2425e89c5f5c30c2ba955b5be64b793e Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Tue, 14 Sep 2021 01:49:24 +0200 Subject: [PATCH 17/78] Update list.php $search_account and $search_paymenttype are not saved when sorting by any field --- htdocs/compta/paiement/list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index d1a94f5e690..75ff876ddc7 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -321,6 +321,12 @@ if ($search_company) { if ($search_amount != '') { $param .= '&search_amount='.urlencode($search_amount); } +if ($search_paymenttype) { + $param .= '&search_paymenttype='.urlencode($search_paymenttype); +} +if ($search_account) { + $param .= '&search_account='.urlencode($search_account); +} if ($search_payment_num) { $param .= '&search_payment_num='.urlencode($search_payment_num); } From cb37c42b5e186f11a3166c7ce168d3ea13fb456f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Sep 2021 04:50:05 +0200 Subject: [PATCH 18/78] NEW Customer invoice template list - Add input date from/to --- .../compta/facture/invoicetemplate_list.php | 136 ++++++++++++------ 1 file changed, 93 insertions(+), 43 deletions(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 660c7d7c4e4..e5c7fdafd0c 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -74,12 +74,22 @@ $search_montant_vat = GETPOST('search_montant_vat'); $search_montant_ttc = GETPOST('search_montant_ttc'); $search_payment_mode = GETPOST('search_payment_mode'); $search_payment_term = GETPOST('search_payment_term'); -$search_day = GETPOST('search_day', 'int'); -$search_year = GETPOST('search_year', 'int'); -$search_month = GETPOST('search_month', 'int'); -$search_day_date_when = GETPOST('search_day_date_when', 'int'); -$search_year_date_when = GETPOST('search_year_date_when', 'int'); -$search_month_date_when = GETPOST('search_month_date_when', 'int'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_when_startday = GETPOST('search_date_when_startday', 'int'); +$search_date_when_startmonth = GETPOST('search_date_when_startmonth', 'int'); +$search_date_when_startyear = GETPOST('search_date_when_startyear', 'int'); +$search_date_when_endday = GETPOST('search_date_when_endday', 'int'); +$search_date_when_endmonth = GETPOST('search_date_when_endmonth', 'int'); +$search_date_when_endyear = GETPOST('search_date_when_endyear', 'int'); +$search_date_when_start = dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear); // Use tzserver +$search_date_when_end = dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear); $search_recurring = GETPOST('search_recurring', 'int'); $search_frequency = GETPOST('search_frequency', 'alpha'); $search_unit_frequency = GETPOST('search_unit_frequency', 'alpha'); @@ -206,12 +216,22 @@ if (empty($reshook)) { $search_montant_ttc = ''; $search_payment_mode = ''; $search_payment_term = ''; - $search_day = ''; - $search_year = ''; - $search_month = ''; - $search_day_date_when = ''; - $search_year_date_when = ''; - $search_month_date_when = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_date_when_startday = ''; + $search_date_when_startmonth = ''; + $search_date_when_startyear = ''; + $search_date_when_endday = ''; + $search_date_when_endmonth = ''; + $search_date_when_endyear = ''; + $search_date_when_start = ''; + $search_date_when_end = ''; $search_recurring = ''; $search_frequency = ''; $search_unit_frequency = ''; @@ -326,8 +346,18 @@ if ($search_status != '' && $search_status >= -1) { $sql .= ' AND suspended = 1'; } } -$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year); -$sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when); +if ($search_date_start) { + $sql .= " AND f.date_last_gen >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND f.date_last_gen <= '".$db->idate($search_date_end)."'"; +} +if ($search_date_when_start) { + $sql .= " AND f.date_when >= '".$db->idate($search_date_when_start)."'"; +} +if ($search_date_when_end) { + $sql .= " AND f.date_when <= '".$db->idate($search_date_when_end)."'"; +} $sql .= $db->order($sortfield, $sortorder); @@ -357,23 +387,41 @@ if ($resql) { if ($socid > 0) { $param .= '&socid='.urlencode($socid); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); } - if ($search_day_date_when) { - $param .= '&search_day_date_when='.urlencode($search_day_date_when); + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); } - if ($search_month_date_when) { - $param .= '&search_month_date_when='.urlencode($search_month_date_when); + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); } - if ($search_year_date_when) { - $param .= '&search_year_date_when='.urlencode($search_year_date_when); + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } + if ($search_date_when_startday) { + $param .= '&search_date_when_startday='.urlencode($search_date_when_startday); + } + if ($search_date_when_startmonth) { + $param .= '&search_date_when_startmonth='.urlencode($search_date_when_startmonth); + } + if ($search_date_when_startyear) { + $param .= '&search_date_when_startyear='.urlencode($search_date_when_startyear); + } + if ($search_date_when_endday) { + $param .= '&search_date_when_endday='.urlencode($search_date_when_endday); + } + if ($search_date_when_endmonth) { + $param .= '&search_date_when_endmonth='.urlencode($search_date_when_endmonth); + } + if ($search_date_when_endyear) { + $param .= '&search_date_when_endyear='.urlencode($search_date_when_endyear); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -453,7 +501,7 @@ if ($resql) { print ''; print ''; } - // Thirpdarty + // Thirdparty if (!empty($arrayfields['s.nom']['checked'])) { print ''; } @@ -489,19 +537,19 @@ if ($resql) { } if (!empty($arrayfields['recurring']['checked'])) { // Recurring or not - print ''; + print ''; print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1); print ''; } if (!empty($arrayfields['f.frequency']['checked'])) { // Recurring or not - print ''; + print ''; print ''; print ''; } if (!empty($arrayfields['f.unit_frequency']['checked'])) { // Frequency unit - print ''; + print ''; print ''; print ''; } @@ -512,22 +560,24 @@ if ($resql) { } // Date invoice if (!empty($arrayfields['f.date_last_gen']['checked'])) { - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // Date next generation if (!empty($arrayfields['f.date_when']['checked'])) { - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year_date_when ? $search_year_date_when : -1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + print ''; + print '
'; + print $form->selectDate($search_date_when_start ? $search_date_when_start : -1, 'search_date_when_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_when_end ? $search_date_when_end : -1, 'search_date_when_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // Extra fields @@ -559,7 +609,7 @@ if ($resql) { } // Status if (!empty($arrayfields['status']['checked'])) { - print ''; + print ''; $liststatus = array( 0=>$langs->trans("Draft"), 1=>$langs->trans("Active"), From c967c5c6d4bf95575eb3ea9c3e746bb74d53b14f Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 14 Sep 2021 08:46:07 +0200 Subject: [PATCH 19/78] fix cancel redirects on product,warehouse cards --- htdocs/product/card.php | 2 +- htdocs/product/stock/card.php | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b4625d5602d..23fc0077c97 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -201,7 +201,7 @@ if ($reshook < 0) { } if (empty($reshook)) { - $backurlforlist = DOL_URL_ROOT.'/product/list.php'; + $backurlforlist = DOL_URL_ROOT.'/product/list.php?type='.$type; if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 2ffaf43ea90..fc394d6203a 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -104,6 +104,29 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/product/stock/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/product/stock/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + + if ($cancel) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + $action = ''; + } + // Ajout entrepot if ($action == 'add' && $user->rights->stock->creer) { $object->ref = (string) GETPOST("ref", "alpha"); From f3fcb7a48a45b16d16357ad1e0bc282e611042df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Sep 2021 16:59:49 +0200 Subject: [PATCH 20/78] Fix insertion of email templates --- htdocs/admin/mails_templates.php | 2 +- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 1ea8564808e..f6c7684e4fa 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -228,7 +228,7 @@ if (!empty($conf->agenda->enabled)) { $elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush')); } if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) { - $elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); + $elementList['conferenceorbooth'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); } if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) { $elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership')); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 89d0d2d0ce1..e9c8779ca4b 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -267,12 +267,13 @@ INSERT INTO llx_payment_vat (rowid, fk_tva, datec, datep, amount, fk_typepaiemen ALTER TABLE llx_tva ALTER COLUMN paye SET DEFAULT 0; -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailAskConf', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailAskBooth', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailSubsBooth', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailSubsEvent', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__

__(Sincerely)__

__MYCOMPANY_NAME__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailAttendees', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- Event organization +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__

__(Sincerely)__

__MYCOMPANY_NAME__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); ALTER TABLE llx_projet ADD COLUMN accept_conference_suggestions integer DEFAULT 0; ALTER TABLE llx_projet ADD COLUMN accept_booth_suggestions integer DEFAULT 0; From aeead15a62bb9a64e2c4a5d15193b05d32680653 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Sep 2021 17:07:29 +0200 Subject: [PATCH 21/78] css --- htdocs/admin/eventorganization.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 439a3d9cafa..44bd0b035c6 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -213,7 +213,7 @@ if ($action == 'edit') { print ''; print ''; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { @@ -309,7 +309,7 @@ if ($action == 'edit') { } else { if (!empty($arrayofparameters)) { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { From 21462d0b8211f474ee0218adbbc91fc469c5aebc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Sep 2021 17:24:53 +0200 Subject: [PATCH 22/78] Fix can reset filter in setup --- htdocs/admin/eventorganization.php | 2 +- htdocs/core/class/html.formcompany.class.php | 26 ++++++++++++------- .../class/conferenceorboothattendee.class.php | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 44bd0b035c6..c7b698ea9eb 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -264,7 +264,7 @@ if ($action == 'edit') { } elseif (preg_match('/thirdparty_type/', $val['type'])) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $formcompany = new FormCompany($db); - print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname); + print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname, 'customerorprospect', 'form', '', 1); } elseif ($val['type'] == 'securekey') { print ''; if (!empty($conf->use_javascript_ajax)) { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 3e2c3588405..94ab9caf5f9 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -998,16 +998,16 @@ class FormCompany extends Form /** * Return a HTML select for thirdparty type * - * @param int $selected selected value - * @param string $htmlname HTML select name - * @param string $htmlidname HTML select id - * @param string $typeinput HTML output - * @param string $morecss More css - * @return string HTML string + * @param int $selected Selected value + * @param string $htmlname HTML select name + * @param string $htmlidname HTML select id + * @param string $typeinput HTML output + * @param string $morecss More css + * @param string $allowempty Allow empty value or not + * @return string HTML string */ - public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '') + public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '', $allowempty = '') { - global $conf, $langs; if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->fournisseur->enabled)) { return '' ; @@ -1015,8 +1015,14 @@ class FormCompany extends Form $out = '"; } - print ''; + print ' + '."\n"; + } + // MESSAGE $msg = GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ''; print '\n"; // Can edit diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index f84fce1a2b6..1e2f7aaa63d 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -536,15 +536,16 @@ jQuery(document).ready(function () { jQuery(document).ready(function () { function initmorphy() { - if (jQuery("#morphy").val()==\'phy\') { - jQuery("#trcompany").hide(); - } - if (jQuery("#morphy").val()==\'mor\') { - jQuery("#trcompany").show(); - } + console.log("Call initmorphy"); + if (jQuery("#morphy").val() == \'phy\') { + jQuery("#trcompany").hide(); + } + if (jQuery("#morphy").val() == \'mor\') { + jQuery("#trcompany").show(); + } }; initmorphy(); - jQuery("#morphy").click(function() { + jQuery("#morphy").change(function() { initmorphy(); }); jQuery("#selectcountry_id").change(function() { @@ -592,21 +593,31 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { print ''; } -// Civility +// Company +print ''."\n"; +// Title print ''."\n"; // Lastname print ''."\n"; // Firstname print ''."\n"; +// EMail +print ''."\n"; +// Login +if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + print ''."\n"; + print ''."\n"; + print ''."\n"; +} // Gender print ''; print ''; -// Company -print ''."\n"; // Address print ''."\n"; @@ -618,7 +629,8 @@ print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'se print ''; // Country print ''; } -// EMail -print ''."\n"; -// Login -if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''."\n"; - print ''."\n"; - print ''."\n"; -} // Birthday print ''; print ''; print ''."\n"; - // Add specific fields used by Dolibarr foundation for example +// Add specific fields used by Dolibarr foundation for example +// TODO Move this into generic feature. if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); print ''."\n"; } + if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount From 29d9771b800c95bda46cf245540598a33835cc9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Sep 2021 19:39:22 +0200 Subject: [PATCH 33/78] Code comment --- htdocs/public/members/new.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 1e2f7aaa63d..b6498ca4032 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -605,7 +605,9 @@ print ''."\n"; // EMail -print ''."\n"; +print ''."\n"; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''."\n"; From eab4014f2086cf3e921388eaa6352d357b3f1103 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Sep 2021 19:42:07 +0200 Subject: [PATCH 34/78] Rename url --- htdocs/eventorganization/class/conferenceorbooth.class.php | 2 +- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +- .../{attendee_registration.php => attendee_register.php} | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename htdocs/public/eventorganization/{attendee_registration.php => attendee_register.php} (99%) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index a8b1dddda3a..ea2bf2eb87f 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -246,7 +246,7 @@ class ConferenceOrBooth extends ActionComm $result = parent::fetch($id, $ref, $ref_ext, $email_msgid); - $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_registration.php?id='.urlencode($id).'&type=conf'; + $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.urlencode($id).'&type=conf'; $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); $link_subscription .= '&securekey='.urlencode($encodedsecurekey); diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index a09d7aff6de..c46798b05b5 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -447,7 +447,7 @@ if ($projectid > 0) { print $langs->trans("PublicAttendeeSubscriptionGlobalPage"); //print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print '
'; $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); @@ -541,7 +560,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { //print ''; print ''; $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id; - $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2); + $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5'); $linksuggest .= '&securekey='.urlencode($encodedsecurekey); //print ''; $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_registration.php?id='.$projectstatic->id.'&type=global'; - $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2); + $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5'); $link_subscription .= '&securekey='.urlencode($encodedsecurekey); //print '
'; + print '
'; $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 7dd52818798..faa2013ceb5 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -142,17 +142,10 @@ VoteOk = Your vote has been accepted. AlreadyVoted = You have already voted for this event. VoteError = An error has occurred during the vote, please try again. -# -# SubscriptionOk page -# -SubscriptionOk = Your subscription has been validated -# -# Subscription validation mail -# +SubscriptionOk = Your registration has been validated ConfAttendeeSubscriptionConfirmation = Confirmation of your subscription to an event -# -# Payment page -# Attendee = Attendee PaymentConferenceAttendee = Conference attendee payment PaymentBoothLocation = Booth location payment + +RegistrationAndPaymentWereAlreadyRecorder=A registration and a payment were already recorded for the email %s diff --git a/htdocs/public/eventorganization/attendee_registration.php b/htdocs/public/eventorganization/attendee_registration.php index 385152e420a..fdfd9a3f2e3 100644 --- a/htdocs/public/eventorganization/attendee_registration.php +++ b/htdocs/public/eventorganization/attendee_registration.php @@ -279,10 +279,16 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen // At this point, we have an existing $confattendee. It may not be linked to a thirdparty. //var_dump($confattendee); - // If the attendee has already been paid - if (!empty($confattendee->date_subscription)) { - $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); + // If the registration has already been paid for this attendee + if (!empty($confattendee->date_subscription) && !empty($confattendee->amount)) { + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'master'); $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl); + + $mesg = $langs->trans("RegistrationAndPaymentWereAlreadyRecorder", $email); + setEventMessages($mesg, null, 'mesgs'); + + $db->commit(); + Header("Location: ".$redirection); exit; } @@ -359,6 +365,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); + // Update attendee country to match country of thirdparty $confattendee->fk_soc = $thirdparty->id; $confattendee->update($user); } @@ -370,6 +377,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $outputlangs = $langs; // TODO Use default language of $thirdparty->default_lang to build $outputlang + // Get product to use for invoice $productforinvoicerow = new Product($db); $productforinvoicerow->id = 0; @@ -378,6 +386,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION); } + // Create invoice if ($resultprod < 0) { $error++; $errmsg .= $productforinvoicerow->error; @@ -442,6 +451,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $redirection .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } + Header("Location: ".$redirection); exit; } else { From 724badb522ebfdfb155969d9b7446b9ead86f5b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Sep 2021 13:29:19 +0200 Subject: [PATCH 28/78] Fix deletion of shipment when there is batch record --- htdocs/expedition/class/expedition.class.php | 8 +++----- htdocs/expedition/class/expeditionbatch.class.php | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 752da8aca04..0d505a46007 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1455,11 +1455,9 @@ class Expedition extends CommonObject } } - // delete batch expedition line - if (!$error && $conf->productbatch->enabled) - { - if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) - { + // delete batch expedition line (we try deletion even if module not enabled in case of the module were enabled and disabled previously) + if (!$error) { + if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index 637f9dd749c..0cf9a3a68e8 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -153,10 +153,8 @@ class ExpeditionLineBatch extends CommonObject */ public static function deletefromexp($db, $id_expedition) { - $id_expedition = (int) $id_expedition; - $sql = "DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element; - $sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".$id_expedition.")"; + $sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".((int) $id_expedition).")"; dol_syslog(__METHOD__, LOG_DEBUG); if ($db->query($sql)) From b26e9be36fda9a0b9cd28d42179e95e06db60d6e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 15 Sep 2021 15:36:57 +0200 Subject: [PATCH 29/78] Close #18677 : new show articles of KM --- htdocs/core/ajax/fetchKnowledgeRecord.php | 80 +++++++++++++++++++++ htdocs/core/class/html.formticket.class.php | 59 +++++++++++++++ htdocs/langs/en_US/ticket.lang | 3 +- htdocs/langs/fr_FR/ticket.lang | 1 + 4 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 htdocs/core/ajax/fetchKnowledgeRecord.php diff --git a/htdocs/core/ajax/fetchKnowledgeRecord.php b/htdocs/core/ajax/fetchKnowledgeRecord.php new file mode 100644 index 00000000000..a1f8ae6a1e9 --- /dev/null +++ b/htdocs/core/ajax/fetchKnowledgeRecord.php @@ -0,0 +1,80 @@ +. + */ + +/** + * \file /htdocs/core/ajax/fetchKnowledgeRecord.php + * \brief File to make Ajax action on Knowledge Management + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); // Disables token renewal +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} +if (!defined('NOREQUIRESOC')) { + define('NOREQUIRESOC', '1'); +} + +include '../../main.inc.php'; + +$action = GETPOST('action', 'aZ09'); +$idticketgroup = GETPOST('idticketgroup', 'aZ09'); +$idticketgroup = GETPOST('idticketgroup', 'aZ09'); +$lang = GETPOST('lang', 'aZ09'); + +/* + * Actions + */ + +// None + + +/* + * View + */ + +if ($action == "getKnowledgeRecord") { + $response = ''; + $sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,l.url,ctc.code"; + $sql .= " FROM ".MAIN_DB_PREFIX."links as l"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ON kr.rowid = l.objectid"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category"; + $sql .= " WHERE ctc.code = '".$db->escape($idticketgroup)."'"; + $sql .= " AND ctc.active = 1 AND ctc.public = 1 AND (kr.lang = '".$db->escape($lang)."' OR kr.lang = 0)"; + $sql .= " AND kr.status = 1"; + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + $response = array(); + while ($i < $num) { + $obj = $db->fetch_object($resql); + $response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$obj->url); + $i++; + } + } else { + dol_print_error($db); + } + $response =json_encode($response); + echo $response; +} diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index d486805cf46..496778525d1 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -243,6 +243,65 @@ class FormTicket } } + if ($conf->knowledgemanagement->enabled) { + // KM Articles + print '
'; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 6243e98fdc9..cad00ad21f9 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -318,4 +318,5 @@ BoxNoTicketLastXDays=No new tickets the last %s days BoxNumberOfTicketByDay=Number of new tickets by day BoxNewTicketVSClose=Number of today's new tickets versus today's closed tickets TicketCreatedToday=Ticket created today -TicketClosedToday=Ticket closed today \ No newline at end of file +TicketClosedToday=Ticket closed today +KMFoundForTicketGroup=We found topics and FAQs that may answers your question, thanks to check them before submitting the ticket diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index b166e963caf..4b777ff33ca 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -319,3 +319,4 @@ BoxNumberOfTicketByDay=Nombre de nouveaux tickets par jour BoxNewTicketVSClose=Nombre de nouveaux tickets aujourd’hui par rapport aux tickets fermés aujourd’hui TicketCreatedToday=Ticket créé aujourd'hui TicketClosedToday=Ticket fermé aujourd'hui +KMFoundForTicketGroup=Nous avons trouvé des sujets et des FAQ susceptibles de répondre à votre question, merci de les vérifier avant de soumettre le ticket From 2c73c19bd5340f61a1b160f44964b094d7ad1a1c Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Wed, 15 Sep 2021 18:26:32 +0200 Subject: [PATCH 30/78] fix ldap passw bug with activedirectory Fix to avoid LDAP Error: 53 (Unwilling to perform) on Samba4 AD --- htdocs/core/class/ldap.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 0e8fd3ee7b4..eb4f200f5fd 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -486,6 +486,7 @@ class Ldap // For better compatibility with Samba4 AD if ($this->serverType == "activedirectory") { unset($info['cn']); // To avoid error : Operation not allowed on RDN (Code 67) + $info['unicodePwd'] = mb_convert_encoding("\"".$info['unicodePwd']."\"", "UTF-16LE", "UTF-8"); // To avoid error : LDAP Error: 53 (Unwilling to perform) } $result = @ldap_modify($this->connection, $dn, $info); From 3f7a75b0a3a8165bcd2c609a323b581b72c8add6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Sep 2021 19:02:17 +0200 Subject: [PATCH 31/78] FIX translation into email for member at membership validation. --- htdocs/adherents/card.php | 8 ++++---- htdocs/adherents/class/adherent.class.php | 4 ++-- htdocs/install/mysql/data/llx_c_email_templates.sql | 2 +- htdocs/societe/class/societe.class.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 7dd164c38b5..56643d80632 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -645,7 +645,7 @@ if (empty($reshook)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); + $outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); // Get email content from template $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; @@ -716,7 +716,7 @@ if (empty($reshook)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); + $outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); // Get email content from template $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; @@ -787,7 +787,7 @@ if (empty($reshook)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); + $outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); // Get email content from template $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION; @@ -1506,7 +1506,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); + $outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); // Get email content from template $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index df9e35651c2..b7f2810912b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1900,8 +1900,8 @@ class Adherent extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; $sql .= " statut = ".self::STATUS_VALIDATED; $sql .= ", datevalid = '".$this->db->idate($now)."'"; - $sql .= ", fk_user_valid=".$user->id; - $sql .= " WHERE rowid = ".$this->id; + $sql .= ", fk_user_valid=".((int) $user->id); + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::validate", LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index 4005506e887..69a41a5b3ef 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -29,7 +29,7 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civility)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -- Recruiting INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 69aecc885c7..ff6e9474d34 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1759,7 +1759,7 @@ class Societe extends CommonObject $this->country_id = $obj->country_id; $this->country_code = $obj->country_id ? $obj->country_code : ''; - $this->country = $obj->country_id ? ($langs->transnoentities('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : ''; + $this->country = $obj->country_id ? (($langs->transnoentities('Country'.$obj->country_code) != 'Country'.$obj->country_code) ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : ''; $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; From 4a2d3a55d41645e50d9f5e946895f7fb4f9f03e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Sep 2021 19:33:30 +0200 Subject: [PATCH 32/78] FIX Selection of type "people" for membership must hide the company --- htdocs/adherents/admin/website.php | 4 +-- htdocs/public/members/new.php | 46 +++++++++++++++++------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index bb320e9f48a..e99e20452cc 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -56,7 +56,7 @@ if ($action == 'setMEMBER_ENABLE_PUBLIC') { if ($action == 'update') { $public = GETPOST('MEMBER_ENABLE_PUBLIC'); - $amount = GETPOST('MEMBER_NEWFORM_AMOUNT'); + $amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2); $editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE'); $forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int'); @@ -205,7 +205,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { print '
'; print $langs->trans("DefaultAmount"); print ''; - print ''; + print ''; print "
'.$langs->trans("Company").''; +print img_picto('', 'company', 'class="pictofixedwidth"'); +print '
'.$langs->trans('UserTitle').''; print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').'
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordAgain").' *
'.$langs->trans("Gender").''; $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); print '
'.$langs->trans("Company").'
'.$langs->trans("Address").''."\n"; print '
'.$langs->trans('Country').''; -$country_id = GETPOST('country_id'); +print img_picto('', 'country', 'class="pictofixedwidth"'); +$country_id = GETPOST('country_id', 'int'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); } @@ -644,14 +656,6 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { } print '
'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').'
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordAgain").' *
'.$langs->trans("DateOfBirth").''; print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); @@ -669,7 +673,8 @@ print ''.$langs->trans("Comments").'
'.$langs->trans("TurnoverOrBudget").' *'; @@ -712,6 +717,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { '; print '
'.$langs->trans("Lastname").' * // Firstname print '
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').'
'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').''; +//print img_picto('', 'email', 'class="pictofixedwidth"'); +print '
'.$langs->trans("Login").' *
'; - $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_registration.php?id='.$project->id.'&type=global'; + $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$project->id.'&type=global'; $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 'md5'); $link_subscription .= '&securekey='.urlencode($encodedsecurekey); //print ''; - $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_registration.php?id='.$projectstatic->id.'&type=global'; + $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$projectstatic->id.'&type=global'; $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2); $link_subscription .= '&securekey='.urlencode($encodedsecurekey); //print ''; - $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_registration.php?id='.$projectstatic->id.'&type=global'; + $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$projectstatic->id.'&type=global'; $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5'); $link_subscription .= '&securekey='.urlencode($encodedsecurekey); //print '