From 4504c53007da272d57f6a3d5c48b1166e01cd93c Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Nov 2022 14:14:03 +0530 Subject: [PATCH 01/55] #22941 --- htdocs/core/actions_sendmails.inc.php | 8 ++++---- htdocs/core/class/html.formmail.class.php | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index f0ef66eb78b..dcdd6be9bad 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -34,7 +34,7 @@ * Add file in email form */ if (GETPOST('addfile', 'alpha')) { - $trackid = GETPOST('trackid', 'aZ09'); + $trackid = GETPOST('track_id', 'aZ09'); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -50,7 +50,7 @@ if (GETPOST('addfile', 'alpha')) { * Remove file in email form */ if (GETPOST('removedfile') && !GETPOST('removAll')) { - $trackid = GETPOST('trackid', 'aZ09'); + $trackid = GETPOST('track_id', 'aZ09'); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -68,7 +68,7 @@ if (GETPOST('removedfile') && !GETPOST('removAll')) { * Remove all files in email form */ if (GETPOST('removAll', 'alpha')) { - $trackid = GETPOST('trackid', 'aZ09'); + $trackid = GETPOST('track_id', 'aZ09'); $listofpaths = array(); $listofnames = array(); @@ -105,7 +105,7 @@ if (GETPOST('removAll', 'alpha')) { */ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPOST('removAll') && !GETPOST('removedfile') && !GETPOST('cancel') && !GETPOST('modelselected')) { if (empty($trackid)) { - $trackid = GETPOST('trackid', 'aZ09'); + $trackid = GETPOST('track_id', 'aZ09'); } $subject = ''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 74f0eadfdf2..2f90a277f36 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -196,6 +196,8 @@ class FormMail extends Form $this->withbodyreadonly = 0; $this->withdeliveryreceiptreadonly = 0; $this->withfckeditor = -1; // -1 = Auto + + $this->trackid = GETPOST('track_id', 'aZ09'); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 81b4f6dce1492837d0ce1caaea9e576341a2aa7d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 25 Nov 2022 16:34:55 +0530 Subject: [PATCH 02/55] #22947 --- htdocs/core/actions_sendmails.inc.php | 8 ++++---- htdocs/core/class/html.formmail.class.php | 2 -- htdocs/core/class/html.formticket.class.php | 6 ++++++ htdocs/ticket/class/ticket.class.php | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index dcdd6be9bad..f0ef66eb78b 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -34,7 +34,7 @@ * Add file in email form */ if (GETPOST('addfile', 'alpha')) { - $trackid = GETPOST('track_id', 'aZ09'); + $trackid = GETPOST('trackid', 'aZ09'); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -50,7 +50,7 @@ if (GETPOST('addfile', 'alpha')) { * Remove file in email form */ if (GETPOST('removedfile') && !GETPOST('removAll')) { - $trackid = GETPOST('track_id', 'aZ09'); + $trackid = GETPOST('trackid', 'aZ09'); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -68,7 +68,7 @@ if (GETPOST('removedfile') && !GETPOST('removAll')) { * Remove all files in email form */ if (GETPOST('removAll', 'alpha')) { - $trackid = GETPOST('track_id', 'aZ09'); + $trackid = GETPOST('trackid', 'aZ09'); $listofpaths = array(); $listofnames = array(); @@ -105,7 +105,7 @@ if (GETPOST('removAll', 'alpha')) { */ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPOST('removAll') && !GETPOST('removedfile') && !GETPOST('cancel') && !GETPOST('modelselected')) { if (empty($trackid)) { - $trackid = GETPOST('track_id', 'aZ09'); + $trackid = GETPOST('trackid', 'aZ09'); } $subject = ''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 2f90a277f36..74f0eadfdf2 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -196,8 +196,6 @@ class FormMail extends Form $this->withbodyreadonly = 0; $this->withdeliveryreceiptreadonly = 0; $this->withfckeditor = -1; // -1 = Auto - - $this->trackid = GETPOST('track_id', 'aZ09'); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index b5ba0b0208e..02ee41ebd4b 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1361,6 +1361,12 @@ class FormTicket print ''; print ''; print ''; + if (!empty($this->trackid)) { + print ''; + } else { + print ''; + $keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id; // track_id instead of trackid + } foreach ($this->param as $key => $value) { print ''; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index eda4c06aa1e..42152a76a55 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2366,7 +2366,7 @@ class Ticket extends CommonObject $maxheightmini = 72; $formmail = new FormMail($this->db); - + $formmail->trackid = $this->trackid; $attachedfiles = $formmail->get_attached_files(); $filepath = $attachedfiles['paths']; @@ -2496,7 +2496,8 @@ class Ticket extends CommonObject $object->subject = GETPOST('subject', 'alphanohtml'); $object->message = GETPOST("message", "restricthtml"); $object->private = GETPOST("private_message", "alpha"); - + $object->trackid = GETPOST('trackid', 'aZ09'); + $send_email = GETPOST('send_email', 'int'); // Copy attached files (saved into $_SESSION) as linked files to ticket. Return array with final name used. From dec546eec0e7f2b2dadb02e81b99b316e217afca Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 25 Nov 2022 11:05:58 +0000 Subject: [PATCH 03/55] Fixing style errors. --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 42152a76a55..722d991662e 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2497,7 +2497,7 @@ class Ticket extends CommonObject $object->message = GETPOST("message", "restricthtml"); $object->private = GETPOST("private_message", "alpha"); $object->trackid = GETPOST('trackid', 'aZ09'); - + $send_email = GETPOST('send_email', 'int'); // Copy attached files (saved into $_SESSION) as linked files to ticket. Return array with final name used. From cd2fc2347dd76a65b08253374b259669edeb4c1a Mon Sep 17 00:00:00 2001 From: root Date: Sat, 26 Nov 2022 14:29:00 +0530 Subject: [PATCH 04/55] #23011 --- htdocs/accountancy/admin/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 02b95cfd043..1ba9ff540d0 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -315,7 +315,7 @@ if ($action == 'create') { // Account number print ''.$langs->trans("AccountNumber").''; - print ''; + print ''; // Label print ''.$langs->trans("Label").''; From 871789c49921a7a16b0ac32aaf03e9b7a64f4daf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 1 Dec 2022 13:20:34 +0530 Subject: [PATCH 05/55] Feature Request : #23062 --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 1c8c0b8698f..a68d81d2d92 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2234,7 +2234,7 @@ class EmailCollector extends CommonObject $tickettocreate->fk_user_create = $user->id; $tickettocreate->datec = $date; $tickettocreate->fk_project = $projectstatic->id; - $tickettocreate->notify_tiers_at_create = 0; + $tickettocreate->notify_tiers_at_create = empty($conf->global->TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION) ? 0 : 1; $tickettocreate->note_private = $descriptionfull; $tickettocreate->entity = $conf->entity; $tickettocreate->email_msgid = $msgid; From 12a3d7432e4d503c45e1c943ea09bfa50a91a61d Mon Sep 17 00:00:00 2001 From: root Date: Thu, 1 Dec 2022 13:32:52 +0530 Subject: [PATCH 06/55] Feature Request : #23062 --- htdocs/accountancy/admin/card.php | 2 +- htdocs/core/class/html.formticket.class.php | 6 ------ htdocs/ticket/class/ticket.class.php | 3 +-- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 1ba9ff540d0..02b95cfd043 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -315,7 +315,7 @@ if ($action == 'create') { // Account number print ''.$langs->trans("AccountNumber").''; - print ''; + print ''; // Label print ''.$langs->trans("Label").''; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 02ee41ebd4b..b5ba0b0208e 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1361,12 +1361,6 @@ class FormTicket print ''; print ''; print ''; - if (!empty($this->trackid)) { - print ''; - } else { - print ''; - $keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id; // track_id instead of trackid - } foreach ($this->param as $key => $value) { print ''; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 722d991662e..eda4c06aa1e 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2366,7 +2366,7 @@ class Ticket extends CommonObject $maxheightmini = 72; $formmail = new FormMail($this->db); - $formmail->trackid = $this->trackid; + $attachedfiles = $formmail->get_attached_files(); $filepath = $attachedfiles['paths']; @@ -2496,7 +2496,6 @@ class Ticket extends CommonObject $object->subject = GETPOST('subject', 'alphanohtml'); $object->message = GETPOST("message", "restricthtml"); $object->private = GETPOST("private_message", "alpha"); - $object->trackid = GETPOST('trackid', 'aZ09'); $send_email = GETPOST('send_email', 'int'); From 1eb3c69acd8befeb004ce35ec1f4796b5d0e7937 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 9 Dec 2022 15:44:36 +0100 Subject: [PATCH 07/55] NEW inventory without virtual products (kits) --- htdocs/product/inventory/class/inventory.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 9acc4232490..a45d82e12b0 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -302,6 +302,13 @@ class Inventory extends CommonObject $sql .= " AND cp.fk_categorie IN (".$this->db->sanitize($this->categories_product).")"; $sql .= ")"; } + if (getDolGlobalInt('PRODUIT_SOUSPRODUITS')) { + $sql .= " AND NOT EXISTS ("; + $sql .= " SELECT pa.rowid"; + $sql .= " FROM ".$this->db->prefix()."product_association as pa"; + $sql .= " WHERE pa.fk_product_pere = ps.fk_product"; + $sql .= ")"; + } $inventoryline = new InventoryLine($this->db); From 5377e72593266784eba19b23ea4f2a96462c211c Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 25 Jul 2023 20:32:13 +0200 Subject: [PATCH 08/55] make button add property --- htdocs/modulebuilder/index.php | 75 ++- .../template/myobject_property_card.php | 631 ++++++++++++++++++ htdocs/theme/eldy/global.inc.php | 2 +- 3 files changed, 678 insertions(+), 30 deletions(-) create mode 100644 htdocs/modulebuilder/template/myobject_property_card.php diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 4bc7deca258..d5172d7f6fb 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -311,6 +311,7 @@ if ($dirins && $action == 'initmodule' && $modulename) { dol_delete_file($destdir.'/myobject_document.php'); dol_delete_file($destdir.'/myobject_agenda.php'); dol_delete_file($destdir.'/myobject_list.php'); + dol_delete_file($destdir.'/myobject_property_card.php'); dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php'); dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.sql'); @@ -1239,6 +1240,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { 'myobject_document.php'=>strtolower($objectname).'_document.php', 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', 'myobject_list.php'=>strtolower($objectname).'_list.php', + 'myobject_property_card.php'=>strtolower($objectname).'_property_card.php', 'admin/myobject_extrafields.php'=>'admin/'.strtolower($objectname).'_extrafields.php', 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', //'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', @@ -2621,6 +2623,9 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int')) { } } +if ($dirins && $action == "create_property") { +} + /* * View */ @@ -3440,8 +3445,7 @@ if ($module == 'initmodule') { // Print form confirm print $formconfirm; } - - if ($action != 'editfile' || empty($file)) { + if ($action != 'editfile' || empty($file) ) { try { //$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; @@ -3759,33 +3763,44 @@ if ($module == 'initmodule') { if (!empty($properties)) { // Line to add a property print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // //print ''; + // print ''; + // print ''; + // print ''; + // print ''; + // print ''; + for ($i = 0; $i<22;$i++) { + print ''; + } + $mod = strtolower($module); + $obj = strtolower($tabobj); + if ($user->hasRight("$mod", "$obj", "write")) { + $newcardbutton .= dolGetButtonTitle($langs->trans('NewProperty'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?action=create_property&tab=objects&module='.urlencode($module).'&tabobj='.urlencode($tabobj)); + print ''; + print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', '', '', '', '', 0, '', 0, $newcardbutton, '', '', 0, 0, 1); + print ''; + } + print ''; // List of existing properties foreach ($properties as $propkey => $propval) { /* If from Reflection @@ -3989,6 +4004,8 @@ if ($module == 'initmodule') { print ''; } print ''; + if ($action == 'create_property') { + } } } else { if ($tab == 'specifications') { diff --git a/htdocs/modulebuilder/template/myobject_property_card.php b/htdocs/modulebuilder/template/myobject_property_card.php new file mode 100644 index 00000000000..b9c3be569aa --- /dev/null +++ b/htdocs/modulebuilder/template/myobject_property_card.php @@ -0,0 +1,631 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 . + */ + +/** + * \file htdocs/modulebuilder/template/myobject_card.php + * \ingroup mymodule + * \brief Page to create/edit/view myobject + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. +//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler +//if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies +//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification +//if (! defined('NOSESSION')) define('NOSESSION', '1'); // Disable session + +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +} +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { + $i--; $j--; +} +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +} +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { + $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +} +// Try main.inc.php using relative path +if (!$res && file_exists("../main.inc.php")) { + $res = @include "../main.inc.php"; +} +if (!$res && file_exists("../../main.inc.php")) { + $res = @include "../../main.inc.php"; +} +if (!$res && file_exists("../../../main.inc.php")) { + $res = @include "../../../main.inc.php"; +} +if (!$res) { + die("Include of main fails"); +} + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +dol_include_once('/mymodule/class/myobject.class.php'); +dol_include_once('/mymodule/lib/mymodule_myobject.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("mymodule@mymodule", "other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$lineid = GETPOST('lineid', 'int'); + +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used +$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); +$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); + +if (!empty($backtopagejsfields)) { + $tmpbacktopagejsfields = explode(':', $backtopagejsfields); + $dol_openinpopup = $tmpbacktopagejsfields[0]; +} + +// Initialize technical objects +$object = new MyObject($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('myobjectcard', 'globalcard')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Initialize array of search criterias +$search_all = GETPOST("search_all", 'alpha'); +$search = array(); +foreach ($object->fields as $key => $val) { + if (GETPOST('search_'.$key, 'alpha')) { + $search[$key] = GETPOST('search_'.$key, 'alpha'); + } +} + +if (empty($action) && empty($id) && empty($ref)) { + $action = 'view'; +} + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. + +// There is several ways to check permission. +// Set $enablepermissioncheck to 1 to enable a minimum low level of checks +$enablepermissioncheck = 0; +if ($enablepermissioncheck) { + $permissiontoread = $user->hasRight('mymodule', 'myobject', 'read'); + $permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + $permissiontodelete = $user->hasRight('mymodule', 'myobject', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); + $permissionnote = $user->hasRight('mymodule', 'myobject', 'write'); // Used by the include of actions_setnotes.inc.php + $permissiondellink = $user->hasRight('mymodule', 'myobject', 'write'); // Used by the include of actions_dellink.inc.php +} else { + $permissiontoread = 1; + $permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + $permissiontodelete = 1; + $permissionnote = 1; + $permissiondellink = 1; +} + +$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1].'/myobject'; + +// Security check (enable the most restrictive one) +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0); +//restrictedArea($user, $object->module, $object, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft); +if (!isModEnabled("mymodule")) { + accessforbidden(); +} +if (!$permissiontoread) { + accessforbidden(); +} + + +/* + * Actions + */ + +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + $error = 0; + + $backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1); + + 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_buildpath('/mymodule/myobject_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + + $triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record + + // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + + // Actions when linking object each other + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; + + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + + // Action to move up and down lines of object + //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; + + // Action to build doc + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + if ($action == 'set_thirdparty' && $permissiontoadd) { + $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); + } + if ($action == 'classin' && $permissiontoadd) { + $object->setProject(GETPOST('projectid', 'int')); + } + + // Actions to send emails + $triggersendname = 'MYMODULE_MYOBJECT_SENTBYMAIL'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; + $trackid = 'myobject'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; +} + + + + +/* + * View + */ + +$form = new Form($db); +$formfile = new FormFile($db); +$formproject = new FormProjets($db); + +$title = $langs->trans("MyObject"); +$help_url = ''; +llxHeader('', $title, $help_url); + +// Example : Adding jquery code +// print ''; + + +// Part to create +if ($action == 'create') { + if (empty($permissiontoadd)) { + accessforbidden('NotEnoughPermissions', 0, 1); + } + + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("MyObject")), '', 'object_'.$object->picto); + + print '
'; + print ''; + print ''; + if ($backtopage) { + print ''; + } + if ($backtopageforcancel) { + print ''; + } + if ($backtopagejsfields) { + print ''; + } + if ($dol_openinpopup) { + print ''; + } + + print dol_get_fiche_head(array(), ''); + + // Set some default values + //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + + print '
'."\n"; + + print dol_get_fiche_end(); + + print $form->buttonsSaveCancel("Create"); + + print '
'; + + //dol_set_focus('input[name="ref"]'); +} + +// Part to edit record +if (($id || $ref) && $action == 'edit') { + print load_fiche_titre($langs->trans("MyObject"), '', 'object_'.$object->picto); + + print '
'; + print ''; + print ''; + print ''; + if ($backtopage) { + print ''; + } + if ($backtopageforcancel) { + print ''; + } + + print dol_get_fiche_head(); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + print dol_get_fiche_end(); + + print $form->buttonsSaveCancel(); + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { + $head = myobjectPrepareHead($object); + + print dol_get_fiche_head($head, 'card', $langs->trans("MyObject"), -1, $object->picto, 0, '', '', 0, '', 1); + + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); + } + // Confirmation to delete line + if ($action == 'deleteline') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + } + + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + + // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) + if ($action == 'xxx') { + $text = $langs->trans('ConfirmActionMyObject', $object->ref); + /*if (isModEnabled('notification')) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('MYOBJECT_CLOSE', $object->socid, $object); + }*/ + + $formquestion = array(); + + /* + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + } + + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + /* + // Ref customer + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); + // Thirdparty + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + } + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
'; + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } + } + } + */ + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field + //unset($object->fields['fk_project']); // Hide field already shown in banner + //unset($object->fields['fk_soc']); // Hide field already shown in banner + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + // Other attributes. Fields from hook formObjectOptions and Extrafields. + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'; + print '
'; + print '
'; + + print '
'; + + print dol_get_fiche_end(); + + + /* + * Lines + */ + + if (!empty($object->table_element_line)) { + // Show object lines + $result = $object->getLinesArray(); + + print '
+ + + + + + '; + + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { + print ''; + } + + if (!empty($object->lines)) { + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1); + } + + // Form to add new line + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { + if ($action != 'editline') { + // Add products/services form + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $mysoc, $soc); + } + } + + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { + print '
'; + } + print '
'; + + print "
\n"; + } + + + // Buttons for actions + + if ($action != 'presend' && $action != 'editline') { + print '
'."\n"; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + + if (empty($reshook)) { + // Send + if (empty($user->socid)) { + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + } + + // Back to draft + if ($object->status == $object::STATUS_VALIDATED) { + print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); + } + + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); + + // Validate + if ($object->status == $object::STATUS_DRAFT) { + if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); + } else { + $langs->load("errors"); + print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); + } + } + + // Clone + if ($permissiontoadd) { + print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd); + } + + /* + if ($permissiontoadd) { + if ($object->status == $object::STATUS_ENABLED) { + print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd); + } else { + print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd); + } + } + if ($permissiontoadd) { + if ($object->status == $object::STATUS_VALIDATED) { + print dolGetButtonAction('', $langs->trans('Cancel'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); + } else { + print dolGetButtonAction('', $langs->trans('Re-Open'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken(), '', $permissiontoadd); + } + } + */ + + // Delete + $params = array(); + print dolGetButtonAction('', $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete, $params); + } + print '
'."\n"; + } + + + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') { + print '
'; + print ''; // ancre + + $includedocgeneration = 0; + + // Documents + if ($includedocgeneration) { + $objref = dol_sanitizeFileName($object->ref); + $relativepath = $objref.'/'.$objref.'.pdf'; + $filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref; + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed = $permissiontoread; // If you can read, you can build the PDF to read content + $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('mymodule:MyObject', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + } + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('myobject')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + + print '
'; + + $MAXEVENT = 10; + + $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id); + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); + + print '
'; + } + + //Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + // Presend form + $modelmail = 'myobject'; + $defaulttopic = 'InformationMessage'; + $diroutput = $conf->mymodule->dir_output; + $trackid = 'myobject'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 190d6159afb..fc2c04d51f5 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -8045,4 +8045,4 @@ if (!empty($conf->global->THEME_CUSTOM_CSS)) { /* Must be at end */ div.flot-text .flot-tick-label .tickLabel, .fa-color-unset { color: unset; -} +} \ No newline at end of file From fac590261f6635d4eb53f87b5ae81b9c8cce63fe Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 28 Jul 2023 01:19:03 +0200 Subject: [PATCH 09/55] fix button and change the page --- htdocs/core/actions_addupdatedelete.inc.php | 1 + .../myobject_property_card.php => card.php} | 0 htdocs/modulebuilder/index.php | 44 +++++++++---------- 3 files changed, 22 insertions(+), 23 deletions(-) rename htdocs/modulebuilder/{template/myobject_property_card.php => card.php} (100%) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 71901f8db44..fbf803c676f 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -55,6 +55,7 @@ if ($cancel) { // Action to add record if ($action == 'add' && !empty($permissiontoadd)) { + var_dump(GETPOST('label', 'alpha'));exit; foreach ($object->fields as $key => $val) { if ($object->fields[$key]['type'] == 'duration') { if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') { diff --git a/htdocs/modulebuilder/template/myobject_property_card.php b/htdocs/modulebuilder/card.php similarity index 100% rename from htdocs/modulebuilder/template/myobject_property_card.php rename to htdocs/modulebuilder/card.php diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d5172d7f6fb..24f2cd9e07c 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -233,7 +233,6 @@ if ($dirins && $action == 'initmodule' && $modulename) { 'mymodule'=>strtolower($modulename), 'MyModule'=>$modulename ); - $result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement); //dol_mkdir($destfile); if ($result <= 0) { @@ -311,7 +310,6 @@ if ($dirins && $action == 'initmodule' && $modulename) { dol_delete_file($destdir.'/myobject_document.php'); dol_delete_file($destdir.'/myobject_agenda.php'); dol_delete_file($destdir.'/myobject_list.php'); - dol_delete_file($destdir.'/myobject_property_card.php'); dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php'); dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.sql'); @@ -380,6 +378,11 @@ if ($dirins && $action == 'initmodule' && $modulename) { dol_delete_file($destdir.'/README.md'); file_put_contents($destdir.'/README.md', $conf->global->MODULEBUILDER_SPECIFIC_README); } + // for create file to add properties + // file_put_contents($destdir.'/'.strtolower($modulename).'propertycard.php',''); + // $srcFileCard = DOL_DOCUMENT_ROOT.'/modulebuilder/card.php'; + // $destFileCard = $dirins.'/'.strtolower($modulename).'/template/card.php'; + // dol_copy($srcFileCard, $destdir.'/'.strtolower($modulename).'propertycard.php', 0,1, $arrayreplacement); } if (!$error) { @@ -1240,7 +1243,6 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { 'myobject_document.php'=>strtolower($objectname).'_document.php', 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', 'myobject_list.php'=>strtolower($objectname).'_list.php', - 'myobject_property_card.php'=>strtolower($objectname).'_property_card.php', 'admin/myobject_extrafields.php'=>'admin/'.strtolower($objectname).'_extrafields.php', 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', //'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', @@ -2623,9 +2625,6 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int')) { } } -if ($dirins && $action == "create_property") { -} - /* * View */ @@ -3415,6 +3414,15 @@ if ($module == 'initmodule') { print '
'; */ + print ''; + } elseif ($tabobj == 'createproperty') { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + var_dump($obj); print '
'; } elseif ($tabobj == 'deleteobject') { // Delete object tab @@ -3716,8 +3724,13 @@ if ($module == 'initmodule') { print ''; print '

'; - print load_fiche_titre($langs->trans("ObjectProperties"), '', ''); + $mod = strtolower($module); + $obj = strtolower($tabobj); + $newproperty = dolGetButtonTitle($langs->trans('NewProperty'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.urlencode($module).'&tabobj=createproperty'); + print_barre_liste($langs->trans("ObjectProperties"), $page, $_SERVER["PHP_SELF"], '', '', '', '', '', 0, '', 0, $newproperty, '', '', 0, 0, 1); + + //var_dump($reflectorpropdefault);exit; print ''."\n"; print '
'; print ''; @@ -3759,10 +3772,9 @@ if ($module == 'initmodule') { // modified during the constructor and we want value into head of class before constructor is called. //$properties = dol_sort_array($tmpobject->fields, 'position'); $properties = dol_sort_array($reflectorpropdefault['fields'], 'position'); - if (!empty($properties)) { // Line to add a property - print ''; + //print ''; // print ''; // print ''; // print ''; @@ -3789,18 +3801,6 @@ if ($module == 'initmodule') { // print ''; - for ($i = 0; $i<22;$i++) { - print ''; - } - $mod = strtolower($module); - $obj = strtolower($tabobj); - if ($user->hasRight("$mod", "$obj", "write")) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewProperty'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?action=create_property&tab=objects&module='.urlencode($module).'&tabobj='.urlencode($tabobj)); - print ''; - } - print ''; // List of existing properties foreach ($properties as $propkey => $propval) { /* If from Reflection @@ -4004,8 +4004,6 @@ if ($module == 'initmodule') { print ''; } print ''; - if ($action == 'create_property') { - } } } else { if ($tab == 'specifications') { From 1a6c53ef86867bfc48a83683368bc097f4231ef7 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 28 Jul 2023 19:41:25 +0200 Subject: [PATCH 10/55] add autocomplete for an input --- htdocs/langs/en_US/errors.lang | 2 +- htdocs/langs/fr_FR/errors.lang | 1 + htdocs/modulebuilder/index.php | 159 ++++++++++++++++++++++++++------- 3 files changed, 127 insertions(+), 35 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 8f85caebb50..7759ac91a9c 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -317,7 +317,7 @@ ErrorTheUrlOfYourDolInstanceDoesNotMatchURLIntoOAuthSetup=Error: The URL of you ErrorMenuExistValue=A Menu already exist with this Title or URL ErrorSVGFilesNotAllowedAsLinksWithout=SVG files are not allowed as external links without the option %s ErrorTypeMenu=Impossible to add another menu for the same module on the navbar, not handle yet - +ErrorObjectNotFound = The object %s is not found, please check your url # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index d81be42b602..052efda2e0f 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -317,6 +317,7 @@ ErrorTheUrlOfYourDolInstanceDoesNotMatchURLIntoOAuthSetup=Erreur : L'URL de vot ErrorMenuExistValue=Un menu existe déjà avec ce titre ou cette URL ErrorSVGFilesNotAllowedAsLinksWithout=Les fichiers SVG ne sont pas autorisés en tant que liens externes sans l'option %s ErrorTypeMenu=Impossible d'ajouter un autre menu pour le même module sur la barre de navigation, pas encore géré +ErrorObjectNotFound=L'objet %s est introuvable verifier votre url # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Votre paramètre PHP upload_max_filesize (%s) est supérieur au paramètre PHP post_max_size (%s). Ceci n'est pas une configuration cohérente. diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 24f2cd9e07c..2fa4d8a568e 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1607,10 +1607,10 @@ if ($dirins && ($action == 'droptable' || $action == 'droptableextrafields') && } } -if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && !empty($tabobj)) { +if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && !empty(GETPOST('obj')) && $tabobj == "createproperty") { $error = 0; - $objectname = $tabobj; + $objectname = GETPOST('obj'); $dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; $moduletype = $listofmodules[strtolower($module)]['moduletype']; @@ -1619,6 +1619,11 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && $destdir = $dirins.'/'.strtolower($module); dol_mkdir($destdir); + $objects = dolGetListOfObjectClasses($destdir); + if (!in_array($objectname, array_values($objects))) { + $error++; + setEventMessages($langs->trans("ErrorObjectNotFound", $langs->transnoentities($objectname)), null, 'errors'); + } // We click on add property if (!GETPOST('regenerateclasssql') && !GETPOST('regeneratemissing')) { if (!GETPOST('propname', 'aZ09')) { @@ -3360,6 +3365,7 @@ if ($module == 'initmodule') { print dol_get_fiche_head($head3, $tabobj, '', -1, '', 0, '', '', 0, 'forobjectsuffix'); // Level 3 + if ($tabobj == 'newobject') { // New object tab print '
'; @@ -3416,14 +3422,127 @@ if ($module == 'initmodule') { print ''; } elseif ($tabobj == 'createproperty') { - print '
'; + $attributesUnique = array ( + 'propname' => $form->textwithpicto($langs->trans("Code"), $langs->trans("PropertyDesc"), 1, 'help', 'extracss', 0, 3, 'propertyhelp'), + 'proplabel' => $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")), + 'proptype' => $form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelpIntro").'

'.$langs->trans("TypeOfFieldsHelp"), 1, 'help', 'extracss', 0, 3, 'typehelp'), + 'proparrayofkeyval' => $form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")), + 'propnotnull' => $form->textwithpicto($langs->trans("NotNull"), $langs->trans("NotNullDesc")), + 'propdefault' => $langs->trans("DefaultValue"), + 'propindex' => $langs->trans("DatabaseIndex"), + 'propforeignkey' => $form->textwithpicto($langs->trans("ForeignKey"), $langs->trans("ForeignKeyDesc"), 1, 'help', 'extracss', 0, 3, 'foreignkeyhelp'), + 'propposition' => $langs->trans("Position"), + 'propenabled' => $form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc"), 1, 'help', 'extracss', 0, 3, 'enabledhelp'), + 'propvisible' => $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'

'.$langs->trans("ItCanBeAnExpression"), 1, 'help', 'extracss', 0, 3, 'visiblehelp'), + 'propnoteditable' => $langs->trans("NotEditable"), + 'propalwayseditable' => $langs->trans("AlwaysEditable"), + 'propsearchall' => $form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")), + 'propisameasure' => $form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")), + 'propcss' => $langs->trans("CSSClass"), + 'propcssview' => $langs->trans("CSSViewClass"), + 'propcsslist' => $langs->trans("CSSListClass"), + 'prophelp' => $langs->trans("KeyForTooltip"), + 'propshowoncombobox' => $langs->trans("ShowOnCombobox"), + 'propvalidate' => $form->textwithpicto($langs->trans("Validate"), $langs->trans("ValidateModBuilderDesc")), + 'propcomment' => $langs->trans("Comment"), + ); + print ''; print ''; print ''; print ''; print ''; - print ''; - var_dump($obj); + print ''; + + print '
'; // print ''; // print '
'; - print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', '', '', '', '', 0, '', 0, $newcardbutton, '', '', 0, 0, 1); - print '
'."\n"; + $counter = 0; + foreach ($attributesUnique as $key => $attribute) { + if ($counter % 2 === 0) { + print ''; + } + if ($key == 'propname' || $key == 'proplabel') { + print ''; + } elseif ($key == 'proptype') { + print ''; + } elseif ($key == 'propvalidate') { + print ''; + } else { + print ''; + } + $counter++; + if ($counter % 2 === 0) { + print ''; + } + } + if ($counter % 2 !== 0) { + while ($counter % 2 !== 0) { + print ''; + $counter++; + } + print ''; + } + print '
'.$attribute.''.$attribute.'
'.$attribute.''.$attribute.'

'."\n"; + print '
'; + print ''; + print ''; + print '
'; print ''; + // javascript + print ''; } elseif ($tabobj == 'deleteobject') { // Delete object tab print '
'; @@ -3726,7 +3845,7 @@ if ($module == 'initmodule') { $mod = strtolower($module); $obj = strtolower($tabobj); - $newproperty = dolGetButtonTitle($langs->trans('NewProperty'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.urlencode($module).'&tabobj=createproperty'); + $newproperty = dolGetButtonTitle($langs->trans('NewProperty'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.urlencode($module).'&tabobj=createproperty&obj='.urlencode($tabobj)); print_barre_liste($langs->trans("ObjectProperties"), $page, $_SERVER["PHP_SELF"], '', '', '', '', '', 0, '', 0, $newproperty, '', '', 0, 0, 1); @@ -3773,34 +3892,6 @@ if ($module == 'initmodule') { //$properties = dol_sort_array($tmpobject->fields, 'position'); $properties = dol_sort_array($reflectorpropdefault['fields'], 'position'); if (!empty($properties)) { - // Line to add a property - //print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // //print ''; - // print ''; - // print ''; - // print ''; - // print ''; - // print ''; // List of existing properties foreach ($properties as $propkey => $propval) { /* If from Reflection From 7742b2c5e0c7e3aeab91e4bfd2f18f31124c1488 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 1 Aug 2023 12:30:36 +0200 Subject: [PATCH 11/55] test button & update the select type --- htdocs/modulebuilder/index.php | 101 ++++++++++++++++--------------- htdocs/theme/eldy/global.inc.php | 12 +++- 2 files changed, 64 insertions(+), 49 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 2fa4d8a568e..3d6bb88d346 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1643,7 +1643,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && $addfieldentry = array( 'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), - 'type'=>GETPOST('proptype', 'alpha'), + 'type'=>strtolower(GETPOST('proptype', 'alpha')), 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' 'visible'=>GETPOST('propvisible', 'int'), 'enabled'=>GETPOST('propenabled', 'int'), @@ -1662,8 +1662,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && 'alwayseditable'=>intval(GETPOST('propalwayseditable', 'int')), 'validate' => GETPOST('propvalidate', 'int') ); - - + var_dump($addfieldentry);exit; if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true); } @@ -3462,7 +3461,7 @@ if ($module == 'initmodule') { if ($key == 'propname' || $key == 'proplabel') { print ''.$attribute.''; } elseif ($key == 'proptype') { - print ''.$attribute.'
'; + print ''.$attribute.'
'; } elseif ($key == 'propvalidate') { print ''.$attribute.''; } else { @@ -3494,54 +3493,60 @@ if ($module == 'initmodule') { } $(document).ready(function() { // Tableau de suggestions statiques - var suggestions = [ - "integer", - "varchar", - "boolean", - "float", - "double", - "vol" - ]; + var suggestions = ["VARCHAR", "DOUBLE", "REAL", "TEXT", "HTML", "DATETIME", "TIMESTAMP", "INTEGER", "INTEGER:CLASSNAME:RELATIVEPATH/TO/CLASSFILE.CLASS.PHP[:1[:FILTER]]"]; + function showSuggestions() { + var inputText = $("#proptype").val().toLowerCase(); + var suggestionsDiv = $("#suggestions"); - function updateSuggestions() { - var value = $("#proptype").val().toLowerCase(); - var selectSuggestions = $("#suggestions"); - - var filteredSuggestions = suggestions.filter(function(suggestion) { - return suggestion.toLowerCase().indexOf(value) !== -1; - }); - - selectSuggestions.empty(); - for (var i = 0; i < filteredSuggestions.length; i++) { - var suggestion = filteredSuggestions[i]; - var option = $("
'; From a758eaa0863e402d8857bd3843c8031f2367097d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Sep 2023 13:43:16 +0200 Subject: [PATCH 25/55] FIX Expense report is created on the wrong entity --- htdocs/admin/agenda_other.php | 4 ++-- htdocs/holiday/card.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 18797312ad8..0b172c4e36e 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -356,7 +356,7 @@ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").''."\n"; print ' '."\n"; print ''."\n"; - $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); + $formactions->select_type_actions(getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT'), "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); print ''."\n"; } @@ -386,7 +386,7 @@ if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list" $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE)); } -$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1, $multiselect); +$formactions->select_type_actions(getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE'), "AGENDA_DEFAULT_FILTER_TYPE", '', (getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? -1 : 1), 1, $multiselect); print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 71f8e620286..2f101b1bdf6 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -279,6 +279,7 @@ if (empty($reshook)) { $object->date_debut = $date_debut; $object->date_fin = $date_fin; $object->halfday = $halfday; + $object->entity = $conf->entity; $result = $object->create($user); if ($result <= 0) { From 9cad02760188b8f7395a70815e070eadb00d5faf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Sep 2023 13:50:52 +0200 Subject: [PATCH 26/55] Fix look and feel v18 --- htdocs/compta/index.php | 8 ++++---- htdocs/core/lib/invoice.lib.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ddc48e264c4..a340d7ef7c3 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -270,7 +270,7 @@ if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { $colspan++; } - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '

'; $db->free($resql); @@ -397,7 +397,7 @@ if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { $colspan++; } - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '

'; } else { @@ -488,7 +488,7 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) { print "\n"; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } else { @@ -578,7 +578,7 @@ if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) { print ' '; print ''; } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "
"; $db->free($resql); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 9414e692fa2..c9cd52bce73 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -580,7 +580,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) $result .= ''.price($tot_ttc).''; $result .= ''; } else { - $result .= ''.$langs->trans("NoInvoice").''; + $result .= ''.$langs->trans("NoInvoice").''; } $result .= ""; $db->free($resql); @@ -712,7 +712,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) $result .= ''.price($tot_ttc).''; $result .= ''; } else { - $result .= ''.$langs->trans("NoInvoice").''; + $result .= ''.$langs->trans("NoInvoice").''; } $result .= ""; $db->free($resql); From 1100d8b418d340995ebf5d6efd86005b1b934bc6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 23 Sep 2023 08:42:08 +0200 Subject: [PATCH 27/55] FIX missing entity filter to customize by entity --- htdocs/core/modules/modTicket.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index a165a4acd2e..e5c72e747d5 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -147,10 +147,10 @@ class modTicket extends DolibarrModules "TicketDictResolution" ), 'tabsql' => array( - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f', - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f', - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent FROM '.MAIN_DB_PREFIX.'c_ticket_category as f', - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f' + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity = '.getEntity('c_ticket_type'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity = '.getEntity('c_ticket_severity'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity = '.getEntity('c_ticket_category'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity = '.getEntity('c_ticket_resolution') ), 'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"), 'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), From 5fccbcb9ae5f019daaa93292048d5f532c77402a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 23 Sep 2023 10:05:36 +0200 Subject: [PATCH 28/55] FIX add field "entity" only in $tabfieldinsert --- htdocs/admin/dict.php | 12 ++++++------ htdocs/core/modules/modTicket.class.php | 10 +++++----- htdocs/ticket/class/ticket.class.php | 6 ++++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c08deb66074..99ad67187bf 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -304,8 +304,8 @@ $tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_ $tabfield[9] = "code,label,unicode"; $tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[11] = "element,source,code,libelle,position"; -$tabfield[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity"; -$tabfield[13] = "code,libelle,type,entity"; +$tabfield[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder"; +$tabfield[13] = "code,libelle,type"; $tabfield[14] = "code,label,price,organization,country"; $tabfield[15] = "code,libelle,width,height,unit"; $tabfield[16] = "code,libelle,sortorder"; @@ -330,7 +330,7 @@ $tabfield[34] = "code,label"; $tabfield[35] = "label"; $tabfield[36] = "range_ik,fk_c_exp_tax_cat"; $tabfield[37] = "code,label,short_label,unit_type,scale,sortorder"; -$tabfield[38] = "code,label,url,icon,entity"; +$tabfield[38] = "code,label,url,icon"; $tabfield[39] = "code,libelle,sortorder"; $tabfield[40] = "code,libelle,picto"; $tabfield[41] = "code,label"; @@ -385,7 +385,7 @@ $tabfieldvalue[42] = "code,label"; $tabfieldvalue[43] = "code,label"; $tabfieldvalue[44] = "code,label"; -// Field names in the table for inserting a record +// Field names in the table for inserting a record (add field "entity" only here when dictionary is ready to personalized by entity) $tabfieldinsert = array(); $tabfieldinsert[1] = "code,libelle,fk_pays"; $tabfieldinsert[2] = "code_departement,nom,fk_region"; @@ -411,7 +411,7 @@ $tabfieldinsert[21] = "code,label,qty,type_duration,position"; $tabfieldinsert[22] = "code,label"; $tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[24] = "code,label"; -$tabfieldinsert[25] = "code,label"; +$tabfieldinsert[25] = "code,label,entity"; //$tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[27] = "code,libelle,picto"; $tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder"; @@ -882,7 +882,7 @@ if (empty($reshook)) { } $i = 0; foreach ($listfieldinsert as $f => $value) { - $keycode = $listfieldvalue[$i]; + $keycode = (isset($listfieldvalue[$i]) ? $listfieldvalue[$i] : ''); if (empty($keycode)) { $keycode = $value; } diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index e5c72e747d5..acbf5bedee6 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -147,15 +147,15 @@ class modTicket extends DolibarrModules "TicketDictResolution" ), 'tabsql' => array( - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity = '.getEntity('c_ticket_type'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity = '.getEntity('c_ticket_severity'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity = '.getEntity('c_ticket_category'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity = '.getEntity('c_ticket_resolution') + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity = '.getEntity('c_ticket_type'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity = '.getEntity('c_ticket_severity'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity = '.getEntity('c_ticket_category'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity = '.getEntity('c_ticket_resolution') ), 'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"), 'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), 'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), - 'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), + 'tabfieldinsert' => array("code,label,pos,use_default,entity", "code,label,pos,use_default,entity", "code,label,pos,use_default,public,fk_parent,entity", "code,label,pos,use_default,entity"), 'tabrowid' => array("rowid", "rowid", "rowid", "rowid"), 'tabcond' => array(isModEnabled("ticket"), isModEnabled("ticket"), isModEnabled("ticket"), isModEnabled("ticket") && getDolGlobalString('TICKET_ENABLE_RESOLUTION')), 'tabhelp' => array( diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 3dc4d8a3088..7fc8ebd3fed 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1242,7 +1242,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type"; - $sql .= " WHERE active > 0"; + $sql .= " WHERE entity = ".getEntity('c_ticket_type'); + $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::load_cache_type_tickets", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1334,7 +1335,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity"; - $sql .= " WHERE active > 0"; + $sql .= " WHERE entity = ".getEntity('c_ticket_severity'); + $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::loadCacheSeveritiesTickets", LOG_DEBUG); $resql = $this->db->query($sql); From 5e8c793b544d7d7c6e5c7fb29a8a7cf79e750907 Mon Sep 17 00:00:00 2001 From: priojk Date: Sat, 23 Sep 2023 13:34:30 +0200 Subject: [PATCH 29/55] Fix #26008 - translation reference keys for ProductRef --- htdocs/product/card.php | 4 ++-- htdocs/product/list.php | 2 +- htdocs/product/stock/replenish.php | 2 +- htdocs/product/stock/stockatdate.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index e0bc8b3b4e4..08d86258150 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -490,7 +490,7 @@ if (empty($reshook)) { } if (empty($ref)) { if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Ref')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors'); $action = "create"; $error++; } @@ -1363,7 +1363,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!empty($modCodeProduct->code_auto)) { $tmpcode = $modCodeProduct->getNextValue($object, $type); } - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("ProductRef").''; if ($refalreadyexists) { print $langs->trans("RefAlreadyExists"); } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ffded66d8e8..67d71fc5633 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -218,7 +218,7 @@ $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? // Definition of array of fields for columns $arrayfields = array( 'p.rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), - 'p.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>10), + 'p.ref'=>array('label'=>'ProductRef', 'checked'=>1, 'position'=>10), //'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(isModEnabled('barcode'))), 'thumbnail'=>array('label'=>'Photo', 'checked'=>0, 'position'=>10), 'p.label'=>array('label'=>"Label", 'checked'=>1, 'position'=>10), diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 9447187e16c..275e08373e2 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -773,7 +773,7 @@ print ''; // Lines of title print ''; print_liste_field_titre('', $_SERVER["PHP_SELF"], ''); -print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre('ProductRef', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { print_liste_field_titre('Duration', $_SERVER["PHP_SELF"], 'p.duration', $param, '', '', $sortfield, $sortorder, 'center '); diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 0e16bf8d68b..12574b150c0 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -487,7 +487,7 @@ if (!empty($search_fk_warehouse)) { // Lines of title print ''; -print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre('ProductRef', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); if ($mode == 'future') { From 34b6d05bad5f9f6d3bc60cd6f5cc47f1f93a8234 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sat, 23 Sep 2023 15:57:23 +0200 Subject: [PATCH 30/55] =?UTF-8?q?Fix=20G=C3=A9n=C3=A9rer=20intervention=20?= =?UTF-8?q?#26000.=20date=20and=20datehour=20already=20converted=20by=20se?= =?UTF-8?q?tVarsFromFetchObj?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/projet/class/task.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 51b4d3e68e1..100d334ba86 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1598,8 +1598,8 @@ class Task extends CommonObjectLine if ($timespent->id > 0) { $this->timespent_id = $timespent->id; $this->id = $timespent->fk_element; - $this->timespent_date = $this->db->jdate($timespent->element_date); - $this->timespent_datehour = $this->db->jdate($timespent->element_datehour); + $this->timespent_date = $timespent->element_date; + $this->timespent_datehour = $timespent->element_datehour; $this->timespent_withhour = $timespent->element_date_withhour; $this->timespent_duration = $timespent->element_duration; $this->timespent_fk_user = $timespent->fk_user; From 7a0a15dd17d33f60415b1d0f07a0a1e7d587ecef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Sep 2023 01:00:25 +0200 Subject: [PATCH 31/55] FIX Look and feel v18 --- htdocs/accountancy/admin/account.php | 103 +++++--- htdocs/accountancy/admin/card.php | 2 +- htdocs/accountancy/admin/categories.php | 8 +- htdocs/accountancy/admin/categories_list.php | 245 +++++++++++------- .../core/class/html.formaccounting.class.php | 10 +- 5 files changed, 243 insertions(+), 125 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 9db51eb136c..9c15535d0c8 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -90,8 +90,8 @@ $arrayfields = array( 'aa.pcg_type'=>array('label'=>"Pcgtype", 'checked'=>1, 'help'=>'PcgtypeDesc'), 'categories'=>array('label'=>"AccountingCategories", 'checked'=>-1, 'help'=>'AccountingCategoriesDesc'), 'aa.reconcilable'=>array('label'=>"Reconcilable", 'checked'=>1), - 'aa.active'=>array('label'=>"Activated", 'checked'=>1), - 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1) + 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1), + 'aa.active'=>array('label'=>"Activated", 'checked'=>1) ); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -413,7 +413,7 @@ if ($resql) { print '
'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); $moreforfilter = ''; @@ -428,6 +428,13 @@ if ($resql) { // Line for search fields print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; + } if (!empty($arrayfields['aa.account_number']['checked'])) { print ''; } @@ -462,12 +469,19 @@ if ($resql) { if (!empty($arrayfields['aa.active']['checked'])) { print ' '; } - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; + } print ''; print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + } if (!empty($arrayfields['aa.account_number']['checked'])) { print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); } @@ -497,7 +511,10 @@ if ($resql) { if (!empty($arrayfields['aa.active']['checked'])) { print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); } - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + } print "\n"; $i = 0; @@ -510,6 +527,32 @@ if ($resql) { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($user->hasRight('accounting', 'chartofaccount')) { + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; + print ' '; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + } + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Account number if (!empty($arrayfields['aa.account_number']['checked'])) { print ""; @@ -522,7 +565,7 @@ if ($resql) { // Account label if (!empty($arrayfields['aa.label']['checked'])) { - print ""; + print ''; print dol_escape_htmltag($obj->label); print "\n"; if (!$i) { @@ -635,28 +678,30 @@ if ($resql) { } } - // Action - print ''; - if ($user->hasRight('accounting', 'chartofaccount')) { - print ''; - print img_edit(); - print ''; - print ' '; - print ''; - print img_delete(); - print ''; - print ' '; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($user->hasRight('accounting', 'chartofaccount')) { + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; + print ' '; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; } - } - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 26287a5bbb8..7f2bf439c09 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -381,7 +381,7 @@ if ($action == 'create') { print '
'; print '
'; - print ''; + print '
'; // Label print ''; diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 7b660419daf..4ef7fe78726 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -131,8 +131,12 @@ print '
'.$langs->trans("Label").'
'; // Select the category print ''; print ''; print '
'.$langs->trans("AccountingCategory").''; -print $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0); -print ''; +$s = $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0); +if ($formaccounting->nbaccounts_category <= 0) { + print ''.$s.''; +} else { + print ''; +} print '
'; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 7b7148f89ce..59d9f219ee4 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -58,9 +58,10 @@ $listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000 $sortfield = GETPOST("sortfield", 'aZ09comma'); $sortorder = GETPOST("sortorder", 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $listlimit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -450,7 +451,7 @@ if (empty($sortfield)) { $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($listlimit + 1, $offset); -//print $sql; + $fieldlist = explode(',', $tabfield[$id]); @@ -468,7 +469,9 @@ if ($sortfield) { if (GETPOST('from', 'alpha')) { $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); } - +if ($listlimit) { + $paramwithsearch .= '&listlimit='.urlencode(GETPOST('listlimit', 'int')); +} print '
'; print ''; print ''; @@ -476,7 +479,7 @@ print ''; -print '
'; +print '
'; print ''; // Form to add a new line @@ -485,6 +488,10 @@ if ($tabname[$id]) { // Line for title print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } foreach ($fieldlist as $field => $value) { // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees @@ -524,6 +531,7 @@ if ($tabname[$id]) { } if ($fieldlist[$field] == 'range_account') { $valuetoshow = $langs->trans("Comment"); + $class = 'width75'; } if ($fieldlist[$field] == 'category_type') { $valuetoshow = $langs->trans("Calculated"); @@ -546,13 +554,20 @@ if ($tabname[$id]) { print ''; print ''; print ''; - print ''; - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; // Line to enter new values print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + $obj = new stdClass(); // If data was already input, we define them in obj to populate input fields. if (GETPOST('actionadd', 'alpha')) { @@ -572,19 +587,29 @@ if ($tabname[$id]) { fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add'); } - print ''; + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ""; $colspan = count($fieldlist) + 3; if ($id == 32) { $colspan++; } - - print ''; // Keep   to have a line with enough height } +print '
'; + print ''; print ''; print '
 
'; +print '
'; + +print '
'; +print ''; + // List of available record in database dol_syslog("htdocs/accountancy/admin/categories_list.php", LOG_DEBUG); @@ -595,13 +620,37 @@ if ($resql) { // There is several pages if ($num > $listlimit) { - print ''; } + $filterfound = 0; + foreach ($fieldlist as $field => $value) { + $showfield = 1; // By defaut + if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { + $showfield = 0; + } + if ($showfield) { + if ($value == 'country') { + $filterfound++; + } + } + } + // Title line with search boxes print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + $filterfound = 0; foreach ($fieldlist as $field => $value) { $showfield = 1; // By defaut @@ -623,17 +672,23 @@ if ($resql) { } print ''; print ''; - print ''; - print ''; } - print ''; print ''; // Title of lines print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); + } foreach ($fieldlist as $field => $value) { // Determines the name of the field in relation to the possible names // in data dictionaries @@ -707,16 +762,22 @@ if ($resql) { print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' '); } } + print getTitleFieldOfList($langs->trans("ListOfAccounts"), 0, $_SERVER["PHP_SELF"], "", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, ''); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center '); - print getTitleFieldOfList(''); - print getTitleFieldOfList(''); - print getTitleFieldOfList(''); + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); + } print ''; + if ($num) { + $imaxinloop = ($listlimit ? min($num, $listlimit) : $num); + // Lines with values - while ($i < $num) { + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + //print_r($obj); print ''; if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { @@ -725,12 +786,16 @@ if ($resql) { $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; + // Actions + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // Show fields if (empty($reshook)) { fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit'); } - print ''; print ''; print ''; - print ''; + // Actions + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } } else { + // Can an entry be erased or disabled ? + $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default + if (isset($obj->code)) { + if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { + $iserasable = 0; $canbedisabled = 0; + } + } + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + if ($param) { + $url .= '&'.$param; + } + $url .= '&'; + + $canbemodified = $iserasable; + $tmpaction = 'view'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; + // Actions + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (empty($reshook)) { foreach ($fieldlist as $field => $value) { $showfield = 1; - $class = "left"; + $title = ''; + $class = 'tddict'; + $tmpvar = $fieldlist[$field]; $valuetoshow = $obj->$tmpvar; if ($value == 'category_type') { @@ -764,43 +863,35 @@ if ($resql) { $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } - } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') { - $key = $langs->trans("Country".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') { - $langs->loadLangs(array("propal")); - $key = $langs->trans("AvailabilityType".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') { - $key = $langs->trans("Action".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); + } elseif (in_array($fieldlist[$field], array('label', 'range_account', 'formula'))) { + $class = "tdoverflowmax250"; + $title = $valuetoshow; } elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; } - $class = 'tddict'; // Show value for field if ($showfield) { - print ''; + print ''; } } } - // Can an entry be erased or disabled ? - $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default - if (isset($obj->code)) { - if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { - $iserasable = 0; $canbedisabled = 0; - } - } + // Link to setup the group + print ''; // Active print '"; - // Modify link - if ($canbemodified) { - print ''; - } else { - print ''; - } - - // Delete link - if ($iserasable) { + // Actions + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - } else { - print ''; } - - // Link to setup the group - print ''; } print "\n"; $i++; } } else { - $colspan = 11; + $colspan = 10; print ''; } } else { @@ -920,20 +987,14 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co print ''; } else { print ''; } } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 9c72c98721c..b1917f42ee8 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -48,6 +48,10 @@ class FormAccounting extends Form * @var int Nb of accounts found */ public $nbaccounts; + /** + * @var int Nb of accounts category found + */ + public $nbaccounts_category; /** @@ -235,7 +239,7 @@ class FormAccounting extends Form public function select_accounting_category($selected = '', $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0) { // phpcs:enable - global $db, $langs, $mysoc; + global $langs, $mysoc; if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries)) { dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); @@ -263,11 +267,15 @@ class FormAccounting extends Form $sql .= " ORDER BY c.label ASC"; } + $this->nbaccounts_category = 0; + dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); if ($num) { + $this->nbaccounts_category = $num; + $out = '\n"; $totalbuyingprice = 0; @@ -643,14 +644,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $totalcurrentstock += $currentstock; } - // Action - print ''; - // Fields from hook $parameters = array('objp'=>$objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Action + print ''; + print ''."\n"; } $i++; From 1ce5963f833e4cee75fc21c28d53e909282a2690 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Sep 2023 17:44:33 +0200 Subject: [PATCH 33/55] FIX Bad choice of filter on product/service --- htdocs/product/list.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 67d71fc5633..7191a15b607 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -847,16 +847,15 @@ if ($type === "") { if ($type === "") { $params['forcenohideoftext'] = 1; } -if ($type === "") { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); - $type = Product::TYPE_SERVICE; -} - $label = 'NewProduct'; -if ($type == Product::TYPE_SERVICE) { - $label = 'NewService'; -} - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type, '', $perm, $params); +if ($type === "" || $type == Product::TYPE_PRODUCT) { + $label = 'NewProduct'; + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); +} +if ($type === "" || $type == Product::TYPE_SERVICE) { + $label = 'NewService'; + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=1', '', $perm, $params); +} print ''; if ($optioncss != '') { From e1217a891155bde0a8beae205f15402755ee42ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Sep 2023 21:11:23 +0200 Subject: [PATCH 34/55] Fix phpcs --- htdocs/core/lib/security.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 64a275651f2..b0b5bbfc3cf 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -144,9 +144,9 @@ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = $newchain = $chain; if (function_exists('openssl_encrypt') && empty($dolibarr_disable_dolcrypt_for_debug)) { - if (empty($key)) { - return $chain; - } + if (empty($key)) { + return $chain; + } $ivlen = 16; if (function_exists('openssl_cipher_iv_length')) { From 0fd8123606a082d75ce73ce0cef0f74fd2d0996e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 26 Sep 2023 21:49:15 +0200 Subject: [PATCH 35/55] NEW FontAwesome - Add possibility to select another version --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/main.inc.php | 4 ++-- htdocs/takepos/css/pos.css.php | 2 +- htdocs/theme/eldy/dropdown.inc.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 8 ++++---- htdocs/theme/eldy/main_menu_fa_icons.inc.php | 2 +- htdocs/theme/md/dropdown.inc.php | 4 ++-- htdocs/theme/md/main_menu_fa_icons.inc.php | 2 +- htdocs/theme/md/style.css.php | 6 +++--- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2928dd090a5..319f609587d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4293,7 +4293,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $fakey = $pictowithouttext; $facolor = ''; $fasize = ''; - $fa = 'fas'; + $fa = getDolGlobalString('MAIN_FONTAWESOME_ICON_STYLE', 'fas'); if (in_array($pictowithouttext, array('card', 'bell', 'clock', 'establishment', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) { $fa = 'far'; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4057397c6e5..2528d402810 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1802,8 +1802,8 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (!defined('DISABLE_FONT_AWSOME')) { print ''."\n"; - print ''."\n"; - print ''."\n"; + $fontawesome_directory = getDolGlobalString('MAIN_FONTAWESOME_DIRECTORY', '/theme/common/fontawesome-5'); + print ''."\n"; } print ''."\n"; diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index fe7a7aa53ac..281b3ec44e3 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -219,7 +219,7 @@ button.item_value.selected { div[aria-describedby="dialog-info"] button:before { content: "\f788"; - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 900; padding-right: 5px; } diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index ac0b25e8f82..d1445a929f0 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -132,7 +132,7 @@ div#topmenu-global-search-dropdown a::after, div#topmenu-quickadd-dropdown a::af .dropdown-toggle::after { - font-family: "Font Awesome 5 Free"; + font-family: ""; font-size: 0.7em; font-weight: 900; font-style: normal; @@ -375,7 +375,7 @@ a.dropdown-item { .dropdown-item::before { /* font part */ - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 900; font-style: normal; font-variant: normal; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 850b145fd08..6fb0883087c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1198,7 +1198,7 @@ div.divsearchfield { content: "\f080"; } .a-filter:before, .a-mesure:before { - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 600; padding-right: 5px; padding-left: 5px; @@ -3470,7 +3470,7 @@ div.tabsElem { /* div.tabsElem a.tabactive::before, div.tabsElem a.tabunactive::before { content: "\f0da"; - font-family: "Font Awesome 5 Free"; + font-family: ""; padding-right: 2px; font-weight: 900; } @@ -7526,7 +7526,7 @@ a.phpdebugbar-tab.phpdebugbar-active { font-weight: 600 !important; } .phpdebugbar-fa-tags, .phpdebugbar-fa-tasks, .phpdebugbar-indicator .fa { - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 600; } div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-warning:before, @@ -7544,7 +7544,7 @@ div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before, div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before, div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before { - font-family: "Font Awesome 5 Free" !important; + font-family: "" !important; } /* ============================================================================== */ diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index 395ab219056..818233649ea 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -5,7 +5,7 @@ .mainmenu::before{ /* font part */ - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 900; font-style: normal; font-variant: normal; diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index 45551b36842..72337ffcaa9 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -145,7 +145,7 @@ div#topmenu-global-search-dropdown a::after, div#topmenu-quickadd-dropdown a::af .dropdown-toggle::after { /* font part */ - font-family: "Font Awesome 5 Free"; + font-family: ""; font-size: 0.7em; font-weight: 900; font-style: normal; @@ -386,7 +386,7 @@ a.dropdown-item { .dropdown-item::before { /* font part */ - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 900; font-style: normal; font-variant: normal; diff --git a/htdocs/theme/md/main_menu_fa_icons.inc.php b/htdocs/theme/md/main_menu_fa_icons.inc.php index f2f5e247e78..f171ebdaa50 100644 --- a/htdocs/theme/md/main_menu_fa_icons.inc.php +++ b/htdocs/theme/md/main_menu_fa_icons.inc.php @@ -5,7 +5,7 @@ .mainmenu::before{ /* font part */ - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 900; font-style: normal; font-variant: normal; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 315f3caafbf..6ed7ecdc69b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1450,7 +1450,7 @@ if ($conf->browser->layout == 'phone') { content: "\f080"; } .a-filter:before, .a-mesure:before { - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 600; padding-right: 5px; padding-left: 5px; @@ -7452,7 +7452,7 @@ a.phpdebugbar-tab.phpdebugbar-active { background-image: unset !important; } .phpdebugbar-indicator .fa { - font-family: "Font Awesome 5 Free"; + font-family: ""; font-weight: 600; } div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-warning:before, @@ -7470,7 +7470,7 @@ div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before, div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before, div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before { - font-family: "Font Awesome 5 Free" !important; + font-family: "" !important; } From be9adbec417121a43bd38b299ff33cbdfff03288 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Sep 2023 00:05:36 +0200 Subject: [PATCH 36/55] FIX uniformize getEntity sql request --- htdocs/admin/dict.php | 8 ++++---- htdocs/core/modules/modTicket.class.php | 8 ++++---- htdocs/societe/class/societe.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 7 ++++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 99ad67187bf..9d265d0240d 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -210,8 +210,8 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; $tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid"; $tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; -$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]); -$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]); +$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity IN (".getEntity($tabname[12]).")"; +$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity IN (".getEntity($tabname[13]).")"; $tabsql[14] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; $tabsql[15] = "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; $tabsql[16] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; @@ -223,7 +223,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.qty, $tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; -$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]); +$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity($tabname[25]).")"; //$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm"; $tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; @@ -236,7 +236,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR $tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c"; $tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r"; $tabsql[37] = "SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r"; -$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]); +$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity IN (".getEntity($tabname[38]).")"; $tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel"; $tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact"; $tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode"; diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index acbf5bedee6..f0380fb6410 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -147,10 +147,10 @@ class modTicket extends DolibarrModules "TicketDictResolution" ), 'tabsql' => array( - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity = '.getEntity('c_ticket_type'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity = '.getEntity('c_ticket_severity'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity = '.getEntity('c_ticket_category'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity = '.getEntity('c_ticket_resolution') + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity IN ('.getEntity('c_ticket_type').')', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity IN ('.getEntity('c_ticket_severity').')', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity IN ('.getEntity('c_ticket_category').')', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity IN ('.getEntity('c_ticket_resolution').')' ), 'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"), 'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9457788899c..cfd23c5e791 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5284,7 +5284,7 @@ class Societe extends CommonObject if ($code) { $sql .= " AND tc.code = '".$this->db->escape($code)."'"; } - $sql .= " AND sc.entity = ".getEntity($this->element); + $sql .= " AND sc.entity IN (".getEntity($this->element).")"; $sql .= " AND tc.source = 'external'"; $sql .= " AND tc.active=1"; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 7fc8ebd3fed..4e6e4b5b63d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1242,7 +1242,7 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type"; - $sql .= " WHERE entity = ".getEntity('c_ticket_type'); + $sql .= " WHERE entity IN (".getEntity('c_ticket_type').")"; $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::load_cache_type_tickets", LOG_DEBUG); @@ -1283,7 +1283,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description, public, active, force_severity, fk_parent"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category"; - $sql .= " WHERE active > 0 AND entity = ".((int) $conf->entity); + $sql .= " WHERE entity IN (".getEntity('c_ticket_category').")"; + $sql .= " WHERE active > 0"; if ($publicgroup > -1) { $sql .= " AND public = ".((int) $publicgroup); } @@ -1335,7 +1336,7 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity"; - $sql .= " WHERE entity = ".getEntity('c_ticket_severity'); + $sql .= " WHERE entity IN (".getEntity('c_ticket_severity').")"; $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::loadCacheSeveritiesTickets", LOG_DEBUG); From e1c1042d422e35a4ba7fcd5aaf30f6ad343cfb38 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 27 Sep 2023 06:16:37 +0200 Subject: [PATCH 37/55] Review ticket admin page --- htdocs/admin/ticket.php | 87 +++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 03a7d5bb02d..0576cd3ccc7 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -1,6 +1,8 @@ - * Copyright (C) 2016 Christophe Battarel +/* Copyright (C) 2013-2018 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2022-2023 Udo Tamm + * Copyright (C) 2023 Alexandre Spangaro * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,17 +19,17 @@ */ /** - * \file admin/ticket.php + * \file htdocs/admin/ticket.php * \ingroup ticket * \brief Page to setup module ticket */ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; -require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; -require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; +require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; // Load translation files required by the page $langs->loadLangs(array("admin", "ticket")); @@ -111,14 +113,14 @@ if ($action == 'updateMask') { $conf->global->TICKET_ADDON_PDF = $value; } - // On active le modele + // Activate the model $ret = delDocumentModel($value, $type); if ($ret > 0) { $ret = addDocumentModel($value, $type, $label, $scandir); } } elseif ($action == 'setmod') { - // TODO Verifier si module numerotation choisi peut etre active - // par appel methode canBeActivated + // TODO check if the chosen numbering module can be activated + // by calling the canBeActivated method dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity); } elseif ($action == 'setvarworkflow') { @@ -235,8 +237,9 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $formcategory = new FormCategory($db); -$help_url = "FR:Module_Ticket"; -$page_name = "TicketSetup"; +// Page Header +$help_url = 'EN:Module_Ticket|FR:Module_Ticket_FR'; +$page_name = 'TicketSetup'; llxHeader('', $langs->trans($page_name), $help_url); // Subheader @@ -267,7 +270,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; clearstatcache(); @@ -391,8 +394,8 @@ print ''; print ''; print '\n"; print '\n"; -print ''; -print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -439,7 +442,7 @@ foreach ($dirmodels as $reldir) { } print ''; - // Active + // Active / Status if (in_array($name, $def)) { print '"; } - // Default + // Default Template print ''; + // Preview + print ''; + + print "\n"; + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); @@ -480,17 +494,6 @@ foreach ($dirmodels as $reldir) { print ''; - - // Preview - print ''; - - print "\n"; } } } @@ -509,17 +512,21 @@ print ''; print ''; print ''; +/* + * Other Parameters + */ + print load_fiche_titre($langs->trans("Other"), '', ''); print '
'; print '
'; + print '
'; print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); print '
'; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + print ''; - if ($filterfound) { - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + print '
'; print '
'; @@ -739,18 +804,52 @@ if ($resql) { print ''; print ''; print '
'; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + if ($user->admin) { + print ''.img_delete().''; + } + } + print ''.dol_escape_htmltag($valuetoshow).''.dol_escape_htmltag($valuetoshow).''; + if (empty($obj->formula)) { + // Count number of accounts into group + $nbofaccountintogroup = 0; + $listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid); + $nbofaccountintogroup = count($listofaccountintogroup); - $canbemodified = $iserasable; - - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); - if ($param) { - $url .= '&'.$param; + print ''; + print $langs->trans("NAccounts", $nbofaccountintogroup); + print ''; + } else { + print ''.$langs->trans("Formula").''; } - $url .= '&'; + print ''; @@ -811,49 +902,25 @@ if ($resql) { } print "'.img_edit().' '; - if ($user->admin) { - print ''.img_delete().''; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + if ($user->admin) { + print ''.img_delete().''; + } } - //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin print ' '; - if (empty($obj->formula)) { - print ''; - print $langs->trans("ListOfAccounts"); - print ''; - - // Count number of accounts into group - $nbofaccountintogroup = 0; - $listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid); - $nbofaccountintogroup = count($listofaccountintogroup); - //if ($nbofaccountintogroup > 0) { - print ' ('.$langs->trans("NAccounts", $nbofaccountintogroup).')'; - //} else { - // print ' (0)'; - //} - } - print '
'.$langs->trans("None").'
'; - $size = ''; $class = ''; - if ($fieldlist[$field] == 'code') { + $class = ''; + if (in_array($fieldlist[$field], array('code', 'range_account', 'label', 'formula'))) { $class = 'maxwidth100'; } if ($fieldlist[$field] == 'position') { $class = 'maxwidth50'; } - if ($fieldlist[$field] == 'libelle') { - $class = 'quatrevingtpercent'; - } - if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'category_type') { - $size = 'size="2" '; - } - print ''; + print ''; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").''.$langs->trans("ShortInfo").'
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Preview").''.$langs->trans("ShortInfo").'
'."\n"; print ''; @@ -452,7 +455,7 @@ foreach ($dirmodels as $reldir) { print "'; if (getDolGlobalString("TICKET_ADDON_PDF") == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -461,6 +464,17 @@ foreach ($dirmodels as $reldir) { } print ''; + if ($module->type == 'pdf') { + print ''.img_object($langs->trans("Preview"), 'pdf').''; + } else { + print img_object($langs->trans("PreviewNotAvailable"), 'generic'); + } + print '
'; print $formcategory->textwithpicto('', $htmltooltip, 1, 0); print ''; - if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'pdf').''; - } else { - print img_object($langs->trans("PreviewNotAvailable"), 'generic'); - } - print '
'; print ''; print ''; -print ''; -print ''; +print '\n"; +print ''; print "\n"; -// Auto mark ticket read when created from backoffice +// Auto mark ticket as read when created from backoffice print ''; print ''; print ''; -// Auto assign ticket at user who created it +// Auto assign ticket to user who created it print ''; print ''; print ''; print ''; -//Allow classification modification even if the ticket is closed +// Allow classification modification even if the ticket is closed print ''; print ''; -print ''; +print ''; +print ''; print "\n"; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { print ''; - print ''; + print ''; + print ''; print "\n"; } -// @todo Use module notification instead... +// TODO Use module notification instead... -// Email d'envoi des notifications +// Email to send notifications print ''; print ''; @@ -656,7 +667,7 @@ print ''; // Email for notification of TICKET_CREATE print ''; print ''; +print ''; print ''; From a661570aecb7297639becf286f9684964769ed08 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Wed, 27 Sep 2023 11:43:21 +0200 Subject: [PATCH 38/55] Fix notnull key missing --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3e10ea82eaa..8d6d90171cf 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9081,7 +9081,7 @@ abstract class CommonObject // If we have a field ref with a default value of (PROV) if (!$error) { - if (key_exists('ref', $this->fields) && $this->fields['ref']['notnull'] > 0 && key_exists('default', $this->fields['ref']) && $this->fields['ref']['default'] == '(PROV)') { + if (key_exists('ref', $this->fields) && key_exists('notnull', $this->fields['ref']) && $this->fields['ref']['notnull'] > 0 && key_exists('default', $this->fields['ref']) && $this->fields['ref']['default'] == '(PROV)') { $sql = "UPDATE ".$this->db->prefix().$this->table_element." SET ref = '(PROV".((int) $this->id).")' WHERE (ref = '(PROV)' OR ref = '') AND rowid = ".((int) $this->id); $resqlupdate = $this->db->query($sql); From 5411a18e1b597e7390f21d1d02177201ec22fc9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Sep 2023 12:53:58 +0200 Subject: [PATCH 39/55] Fix warning --- .../conferenceorboothattendee_list.php | 4 +++- htdocs/modulebuilder/index.php | 19 +++++++++---------- htdocs/product/class/product.class.php | 3 ++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 7404550cdba..d13d51ee655 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -751,8 +751,10 @@ print ''; $params = array('morecss'=>'reposition'); +$urlnew = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl); + $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd, $params); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $urlnew, '', $permissiontoadd, $params); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 28715465920..86aa539fa05 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3895,7 +3895,7 @@ if ($module == 'initmodule') { print ''; print ''; // javascript - print '
'.$langs->trans("Parameter").''.$langs->trans("Status")."'.$langs->trans("ShortInfo").'
'.$langs->trans("TicketsAutoReadTicket").''; if ($conf->use_javascript_ajax) { @@ -534,7 +541,7 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp" print '
'.$langs->trans("TicketsAutoAssignTicket").''; @@ -600,7 +607,7 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswers print '
'.$langs->trans("TicketsAllowClassificationModificationIfClosed").''; if ($conf->use_javascript_ajax) { @@ -621,7 +628,9 @@ print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); print ''; - +/* + * Notification + */ // Admin var of module print load_fiche_titre($langs->trans("Notification"), '', ''); @@ -633,18 +642,20 @@ print ''; print ''; print '
'.$langs->trans("Email").''.$langs->trans("Email").''.$langs->trans("ShortInfo").'
'.$langs->trans("TicketCkEditorEmailNotActivated").'
'.$langs->trans("TicketCkEditorEmailNotActivated").'
'.$langs->trans("ShortInfo").'
'.$langs->trans("TicketEmailNotificationFrom").''; print '
'.$langs->trans("TicketEmailNotificationTo").''; -print ''; print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help'); print '