From 6b29b2d9dc9bc50e600f9d015aff5d6fc10483e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Feb 2022 10:51:51 +0100 Subject: [PATCH 001/328] Add preg_quote --- htdocs/core/class/utils.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 09e11ed5221..17afecde14a 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -376,9 +376,9 @@ class Utils continue; } fwrite($handle, $read.($execmethod == 2 ? '' : "\n")); - if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) { + if (preg_match('/'.preg_quote('-- Dump completed', '/').'/i', $read)) { $ok = 1; - } elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) { + } elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES', '/').'/i', $read)) { $ok = 1; } } From e5fd11c8e075d275e69be05cf6073d0345f0cb7f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 1 Mar 2022 09:28:38 +0100 Subject: [PATCH 002/328] FIX missing advanced perms --- htdocs/comm/propal/card.php | 2 +- htdocs/fourn/paiement/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9f902c51e29..9e6e68a2ee9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -116,7 +116,7 @@ $usercandelete = $user->rights->propal->supprimer; $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate))); -$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send); +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send)); $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index f8f484f0cc9..3c077881f99 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -344,7 +344,7 @@ if ($result > 0) { // Send by mail if ($user->socid == 0 && $action == '') { - $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS)); + $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->send))); if ($usercansend) { print ''.$langs->trans('SendMail').''; } else { From dd9a350136daf495348a548bc971369e19e4a226 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 2 Mar 2022 22:41:00 +0100 Subject: [PATCH 003/328] Simplification of the code by separating the part given to menu processing The goal: - A simplification of the code for easier maintenance is targeted - Separation of data to left menu display processing - Plan in the future to put the left menu data directly in the folders of the modules concerned and which will be loaded automatically by eldy.lib.php or eldy_menus.php (for example add a folder "menus/leftmenu.php" in the module "bank" => "bank/menus/leftmenu.php")... This greatly cleans up the code and makes the modules easier to maintain while also avoiding the massive use of hooks for external modules. - A reuse of the left menus in other corners of the ERP just by calling the function of the desired menu. - The code is much lighter! is more readable with easier display order modification! --- htdocs/core/menus/standard/eldy.lib.php | 2530 ++++++++++++----------- 1 file changed, 1378 insertions(+), 1152 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 9361b01b086..5d2181c3e82 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -676,7 +676,1372 @@ function print_end_menu_array() print "\n"; } +/** + * Get left Menu HOME + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + if ($mainmenu == 'home') { + $langs->load("users"); + + // Home - dashboard + $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', ''); + + // Setup + $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', ''); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") { + // Load translation files required by the page + $langs->loadLangs(array("admin", "help")); + + $warnpicto = ''; + if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { + $langs->load("errors"); + $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); + } + $newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto, 1); + + $warnpicto = ''; + if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled + $langs->load("errors"); + $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); + } + $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto, 1); + $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"), 1); + $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"), 1); + + $newmenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"), 1); + $newmenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"), 1); + $newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"), 1); + $newmenu->add("/admin/delais.php?mainmenu=home", $langs->trans("MenuWarnings"), 1); + $newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"), 1); + $newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"), 1); + $newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1); + + $warnpicto = ''; + if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { + $langs->load("errors"); + $warnpicto = img_warning($langs->trans("WarningPHPMailD")); + } + if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) { + $langs->load("errors"); + $warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete")); + } + + $newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails").$warnpicto, 1); + $newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"), 1); + $newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"), 1); + $newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"), 1); + } + + // System tools + $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', ''); + if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) { + // Load translation files required by the page + $langs->loadLangs(array('admin', 'help')); + + $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); + if ($usemenuhider || empty($leftmenu) || $leftmenu == 'admintools_info') { + $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); + $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); + $newmenu->add('/admin/system/filecheck.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('FileCheck'), 2); + } + $newmenu->add('/admin/system/browser.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoBrowser'), 1); + $newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1); + $newmenu->add('/admin/system/web.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoWebServer'), 1); + $newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1); + $newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1); + $newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"), 1); + $newmenu->add("/admin/system/security.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoSecurity"), 1); + $newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"), 1); + $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"), 1); + $newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"), 1); + $newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"), 1); + $newmenu->add("/admin/tools/listevents.php?mainmenu=home&leftmenu=admintools", $langs->trans("Audit"), 1); + $newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"), 1); + $newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('ExternalResources'), 1); + + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { + $langs->load("products"); + $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin); + } + } + + $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); + if ($user->rights->user->user->lire) { + if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") { + $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); + $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->rights->user->user->creer || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home'); + $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); + $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + } + } + } +} + +/** + * Get left Menu THIRDPARTIES + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'companies') { + // Societes + if (!empty($conf->societe->enabled)) { + $langs->load("companies"); + $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"')); + + if ($user->rights->societe->creer) { + $newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1); + if (!$conf->use_javascript_ajax) { + $newmenu->add("/societe/card.php?action=create&private=1", $langs->trans("MenuNewPrivateIndividual"), 1); + } + } + } + + $newmenu->add("/societe/list.php?leftmenu=thirdparties", $langs->trans("List"), 1); + + // Prospects + if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $langs->load("commercial"); + $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects'); + /* no more required, there is a filter that can do more + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); + */ + $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->rights->societe->creer); + } + + // Customers/Prospects + if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $langs->load("commercial"); + $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'customers'); + + $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->rights->societe->creer); + } + + // Suppliers + if (!empty($conf->societe->enabled) && (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) { + $langs->load("suppliers"); + $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers'); + $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire)); + } + + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + // Categories prospects/customers + $menutoshow = $langs->trans("CustomersProspectsCategoriesShort"); + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $menutoshow = $langs->trans("CustomersCategoriesShort"); + } + if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $menutoshow = $langs->trans("ProspectsCategoriesShort"); + } + $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + // Categories suppliers + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire); + } + } + + // Contacts + $newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"')); + + $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); + $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); + } + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); + } + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); + } + $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire); + //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); + + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + // Categories Contact + $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + } +} + +/** + * Get left Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'commercial') { + $langs->load("companies"); + + // Customer proposal + if (!empty($conf->propal->enabled)) { + $langs->load("propal"); + $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer); + $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") { + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); + //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); + } + $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire); + } + + // Customers orders + if (!empty($conf->commande->enabled)) { + $langs->load("orders"); + $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); + $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") { + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); + if (!empty($conf->expedition->enabled)) { + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); + } + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire); + //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); + } + $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); + } + + // Supplier proposal + if (!empty($conf->supplier_proposal->enabled)) { + $langs->load("supplier_proposal"); + $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer); + $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->rights->supplier_proposal->lire); + $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->supplier_proposal->lire); + } + + // Suppliers orders + if (!empty($conf->supplier_order->enabled)) { + $langs->load("orders"); + $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->rights->fournisseur->commande->creer); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") { + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); + if (empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) { + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->rights->fournisseur->commande->lire); + } + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->rights->fournisseur->commande->lire); + } + // Billed is another field. We should add instead a dedicated filter on list. if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("Billed"), 2, $user->rights->fournisseur->commande->lire); + + + $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); + } + + // Contrat + if (!empty($conf->contrat->enabled)) { + $langs->load("contracts"); + $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer); + $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") { + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire); + } + } + + // Interventions + if (!empty($conf->ficheinter->enabled)) { + $langs->load("interventions"); + $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); + $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203); + } + $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire); + } + } +} + +/** + * Get left COMPTA-FINANCIAL + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'billing') { + $langs->load("companies"); + + // Customers invoices + if (!empty($conf->facture->enabled)) { + $langs->load("bills"); + $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_list'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) { + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->rights->facture->lire); + } + $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->rights->facture->creer, '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice. + + $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment'); + + if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { + $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->rights->facture->lire, '', $mainmenu, 'customer_bills_tovalid'); + } + if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu)) { + $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment_report'); + } + + $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_stats'); + } + + // Suppliers invoices + if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) { + $langs->load("bills"); + $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_notpaid'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid'); + } + + $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'supplierinvoicestemplate_list'); + + $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { + $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment_report'); + } + + $newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_stats'); + } + + // Orders + if (!empty($conf->commande->enabled)) { + $langs->load("orders"); + if (!empty($conf->facture->enabled)) { + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); + } + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); + } + + // Supplier Orders to bill + if (!empty($conf->supplier_invoice->enabled)) { + if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) { + $langs->load("supplier"); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); + } + } + + + // Donations + if (!empty($conf->don->enabled)) { + $langs->load("donations"); + $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") { + $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->rights->don->creer); + $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->rights->don->lire); + } + // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); + } + + // Taxes and social contributions + if (!empty($conf->tax->enabled)) { + $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + + $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) { + $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); + $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); + } + // VAT + if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) { + global $mysoc; + + $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) { + $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->rights->tax->charges->creer); + $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/payments.php?mode=tvaonly&leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + } + + //Local Taxes 1 + if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) { + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->rights->tax->charges->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) { + $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->rights->tax->charges->creer); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("List"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + } + } + //Local Taxes 2 + if ($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj == "1")) { + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->rights->tax->charges->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) { + $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->rights->tax->charges->creer); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("List"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + } + } + } + } + + // Salaries + if (!empty($conf->salaries->enabled)) { + $langs->load("salaries"); + $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) { + $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->rights->salaries->write); + $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->rights->salaries->read); + $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read); + $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->rights->salaries->read); + } + } + + // Loan + if (!empty($conf->loan->enabled)) { + $langs->load("loan"); + $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) { + $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->rights->loan->write); + //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read); + } + } + + // Various payment + if (!empty($conf->banque->enabled) && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { + $langs->load("banks"); + $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) { + $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->rights->banque->modifier); + $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->rights->banque->lire); + } + } + } +} + +/** + * Get left COMPTA-FINANCIAL (accountancy) + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @param DB $db + * @return void + */ +function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0, $db) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'accountancy') { + $langs->load("companies"); + + // Accounting (Double entries) + if (!empty($conf->accounting->enabled)) { + //$permtoshowmenu = (!empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire); + //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy'); + + // Configuration + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) { + global $mysoc; + $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10); + + // Fiscal year - Not really yet used. In a future will lock some periods. + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20); + } + + $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30); + $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40); + $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); + $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); + $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50); + $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60); + if (!empty($conf->banque->enabled)) { + $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70); + } + if (!empty($conf->facture->enabled) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { + $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80); + } + if (!empty($conf->tax->enabled)) { + $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90); + } + if (!empty($conf->expensereport->enabled)) { + $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100); + } + $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110); + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120); + } + $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130); + } + + // Transfer in accounting + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"')); + + // Binding + // $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch'); + if (!empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { + $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) { + $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + } + } + if (!empty($conf->supplier_invoice->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { + $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier'); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) { + $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + } + } + if (!empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { + $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport'); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) { + $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + } + } + + // Journals + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', '', ''); + + // Multi journal + $sql = "SELECT rowid, code, label, nature"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal"; + $sql .= " WHERE entity = ".$conf->entity; + $sql .= " AND active = 1"; + $sql .= " ORDER BY nature ASC, label DESC"; + + $resql = $db->query($sql); + if ($resql) { + $numr = $db->num_rows($resql); + $i = 0; + + if ($numr > 0) { + while ($i < $numr) { + $objp = $db->fetch_object($resql); + + $nature = ''; + + // Must match array $sourceList defined into journals_list.php + if ($objp->nature == 2 && !empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { + $nature = "sells"; + } + if ($objp->nature == 3 + && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) + && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { + $nature = "purchases"; + } + if ($objp->nature == 4 && !empty($conf->banque->enabled)) { + $nature = "bank"; + } + if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { + $nature = "expensereports"; + } + if ($objp->nature == 1) { + $nature = "various"; + } + if ($objp->nature == 8) { + $nature = "inventory"; + } + if ($objp->nature == 9) { + $nature = "hasnew"; + } + + // To enable when page exists + if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { + if ($nature == 'hasnew' || $nature == 'inventory') { + $nature = ''; + } + } + + if ($nature) { + $langs->load('accountancy'); + $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... + $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); + } + $i++; + } + } else { + // Should not happend. Entries are added + $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire); + } + } else { + dol_print_error($db); + } + $db->free($resql); + } + + // Files + if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); + } + + + // Accounting + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire || $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); + + // General Ledger + $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); + + // Journals + $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); + + // Account Balance + $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); + + // Closure + $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure'); + + // Reports + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); + } + + $modecompta = 'CREANCES-DETTES'; + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + } + if ($modecompta) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->rights->accounting->comptarapport->lire); + } + } + + $modecompta = 'RECETTES-DEPENSES'; + //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + if ($modecompta) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); + //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); + //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + } + } + + $modecompta = 'CREANCES-DETTES'; + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPING'; // Not yet implemented. + } + if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); + } + } + + $modecompta = 'RECETTES-DEPENSES'; + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented. + } + if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + } + } + } + + // Accountancy (simple) + if (!empty($conf->comptabilite->enabled)) { + // Files + if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); + } + + // Bilan, resultats + $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) { + $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + /* On verra ca avec module compabilite expert + $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); + */ + + /* + $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); + if (! empty($conf->propal->enabled)) { + $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); + } + */ + + $modecompta = 'CREANCES-DETTES'; + $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire); + + $modecompta = 'RECETTES-DEPENSES'; + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + + //Achats + $modecompta = 'CREANCES-DETTES'; + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); + + /* + $modecompta = 'RECETTES-DEPENSES'; + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + */ + + // Journals + $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); + $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51); + } + //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + } + + // Intracomm report + if (!empty($conf->intracommreport->enabled)) { + $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) { + // DEB / DES + $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1); + $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); + } + } + + // Assets + if (!empty($conf->asset->enabled)) { + $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write); + $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)), '', $mainmenu, 'asset_model'); + if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) { + $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read))); + } + } + } +} + + +/** + * Get left Menu BANK + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'bank') { + // Load translation files required by the page + $langs->loadLangs(array("withdrawals", "banks", "bills", "categories")); + + // Bank-Cash account + if (!empty($conf->banque->enabled)) { + $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"')); + + $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer); + $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->lire, '', $mainmenu, 'bank'); + $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->rights->banque->lire); + $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->rights->banque->lire); + + $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->rights->banque->transfer); + } + + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->rights->categorie->creer, '', $mainmenu, 'tags'); + $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->rights->banque->configurer, '', $mainmenu, 'tags'); + } + + // Direct debit order + if (!empty($conf->prelevement->enabled)) { + $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { + $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); + + $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire); + $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->rights->prelevement->bons->lire); + $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->prelevement->bons->lire); + $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->prelevement->bons->lire); + } + } + + // Bank transfer order + if (!empty($conf->paymentbybanktransfer->enabled)) { + $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { + $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->rights->paymentbybanktransfer->create); + + $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->paymentbybanktransfer->read); + } + } + + // Management of checks + if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && !empty($conf->banque->enabled) && (!empty($conf->facture->enabled) || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) { + $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque, '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + if (preg_match('/checks/', $leftmenu)) { + $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->rights->banque->cheque); + $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->cheque); + } + } + + // Cash Control + if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) { + $permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run')); + $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="pictofixedwidth"')); + $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence); + $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence); + } + } +} + +/** + * Get left Menu PRODUCTS-SERVICES + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'products') { + // Products + if (!empty($conf->product->enabled)) { + $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"')); + $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); + $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); + if (!empty($conf->stock->enabled)) { + $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + } + if (!empty($conf->productbatch->enabled)) { + $langs->load("stocks"); + $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + } + if (!empty($conf->variants->enabled)) { + $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire); + } + if (!empty($conf->propal->enabled) || (!empty($conf->commande->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); + } + + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + } + } + + // Services + if (!empty($conf->service->enabled)) { + $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"')); + $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); + $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); + if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_oder->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire || $user->rights->product->lire); + } + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + } + } + + // Warehouse + if (!empty($conf->stock->enabled)) { + $langs->load("stocks"); + $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"')); + $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); + $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); + $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); + + $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer); + if ($conf->supplier_order->enabled) { + $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + } + $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + + // Categories for warehouses + if (!empty($conf->categorie->enabled)) { + $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + } + + // Inventory + if (!empty($conf->stock->enabled)) { + $langs->load("stocks"); + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire); + } + } else { + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); + } + } + } + + // Shipments + if (!empty($conf->expedition->enabled)) { + $langs->load("sendings"); + $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"')); + $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); + $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") { + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->rights->expedition->lire); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->rights->expedition->lire); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->rights->expedition->lire); + } + $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); + } + + // Receptions + if (!empty($conf->reception->enabled)) { + $langs->load("receptions"); + $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"')); + $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer); + $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); + } + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); + } + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); + } + $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire); + } + } +} + +/** + * Get left Menu PRODUCTS-SERVICES MRP - GPAO + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'mrp') { + // BOM + if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) { + $langs->load("mrp"); + + $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingrightonly pictofixedwidth"')); + $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write, '', $mainmenu, 'bom'); + $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom'); + } + + if (!empty($conf->mrp->enabled)) { + $langs->load("mrp"); + + $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingrightonly pictofixedwidth"')); + $newmenu->add("/mrp/mo_card.php?leftmenu=mo&action=create", $langs->trans("NewMO"), 1, $user->rights->mrp->write, '', $mainmenu, 'mo'); + $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo'); + } + } +} + +/** + * Get left Menu PROJECTS + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'project') { + if (!empty($conf->projet->enabled)) { + $langs->load("projects"); + + $search_project_user = GETPOST('search_project_user', 'int'); + + $tmpentry = array( + 'enabled'=>(!empty($conf->projet->enabled)), + 'perms'=>(!empty($user->rights->projet->lire)), + 'module'=>'projet' + ); + $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); + + $titleboth = $langs->trans("LeadsOrProjects"); + $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default + if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + $titleboth = $langs->trans("Projects"); + $titlenew = $langs->trans("NewProject"); + } + if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only + $titleboth = $langs->trans("Leads"); + $titlenew = $langs->trans("NewLead"); + } + + // Project assigned to user + $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="pictofixedwidth"')); + $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer); + + if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list'); + } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 1) { + $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); + } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); + } + + $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); + + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + // Project affected to user + $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="pictofixedwidth"')); + $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); + + $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"')); + } + } + } +} + +/** + * Get left Menu HRM + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'hrm') { + // HRM module + if (!empty($conf->hrm->enabled)) { + $langs->load("hrm"); + + $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->user->user->lire, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); + $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->user->user->creer); + $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->user->user->lire); + + $newmenu->add("/hrm/index.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm_sm") { + // Skills + $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Skills"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="pictofixedwidth"')); + //$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewSkill"), 1, $user->rights->hrm->all->write); + //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + + // Job (Description of work to do and skills required) + $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="pictofixedwidth"')); + //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->rights->hrm->all->write); + //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + + // Position = Link job - user + $newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("EmployeePositions"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user-cog', 'class="pictofixedwidth"')); + //$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->rights->hrm->all->write); + //$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + + // Evaluation + $newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Evalutions"), 1, $user->rights->hrm->evaluation->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); + //$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewEval"), 1, $user->rights->hrm->evaluation->write); + //$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->evaluation->read); + $newmenu->add("/hrm/compare.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillComparison"), 1, $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read); + } + } + + // Leave/Holiday/Vacation module + if (!empty($conf->holiday->enabled)) { + // Load translation files required by the page + $langs->loadLangs(array("holiday", "trips")); + + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'holiday', 'class="pictofixedwidth"')); + $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm") { + $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); + } + $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall); + $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); + } + + // Trips and expenses (old module) + if (!empty($conf->deplacement->enabled)) { + $langs->load("trips"); + $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"')); + $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer); + $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->deplacement->lire); + $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); + } + + // Expense report + if (!empty($conf->expensereport->enabled)) { + $langs->load("trips"); + $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->expensereport->lire, '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"')); + $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->expensereport->creer); + $newmenu->add("/expensereport/list.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->expensereport->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "expensereport") { + $newmenu->add("/expensereport/list.php?search_status=0&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Draft"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=2&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Validated"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=5&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Approved"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=6&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Paid"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=4&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Canceled"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=99&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Refused"), 2, $user->rights->expensereport->lire); + } + $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->expensereport->lire); + } + + if (!empty($conf->projet->enabled)) { + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + $langs->load("projects"); + + $search_project_user = GETPOST('search_project_user', 'int'); + + $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"')); + } + } + } +} + +/** + * Get left Menu TOOLS + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'tools') { + if (empty($user->socid)) { // limit to internal users + $langs->load("mails"); + $newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); + } + + if (!empty($conf->mailing->enabled)) { + $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); + $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); + } + + if (!empty($conf->export->enabled)) { + $langs->load("exports"); + $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer); + //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire); + } + + if (!empty($conf->import->enabled)) { + $langs->load("exports"); + $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run); + } + } +} + +/** + * Get left Menu MEMBERS + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'members') { + if (!empty($conf->adherent->enabled)) { + // Load translation files required by the page + $langs->loadLangs(array("members", "compta")); + + $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'member', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/card.php?leftmenu=members&action=create", $langs->trans("NewMember"), 1, $user->rights->adherent->creer); + $newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("UpToDate"), 3, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("OutOfDate"), 3, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire); + $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); + + $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->rights->adherent->export); + if (!empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) { + $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export); + } + + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + + $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members", $langs->trans("NewSubscription"), 1, $user->rights->adherent->cotisation->creer); + $newmenu->add("/adherents/subscription/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->cotisation->lire); + $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); + + //$newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Tools"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); + //if (! empty($conf->export->enabled) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); + + // Type + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members&action=create", $langs->trans("New"), 1, $user->rights->adherent->configurer); + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer); + } + } +} /** * Core function to output left menu eldy @@ -697,7 +2062,7 @@ function print_end_menu_array() function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) { - global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc, $hookmanager; + global $user, $conf, $langs, $hookmanager; //var_dump($tabMenu); @@ -739,1223 +2104,84 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM * Menu HOME */ if ($mainmenu == 'home') { - $langs->load("users"); - - // Home - dashboard - $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', ''); - - // Setup - $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', ''); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") { - // Load translation files required by the page - $langs->loadLangs(array("admin", "help")); - - $warnpicto = ''; - if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { - $langs->load("errors"); - $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); - } - $newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto, 1); - - $warnpicto = ''; - if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled - $langs->load("errors"); - $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); - } - $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto, 1); - $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"), 1); - $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"), 1); - - $newmenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"), 1); - $newmenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"), 1); - $newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"), 1); - $newmenu->add("/admin/delais.php?mainmenu=home", $langs->trans("MenuWarnings"), 1); - $newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"), 1); - $newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"), 1); - $newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1); - - $warnpicto = ''; - if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { - $langs->load("errors"); - $warnpicto = img_warning($langs->trans("WarningPHPMailD")); - } - if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) { - $langs->load("errors"); - $warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete")); - } - - $newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails").$warnpicto, 1); - $newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"), 1); - $newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"), 1); - $newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"), 1); - } - - // System tools - $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', ''); - if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) { - // Load translation files required by the page - $langs->loadLangs(array('admin', 'help')); - - $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); - if ($usemenuhider || empty($leftmenu) || $leftmenu == 'admintools_info') { - $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); - $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); - $newmenu->add('/admin/system/filecheck.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('FileCheck'), 2); - } - $newmenu->add('/admin/system/browser.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoBrowser'), 1); - $newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1); - $newmenu->add('/admin/system/web.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoWebServer'), 1); - $newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1); - $newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1); - $newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"), 1); - $newmenu->add("/admin/system/security.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoSecurity"), 1); - $newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"), 1); - $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"), 1); - $newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"), 1); - $newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"), 1); - $newmenu->add("/admin/tools/listevents.php?mainmenu=home&leftmenu=admintools", $langs->trans("Audit"), 1); - $newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"), 1); - $newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('ExternalResources'), 1); - - if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { - $langs->load("products"); - $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin); - } - } - - $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); - if ($user->rights->user->user->lire) { - if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") { - $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); - $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->rights->user->user->creer || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home'); - $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); - $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - } - } + get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } - /* * Menu THIRDPARTIES */ if ($mainmenu == 'companies') { - // Societes - if (!empty($conf->societe->enabled)) { - $langs->load("companies"); - $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"')); - - if ($user->rights->societe->creer) { - $newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1); - if (!$conf->use_javascript_ajax) { - $newmenu->add("/societe/card.php?action=create&private=1", $langs->trans("MenuNewPrivateIndividual"), 1); - } - } - } - - $newmenu->add("/societe/list.php?leftmenu=thirdparties", $langs->trans("List"), 1); - - // Prospects - if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects'); - /* no more required, there is a filter that can do more - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); - */ - $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->rights->societe->creer); - } - - // Customers/Prospects - if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'customers'); - - $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->rights->societe->creer); - } - - // Suppliers - if (!empty($conf->societe->enabled) && (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) { - $langs->load("suppliers"); - $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers'); - $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire)); - } - - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - // Categories prospects/customers - $menutoshow = $langs->trans("CustomersProspectsCategoriesShort"); - if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $menutoshow = $langs->trans("CustomersCategoriesShort"); - } - if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $menutoshow = $langs->trans("ProspectsCategoriesShort"); - } - $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - // Categories suppliers - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { - $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire); - } - } - - // Contacts - $newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"')); - - $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); - $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); - } - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); - } - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); - } - $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire); - //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); - - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - // Categories Contact - $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } + get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) */ if ($mainmenu == 'commercial') { - $langs->load("companies"); - - // Customer proposal - if (!empty($conf->propal->enabled)) { - $langs->load("propal"); - $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer); - $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") { - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); - //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); - } - $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire); - } - - // Customers orders - if (!empty($conf->commande->enabled)) { - $langs->load("orders"); - $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); - $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); - if (!empty($conf->expedition->enabled)) { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); - } - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire); - //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); - } - $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); - } - - // Supplier proposal - if (!empty($conf->supplier_proposal->enabled)) { - $langs->load("supplier_proposal"); - $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer); - $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->rights->supplier_proposal->lire); - $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->supplier_proposal->lire); - } - - // Suppliers orders - if (!empty($conf->supplier_order->enabled)) { - $langs->load("orders"); - $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->rights->fournisseur->commande->creer); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") { - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); - if (empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) { - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->rights->fournisseur->commande->lire); - } - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->rights->fournisseur->commande->lire); - } - // Billed is another field. We should add instead a dedicated filter on list. if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("Billed"), 2, $user->rights->fournisseur->commande->lire); - - - $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); - } - - // Contrat - if (!empty($conf->contrat->enabled)) { - $langs->load("contracts"); - $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer); - $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") { - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire); - } - } - - // Interventions - if (!empty($conf->ficheinter->enabled)) { - $langs->load("interventions"); - $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); - $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203); - } - $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire); - } + get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } - /* * Menu COMPTA-FINANCIAL */ if ($mainmenu == 'billing') { - $langs->load("companies"); - - // Customers invoices - if (!empty($conf->facture->enabled)) { - $langs->load("bills"); - $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_list'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) { - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->rights->facture->lire); - } - $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->rights->facture->creer, '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice. - - $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment'); - - if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->rights->facture->lire, '', $mainmenu, 'customer_bills_tovalid'); - } - if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu)) { - $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment_report'); - } - - $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_stats'); - } - - // Suppliers invoices - if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) { - $langs->load("bills"); - $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_notpaid'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid'); - } - - $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'supplierinvoicestemplate_list'); - - $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { - $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment_report'); - } - - $newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_stats'); - } - - // Orders - if (!empty($conf->commande->enabled)) { - $langs->load("orders"); - if (!empty($conf->facture->enabled)) { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); - } - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); - } - - // Supplier Orders to bill - if (!empty($conf->supplier_invoice->enabled)) { - if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) { - $langs->load("supplier"); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); - } - } - - - // Donations - if (!empty($conf->don->enabled)) { - $langs->load("donations"); - $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") { - $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->rights->don->creer); - $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->rights->don->lire); - } - // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); - } - - // Taxes and social contributions - if (!empty($conf->tax->enabled)) { - $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - - $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) { - $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); - } - // VAT - if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) { - global $mysoc; - - $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) { - $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/payments.php?mode=tvaonly&leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); - } - - //Local Taxes 1 - if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) { - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->rights->tax->charges->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) { - $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); - } - } - //Local Taxes 2 - if ($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj == "1")) { - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->rights->tax->charges->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) { - $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); - } - } - } - } - - // Salaries - if (!empty($conf->salaries->enabled)) { - $langs->load("salaries"); - $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) { - $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->rights->salaries->write); - $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->rights->salaries->read); - $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read); - $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->rights->salaries->read); - } - } - - // Loan - if (!empty($conf->loan->enabled)) { - $langs->load("loan"); - $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) { - $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->rights->loan->write); - //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read); - } - } - - // Various payment - if (!empty($conf->banque->enabled) && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { - $langs->load("banks"); - $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) { - $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->rights->banque->modifier); - $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->rights->banque->lire); - } - } + get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu COMPTA-FINANCIAL */ if ($mainmenu == 'accountancy') { - $langs->load("companies"); - - // Accounting (Double entries) - if (!empty($conf->accounting->enabled)) { - //$permtoshowmenu = (!empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire); - //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy'); - - // Configuration - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) { - $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10); - - // Fiscal year - Not really yet used. In a future will lock some periods. - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20); - } - - $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30); - $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40); - $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50); - $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60); - if (!empty($conf->banque->enabled)) { - $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70); - } - if (!empty($conf->facture->enabled) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { - $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80); - } - if (!empty($conf->tax->enabled)) { - $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90); - } - if (!empty($conf->expensereport->enabled)) { - $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100); - } - $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110); - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { - $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120); - } - $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130); - } - - // Transfer in accounting - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"')); - - // Binding - // $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch'); - if (!empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { - $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) { - $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); - } - } - if (!empty($conf->supplier_invoice->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { - $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier'); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) { - $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); - } - } - if (!empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { - $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport'); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) { - $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); - } - } - - // Journals - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', '', ''); - - // Multi journal - $sql = "SELECT rowid, code, label, nature"; - $sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal"; - $sql .= " WHERE entity = ".$conf->entity; - $sql .= " AND active = 1"; - $sql .= " ORDER BY nature ASC, label DESC"; - - $resql = $db->query($sql); - if ($resql) { - $numr = $db->num_rows($resql); - $i = 0; - - if ($numr > 0) { - while ($i < $numr) { - $objp = $db->fetch_object($resql); - - $nature = ''; - - // Must match array $sourceList defined into journals_list.php - if ($objp->nature == 2 && !empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { - $nature = "sells"; - } - if ($objp->nature == 3 - && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) - && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { - $nature = "purchases"; - } - if ($objp->nature == 4 && !empty($conf->banque->enabled)) { - $nature = "bank"; - } - if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { - $nature = "expensereports"; - } - if ($objp->nature == 1) { - $nature = "various"; - } - if ($objp->nature == 8) { - $nature = "inventory"; - } - if ($objp->nature == 9) { - $nature = "hasnew"; - } - - // To enable when page exists - if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { - if ($nature == 'hasnew' || $nature == 'inventory') { - $nature = ''; - } - } - - if ($nature) { - $langs->load('accountancy'); - $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... - $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); - } - $i++; - } - } else { - // Should not happend. Entries are added - $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire); - } - } else { - dol_print_error($db); - } - $db->free($resql); - } - - // Files - if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); - } - - - // Accounting - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire || $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); - - // General Ledger - $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); - - // Journals - $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); - - // Account Balance - $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); - - // Closure - $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure'); - - // Reports - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); - } - - $modecompta = 'CREANCES-DETTES'; - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED - } - if ($modecompta) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->rights->accounting->comptarapport->lire); - } - } - - $modecompta = 'RECETTES-DEPENSES'; - //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED - if ($modecompta) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); - //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); - //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); - } - } - - $modecompta = 'CREANCES-DETTES'; - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $modecompta = 'BOOKKEEPING'; // Not yet implemented. - } - if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); - } - } - - $modecompta = 'RECETTES-DEPENSES'; - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented. - } - if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - } - } - } - - // Accountancy (simple) - if (!empty($conf->comptabilite->enabled)) { - // Files - if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); - } - - // Bilan, resultats - $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) { - $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - /* On verra ca avec module compabilite expert - $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); - */ - - /* - $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); - if (! empty($conf->propal->enabled)) { - $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); - } - */ - - $modecompta = 'CREANCES-DETTES'; - $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire); - - $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - - //Achats - $modecompta = 'CREANCES-DETTES'; - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); - - /* - $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - */ - - // Journals - $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); - $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51); - } - //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); - } - - // Intracomm report - if (!empty($conf->intracommreport->enabled)) { - $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) { - // DEB / DES - $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1); - $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); - } - } - - // Assets - if (!empty($conf->asset->enabled)) { - $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write); - $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)), '', $mainmenu, 'asset_model'); - if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) { - $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read))); - } - } + get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user, $db); } - /* * Menu BANK */ if ($mainmenu == 'bank') { - // Load translation files required by the page - $langs->loadLangs(array("withdrawals", "banks", "bills", "categories")); - - // Bank-Cash account - if (!empty($conf->banque->enabled)) { - $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"')); - - $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer); - $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->lire, '', $mainmenu, 'bank'); - $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->rights->banque->lire); - $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->rights->banque->lire); - - $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->rights->banque->transfer); - } - - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->rights->categorie->creer, '', $mainmenu, 'tags'); - $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->rights->banque->configurer, '', $mainmenu, 'tags'); - } - - // Direct debit order - if (!empty($conf->prelevement->enabled)) { - $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { - $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); - - $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->prelevement->bons->lire); - } - } - - // Bank transfer order - if (!empty($conf->paymentbybanktransfer->enabled)) { - $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { - $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->rights->paymentbybanktransfer->create); - - $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->paymentbybanktransfer->read); - } - } - - // Management of checks - if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && !empty($conf->banque->enabled) && (!empty($conf->facture->enabled) || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) { - $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque, '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - if (preg_match('/checks/', $leftmenu)) { - $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->rights->banque->cheque); - $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->cheque); - } - } - - // Cash Control - if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) { - $permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run')); - $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="pictofixedwidth"')); - $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence); - $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence); - } + get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu PRODUCTS-SERVICES */ if ($mainmenu == 'products') { - // Products - if (!empty($conf->product->enabled)) { - $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"')); - $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); - $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); - if (!empty($conf->stock->enabled)) { - $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - } - if (!empty($conf->productbatch->enabled)) { - $langs->load("stocks"); - $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - } - if (!empty($conf->variants->enabled)) { - $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire); - } - if (!empty($conf->propal->enabled) || (!empty($conf->commande->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { - $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); - } - - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); - } - } - - // Services - if (!empty($conf->service->enabled)) { - $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"')); - $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); - $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); - if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_oder->enabled) || !empty($conf->supplier_invoice->enabled)) { - $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire || $user->rights->product->lire); - } - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); - } - } - - // Warehouse - if (!empty($conf->stock->enabled)) { - $langs->load("stocks"); - $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"')); - $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); - $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); - $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); - - $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer); - if ($conf->supplier_order->enabled) { - $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); - } - $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - - // Categories for warehouses - if (!empty($conf->categorie->enabled)) { - $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - } - - // Inventory - if (!empty($conf->stock->enabled)) { - $langs->load("stocks"); - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire); - } - } else { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); - } - } - } - - // Shipments - if (!empty($conf->expedition->enabled)) { - $langs->load("sendings"); - $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"')); - $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); - $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") { - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->rights->expedition->lire); - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->rights->expedition->lire); - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->rights->expedition->lire); - } - $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); - } - - // Receptions - if (!empty($conf->reception->enabled)) { - $langs->load("receptions"); - $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"')); - $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer); - $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); - } - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); - } - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); - } - $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire); - } + get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu PRODUCTS-SERVICES MRP - GPAO */ if ($mainmenu == 'mrp') { - // BOM - if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) { - $langs->load("mrp"); - - $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingrightonly pictofixedwidth"')); - $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write, '', $mainmenu, 'bom'); - $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom'); - } - - if (!empty($conf->mrp->enabled)) { - $langs->load("mrp"); - - $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingrightonly pictofixedwidth"')); - $newmenu->add("/mrp/mo_card.php?leftmenu=mo&action=create", $langs->trans("NewMO"), 1, $user->rights->mrp->write, '', $mainmenu, 'mo'); - $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo'); - } + get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu PROJECTS */ if ($mainmenu == 'project') { - if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - - $search_project_user = GETPOST('search_project_user', 'int'); - - $tmpentry = array( - 'enabled'=>(!empty($conf->projet->enabled)), - 'perms'=>(!empty($user->rights->projet->lire)), - 'module'=>'projet' - ); - $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - - $titleboth = $langs->trans("LeadsOrProjects"); - $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default - if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - $titleboth = $langs->trans("Projects"); - $titlenew = $langs->trans("NewProject"); - } - if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only - $titleboth = $langs->trans("Leads"); - $titlenew = $langs->trans("NewLead"); - } - - // Project assigned to user - $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="pictofixedwidth"')); - $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer); - - if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 1) { - $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); - } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); - } - - $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); - - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - - if (empty($conf->global->PROJECT_HIDE_TASKS)) { - // Project affected to user - $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="pictofixedwidth"')); - $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); - $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); - $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); - - $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"')); - } - } + get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu HRM */ if ($mainmenu == 'hrm') { - // HRM module - if (!empty($conf->hrm->enabled)) { - $langs->load("hrm"); - - $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->user->user->lire, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); - $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->user->user->creer); - $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->user->user->lire); - - $newmenu->add("/hrm/index.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm_sm") { - // Skills - $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Skills"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="pictofixedwidth"')); - //$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewSkill"), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); - - // Job (Description of work to do and skills required) - $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="pictofixedwidth"')); - //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); - - // Position = Link job - user - $newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("EmployeePositions"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user-cog', 'class="pictofixedwidth"')); - //$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); - - // Evaluation - $newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Evalutions"), 1, $user->rights->hrm->evaluation->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); - //$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewEval"), 1, $user->rights->hrm->evaluation->write); - //$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->evaluation->read); - $newmenu->add("/hrm/compare.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillComparison"), 1, $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read); - } - } - - // Leave/Holiday/Vacation module - if (!empty($conf->holiday->enabled)) { - // Load translation files required by the page - $langs->loadLangs(array("holiday", "trips")); - - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'holiday', 'class="pictofixedwidth"')); - $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm") { - $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); - } - $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); - $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall); - $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); - } - - // Trips and expenses (old module) - if (!empty($conf->deplacement->enabled)) { - $langs->load("trips"); - $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"')); - $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer); - $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->deplacement->lire); - $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); - } - - // Expense report - if (!empty($conf->expensereport->enabled)) { - $langs->load("trips"); - $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->expensereport->lire, '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"')); - $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->expensereport->creer); - $newmenu->add("/expensereport/list.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->expensereport->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "expensereport") { - $newmenu->add("/expensereport/list.php?search_status=0&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Draft"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=2&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Validated"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=5&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Approved"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=6&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Paid"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=4&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Canceled"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=99&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Refused"), 2, $user->rights->expensereport->lire); - } - $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->expensereport->lire); - } - - if (!empty($conf->projet->enabled)) { - if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $langs->load("projects"); - - $search_project_user = GETPOST('search_project_user', 'int'); - - $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"')); - } - } + get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } - /* * Menu TOOLS */ if ($mainmenu == 'tools') { - if (empty($user->socid)) { // limit to internal users - $langs->load("mails"); - $newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); - } - - if (!empty($conf->mailing->enabled)) { - $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); - $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); - } - - if (!empty($conf->export->enabled)) { - $langs->load("exports"); - $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer); - //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire); - } - - if (!empty($conf->import->enabled)) { - $langs->load("exports"); - $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run); - } + get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu MEMBERS */ if ($mainmenu == 'members') { - if (!empty($conf->adherent->enabled)) { - // Load translation files required by the page - $langs->loadLangs(array("members", "compta")); - - $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'member', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/card.php?leftmenu=members&action=create", $langs->trans("NewMember"), 1, $user->rights->adherent->creer); - $newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("UpToDate"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("OutOfDate"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); - - $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->rights->adherent->export); - if (!empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) { - $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export); - } - - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - - $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members", $langs->trans("NewSubscription"), 1, $user->rights->adherent->cotisation->creer); - $newmenu->add("/adherents/subscription/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->cotisation->lire); - $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); - - //$newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Tools"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); - //if (! empty($conf->export->enabled) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); - - // Type - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members&action=create", $langs->trans("New"), 1, $user->rights->adherent->configurer); - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer); - } + get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } // Add personalized menus and modules menus From cf43024d5df66185d5c6533ec0a43c09e125e843 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Thu, 3 Mar 2022 11:29:47 +0100 Subject: [PATCH 004/328] Update eldy.lib.php --- htdocs/core/menus/standard/eldy.lib.php | 734 ++++++++++++------------ 1 file changed, 367 insertions(+), 367 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5d2181c3e82..efe8d87ff86 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -676,6 +676,373 @@ function print_end_menu_array() print "\n"; } +/** + * Core function to output left menu eldy + * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) + * + * @param DoliDB $db Database handler + * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) + * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param Menu $menu Object Menu to return back list of menu entries + * @param int $noout Disable output (Initialise &$menu only). + * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. + * @param array $moredata An array with more data to output + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office + * @return int Nb of menu entries + */ +function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) +{ + + global $user, $conf, $langs, $hookmanager; + + //var_dump($tabMenu); + + $newmenu = $menu; + + $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]); + $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"])); + + $usemenuhider = 0; + + if (is_array($moredata) && !empty($moredata['searchform'])) { // searchform can contains select2 code or link to show old search form or link to switch on search page + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['searchform']; + print '
'."\n"; + print "\n"; + } + + if (is_array($moredata) && !empty($moredata['bookmarks'])) { + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['bookmarks']; + print '
'."\n"; + print "\n"; + } + + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + + $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + + /** + * We update newmenu with entries found into database + * -------------------------------------------------- + */ + if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail + /* + * Menu HOME + */ + if ($mainmenu == 'home') { + get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu THIRDPARTIES + */ + if ($mainmenu == 'companies') { + get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) + */ + if ($mainmenu == 'commercial') { + get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu COMPTA-FINANCIAL + */ + if ($mainmenu == 'billing') { + get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu COMPTA-FINANCIAL + */ + if ($mainmenu == 'accountancy') { + get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user, $db); + } + + /* + * Menu BANK + */ + if ($mainmenu == 'bank') { + get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu PRODUCTS-SERVICES + */ + if ($mainmenu == 'products') { + get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu PRODUCTS-SERVICES MRP - GPAO + */ + if ($mainmenu == 'mrp') { + get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu PROJECTS + */ + if ($mainmenu == 'project') { + get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu HRM + */ + if ($mainmenu == 'hrm') { + get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu TOOLS + */ + if ($mainmenu == 'tools') { + get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu MEMBERS + */ + if ($mainmenu == 'members') { + get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + // Add personalized menus and modules menus + //var_dump($newmenu->liste); // + $menuArbo = new Menubase($db, 'eldy'); + $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu); + //var_dump($newmenu->liste); // + + if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') { // Entry for FTP + $MAXFTP = 20; + $i = 1; + while ($i <= $MAXFTP) { + $paramkey = 'FTP_NAME_'.$i; + //print $paramkey; + if (!empty($conf->global->$paramkey)) { + $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; + $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24)); + } + $i++; + } + } + } + + //var_dump($tabMenu); // + //var_dump($newmenu->liste); + + // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after + //var_dump($menu_array_before);exit; + //var_dump($menu_array_after);exit; + $menu_array = $newmenu->liste; + if (is_array($menu_array_before)) { + $menu_array = array_merge($menu_array_before, $menu_array); + } + if (is_array($menu_array_after)) { + $menu_array = array_merge($menu_array, $menu_array_after); + } + //var_dump($menu_array);exit; + if (!is_array($menu_array)) { + return 0; + } + + // Allow the $menu_array of the menu to be manipulated by modules + $parameters = array( + 'mainmenu' => $mainmenu, + ); + $hook_items = $menu_array; + $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks + + if (is_numeric($reshook)) { + if ($reshook == 0 && !empty($hookmanager->results)) { + $menu_array[] = $hookmanager->results; // add + } elseif ($reshook == 1) { + $menu_array = $hookmanager->results; // replace + } + + // @todo Sort menu items by 'position' value + // $position = array(); + // foreach ($menu_array as $key => $row) { + // $position[$key] = $row['position']; + // } + // array_multisort($position, SORT_ASC, $menu_array); + } + + // TODO Use the position property in menu_array to reorder the $menu_array + //var_dump($menu_array); + /*$new_menu_array = array(); + $level=0; $cusor=0; $position=0; + $nbentry = count($menu_array); + while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) + { + + $cursor++; + }*/ + + // Show menu + $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; + if (empty($noout)) { + $altok = 0; + $blockvmenuopened = false; + $lastlevel0 = ''; + $num = count($menu_array); + for ($i = 0; $i < $num; $i++) { // Loop on each menu entry + $showmenu = true; + if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) { + $showmenu = false; + } + + // Begin of new left menu block + if (empty($menu_array[$i]['level']) && $showmenu) { + $altok++; + $blockvmenuopened = true; + $lastopened = true; + for ($j = ($i + 1); $j < $num; $j++) { + if (empty($menu_array[$j]['level'])) { + $lastopened = false; + } + } + if ($altok % 2 == 0) { + print '
'."\n"; + } else { + print '
'."\n"; + } + } + + // Add tabulation + $tabstring = ''; + $tabul = ($menu_array[$i]['level'] - 1); + if ($tabul > 0) { + for ($j = 0; $j < $tabul; $j++) { + $tabstring .= '   '; + } + } + + // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution + + $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); + + $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; + if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) { + $tmp = explode('?', $menu_array[$i]['url'], 2); + $url = $shorturl = $tmp[0]; + $param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link + + // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined. + if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) { + $param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; + } + if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) { + $param .= ($param ? '&' : '').'leftmenu='; + } + //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad + $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); + $shorturlwithoutparam = $shorturl; + $shorturl = $shorturl.($param ? '?'.$param : ''); + } + + + print ''."\n"; + + // Menu level 0 + if ($menu_array[$i]['level'] == 0) { + if ($menu_array[$i]['enabled']) { // Enabled so visible + print ''."\n"; + $lastlevel0 = 'enabled'; + } elseif ($showmenu) { // Not enabled but visible (so greyed) + print ''."\n"; + $lastlevel0 = 'greyed'; + } else { + $lastlevel0 = 'hidden'; + } + if ($showmenu) { + print ''."\n"; + } + } + + // Menu level > 0 + if ($menu_array[$i]['level'] > 0) { + $cssmenu = ''; + if ($menu_array[$i]['url']) { + $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url'])); + } + + if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') { + // Enabled so visible, except if parent was not enabled. + print ''."\n"; + } elseif ($showmenu && $lastlevel0 == 'enabled') { + // Not enabled but visible (so greyed), except if parent was not enabled. + print ''."\n"; + } + } + + // If next is a new block or if there is nothing after + if (empty($menu_array[$i + 1]['level'])) { // End menu block + if ($showmenu) { + print ''."\n"; + } + if ($blockvmenuopened) { + print '
'."\n"; + $blockvmenuopened = false; + } + } + } + + if ($altok) { + print '
'; // End menu block + } + } + + return count($menu_array); +} + + /** * Get left Menu HOME * @@ -1516,7 +1883,6 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef } } - /** * Get left Menu BANK * @@ -2042,369 +2408,3 @@ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen } } } - -/** - * Core function to output left menu eldy - * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) - * - * @param DoliDB $db Database handler - * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) - * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) - * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param Menu $menu Object Menu to return back list of menu entries - * @param int $noout Disable output (Initialise &$menu only). - * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' - * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. - * @param array $moredata An array with more data to output - * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @return int Nb of menu entries - */ -function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) -{ - - global $user, $conf, $langs, $hookmanager; - - //var_dump($tabMenu); - - $newmenu = $menu; - - $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]); - $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"])); - - $usemenuhider = 0; - - if (is_array($moredata) && !empty($moredata['searchform'])) { // searchform can contains select2 code or link to show old search form or link to switch on search page - print "\n"; - print "\n"; - print '
'."\n"; - print $moredata['searchform']; - print '
'."\n"; - print "\n"; - } - - if (is_array($moredata) && !empty($moredata['bookmarks'])) { - print "\n"; - print "\n"; - print '
'."\n"; - print $moredata['bookmarks']; - print '
'."\n"; - print "\n"; - } - - $substitarray = getCommonSubstitutionArray($langs, 0, null, null); - - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); - - /** - * We update newmenu with entries found into database - * -------------------------------------------------- - */ - if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail - /* - * Menu HOME - */ - if ($mainmenu == 'home') { - get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu THIRDPARTIES - */ - if ($mainmenu == 'companies') { - get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) - */ - if ($mainmenu == 'commercial') { - get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu COMPTA-FINANCIAL - */ - if ($mainmenu == 'billing') { - get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu COMPTA-FINANCIAL - */ - if ($mainmenu == 'accountancy') { - get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user, $db); - } - - /* - * Menu BANK - */ - if ($mainmenu == 'bank') { - get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu PRODUCTS-SERVICES - */ - if ($mainmenu == 'products') { - get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu PRODUCTS-SERVICES MRP - GPAO - */ - if ($mainmenu == 'mrp') { - get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu PROJECTS - */ - if ($mainmenu == 'project') { - get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu HRM - */ - if ($mainmenu == 'hrm') { - get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu TOOLS - */ - if ($mainmenu == 'tools') { - get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu MEMBERS - */ - if ($mainmenu == 'members') { - get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - // Add personalized menus and modules menus - //var_dump($newmenu->liste); // - $menuArbo = new Menubase($db, 'eldy'); - $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu); - //var_dump($newmenu->liste); // - - if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') { // Entry for FTP - $MAXFTP = 20; - $i = 1; - while ($i <= $MAXFTP) { - $paramkey = 'FTP_NAME_'.$i; - //print $paramkey; - if (!empty($conf->global->$paramkey)) { - $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; - $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24)); - } - $i++; - } - } - } - - //var_dump($tabMenu); // - //var_dump($newmenu->liste); - - // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after - //var_dump($menu_array_before);exit; - //var_dump($menu_array_after);exit; - $menu_array = $newmenu->liste; - if (is_array($menu_array_before)) { - $menu_array = array_merge($menu_array_before, $menu_array); - } - if (is_array($menu_array_after)) { - $menu_array = array_merge($menu_array, $menu_array_after); - } - //var_dump($menu_array);exit; - if (!is_array($menu_array)) { - return 0; - } - - // Allow the $menu_array of the menu to be manipulated by modules - $parameters = array( - 'mainmenu' => $mainmenu, - ); - $hook_items = $menu_array; - $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks - - if (is_numeric($reshook)) { - if ($reshook == 0 && !empty($hookmanager->results)) { - $menu_array[] = $hookmanager->results; // add - } elseif ($reshook == 1) { - $menu_array = $hookmanager->results; // replace - } - - // @todo Sort menu items by 'position' value - // $position = array(); - // foreach ($menu_array as $key => $row) { - // $position[$key] = $row['position']; - // } - // array_multisort($position, SORT_ASC, $menu_array); - } - - // TODO Use the position property in menu_array to reorder the $menu_array - //var_dump($menu_array); - /*$new_menu_array = array(); - $level=0; $cusor=0; $position=0; - $nbentry = count($menu_array); - while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) - { - - $cursor++; - }*/ - - // Show menu - $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; - if (empty($noout)) { - $altok = 0; - $blockvmenuopened = false; - $lastlevel0 = ''; - $num = count($menu_array); - for ($i = 0; $i < $num; $i++) { // Loop on each menu entry - $showmenu = true; - if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) { - $showmenu = false; - } - - // Begin of new left menu block - if (empty($menu_array[$i]['level']) && $showmenu) { - $altok++; - $blockvmenuopened = true; - $lastopened = true; - for ($j = ($i + 1); $j < $num; $j++) { - if (empty($menu_array[$j]['level'])) { - $lastopened = false; - } - } - if ($altok % 2 == 0) { - print '
'."\n"; - } else { - print '
'."\n"; - } - } - - // Add tabulation - $tabstring = ''; - $tabul = ($menu_array[$i]['level'] - 1); - if ($tabul > 0) { - for ($j = 0; $j < $tabul; $j++) { - $tabstring .= '   '; - } - } - - // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution - - $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); - - $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; - if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) { - $tmp = explode('?', $menu_array[$i]['url'], 2); - $url = $shorturl = $tmp[0]; - $param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link - - // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined. - if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) { - $param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; - } - if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) { - $param .= ($param ? '&' : '').'leftmenu='; - } - //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad - $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); - $shorturlwithoutparam = $shorturl; - $shorturl = $shorturl.($param ? '?'.$param : ''); - } - - - print ''."\n"; - - // Menu level 0 - if ($menu_array[$i]['level'] == 0) { - if ($menu_array[$i]['enabled']) { // Enabled so visible - print ''."\n"; - $lastlevel0 = 'enabled'; - } elseif ($showmenu) { // Not enabled but visible (so greyed) - print ''."\n"; - $lastlevel0 = 'greyed'; - } else { - $lastlevel0 = 'hidden'; - } - if ($showmenu) { - print ''."\n"; - } - } - - // Menu level > 0 - if ($menu_array[$i]['level'] > 0) { - $cssmenu = ''; - if ($menu_array[$i]['url']) { - $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url'])); - } - - if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') { - // Enabled so visible, except if parent was not enabled. - print ''."\n"; - } elseif ($showmenu && $lastlevel0 == 'enabled') { - // Not enabled but visible (so greyed), except if parent was not enabled. - print ''."\n"; - } - } - - // If next is a new block or if there is nothing after - if (empty($menu_array[$i + 1]['level'])) { // End menu block - if ($showmenu) { - print ''."\n"; - } - if ($blockvmenuopened) { - print '
'."\n"; - $blockvmenuopened = false; - } - } - } - - if ($altok) { - print '
'; // End menu block - } - } - - return count($menu_array); -} From 6c172d6441c97368f8baa1e72d987247894f5313 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 3 Mar 2022 11:58:29 +0100 Subject: [PATCH 005/328] NEW option update prices on proposal cloning --- htdocs/comm/propal/card.php | 6 +-- htdocs/comm/propal/class/propal.class.php | 54 ++++++++++++++++++++++- htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/products.lang | 1 + 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 61ecb966359..e30adc2f860 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -220,7 +220,7 @@ if (empty($reshook)) { } } - $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null)); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), GETPOSTISSET('update_prices')); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -1914,8 +1914,8 @@ if ($action == 'create') { $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' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')), + array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 1), ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6a6031c3a99..0f711432eb9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1324,11 +1324,12 @@ class Propal extends CommonObject * @param User $user User making the clone * @param int $socid Id of thirdparty * @param int $forceentity Entity id to force + * @param bool $update_prices [=false] Update prices if true * @return int New id of clone */ - public function createFromClone(User $user, $socid = 0, $forceentity = null) + public function createFromClone(User $user, $socid = 0, $forceentity = null, $update_prices = false) { - global $conf, $hookmanager; + global $conf, $hookmanager, $mysoc; dol_include_once('/projet/class/project.class.php'); @@ -1375,6 +1376,55 @@ class Propal extends CommonObject $objsoc->fetch($object->socid); } + // update prices + if ($update_prices === true) { + if ($objsoc->id > 0 && !empty($object->lines)) { + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + // If price per customer + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + } + + foreach ($object->lines as $line) { + if ($line->fk_product > 0) { + $prod = new Product($this->db); + $res = $prod->fetch($line->fk_product); + if ($res > 0) { + $pu_ht = $prod->price; + $tva_tx = get_default_tva($mysoc, $objsoc, $prod->id); + $remise_percent = $objsoc->remise_percent; + + if (!empty($conf->global->PRODUIT_MULTIPRICES) && $objsoc->price_level > 0) { + $pu_ht = $prod->multiprices[$objsoc->price_level]; + if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility + if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) { + $tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level]; + } + } + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + $prodcustprice = new Productcustomerprice($this->db); + $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id); + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + if ($result) { + // If there is some prices specific to the customer + if (count($prodcustprice->lines) > 0) { + $pu_ht = price($prodcustprice->lines[0]->price); + $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); + if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { + $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + } + } + } + } + + $line->subprice = $pu_ht; + $line->tva_tx = $tva_tx; + $line->remise_percent = $remise_percent; + } + } + } + } + } + $object->id = 0; $object->ref = ''; $object->entity = (!empty($forceentity) ? $forceentity : $object->entity); diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 960bf02eb46..b6e41c1f9d5 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -412,3 +412,4 @@ SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status StockMouvementExtraFields= Extra Fields (stock mouvement) InventoryExtraFields= Extra Fields (inventory) +PuttingPricesUpToDate=Update prices diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index a9ae791ec8d..c99f15a4613 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -411,3 +411,4 @@ Rank=Classement SwitchOnSaleStatus=Basculer le statut En vente SwitchOnPurchaseStatus=Basculer le statut En achat StockMouvementExtraFields= Champs supplémentaires (mouvement de stock) +PuttingPricesUpToDate=Mettre à jour les tarifs From 7239fa36052c68e8761b1753fd0806a485db608e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:19:47 +0100 Subject: [PATCH 006/328] FIX: project creation prevented if PROJECTLEADER contact role renamed, de-activated or deleted --- htdocs/projet/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3f496de2f66..ab61a613734 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -174,10 +174,11 @@ if (empty($reshook)) if (!$error && $result > 0) { // Add myself as project leader - $typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error. + $typeofcontact = 'PROJECTLEADER'; $result = $object->add_contact($user->id, $typeofcontact, 'internal'); - if ($result < 0) - { + + // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case + if ($result < 0 && $result != -3) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; From 801402f46aa7e085c7e6ea72b28c403c73f04718 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Mar 2022 11:58:52 +0100 Subject: [PATCH 007/328] fix: #20267 --- htdocs/comm/action/card.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 752868acb87..ee71cc48f07 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1439,6 +1439,10 @@ if ($id > 0) { $("#fullday").change(function() { setdatefields(); }); + $("#actioncode").change(function() { + if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired"); + else $("#dateend").removeClass("fieldrequired"); + }); })'; print ''."\n"; } @@ -1483,7 +1487,12 @@ if ($id > 0) { print ''.$langs->trans("EventOnFullDay").'fulldayevent ? ' checked' : '').'>'; // Date start - end - print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; + print ''; + print ''.$langs->trans("DateActionStart").''; + print ' - '; + print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").''; + print ''; + //print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); } elseif (GETPOST("afaire") == 2) { From 665e401564b30079c1f2ba64b016c374e11da60e Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 4 Mar 2022 17:03:40 +0100 Subject: [PATCH 008/328] wip: replace butAction --- htdocs/compta/facture/card.php | 89 +++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a4d85c257f8..5b4acb040d6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5359,6 +5359,12 @@ if ($action == 'create') { $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); // Editer une facture deja validee, sans paiement effectue et pas exporte en compta if ($object->statut == Facture::STATUS_VALIDATED) { // We check if lines of invoice are not already transfered into accountancy @@ -5368,18 +5374,27 @@ if ($action == 'create') { if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) { if (!$objectidnext && $object->is_last_in_cycle()) { if ($usercanunvalidate) { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', true, $params); } else { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + $params['attr']['title'] = $langs->trans('NotEnoughPermissions'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', false, $params); } } elseif (!$object->is_last_in_cycle()) { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + $params['attr']['title'] = $langs->trans('NotLastInCycle'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } else { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } } } else { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } } @@ -5414,7 +5429,8 @@ if ($action == 'create') { // Validate if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if ($usercanvalidate) { - print ''.$langs->trans('Validate').''; + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params); + //print ''.$langs->trans('Validate').''; } } @@ -5425,9 +5441,11 @@ if ($action == 'create') { print ''.$langs->trans('SendMail').''; } else { if ($usercansend) { - print ''.$langs->trans('SendMail').''; + //print ''.$langs->trans('SendMail').''; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params); } else { - print ''.$langs->trans('SendMail').''; + //print ''.$langs->trans('SendMail').''; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); } } } @@ -5464,10 +5482,13 @@ if ($action == 'create') { } else { if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) { // For down payment, we refuse to receive more than amount to pay. - print ''.$langs->trans('DoPayment').''; + //print ''.$langs->trans('DoPayment').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseRemainderToPayIsZero'); + print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', '#', '', false, $params); } else { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done) - print ''.$langs->trans('DoPayment').''; + //print ''.$langs->trans('DoPayment').''; + print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account, '', true, $params); } } } @@ -5516,9 +5537,12 @@ if ($action == 'create') { ) { if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) { // We can close a down payment only if paid amount is same than amount of down payment (by definition) - print ''.$langs->trans('ClassifyPaid').''; + //print ''.$langs->trans('ClassifyPaid').''; + $params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment'); + print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params); } else { - print ''.$langs->trans('ClassifyPaid').''; + //print ''.$langs->trans('ClassifyPaid').''; + print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid', '', true, $params); } } @@ -5563,13 +5587,15 @@ if ($action == 'create') { // Clone if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) { - print ''.$langs->trans("ToClone").''; + //print ''.$langs->trans("ToClone").''; + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice', '', true, $params); } // Clone as predefined / Create template if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) { if (!$objectidnext && count($object->lines) > 0) { - print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; + //print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; + print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create', '', true, $params); } } @@ -5602,25 +5628,44 @@ if ($action == 'create') { // Delete $isErasable = $object->is_erasable(); + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions) //var_dump($isErasable); + $enableDelete = false; + $deleteHref = '#'; if ($isErasable == -4) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecausePayments'); + //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -3) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice'); + //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -2) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice'); + //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -1) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); + //print ''.$langs->trans('Delete').''; } elseif ($isErasable <= 0) { // Any other cases - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable'); + //print ''.$langs->trans('Delete').''; } elseif ($objectidnext) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice'); + //print ''.$langs->trans('Delete').''; } else { - print ''.$langs->trans('Delete').''; + //print ''.$langs->trans('Delete').''; + $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken(); + $enableDelete = true; } + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params); } else { - print ''.$langs->trans('Delete').''; + //print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('NotAllowed'); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params); } } print '
'; From e4f4a07fc669568f00895100905a5b13854974a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Fri, 4 Mar 2022 17:31:04 +0100 Subject: [PATCH 009/328] correct mass action "classify delivered" --- htdocs/commande/list.php | 8 ++++---- htdocs/langs/en_US/orders.lang | 3 +++ htdocs/langs/fr_FR/orders.lang | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b534d915914..2033b5626b2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -337,15 +337,15 @@ if ($action == 'shipped' && $permissiontoadd) { $error = 0; foreach ($toselect as $checked) { if ($objecttmp->fetch($checked)) { - if ($objecttmp->statut == 1) { + if ($objecttmp->statut == 1 || $objecttmp->statut == 2) { if ($objecttmp->cloture($user)) { - setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + setEventMessage($objecttmp->ref." ".$langs->trans('PassedInShippedStatus'), 'mesgs'); } else { - setEventMessage($langs->trans('CantBeValidated'), 'errors'); + setEventMessage($langs->trans('YouCantShipThis'), 'errors'); $error++; } } else { - setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); + setEventMessage($objecttmp->ref." ".$langs->trans('MustBeValidatedBefore'), 'errors'); $error++; } } else { diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 9018db40a5b..e94153db1a9 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -102,6 +102,9 @@ ConfirmCancelOrder=Are you sure you want to cancel this order? ConfirmMakeOrder=Are you sure you want to confirm you made this order on %s? GenerateBill=Generate invoice ClassifyShipped=Classify delivered +PassedInShippedStatus=classified delivered +YouCantShipThis=I can't classify this. Please check user permissions +MustBeValidatedBefore=must be Validated or Shipping in order to be classified as shipped DraftOrders=Draft orders DraftSuppliersOrders=Draft purchase orders OnProcessOrders=In process orders diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 16d1ecc2b27..3b0a3e38a7d 100644 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -102,6 +102,9 @@ ConfirmCancelOrder=Êtes-vous sûr de vouloir annuler cette commande ? ConfirmMakeOrder=Êtes-vous sûr de vouloir confirmer cette commande en date du %s ? GenerateBill=Facturer ClassifyShipped=Classer livrée +PassedInShippedStatus=classée livrée +YouCantShipThis=Classement impossible : veuillez vérifier les droits utilisateur +MustBeValidatedBefore=doit être Validée ou En cours de livraison pour pouvoir être classée livrée DraftOrders=Commandes brouillons DraftSuppliersOrders=Commandes fournisseurs brouillons OnProcessOrders=Commandes en cours de traitement From cfabaea645a9f8bbe0ad23b668ae770c26264ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Fri, 4 Mar 2022 17:38:39 +0100 Subject: [PATCH 010/328] translation refining --- htdocs/langs/en_US/orders.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index e94153db1a9..cbe9cca4d7a 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -104,7 +104,7 @@ GenerateBill=Generate invoice ClassifyShipped=Classify delivered PassedInShippedStatus=classified delivered YouCantShipThis=I can't classify this. Please check user permissions -MustBeValidatedBefore=must be Validated or Shipping in order to be classified as shipped +MustBeValidatedBefore=must be Validated or In process in order to be classified as shipped DraftOrders=Draft orders DraftSuppliersOrders=Draft purchase orders OnProcessOrders=In process orders From af8ecd1a384ab9ae796e06adf4213e3f39500e71 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 7 Mar 2022 16:02:49 +0100 Subject: [PATCH 011/328] NEW Availibility dictionnary column unit and number --- htdocs/admin/dict.php | 25 ++++++++++++++----- .../install/mysql/data/llx_c_availability.sql | 10 ++++---- .../install/mysql/migration/15.0.0-16.0.0.sql | 10 ++++++++ .../mysql/tables/llx_c_availability.sql | 2 ++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 74d26e29da5..111186d6e6a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -218,7 +218,7 @@ $tabsql[17] = "SELECT id as rowid, code, label, accountancy_code, active FR $tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode"; $tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif"; $tabsql[20] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method"; -$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c"; +$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.number, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c"; $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"; @@ -265,7 +265,7 @@ $tabsqlsort[17] = "code ASC"; $tabsqlsort[18] = "code ASC, libelle ASC"; $tabsqlsort[19] = "id ASC"; $tabsqlsort[20] = "code ASC, libelle ASC"; -$tabsqlsort[21] = "code ASC, label ASC, position ASC"; +$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, number ASC"; $tabsqlsort[22] = "code ASC, label ASC"; $tabsqlsort[23] = "country ASC, taux ASC"; $tabsqlsort[24] = "code ASC, label ASC"; @@ -312,7 +312,7 @@ $tabfield[17] = "code,label,accountancy_code"; $tabfield[18] = "code,libelle,tracking"; $tabfield[19] = "code,libelle"; $tabfield[20] = "code,libelle"; -$tabfield[21] = "code,label,position"; +$tabfield[21] = "code,label,number,type_duration,position"; $tabfield[22] = "code,label"; $tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[24] = "code,label"; @@ -359,7 +359,7 @@ $tabfieldvalue[17] = "code,label,accountancy_code"; $tabfieldvalue[18] = "code,libelle,tracking"; $tabfieldvalue[19] = "code,libelle"; $tabfieldvalue[20] = "code,libelle"; -$tabfieldvalue[21] = "code,label,position"; +$tabfieldvalue[21] = "code,label,number,type_duration,position"; $tabfieldvalue[22] = "code,label"; $tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[24] = "code,label"; @@ -406,7 +406,7 @@ $tabfieldinsert[17] = "code,label,accountancy_code"; $tabfieldinsert[18] = "code,libelle,tracking"; $tabfieldinsert[19] = "code,libelle"; $tabfieldinsert[20] = "code,libelle"; -$tabfieldinsert[21] = "code,label,position"; +$tabfieldinsert[21] = "code,label,number,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"; @@ -566,7 +566,7 @@ $tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[35] = array(); $tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange')); -$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('MeasuringUnitTypeDesc'), 'scale' => $langs->trans('MeasuringScaleDesc')); +$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc')); $tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc')); $tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp")); @@ -1466,6 +1466,9 @@ if ($id) { if ($value == 'block_if_negative') { $valuetoshow = $langs->trans('BlockHolidayIfNegative'); } + if ($value == 'type_duration') { + $valuetoshow = $langs->trans('Unit'); + } if ($id == 2) { // Special case for state page if ($value == 'region_id') { @@ -1818,6 +1821,9 @@ if ($id) { if ($value == 'block_if_negative') { $valuetoshow = $langs->trans('BlockHolidayIfNegative'); } + if ($value == 'type_duration') { + $valuetoshow = $langs->trans('Unit'); + } if ($value == 'region_id' || $value == 'country_id') { $showfield = 0; @@ -2055,6 +2061,9 @@ if ($id) { $valuetoshow = $langs->trans($obj->{$value}); } elseif ($value == 'block_if_negative') { $valuetoshow = yn($obj->{$value}); + } elseif ($value == 'type_duration') { + $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); + $valuetoshow =$TDurationTypes[$obj->{$value}]; } $class .= ($class ? ' ' : '').'tddict'; if ($value == 'note' && $id == 10) { @@ -2450,6 +2459,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; print $form->selectyesno("block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:''), 1); print ''; + } elseif ($value == 'type_duration') { + print ''; + print $form->selectTypeDuration('', $obj->{$value}, array('i','h')); + print ''; } else { $fieldValue = isset($obj->{$value}) ? $obj->{$value}: ''; diff --git a/htdocs/install/mysql/data/llx_c_availability.sql b/htdocs/install/mysql/data/llx_c_availability.sql index 7291c399da0..e3c043d9ac9 100644 --- a/htdocs/install/mysql/data/llx_c_availability.sql +++ b/htdocs/install/mysql/data/llx_c_availability.sql @@ -26,9 +26,9 @@ -- delete from llx_c_availability; -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (1, 'AV_NOW', 'Immediate', 1, 10); -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (2, 'AV_1W', '1 week', 1, 20); -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (3, 'AV_2W', '2 weeks', 1, 30); -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (4, 'AV_3W', '3 weeks', 1, 40); -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (5, 'AV_4W', '4 weeks', 1, 50); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (1, 'AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (2, 'AV_1W', '1 week', 'w', 1, 1, 20); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (3, 'AV_2W', '2 weeks', 'w', 2, 1, 30); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (4, 'AV_3W', '3 weeks', 'w', 3, 1, 40); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (5, 'AV_4W', '4 weeks', 'w', 4, 1, 50); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 8e1a713ecf7..2cd3612bb09 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -276,3 +276,13 @@ UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SEL UPDATE llx_c_country SET eec=0 WHERE eec IS NULL; ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL; + +ALTER TABLE llx_c_availability ADD COLUMN type_duration char(1); +ALTER TABLE llx_c_availability ADD COLUMN number real DEFAULT 0; + +delete from llx_c_availability WHERE rowid IN (1,2,3,4,5); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (1, 'AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (2, 'AV_1W', '1 week', 'w', 1, 1, 20); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (3, 'AV_2W', '2 weeks', 'w', 2, 1, 30); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (4, 'AV_3W', '3 weeks', 'w', 3, 1, 40); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (5, 'AV_4W', '4 weeks', 'w', 4, 1, 50); diff --git a/htdocs/install/mysql/tables/llx_c_availability.sql b/htdocs/install/mysql/tables/llx_c_availability.sql index b36d89870b4..dd999128f36 100644 --- a/htdocs/install/mysql/tables/llx_c_availability.sql +++ b/htdocs/install/mysql/tables/llx_c_availability.sql @@ -23,6 +23,8 @@ create table llx_c_availability rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(30) NOT NULL, label varchar(128) NOT NULL, + type_duration char(1), + number real, active tinyint DEFAULT 1 NOT NULL, position integer NOT NULL DEFAULT 0 )ENGINE=innodb; From 87b187bded77fc30f63a30986a45619906366e97 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 8 Mar 2022 03:43:40 +0100 Subject: [PATCH 012/328] FIX #20279 Accountancy - PostGreSQL - Error on mass update lines already binded --- htdocs/accountancy/customer/lines.php | 6 +++--- htdocs/accountancy/supplier/lines.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index c45e7b27b0a..63314208883 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -121,9 +121,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { { $db->begin(); - $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l"; - $sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); - $sql1 .= ' WHERE l.rowid IN ('.implode(',', $changeaccount).')'; + $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet"; + $sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); + $sql1 .= ' WHERE rowid IN ('.implode(',', $changeaccount).')'; dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1); $resql1 = $db->query($sql1); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 30976287769..2edf3d01791 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -123,9 +123,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { { $db->begin(); - $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l"; - $sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); - $sql1 .= ' WHERE l.rowid IN ('.implode(',', $changeaccount).')'; + $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; + $sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); + $sql1 .= ' WHERE rowid IN ('.implode(',', $changeaccount).')'; dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1); $resql1 = $db->query($sql1); From 44577b2d1a636dee4340ef6ea41e852ccc4b0626 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Tue, 8 Mar 2022 08:51:31 +0100 Subject: [PATCH 013/328] fix remove delete and add update lxx c availability --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index c81204ae954..297c11bd7e3 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -282,11 +282,11 @@ ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL; ALTER TABLE llx_c_availability ADD COLUMN type_duration char(1); ALTER TABLE llx_c_availability ADD COLUMN number real DEFAULT 0; -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (1, 'AV_NOW', 'Immediate', null, 0, 1, 10); -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (2, 'AV_1W', '1 week', 'w', 1, 1, 20); -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (3, 'AV_2W', '2 weeks', 'w', 2, 1, 30); -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (4, 'AV_3W', '3 weeks', 'w', 3, 1, 40); -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (5, 'AV_4W', '4 weeks', 'w', 4, 1, 50); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_1W', '1 week', 'w', 1, 1, 20); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_2W', '2 weeks', 'w', 2, 1, 30); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_3W', '3 weeks', 'w', 3, 1, 40); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_4W', '4 weeks', 'w', 4, 1, 50); UPDATE llx_c_availability SET type_duration = null, number = 0 WHERE code = 'AV_NOW'; UPDATE llx_c_availability SET type_duration = 'w', number = 1 WHERE code = 'AV_1W'; UPDATE llx_c_availability SET type_duration = 'w', number = 2 WHERE code = 'AV_2W'; From 2561fcbb85abd89c6ec21fc37c7463242d834fb2 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 10:06:57 +0100 Subject: [PATCH 014/328] FIX translate update prices and add const in proposal setup --- htdocs/admin/propal.php | 51 ++++++++++++++++++++++++++++++++ htdocs/comm/propal/card.php | 4 +-- htdocs/langs/en_US/products.lang | 2 +- htdocs/langs/en_US/propal.lang | 1 + htdocs/langs/fr_FR/products.lang | 2 +- htdocs/langs/fr_FR/propal.lang | 1 + 6 files changed, 57 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 6384c561967..f0996b02f75 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -198,6 +198,37 @@ if ($action == 'updateMask') { // par appel methode canBeActivated dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity); +} elseif (preg_match('/set_(.*)/',$action,$reg)) { + $code = $reg[1]; + $value=(GETPOST($code) ? GETPOST($code) : 1); + + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } +} elseif (preg_match('/del_(.*)/',$action,$reg)) { + $code = $reg[1]; + $res = dolibarr_del_const($db, $code, $conf->entity); + + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } } @@ -593,6 +624,26 @@ print ''; +print ''; +print ''; +print '' . $langs->trans('DefaultPuttingPricesUpToDate').''; +print ''; +print ''; +if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('PROPOSAL_CLONE_UPDATE_PRICES', array(), $conf->entity, 0, 0, 1, 0); +} else { + if (empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES)) { + print '' . img_picto($langs->trans('Disabled'), 'switch_off') . ''; + } else { + print '' . img_picto($langs->trans('Enabled'), 'switch_on') . ''; + } +} +print ''; +print ''; +print ''; + /* print '
'; print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e30adc2f860..3267b7b8b67 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -220,7 +220,7 @@ if (empty($reshook)) { } } - $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), GETPOSTISSET('update_prices')); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false)); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -1915,7 +1915,7 @@ if ($action == 'create') { // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')), - array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 1), + array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)), ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index b6e41c1f9d5..eb890560d36 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -412,4 +412,4 @@ SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status StockMouvementExtraFields= Extra Fields (stock mouvement) InventoryExtraFields= Extra Fields (inventory) -PuttingPricesUpToDate=Update prices +PuttingPricesUpToDate=Update prices with current known prices diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index db7b559a8a7..f12832129a8 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -54,6 +54,7 @@ NoDraftProposals=No draft proposals CopyPropalFrom=Create commercial proposal by copying existing proposal CreateEmptyPropal=Create empty commercial proposal or from list of products/services DefaultProposalDurationValidity=Default commercial proposal validity duration (in days) +DefaultPuttingPricesUpToDate=By default update prices with current known prices on cloning a proposal UseCustomerContactAsPropalRecipientIfExist=Use contact/address with type 'Contact following-up proposal' if defined instead of third party address as proposal recipient address ConfirmClonePropal=Are you sure you want to clone the commercial proposal %s? ConfirmReOpenProp=Are you sure you want to open back the commercial proposal %s? diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index c99f15a4613..97443fa3f64 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -411,4 +411,4 @@ Rank=Classement SwitchOnSaleStatus=Basculer le statut En vente SwitchOnPurchaseStatus=Basculer le statut En achat StockMouvementExtraFields= Champs supplémentaires (mouvement de stock) -PuttingPricesUpToDate=Mettre à jour les tarifs +PuttingPricesUpToDate=Mettre à jour les prix diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index c32edfad8c1..54723a5747f 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -54,6 +54,7 @@ NoDraftProposals=Pas de propositions brouillons CopyPropalFrom=Créer proposition/devis par recopie d'un proposition existante CreateEmptyPropal=Créer proposition/devis vierge ou avec la liste des produits/services DefaultProposalDurationValidity=Délai de validité par défaut (en jours) +DefaultPuttingPricesUpToDate=Par défaut, mettre à jour les prix lors de clonage d'une proposition commerciale UseCustomerContactAsPropalRecipientIfExist=Utiliser l'adresse de 'contact suivi client' si définie plutôt que l'adresse du tiers comme destinataire des propositions ConfirmClonePropal=Êtes-vous sûr de vouloir cloner la proposition commerciale %s ? ConfirmReOpenProp=Êtes-vous sûr de vouloir réouvrir la proposition commerciale %s ? From bbe3cfffb187e84491c265057015043afc27d289 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 10:17:47 +0100 Subject: [PATCH 015/328] FIX stickler-ci --- htdocs/admin/propal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index f0996b02f75..da886630ac9 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -198,9 +198,9 @@ if ($action == 'updateMask') { // par appel methode canBeActivated dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity); -} elseif (preg_match('/set_(.*)/',$action,$reg)) { +} elseif (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; - $value=(GETPOST($code) ? GETPOST($code) : 1); + $value = (GETPOST($code) ? GETPOST($code) : 1); $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { @@ -214,7 +214,7 @@ if ($action == 'updateMask') { header("Location: " . $_SERVER["PHP_SELF"]); exit(); } -} elseif (preg_match('/del_(.*)/',$action,$reg)) { +} elseif (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; $res = dolibarr_del_const($db, $code, $conf->entity); From 397776d4a42edeaddd7a36ece03ae833020b276a Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 11:29:01 +0100 Subject: [PATCH 016/328] FIX check mandatory thirdparty fields for mass action --- htdocs/compta/facture/card.php | 39 ----------------- htdocs/compta/facture/class/facture.class.php | 42 ++++++++++++++++++- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d3e5a0062b0..573f1548b9a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -566,45 +566,6 @@ if (empty($reshook)) // Check parameters - // Check for mandatory fields in thirdparty (defined into setup) - $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); - foreach ($array_to_check as $key) - { - $keymin = strtolower($key); - $i = (int) preg_replace('/[^0-9]/', '', $key); - $vallabel = $object->thirdparty->$keymin; - - if ($i > 0) - { - if ($object->thirdparty->isACompany()) - { - // Check for mandatory prof id (but only if country is other than ours) - if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) - { - $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; - if (!$vallabel && !empty($conf->global->$idprof_mandatory)) - { - $langs->load("errors"); - $error++; - setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors'); - } - } - } - } else { - //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); - if ($key == 'EMAIL') - { - // Check for mandatory - if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($object->thirdparty->email)) - { - $langs->load("errors"); - $error++; - setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors'); - } - } - } - } - // Check for mandatory fields in invoice $array_to_check = array('REF_CUSTOMER'=>'RefCustomer'); foreach ($array_to_check as $key => $val) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 63a7b2f8e21..6ae01621b2e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2470,7 +2470,7 @@ class Facture extends CommonInvoice */ public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0) { - global $conf, $langs; + global $conf, $langs, $mysoc; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $productStatic = null; @@ -2512,6 +2512,46 @@ class Facture extends CommonInvoice return -1; } + // Check for mandatory fields in thirdparty (defined into setup) + $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); + foreach ($array_to_check as $key) + { + $keymin = strtolower($key); + $i = (int) preg_replace('/[^0-9]/', '', $key); + $vallabel = $this->thirdparty->$keymin; + + if ($i > 0) + { + if ($this->thirdparty->isACompany()) + { + // Check for mandatory prof id (but only if country is other than ours) + if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) + { + $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; + if (!$vallabel && !empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + } + } else { + if ($key == 'EMAIL') + { + // Check for mandatory + if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) + { + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + } + } + $this->db->begin(); // Check parameters From 19ad2310125a57069ae76ef774664ac051996c03 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 12:02:05 +0100 Subject: [PATCH 017/328] FIX stickler-ci --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6ae01621b2e..00734ccb680 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2531,7 +2531,7 @@ class Facture extends CommonInvoice if (!$vallabel && !empty($conf->global->$idprof_mandatory)) { $langs->load("errors"); - $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } @@ -2544,7 +2544,7 @@ class Facture extends CommonInvoice if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) { $langs->load("errors"); - $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } From e9893716519da24ded648c4b51c872ffbccc148d Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 8 Mar 2022 14:49:26 +0100 Subject: [PATCH 018/328] FIX: better error management at product selling price update --- htdocs/product/class/product.class.php | 3 +- htdocs/product/price.php | 40 +++++++++++++------ .../class/ProductCombination.class.php | 20 +++++++++- 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ce7a5858a6a..cdab6a18c38 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2045,7 +2045,8 @@ class Product extends CommonObject $this->db->commit(); } else { $this->db->rollback(); - dol_print_error($this->db); + $this->error = $this->db->lasterror(); + return -1; } } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 9c084cd8352..704db910147 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -163,11 +163,15 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } - if ($error) - { + if (!$error) { //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2); $localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them. - $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode); + + if ($ret < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } if (!$error) @@ -400,14 +404,22 @@ if (empty($reshook)) { // Activating product price by quantity add a new price line with price_by_qty set to 1 $level = GETPOST('level', 'int'); - $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); + + if ($ret < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } // Unset Price by quantity if ($action == 'disable_price_by_qty') { // Disabling product price by quantity add a new price line with price_by_qty set to 0 $level = GETPOST('level', 'int'); - $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0); + + if ($ret < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } if ($action == 'edit_price_by_qty') @@ -1444,17 +1456,21 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul { $db->free($result); - // Il doit au moins y avoir la ligne de prix initial. - // On l'ajoute donc pour remettre a niveau (pb vieilles versions) - // We emulate the change of the price from interface with the same value than the one into table llx_product + // Il doit au moins y avoir la ligne de prix initial. + // On l'ajoute donc pour remettre a niveau (pb vieilles versions) + // We emulate the change of the price from interface with the same value than the one into table llx_product if (!empty($conf->global->PRODUIT_MULTIPRICES)) { - $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); + $ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); } else { - $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); + $ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); } - $result = $db->query($sql); - $num = $db->num_rows($result); + if ($ret < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + $result = $db->query($sql); + $num = $db->num_rows($result); + } } if ($num > 0) { diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 336503056f9..93960b62f9e 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -534,7 +534,14 @@ class ProductCombination $new_price += $variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code); + $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code); + + if ($ret < 0) { + $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; + return $ret; + } } } } else { @@ -556,7 +563,14 @@ class ProductCombination $new_price += $this->variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq); + $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq); + + if ($ret < 0) { + $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; + return $ret; + } } $this->db->commit(); @@ -565,6 +579,8 @@ class ProductCombination } $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; return -1; } From f837845c122840182ca1f52e0f5a50066accbc70 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 8 Mar 2022 15:07:02 +0100 Subject: [PATCH 019/328] FIX: still prevent project creation if PROJECTLEADER role unavailable, but with a specific error message --- htdocs/langs/en_US/projects.lang | 3 ++- htdocs/projet/card.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2aedbd53377..d93bbbe4a9d 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -267,4 +267,5 @@ NewInvoice=New invoice OneLinePerTask=One line per task OneLinePerPeriod=One line per period RefTaskParent=Ref. Parent Task -ProfitIsCalculatedWith=Profit is calculated using \ No newline at end of file +ProfitIsCalculatedWith=Profit is calculated using +ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types \ No newline at end of file diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index ab61a613734..8c921c0868e 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -178,7 +178,10 @@ if (empty($reshook)) $result = $object->add_contact($user->id, $typeofcontact, 'internal'); // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case - if ($result < 0 && $result != -3) { + if ($result == -3) { + setEventMessage('ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary', 'errors'); + $error++; + } elseif ($result < 0) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; From 8e944b8b6de998f1c8a03a22044015d7ffb7a9ee Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 8 Mar 2022 17:34:51 +0100 Subject: [PATCH 020/328] Fix: Error whem generating supplier payment pdf --- .../core/modules/supplier_payment/doc/pdf_standard.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index b6da2d4c294..1f32f645116 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García + * Copyright (C) 2022 Ferran Marcet * * 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 @@ -132,7 +133,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->db = $db; $this->name = "standard"; $this->description = $langs->trans('DocumentModelStandardPDF'); - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + $this->update_main_doc_field = 0; // Save the name of generated file as the main doc when generating a doc with this template // Page size for A4 format $this->type = 'pdf'; From a14bf4b6217ae2e72f5165a54613283e9d0a211d Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 8 Mar 2022 18:02:55 +0100 Subject: [PATCH 021/328] Fix: New hidden option MAIN_LINK_BY_REF_IN_LINKTO don't work --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 821d87dcd82..f91063653a4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -16,7 +16,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2014-2020 Alexandre Spangaro - * Copyright (C) 2018-2021 Ferran Marcet + * Copyright (C) 2018-2022 Ferran Marcet * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Christophe Battarel @@ -8482,6 +8482,7 @@ class Form print '
'; print ''; print ''; + print ''; print ''; print ''; print ''; From eae3fe78f140e1b7e0f30c1112c6d75867686b36 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Tue, 8 Mar 2022 18:06:26 +0100 Subject: [PATCH 022/328] init --- htdocs/core/lib/functions.lib.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index af5671437ae..5e56ff5b36c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8750,7 +8750,7 @@ function getLanguageCodeFromCountryCode($countrycode) */ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode = 'add') { - global $hookmanager; + global $hookmanager, $db; if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type])) { foreach ($conf->modules_parts['tabs'][$type] as $value) { @@ -8771,7 +8771,18 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, complete_substitutions_array($substitutionarray, $langs, $object, array('needforkey'=>$values[2])); $label = make_substitutions($reg[1], $substitutionarray); } else { - $label = $langs->trans($values[2]); + $labeltemp = explode(',', $values[2]); + if (is_array($labeltemp)) { + $label = $langs->trans($labeltemp[0]); + if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { + dol_include_once($labeltemp[2]); + $obj = new $labeltemp[1]($db); + $function = $labeltemp[3]; + $label .= $obj->$function($object->id, $obj); + } + } else { + $label = $langs->trans($values[2]); + } } $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1); From cef9cf8670842955fca199edaaad25eb799057c9 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Tue, 8 Mar 2022 18:34:56 +0100 Subject: [PATCH 023/328] int --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5e56ff5b36c..109f0fa3f13 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8778,7 +8778,8 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, dol_include_once($labeltemp[2]); $obj = new $labeltemp[1]($db); $function = $labeltemp[3]; - $label .= $obj->$function($object->id, $obj); + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; } } else { $label = $langs->trans($values[2]); From 3dfd92e9c0fda483facd6b6a39b71604d8718609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Mar 2022 21:19:29 +0100 Subject: [PATCH 024/328] Fix do not modify entity on group edit https://www.dolibarr.fr/forum/t/etoile-globalgroup-dans-les-groupes-dutilisateurs-quelle-signification-quel-usage/38772/26 --- htdocs/user/group/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index c3e0e00fdf6..3cce6710f7f 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -206,8 +206,8 @@ if (empty($reshook)) { $object->oldcopy = clone $object; - $object->name = GETPOST("nom", 'nohtml'); - $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml'))); + $object->name = GETPOST("nom", 'nohtml'); + $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml'))); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); @@ -218,7 +218,7 @@ if (empty($reshook)) { if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $object->entity = 0; } else { - $object->entity = GETPOST("entity"); + $object->entity = GETPOSTISSET("entity") ? GETPOST("entity") : $conf->entity; } $ret = $object->update(); From 8f7c361a126fc89710eb2149dbb0462d2d072690 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Wed, 9 Mar 2022 01:31:04 +0100 Subject: [PATCH 025/328] Restoring missing VATIsNotUsed label Overwritten by a transiflex sync --- htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 851323cadd9..b9b4b111b43 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -482,6 +482,7 @@ PaymentByChequeOrderedToShort=Check payments (incl. tax) are payable to SendTo=sent to PaymentByTransferOnThisBankAccount=Payment by transfer to the following bank account VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI +VATIsNotUsedForInvoiceAsso=* Non applicable VAT art-261-7 of CGI LawApplicationPart1=By application of the law 80.335 of 12/05/80 LawApplicationPart2=the goods remain the property of LawApplicationPart3=the seller until full payment of diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index d06da508e4e..d1a0dbbbe92 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -482,6 +482,7 @@ PaymentByChequeOrderedToShort=Règlement TTC par chèque à l'ordre de SendTo=envoyé à PaymentByTransferOnThisBankAccount=Règlement par virement sur le compte bancaire suivant VATIsNotUsedForInvoice=* TVA non applicable art-293B du CGI +VATIsNotUsedForInvoiceAsso=* TVA non applicable art-261-7 du CGI LawApplicationPart1=Par application de la loi 80.335 du 12/05/80 LawApplicationPart2=les marchandises demeurent la propriété du LawApplicationPart3=vendeur jusqu'à complet encaissement de From 6e08115aa2f4794dda3ba330691b1722e87e3710 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 14:52:19 +0100 Subject: [PATCH 026/328] introduce constant INVOICE_CHECK_POSTERIOR_DATE in Facture module --- htdocs/core/modules/modFacture.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index fac768b9c60..2d1a742a304 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -106,6 +106,13 @@ class modFacture extends DolibarrModules $this->const[$r][4] = 0; $r++;*/ + $this->const[$r][0] = "INVOICE_CHECK_POSTERIOR_DATE"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = 0; + $this->const[$r][3] = "When validating an invoice, check that its date is posterior to last invoice date for invoices of same type."; + $this->const[$r][4] = 0; + $r++; + // Boxes //$this->boxes = array(0=>array(1=>'box_factures_imp.php'),1=>array(1=>'box_factures.php')); From 02693ba5eab08ed1d3de0ce5994a5e0d40c751a0 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 15:22:46 +0100 Subject: [PATCH 027/328] Facture : add config option for INVOICE_CHECK_POSTERIOR_DATE --- htdocs/admin/facture.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 9eec54b03a7..f2ab39f6fb4 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -225,6 +225,12 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("Error"), null, 'errors'); } } +} elseif ($action == 'set_INVOICE_CHECK_POSTERIOR_DATE') { + $check_posterior_date = GETPOST('INVOICE_CHECK_POSTERIOR_DATE', 'int'); + $res = dolibarr_set_const($db, 'INVOICE_CHECK_POSTERIOR_DATE', $check_posterior_date, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } } @@ -761,6 +767,25 @@ print '\n"; print ''; + +print ''; +print ''; +print ''; + print '
'.$langs->trans("InvoiceCheckPosteriorDate"). ' ' ; +print $form->textwithpicto('', $langs->trans("InvoiceCheckPosteriorDateHelp"), 1, 'help') . ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE'); +} else { + print '
'; + print ''; + print ''; + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE); +} +print '
'; +print ''; +print ''; +print '
'; print '
'; From ad416ef7925bc28c70f9bef882b971d6d5a72006 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 16:18:34 +0100 Subject: [PATCH 028/328] Facture: create method willBeLastOfSameType() --- htdocs/compta/facture/class/facture.class.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 70aebe6932c..10bc1b0af62 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5123,6 +5123,38 @@ class Facture extends CommonInvoice return $error; } } + + /** + * See if current invoice date is posterior to the last invoice date among validated invoices of same type. + * @param bool $strict compare precise time or only days. + * @return boolean + */ + public function willBeLastOfSameType() + { + // get date of last validated invoices of same type + $sql = 'SELECT datef'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture'; + $sql .= ' WHERE type = ' . (int) $this->type ; + $sql .= ' AND date_valid IS NOT NULL'; + $sql .= ' ORDER BY datef DESC LIMIT 1'; + + $result = $this->db->query($sql); + if ($result) { + // compare with current validation date + if ($this->db->num_rows($result)) { + $obj = $this->db->fetch_object($result); + $last_date = $this->db->jdate($obj->datef); + $invoice_date = $this->date; + + return [$invoice_date >= $last_date, $last_date]; + } else { + // element is first of type to be validated + return [true]; + } + } else { + dol_print_error($this->db); + } + } } /** From eda9622c9ca769ac3a6782b3e5d57d949aac415b Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 10:16:14 +0100 Subject: [PATCH 029/328] Facture: enhance validation by adding INVOICE_CHECK_POSTERIOR_DATE option --- htdocs/compta/facture/class/facture.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 10bc1b0af62..569f677e66b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2671,6 +2671,13 @@ class Facture extends CommonInvoice dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR); return -1; } + if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { + $last_of_type = $this->willBeLastOfSameType(); + if (!$last_of_type[0]) { + $this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref , dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day')); + return -1; + } + } $this->db->begin(); From 7c866ce6a2086355fbac0af97b1cb28a048fa783 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 17:18:29 +0100 Subject: [PATCH 030/328] facture/card.php: avoid validating invoices with date anterior to last invoice date --- htdocs/compta/facture/card.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a4d85c257f8..f980d1c6bde 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -302,6 +302,15 @@ if (empty($reshook)) { // Validation $object->fetch($id); + if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { + $last_of_type = $object->willBeLastOfSameType(); + if (empty($object->date_validation) && !$last_of_type[0]) { + setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref , dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); + header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); + exit; + } + } + // On verifie signe facture if ($object->type == Facture::TYPE_CREDIT_NOTE) { // Si avoir, le signe doit etre negatif From 288663be3682dbd9bdab5600ce45338a4b082abc Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 10:16:48 +0100 Subject: [PATCH 031/328] Facture mass validation: sort by date to avoid conflicts --- htdocs/core/actions_massactions.inc.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 5a4ec3bf02f..4a5fe519acb 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1209,6 +1209,26 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); $error++; } + if ($objecttmp->element == 'facture') { + if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { + // order $toselect by date + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture'; + $sql .= ' WHERE rowid IN ('.$db->escape(implode(', ', $toselect)).')'; + $sql .= ' ORDER BY datef'; + + $resql = $db->query($sql); + if ($resql) { + $toselectnew = []; + while ( !empty($arr = $db->fetch_row($resql))) { + $toselectnew[] = $arr[0]; + } + $toselect = (empty($toselectnew)) ? $toselect : $toselectnew; + } else { + dol_print_error($db); + $error++; + } + } + } if (!$error) { $db->begin(); From 07672b23b92ca503e840c1b721632f1565e7d195 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 17:24:28 +0100 Subject: [PATCH 032/328] Langs/bills.lang: add error string for invoice date check --- htdocs/langs/en_US/admin.lang | 2 ++ htdocs/langs/en_US/bills.lang | 1 + 2 files changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cffd3532c05..fd86b2e7788 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1421,6 +1421,8 @@ WatermarkOnDraftInvoices=Watermark on draft invoices (none if empty) PaymentsNumberingModule=Payments numbering model SuppliersPayment=Vendor payments SupplierPaymentSetup=Vendor payments setup +InvoiceCheckPosteriorDate=Check facture date before validation +InvoiceCheckPosteriorDateHelp=Validating an invoice will be forbidden if its date is anterior to the date of last invoice of same type. ##### Proposals ##### PropalSetup=Commercial proposals module setup ProposalsNumberingModules=Commercial proposal numbering models diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 851323cadd9..993f5a21b2b 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -156,6 +156,7 @@ ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amou ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have an amount excluding tax positive (or null) ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or another is already used so discount series cannot be removed. +ErrorInvoiceIsNotLastOfSameType=Error: The date of invoice %s is %s. It must be posterior or equal to last date for same type invoices (%s). Please change the invoice date. BillFrom=From BillTo=To ActionsOnBill=Actions on invoice From 9ce51ba4b73d8cdcdda5c858784faad004f9029b Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 12:07:40 +0100 Subject: [PATCH 033/328] admin/facture: don't show the modify button if not in an HTML form --- htdocs/admin/facture.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index f2ab39f6fb4..599aac27c3f 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -779,11 +779,11 @@ if ($conf->use_javascript_ajax) { print ''; $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE); + print ''; + print ''; + print ''; + print ''; } -print ''; -print ''; -print ''; -print ''; print ''; print ''; From 4ad92a04fc78c45b4654710ef56eb55f62ac4ddb Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 12:53:44 +0100 Subject: [PATCH 034/328] stickler corrections --- htdocs/compta/facture/card.php | 2 +- htdocs/compta/facture/class/facture.class.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f980d1c6bde..1540846d99a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -305,7 +305,7 @@ if (empty($reshook)) { if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { $last_of_type = $object->willBeLastOfSameType(); if (empty($object->date_validation) && !$last_of_type[0]) { - setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref , dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); + setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 569f677e66b..0d52e4b9fd0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2674,7 +2674,7 @@ class Facture extends CommonInvoice if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { $last_of_type = $this->willBeLastOfSameType(); if (!$last_of_type[0]) { - $this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref , dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day')); + $this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref, dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day')); return -1; } } @@ -5133,7 +5133,6 @@ class Facture extends CommonInvoice /** * See if current invoice date is posterior to the last invoice date among validated invoices of same type. - * @param bool $strict compare precise time or only days. * @return boolean */ public function willBeLastOfSameType() From 93765add38e9ad9754df340a6f20faf5a34b4429 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 13:08:42 +0100 Subject: [PATCH 035/328] Travis fix, hopefully. --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 4a5fe519acb..bdf13214717 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1213,7 +1213,7 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { // order $toselect by date $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture'; - $sql .= ' WHERE rowid IN ('.$db->escape(implode(', ', $toselect)).')'; + $sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')'; $sql .= ' ORDER BY datef'; $resql = $db->query($sql); From 7f527b85b0c3bc83ee00d8df94a6de6a06a8455b Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 9 Mar 2022 09:34:50 +0100 Subject: [PATCH 036/328] use double quotes to compose SQL requests --- htdocs/compta/facture/class/facture.class.php | 10 +++++----- htdocs/core/actions_massactions.inc.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0d52e4b9fd0..5ca66ac0cd3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5138,11 +5138,11 @@ class Facture extends CommonInvoice public function willBeLastOfSameType() { // get date of last validated invoices of same type - $sql = 'SELECT datef'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture'; - $sql .= ' WHERE type = ' . (int) $this->type ; - $sql .= ' AND date_valid IS NOT NULL'; - $sql .= ' ORDER BY datef DESC LIMIT 1'; + $sql = "SELECT datef"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE type = " . (int) $this->type ; + $sql .= " AND date_valid IS NOT NULL"; + $sql .= " ORDER BY datef DESC LIMIT 1"; $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index bdf13214717..39d99c4a03b 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1212,9 +1212,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { if ($objecttmp->element == 'facture') { if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { // order $toselect by date - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture'; - $sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')'; - $sql .= ' ORDER BY datef'; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE rowid IN (".$db->sanitize(implode(",", $toselect)).")"; + $sql .= " ORDER BY datef"; $resql = $db->query($sql); if ($resql) { From 7ae96b9839fb200c0cf5a4e2dfbfe1df86cf62c3 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 9 Mar 2022 10:34:23 +0100 Subject: [PATCH 037/328] convert number into qty --- htdocs/admin/dict.php | 10 +++++----- .../install/mysql/data/llx_c_availability.sql | 10 +++++----- .../install/mysql/migration/15.0.0-16.0.0.sql | 17 ++++++----------- .../install/mysql/tables/llx_c_availability.sql | 2 +- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 111186d6e6a..8cfd45fc395 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -218,7 +218,7 @@ $tabsql[17] = "SELECT id as rowid, code, label, accountancy_code, active FR $tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode"; $tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif"; $tabsql[20] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method"; -$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.number, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c"; +$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.qty, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c"; $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"; @@ -265,7 +265,7 @@ $tabsqlsort[17] = "code ASC"; $tabsqlsort[18] = "code ASC, libelle ASC"; $tabsqlsort[19] = "id ASC"; $tabsqlsort[20] = "code ASC, libelle ASC"; -$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, number ASC"; +$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, qty ASC"; $tabsqlsort[22] = "code ASC, label ASC"; $tabsqlsort[23] = "country ASC, taux ASC"; $tabsqlsort[24] = "code ASC, label ASC"; @@ -312,7 +312,7 @@ $tabfield[17] = "code,label,accountancy_code"; $tabfield[18] = "code,libelle,tracking"; $tabfield[19] = "code,libelle"; $tabfield[20] = "code,libelle"; -$tabfield[21] = "code,label,number,type_duration,position"; +$tabfield[21] = "code,label,qty,type_duration,position"; $tabfield[22] = "code,label"; $tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[24] = "code,label"; @@ -359,7 +359,7 @@ $tabfieldvalue[17] = "code,label,accountancy_code"; $tabfieldvalue[18] = "code,libelle,tracking"; $tabfieldvalue[19] = "code,libelle"; $tabfieldvalue[20] = "code,libelle"; -$tabfieldvalue[21] = "code,label,number,type_duration,position"; +$tabfieldvalue[21] = "code,label,qty,type_duration,position"; $tabfieldvalue[22] = "code,label"; $tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[24] = "code,label"; @@ -406,7 +406,7 @@ $tabfieldinsert[17] = "code,label,accountancy_code"; $tabfieldinsert[18] = "code,libelle,tracking"; $tabfieldinsert[19] = "code,libelle"; $tabfieldinsert[20] = "code,libelle"; -$tabfieldinsert[21] = "code,label,number,type_duration,position"; +$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"; diff --git a/htdocs/install/mysql/data/llx_c_availability.sql b/htdocs/install/mysql/data/llx_c_availability.sql index 2e5c64fec05..9b5d1ca5e32 100644 --- a/htdocs/install/mysql/data/llx_c_availability.sql +++ b/htdocs/install/mysql/data/llx_c_availability.sql @@ -25,9 +25,9 @@ -- Availability type -- -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_NOW', 'Immediate', null, 0, 1, 10); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_1W', '1 week', 'w', 1, 1, 20); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_2W', '2 weeks', 'w', 2, 1, 30); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_3W', '3 weeks', 'w', 3, 1, 40); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_4W', '4 weeks', 'w', 4, 1, 50); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_1W', '1 week', 'w', 1, 1, 20); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_2W', '2 weeks', 'w', 2, 1, 30); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_3W', '3 weeks', 'w', 3, 1, 40); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_4W', '4 weeks', 'w', 4, 1, 50); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 297c11bd7e3..746aeae84d3 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -280,15 +280,10 @@ ALTER TABLE llx_propal ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf; UPDATE llx_c_country SET eec=0 WHERE eec IS NULL; ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL; ALTER TABLE llx_c_availability ADD COLUMN type_duration char(1); -ALTER TABLE llx_c_availability ADD COLUMN number real DEFAULT 0; +ALTER TABLE llx_c_availability ADD COLUMN qty real DEFAULT 0; -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_NOW', 'Immediate', null, 0, 1, 10); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_1W', '1 week', 'w', 1, 1, 20); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_2W', '2 weeks', 'w', 2, 1, 30); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_3W', '3 weeks', 'w', 3, 1, 40); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_4W', '4 weeks', 'w', 4, 1, 50); -UPDATE llx_c_availability SET type_duration = null, number = 0 WHERE code = 'AV_NOW'; -UPDATE llx_c_availability SET type_duration = 'w', number = 1 WHERE code = 'AV_1W'; -UPDATE llx_c_availability SET type_duration = 'w', number = 2 WHERE code = 'AV_2W'; -UPDATE llx_c_availability SET type_duration = 'w', number = 3 WHERE code = 'AV_3W'; -UPDATE llx_c_availability SET type_duration = 'w', number = 4 WHERE code = 'AV_4W'; +UPDATE llx_c_availability SET type_duration = null, qty = 0 WHERE code = 'AV_NOW'; +UPDATE llx_c_availability SET type_duration = 'w', qty = 1 WHERE code = 'AV_1W'; +UPDATE llx_c_availability SET type_duration = 'w', qty = 2 WHERE code = 'AV_2W'; +UPDATE llx_c_availability SET type_duration = 'w', qty = 3 WHERE code = 'AV_3W'; +UPDATE llx_c_availability SET type_duration = 'w', qty = 4 WHERE code = 'AV_4W'; diff --git a/htdocs/install/mysql/tables/llx_c_availability.sql b/htdocs/install/mysql/tables/llx_c_availability.sql index dd999128f36..8dfd2e1d5d6 100644 --- a/htdocs/install/mysql/tables/llx_c_availability.sql +++ b/htdocs/install/mysql/tables/llx_c_availability.sql @@ -24,7 +24,7 @@ create table llx_c_availability code varchar(30) NOT NULL, label varchar(128) NOT NULL, type_duration char(1), - number real, + qty real, active tinyint DEFAULT 1 NOT NULL, position integer NOT NULL DEFAULT 0 )ENGINE=innodb; From e06c38650796bbfb531ec98556f7a5cfd4bc2f3b Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 9 Mar 2022 11:32:07 +0100 Subject: [PATCH 038/328] Fix errors propagation and trigger position on delete proposal line --- htdocs/comm/propal/card.php | 5 ++- htdocs/comm/propal/class/propal.class.php | 52 +++++++++++++---------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 63f2977acdb..a77e242379f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -231,8 +231,11 @@ if (empty($reshook)) { // Remove line $result = $object->deleteline($lineid); // reorder lines - if ($result) { + if ($result > 0) { $object->line_order(true); + } else { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0142d0c1b7a..16db2b12723 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -980,6 +980,8 @@ class Propal extends CommonObject $this->db->commit(); return 1; } else { + $this->error = $line->error; + $this->errors = $line->errors; $this->db->rollback(); return -1; } @@ -4166,36 +4168,40 @@ class PropaleLigne extends CommonObjectLine $error = 0; $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".((int) $this->rowid); - dol_syslog("PropaleLigne::delete", LOG_DEBUG); - if ($this->db->query($sql)) { - // Remove extrafields - if (!$error) { - $this->id = $this->rowid; - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('LINEPROPAL_DELETE', $user); + if ($result < 0) { + $error++; } + } + // End call triggers - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('LINEPROPAL_DELETE', $user); - if ($result < 0) { - $this->db->rollback(); - return -1; + if (!$error) { + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int)$this->rowid); + dol_syslog("PropaleLigne::delete", LOG_DEBUG); + if ($this->db->query($sql)) { + // Remove extrafields + if (!$error) { + $this->id = $this->rowid; + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR); + } } + } else { + $this->error = $this->db->error() . " sql=" . $sql; + $error++; } - // End call triggers + } - $this->db->commit(); - - return 1; - } else { - $this->error = $this->db->error()." sql=".$sql; + if ($error) { $this->db->rollback(); return -1; + } else { + $this->db->commit(); + return 1; } } From 1f00dff4dac508c367f29025ef2302815670347b Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 9 Mar 2022 11:40:26 +0100 Subject: [PATCH 039/328] Correction Stickler CI / stickler-ci --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 16db2b12723..65a2e60777f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -4178,7 +4178,7 @@ class PropaleLigne extends CommonObjectLine // End call triggers if (!$error) { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int)$this->rowid); + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid); dol_syslog("PropaleLigne::delete", LOG_DEBUG); if ($this->db->query($sql)) { // Remove extrafields From 22249d15c3e2bd054ab206bdc186b745553f07af Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 9 Mar 2022 14:09:22 +0100 Subject: [PATCH 040/328] Add WYSIWYG Editor on project's tasks description field --- htdocs/projet/tasks.php | 15 ++++++++++++++- htdocs/projet/tasks/task.php | 25 ++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 310857e24cc..bd1fcb326c2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -763,7 +763,20 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Description print ''.$langs->trans("Description").''; print ''; - print ''; + + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } + print ''; print ''.$langs->trans("Budget").''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 19be96cc558..74ea6b17649 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -45,6 +45,7 @@ $confirm = GETPOST('confirm', 'alpha'); $withproject = GETPOST('withproject', 'int'); $project_ref = GETPOST('project_ref', 'alpha'); $planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : ''); +$description = GETPOST('description', 'restricthtml'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projecttaskcard', 'globalcard')); @@ -99,7 +100,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2); $object->label = GETPOST("label", "alphanohtml"); - $object->description = GETPOST('description', "alphanohtml"); + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); + else $object->description = GETPOST('description', "restricthtml"); $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; $object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); @@ -439,7 +441,20 @@ if ($id > 0 || !empty($ref)) { // Description print ''.$langs->trans("Description").''; print ''; - print ''; + + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $description = !empty($description) ? $description : $object->description; + $doleditor = new DolEditor('description', $description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } print ''; print ''.$langs->trans("Budget").''; @@ -536,7 +551,11 @@ if ($id > 0 || !empty($ref)) { // Description print ''.$langs->trans("Description").''; - print nl2br($object->description); + if (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print $object->description; + } else { + print nl2br($object->description); + } print ''; print ''; From bb2f57a962f81204ddd71ee19376fa321bfbf137 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 9 Mar 2022 13:15:30 +0000 Subject: [PATCH 041/328] Fixing style errors. --- htdocs/projet/tasks.php | 24 +++++++++++----------- htdocs/projet/tasks/task.php | 40 ++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index bd1fcb326c2..364fcfe49f1 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -764,18 +764,18 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''.$langs->trans("Description").''; print ''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } else { - // WYSIWYG editor - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } - $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); - print $doleditor->Create(); - } + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 74ea6b17649..41f8fe1f852 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -100,8 +100,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2); $object->label = GETPOST("label", "alphanohtml"); - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); - else $object->description = GETPOST('description', "restricthtml"); + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); + else $object->description = GETPOST('description', "restricthtml"); $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; $object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); @@ -442,19 +442,19 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Description").''; print ''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } else { - // WYSIWYG editor - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } - $description = !empty($description) ? $description : $object->description; - $doleditor = new DolEditor('description', $description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); - print $doleditor->Create(); - } + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $description = !empty($description) ? $description : $object->description; + $doleditor = new DolEditor('description', $description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } print ''; print ''.$langs->trans("Budget").''; @@ -551,11 +551,11 @@ if ($id > 0 || !empty($ref)) { // Description print ''.$langs->trans("Description").''; - if (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print $object->description; - } else { - print nl2br($object->description); - } + if (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print $object->description; + } else { + print nl2br($object->description); + } print ''; print ''; From 25fcb83b7490c6abbedbcb953fcc6c30ebbd7c06 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 9 Mar 2022 16:41:26 +0100 Subject: [PATCH 042/328] wip: reopen button --- htdocs/compta/facture/card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5b4acb040d6..c974a1b053c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5409,9 +5409,12 @@ if ($action == 'create') { && ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely) if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted - print ''.$langs->trans('ReOpen').''; + //print ''.$langs->trans('ReOpen').''; + print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { - print ''.$langs->trans('ReOpen').''; + //print ''.$langs->trans('ReOpen').''; + $params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice"); + print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', '#', '', false, $params); } } From c3b22ed26ec1773556140ec2e54e6d62d0e3430a Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 9 Mar 2022 17:10:53 +0100 Subject: [PATCH 043/328] wip: clean comments --- htdocs/compta/facture/card.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c974a1b053c..710ae01d1a6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5374,25 +5374,20 @@ if ($action == 'create') { if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) { if (!$objectidnext && $object->is_last_in_cycle()) { if ($usercanunvalidate) { - //print ''.$langs->trans('Modify').''; print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', true, $params); } else { - //print ''.$langs->trans('Modify').''; $params['attr']['title'] = $langs->trans('NotEnoughPermissions'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', false, $params); } } elseif (!$object->is_last_in_cycle()) { - //print ''.$langs->trans('Modify').''; $params['attr']['title'] = $langs->trans('NotLastInCycle'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } else { - //print ''.$langs->trans('Modify').''; $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } } } else { - //print ''.$langs->trans('Modify').''; $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } @@ -5409,10 +5404,8 @@ if ($action == 'create') { && ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely) if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted - //print ''.$langs->trans('ReOpen').''; print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { - //print ''.$langs->trans('ReOpen').''; $params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice"); print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', '#', '', false, $params); } @@ -5433,7 +5426,6 @@ if ($action == 'create') { if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if ($usercanvalidate) { print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params); - //print ''.$langs->trans('Validate').''; } } @@ -5444,10 +5436,8 @@ if ($action == 'create') { print ''.$langs->trans('SendMail').''; } else { if ($usercansend) { - //print ''.$langs->trans('SendMail').''; print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params); } else { - //print ''.$langs->trans('SendMail').''; print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); } } @@ -5485,7 +5475,6 @@ if ($action == 'create') { } else { if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) { // For down payment, we refuse to receive more than amount to pay. - //print ''.$langs->trans('DoPayment').''; $params['attr']['title'] = $langs->trans('DisabledBecauseRemainderToPayIsZero'); print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', '#', '', false, $params); } else { @@ -5540,11 +5529,9 @@ if ($action == 'create') { ) { if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) { // We can close a down payment only if paid amount is same than amount of down payment (by definition) - //print ''.$langs->trans('ClassifyPaid').''; $params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment'); print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params); } else { - //print ''.$langs->trans('ClassifyPaid').''; print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid', '', true, $params); } } @@ -5590,14 +5577,12 @@ if ($action == 'create') { // Clone if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) { - //print ''.$langs->trans("ToClone").''; print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice', '', true, $params); } // Clone as predefined / Create template if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) { if (!$objectidnext && count($object->lines) > 0) { - //print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create', '', true, $params); } } @@ -5638,35 +5623,26 @@ if ($action == 'create') { ) ); if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions) - //var_dump($isErasable); $enableDelete = false; $deleteHref = '#'; if ($isErasable == -4) { $params['attr']['title'] = $langs->trans('DisabledBecausePayments'); - //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -3) { $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice'); - //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -2) { $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice'); - //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -1) { $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); - //print ''.$langs->trans('Delete').''; } elseif ($isErasable <= 0) { // Any other cases $params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable'); - //print ''.$langs->trans('Delete').''; } elseif ($objectidnext) { $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice'); - //print ''.$langs->trans('Delete').''; } else { - //print ''.$langs->trans('Delete').''; $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken(); $enableDelete = true; } print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params); } else { - //print ''.$langs->trans('Delete').''; $params['attr']['title'] = $langs->trans('NotAllowed'); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params); } From f2aaa27d7b25477380272a8ff84afa6115756a65 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 9 Mar 2022 17:41:48 +0100 Subject: [PATCH 044/328] FIX : when we use ajax select product fourn price on supplier order for example, unitprice should be rounded with MU and not MT --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 39d53e9dbc7..9c14bfeb866 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3400,7 +3400,7 @@ class Form 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, - 'price_ht'=>price2num($objp->unitprice, 'MT'), + 'price_ht'=>price2num($objp->unitprice, 'MU'), 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, From d7fe48ebc0be43e3249ea6794d48a96ce38f7ff7 Mon Sep 17 00:00:00 2001 From: Khang Date: Thu, 10 Mar 2022 14:14:10 +0700 Subject: [PATCH 045/328] Vietnam date format https://en.wikipedia.org/wiki/Date_and_time_notation_in_Vietnam --- htdocs/langs/vi_VN/main.lang | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/vi_VN/main.lang b/htdocs/langs/vi_VN/main.lang index 7c554f803a4..be80241bf8a 100644 --- a/htdocs/langs/vi_VN/main.lang +++ b/htdocs/langs/vi_VN/main.lang @@ -8,19 +8,19 @@ FONTFORPDF=DejaVuSans FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, -FormatDateShort=%m/%d/%Y -FormatDateShortInput=%m/%d/%Y -FormatDateShortJava=MM/dd/yyyy -FormatDateShortJavaInput=MM/dd/yyyy -FormatDateShortJQuery=mm/dd/yy -FormatDateShortJQueryInput=mm/dd/yy +FormatDateShort=%d/%m/%Y +FormatDateShortInput=%d/%m/%Y +FormatDateShortJava=dd/MM/yyyy +FormatDateShortJavaInput=dd/MM/yyyy +FormatDateShortJQuery=dd/mm/yy +FormatDateShortJQueryInput=dd/mm/yy FormatHourShortJQuery=HH:MI FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M FormatDateTextShort=%b %d, %Y FormatDateText=%B %d, %Y -FormatDateHourShort=%m/%d/%Y %I:%M %p -FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p +FormatDateHourShort=%d/%m/%Y %I:%M %p +FormatDateHourSecShort=%d/%m/%Y %I:%M:%S %p FormatDateHourTextShort=%b %d, %Y, %I:%M %p FormatDateHourText=%B %d, %Y, %I:%M %p DatabaseConnection=Kết nối cơ sở dữ liệu From 7291bbf7102a7d13f31ae66c6b53c33679ab75ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 10 Mar 2022 13:52:05 +0100 Subject: [PATCH 046/328] tooltip order date is date not datetime from sql table date_commande date, -- date de la commande --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0c43cc4ad2d..234f2fba627 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3723,7 +3723,7 @@ class Commande extends CommonOrder $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } if (!empty($this->date)) { - $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'dayhour'); + $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); } if (!empty($this->delivery_date)) { $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); From fffbc9eac866f63651b97c92790ada8d52fd8f7a Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 10 Mar 2022 15:56:10 +0100 Subject: [PATCH 047/328] wip: Contrat dolGetButtonAction --- htdocs/contrat/card.php | 63 ++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 87d6b98475b..ab97a549df5 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2027,62 +2027,87 @@ if ($action == 'create') { $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); + // Send if (empty($user->socid)) { if ($object->statut == 1) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params); } else { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); } } } if ($object->statut == 0 && $nbofservices) { if ($user->rights->contrat->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); + print dolGetButtonAction($langs->trans('Validate'), '', 'default', '#', '', false, $params); } } if ($object->statut == 1) { if ($user->rights->contrat->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } } if (!empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) { $langs->load("orders"); if ($user->rights->commande->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', DOL_URL_ROOT.'/commande/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); + print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', '#', '', false, $params); } } if (!empty($conf->facture->enabled) && $object->statut > 0) { $langs->load("bills"); if ($user->rights->facture->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); + print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', '#', '', false, $params); } } if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) { if ($user->rights->contrat->activer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', '#', '', false, $params); } } if ($object->nbofservicesclosed < $nbofservices) { if ($user->rights->contrat->desactiver) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', '#', '', false, $params); } //if (! $numactive) @@ -2104,16 +2129,20 @@ if ($action == 'create') { // Clone if ($user->rights->contrat->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params); } // On peut supprimer entite si // - Droit de creer + mode brouillon (erreur creation) // - Droit de supprimer if (($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotAllowed"); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', false, $params); } } From 7b3d472fa2f4f497249725a45dca49c23e19d75a Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 10 Mar 2022 16:10:34 +0100 Subject: [PATCH 048/328] Rework code to best match the standard --- htdocs/projet/tasks/task.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 74ea6b17649..53607645906 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -45,7 +45,6 @@ $confirm = GETPOST('confirm', 'alpha'); $withproject = GETPOST('withproject', 'int'); $project_ref = GETPOST('project_ref', 'alpha'); $planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : ''); -$description = GETPOST('description', 'restricthtml'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projecttaskcard', 'globalcard')); @@ -451,8 +450,7 @@ if ($id > 0 || !empty($ref)) { if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; } - $description = !empty($description) ? $description : $object->description; - $doleditor = new DolEditor('description', $description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); print $doleditor->Create(); } print ''; @@ -551,11 +549,7 @@ if ($id > 0 || !empty($ref)) { // Description print ''.$langs->trans("Description").''; - if (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print $object->description; - } else { - print nl2br($object->description); - } + print dol_htmlentitiesbr($object->description); print ''; print ''; From f987c30a10ca67b0d0c1bcecddb98f10afa88a3b Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 10 Mar 2022 16:19:32 +0100 Subject: [PATCH 049/328] clean comments --- htdocs/contrat/card.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index ab97a549df5..7265a69d1af 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2038,10 +2038,8 @@ if ($action == 'create') { if (empty($user->socid)) { if ($object->statut == 1) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) { - //print ''; print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params); } else { - //print ''; print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); } } @@ -2049,20 +2047,16 @@ if ($action == 'create') { if ($object->statut == 0 && $nbofservices) { if ($user->rights->contrat->creer) { - //print ''; print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); print dolGetButtonAction($langs->trans('Validate'), '', 'default', '#', '', false, $params); } } if ($object->statut == 1) { if ($user->rights->contrat->creer) { - //print ''; print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } @@ -2071,10 +2065,8 @@ if ($action == 'create') { if (!empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) { $langs->load("orders"); if ($user->rights->commande->creer) { - //print ''; print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', DOL_URL_ROOT.'/commande/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', '#', '', false, $params); } @@ -2083,10 +2075,8 @@ if ($action == 'create') { if (!empty($conf->facture->enabled) && $object->statut > 0) { $langs->load("bills"); if ($user->rights->facture->creer) { - //print ''; print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', '#', '', false, $params); } @@ -2094,19 +2084,15 @@ if ($action == 'create') { if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) { if ($user->rights->contrat->activer) { - //print ''; print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate&token='.newToken(), '', true, $params); } else { - //print ''; print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', '#', '', false, $params); } } if ($object->nbofservicesclosed < $nbofservices) { if ($user->rights->contrat->desactiver) { - //print ''; print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', true, $params); } else { - //print ''; print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', '#', '', false, $params); } @@ -2129,7 +2115,6 @@ if ($action == 'create') { // Clone if ($user->rights->contrat->creer) { - //print ''; print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params); } @@ -2137,10 +2122,8 @@ if ($action == 'create') { // - Droit de creer + mode brouillon (erreur creation) // - Droit de supprimer if (($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer) { - //print ''; print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotAllowed"); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', false, $params); } From bf9b6c05a2c12c39665fc04ca2e9d72ed406a268 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 10 Mar 2022 15:20:37 +0000 Subject: [PATCH 050/328] Fixing style errors. --- htdocs/projet/tasks/task.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index e36c243e403..f6e9b6803af 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -99,8 +99,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2); $object->label = GETPOST("label", "alphanohtml"); - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); - else $object->description = GETPOST('description', "restricthtml"); + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); + else $object->description = GETPOST('description', "restricthtml"); $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; $object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); @@ -441,18 +441,18 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Description").''; print ''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } else { - // WYSIWYG editor - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } - $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); - print $doleditor->Create(); - } + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } print ''; print ''.$langs->trans("Budget").''; From b9a698b3edc597412b7ec8df53bbfca883736365 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Thu, 10 Mar 2022 17:39:53 +0100 Subject: [PATCH 051/328] DLC and DLUO are reversed in the called function --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index ca9bd1b3065..08b4b2c6bf0 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -337,7 +337,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { } if (!$error) { - $result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); + $result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLUO, $dDLC, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; From c9cc067075bcc0f7c3c7cc8b436c4eb031f94557 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 11 Mar 2022 10:48:51 +0100 Subject: [PATCH 052/328] FIX missing parenthesis --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9e6e68a2ee9..a737da87e94 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -116,7 +116,7 @@ $usercandelete = $user->rights->propal->supprimer; $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate))); -$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send)); +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send))); $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; From 193a073b16d42caf64bf21e4563af102182be429 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 11 Mar 2022 11:18:09 +0100 Subject: [PATCH 053/328] FIX missing multientity managed --- htdocs/mrp/class/mo.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 8b86c7db6e9..6f7dfd2260b 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -46,7 +46,7 @@ class Mo extends CommonObject /** * @var int Does mo support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ - public $ismultientitymanaged = 0; + public $ismultientitymanaged = 1; /** * @var int Does mo support extrafields ? 0=No, 1=Yes From 32b508ae1921ec63bed5d3235fc16d3bc25bb7ef Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 11 Mar 2022 11:48:50 +0100 Subject: [PATCH 054/328] Lang --- htdocs/langs/en_US/propal.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index db7b559a8a7..82854821176 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -92,6 +92,7 @@ LineBuyPriceHT=Buy Price Amount net of tax for line SignPropal=Accept proposal RefusePropal=Refuse proposal Sign=Sign +NoSign=Refuse PropalAlreadySigned=Proposal already accepted PropalAlreadyRefused=Proposal already refused PropalSigned=Proposal accepted From bb82e6328d6978293501e3eb617d06c3c3575703 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:08:53 +0100 Subject: [PATCH 055/328] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 67 ++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 3b173cecb26..5a3bc2fa2c4 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -8,7 +8,9 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- table llx_menu -- -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); + +-- Top-Menu +insert into llx_menu (rowid, enabled, module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); @@ -21,15 +23,18 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); + +-- Sub-Menu + -- Home - Dashboard insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'MyDashboard', 0, '', '', '', 2, 0, __ENTITY__); -- Home - Setup -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?mainmenu=home&leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?mainmenu=home&leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 102__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/ihm.php?mainmenu=home&leftmenu=setup', 'GUISetup', 1, 'admin', '', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 114__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/translation.php?mainmenu=home&leftmenu=setup', 'Translation', 1, 'admin', '', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 115__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/defaultvalues.php?mainmenu=home&leftmenu=setup', 'DefaultValues', 1, 'admin', '', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin' , __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?mainmenu=home&leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '' , 100__+MAX_llx_menu__, '/admin/company.php?mainmenu=home&leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 102__+MAX_llx_menu__, 'home', '' , 100__+MAX_llx_menu__, '/admin/ihm.php?mainmenu=home&leftmenu=setup', 'GUISetup', 1, 'admin', '', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 114__+MAX_llx_menu__, 'home', '' , 100__+MAX_llx_menu__, '/admin/translation.php?mainmenu=home&leftmenu=setup', 'Translation', 1, 'admin', '', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 115__+MAX_llx_menu__, 'home', '' , 100__+MAX_llx_menu__, '/admin/defaultvalues.php?mainmenu=home&leftmenu=setup', 'DefaultValues', 1, 'admin', '', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 103__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/modules.php?mainmenu=home&leftmenu=setup', 'Modules', 1, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 104__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/boxes.php?mainmenu=home&leftmenu=setup', 'Boxes', 1, 'admin', '', '', 2, 6, __ENTITY__); @@ -42,6 +47,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?mainmenu=home&leftmenu=setup', 'SMS', 1, 'admin', '', '', 2, 12, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 111__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/dict.php?mainmenu=home&leftmenu=setup', 'Dictionary', 1, 'admin', '', '', 2, 13, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 112__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/const.php?mainmenu=home&leftmenu=setup', 'OtherSetup', 1, 'admin', '', '', 2, 14, __ENTITY__); + -- Home - Admin tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?mainmenu=home&leftmenu=admintools', 'AdminTools', 0, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__); @@ -62,6 +68,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?mainmenu=home&leftmenu=admintools', 'ExternalResources', 1, 'admin', '', '', 2, 14, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 320__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools', 'ProductVatMassChange', 1, 'products', '', '', 2, 15, __ENTITY__); + -- Home - Menu users and groups insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?mainmenu=home&leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__); @@ -84,6 +91,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); + -- Third parties - Contacts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?mainmenu=companies&leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); @@ -92,15 +100,19 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); + -- Third parties - Category customer insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Third parties - Category supplier insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Third parties - Category contact insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Product - Product insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__); @@ -112,11 +124,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->variants->enabled', __HANDLER__, 'left', 2807__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/variants/list.php?mainmenu=products', 'VariantAttributes', 1, 'products', '$user->rights->produit->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&id=all&leftmenu=stats&type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 8, __ENTITY__); + -- Product - Services insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=service&type=1', 'Services', 0, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2901__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=service&action=create&type=1', 'NewService', 1, 'products', '$user->rights->service->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2902__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/list.php?mainmenu=products&leftmenu=service&type=1', 'List', 1, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2903__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&id=all&leftmenu=stats&type=1', 'Statistics', 1, 'main', '$user->rights->service->lire', '', 2, 5, __ENTITY__); + -- Product - Stocks insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/stock/index.php?mainmenu=products&leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?mainmenu=products&action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); @@ -128,11 +142,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?mainmenu=products&leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3201__+MAX_llx_menu__, 'products', '', 3200__+MAX_llx_menu__, '/categories/card.php?mainmenu=products&action=create&type=0', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Product - Shipment insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled', __HANDLER__, 'left', 1300__+MAX_llx_menu__, 'commercial', 'sendings', 3__+MAX_llx_menu__, '/expedition/index.php?mainmenu=commercial&leftmenu=sendings', 'Shipments', 0, 'sendings', '$user->rights->expedition->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1301__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/card.php?mainmenu=commercial&action=create2&leftmenu=sendings', 'NewSending', 1, 'sendings', '$user->rights->expedition->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1302__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/list.php?mainmenu=commercial&leftmenu=sendings', 'List', 1, 'sendings', '$user->rights->expedition->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1303__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/stats/index.php?mainmenu=commercial&leftmenu=sendings', 'Statistics', 1, 'sendings', '$user->rights->expedition->lire', '', 2, 2, __ENTITY__); + -- Product - Reception insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->reception->enabled', __HANDLER__, 'left', 1350__+MAX_llx_menu__, 'commercial', 'receptions', 3__+MAX_llx_menu__, '/reception/index.php?mainmenu=commercial&leftmenu=receptions', 'Receptions', 0, 'receptions', '$user->rights->reception->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->reception->enabled && $leftmenu=="receptions"', __HANDLER__, 'left', 1351__+MAX_llx_menu__, 'commercial', '', 1350__+MAX_llx_menu__, '/reception/card.php?mainmenu=commercial&action=create2&leftmenu=receptions', 'NewSending', 1, 'receptions', '$user->rights->reception->creer', '', 2, 0, __ENTITY__); @@ -149,6 +165,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1106__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=3', 'PropalStatusNotSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1107__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=4', 'PropalStatusBilled', 1, 'propal', '$user->rights->propale->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1110__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/stats/index.php?mainmenu=commercial&leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__); + -- Commercial - Customer's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1200__+MAX_llx_menu__, 'commercial', 'orders', 5__+MAX_llx_menu__, '/commande/index.php?mainmenu=commercial&leftmenu=orders', 'CustomersOrders', 0, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1201__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/card.php?mainmenu=commercial&action=create&leftmenu=orders', 'NewOrder', 1, 'orders', '$user->rights->commande->creer', '', 2, 0, __ENTITY__); @@ -160,11 +177,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); + -- Commercial - Supplier's proposals insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1650__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1651__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', 'SupplierProposalNew', 1, 'supplier_proposal', '$user->rights->supplier_proposal->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1652__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/supplier_proposal/list.php?leftmenu=supplier_proposals', 'List', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1653__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', 'Statistics', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 2, __ENTITY__); + -- Commercial - Supplier's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?mainmenu=commercial&leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?mainmenu=commercial&action=create&leftmenu=orders_suppliers', 'NewSupplierOrderShort', 1, 'orders', '($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer)', '', 2, 0, __ENTITY__); @@ -178,6 +197,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5109__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers&statut=6,7', 'StatusOrderCanceled', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 8, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5110__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers&statut=9', 'StatusOrderRefused', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5111__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders_suppliers&mode=supplier', 'Statistics', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 7, __ENTITY__); + -- Commercial - Contracts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1400__+MAX_llx_menu__, 'commercial', 'contracts', 5__+MAX_llx_menu__, '/contrat/index.php?mainmenu=commercial&leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?mainmenu=commercial&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__); @@ -187,11 +207,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__); + -- Commercial - Interventions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?mainmenu=commercial&action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1502__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1503__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/stats/index.php?mainmenu=commercial&leftmenu=ficheinter', 'Statistics', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 2, __ENTITY__); + -- Billing - Supplier invoice insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'billing', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?mainmenu=billing&action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__); @@ -200,6 +222,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', 'suppliers_bills_payment', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?mainmenu=billing&leftmenu=suppliers_bills_payment', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'billing', 'suppliers_bills_reports', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?mainmenu=billing&leftmenu=suppliers_bills_reports', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); + -- Billing - Customer invoice insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?mainmenu=billing&action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); @@ -215,19 +238,24 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', 'customers_bills_payment', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?mainmenu=billing&leftmenu=customers_bills_payment', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?mainmenu=billing&leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); + -- Billing - Orders to bill insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?mainmenu=billing&leftmenu=orders&search_status=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); + -- Donations insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'billing', 'donations', 6__+MAX_llx_menu__, '/don/index.php?mainmenu=billing&leftmenu=donations', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/card.php?mainmenu=billing&leftmenu=donations&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/list.php?mainmenu=billing&leftmenu=donations', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__); -- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?mainmenu=billing&leftmenu=donations', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); + -- Special expenses insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'billing', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?mainmenu=billing&leftmenu=tax', 'MenuTaxesAndSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__); + -- Social contributions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'billing', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/list.php?mainmenu=billing&leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/card.php?mainmenu=billing&leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/payments.php?mainmenu=billing&leftmenu=tax_social', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); + -- VAT insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'billing', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/list.php?mainmenu=billing&leftmenu=tax_vat', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?mainmenu=billing&leftmenu=tax_vat&action=create', 'New', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__); @@ -235,22 +263,27 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/index.php?mainmenu=billing&leftmenu=tax_vat', 'ReportByMonth', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?mainmenu=billing&leftmenu=tax_vat', 'ReportByThirdparties', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2305__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?mainmenu=billing&leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 4, __ENTITY__); + -- Salary insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 6__+MAX_llx_menu__, '/salaries/list.php?mainmenu=billing&leftmenu=tax_salary', 'Salaries', 0, 'salaries', '$user->rights->salaries->read', '', 0, 10, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/card.php?mainmenu=billing&leftmenu=tax_salary&action=create', 'NewPayment', 1, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/list.php?mainmenu=billing&leftmenu=tax_salary', 'Payments', 1, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2213__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/stats/index.php?mainmenu=billing&leftmenu=tax_salary', 'Statistics', 1, 'companies', '$user->rights->salaries->read', '', 0, 4, __ENTITY__); + -- Loan insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'billing', 'tax_loan', 6__+MAX_llx_menu__, '/loan/list.php?mainmenu=billing&leftmenu=tax_loan', 'Loans', 0, 'loan', '$user->rights->loan->read', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/card.php?mainmenu=billing&leftmenu=tax_loan&action=create', 'NewLoan', 1, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?mainmenu=billing&leftmenu=tax_loan', 'Payments', 1, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan" && ! empty($conf->global->LOAN_SHOW_CALCULATOR)', __HANDLER__, 'left', 2223__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/calc.php?mainmenu=billing&leftmenu=tax_loan', 'Calculator', 1, 'companies', '$user->rights->loan->calc', '', 0, 4, __ENTITY__); + -- Various payments insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)', __HANDLER__, 'left', 2350__+MAX_llx_menu__, 'billing', 'tax_various', 6__+MAX_llx_menu__, '/compta/bank/various_payment/list.php?mainmenu=billing&leftmenu=tax_various', 'MenuVariousPayment', 0, 'banks', '$user->rights->banque->lire', '', 0, 30, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2351__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/compta/bank/various_payment/card.php?mainmenu=billing&leftmenu=tax_various&action=create', 'New', 1, 'various_payment', '$user->rights->banque->modifier', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2352__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/compta/bank/various_payment/list.php?mainmenu=billing&leftmenu=tax_various', 'List', 1, 'various_payment', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); + -- Accounting (Double entries) insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accountancy', 9__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', 0, 'main', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); + -- Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__); @@ -271,8 +304,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2465__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_export', 2451__+MAX_llx_menu__, '/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ExportOptions', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 1', __HANDLER__, 'left', 2466__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_closure', 2451__+MAX_llx_menu__, '/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuClosureAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__); + -- Accounting period insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__); + -- Binding insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__); @@ -283,22 +318,29 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_expensereport', 2400__+MAX_llx_menu__, '/accountancy/expensereport/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport', 'ExpenseReportsVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__); + -- Export accounting documents insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); + -- Journals --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '', 'Journalization', 1, 'main', '$user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3', 'BankJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6', 'ExpenseReportJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 2, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2709__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2', 'PurchasesJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 3, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1', 'SellsJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 4, __ENTITY__); + -- Balance insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 10, __ENTITY__); + -- General Ledger insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__); + -- Journals insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2434__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Journals', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); + -- Closure insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2437__+MAX_llx_menu__, 'accountancy', 'accountancy_closure', 2400__+MAX_llx_menu__, '/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure', 'MenuAccountancyClosure', 1, 'accountancy', '$user->rights->accounting->fiscalyear->write', '', 0, 17, __ENTITY__); + -- Reports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'MenuReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__); @@ -308,6 +350,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__); + -- Accounting simple insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 9__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=ca', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2711__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=ca', 'MenuReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); @@ -316,6 +359,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2714__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2715__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2716__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); + -- Assets insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled', __HANDLER__, 'left', 3000__+MAX_llx_menu__, 'accountancy', 'asset', 9__+MAX_llx_menu__, '/asset/list.php?mainmenu=accountancy&leftmenu=asset', 'MenuAssets', 1, 'assets', '$user->rights->asset->read', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3001__+MAX_llx_menu__, 'asset', '', 3000__+MAX_llx_menu__, '/asset/card.php?mainmenu=accountancy&leftmenu=asset&action=create', 'MenuNewAsset', 2, 'assets', '$user->rights->asset->write', '', 0, 21, __ENTITY__); @@ -323,10 +367,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3004__+MAX_llx_menu__, 'asset', 'asset_type', 3000__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&leftmenu=asset', 'MenuTypeAssets', 2, 'assets', '$user->rights->asset->read', '', 0, 23, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3005__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&action=create', 'MenuNewTypeAssets', 3, 'assets', '$user->rights->asset->setup_advance', '', 0, 24, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3006__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy', 'MenuListTypeAssets', 3, 'assets', '$user->rights->asset->read', '', 0, 25, __ENTITY__); + -- Check deposit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?mainmenu=bank&leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/list.php?mainmenu=bank&leftmenu=checks', 'List', 1, 'bills', '$user->rights->banque->lire', '', 2, 1, __ENTITY__); + -- PaymentByDirectDebit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled', __HANDLER__, 'left', 2500__+MAX_llx_menu__, 'accountancy', 'withdraw', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=withdraw', 'PaymentByDirectDebit', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2502__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/create.php?mainmenu=bank&leftmenu=withdraw', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0, __ENTITY__); @@ -334,6 +380,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2504__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/list.php?mainmenu=bank&leftmenu=withdraw', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?mainmenu=bank&leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?mainmenu=bank&leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); + -- PaymentByCreditTransfer insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled', __HANDLER__, 'left', 2510__+MAX_llx_menu__, 'accountancy', 'banktransfer', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'PaymentByBankTransfer', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2512__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/create.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0, __ENTITY__); @@ -341,6 +388,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2514__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/list.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2516__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/rejets.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2517__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/stats.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); + -- Bank insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?mainmenu=bank&action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__); @@ -348,9 +396,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries_list.php?mainmenu=bank&leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?mainmenu=bank&leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?mainmenu=bank&leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__); + -- Bank - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2650__+MAX_llx_menu__, 'accountancy', 'cat', 14__+MAX_llx_menu__, '/categories/index.php?mainmenu=bank&leftmenu=bank&type=5', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2651__+MAX_llx_menu__, 'accountancy', '', 2650__+MAX_llx_menu__, '/categories/card.php?mainmenu=bank&leftmenu=bank&action=create&type=5', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + + -- Project insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?mainmenu=project&leftmenu=projects', 'LeadsOrProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?mainmenu=project&leftmenu=projects&action=create', 'New', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); @@ -370,6 +421,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5400__+MAX_llx_menu__, 'mrp', 'bom', 16__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'MenuBOM', 1, 'mrp', '$user->rights->bom->read', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5401__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_card.php?mainmenu=mrp&leftmenu=bom&action=create', 'NewBOM', 2, 'mrp', '$user->rights->bom->write', '', 0, 21, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5403__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'List', 2, 'mrp', '$user->rights->bom->read', '', 0, 22, __ENTITY__); + -- MRP insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5450__+MAX_llx_menu__, 'mrp', 'mrp', 16__+MAX_llx_menu__, '/mrp/mo_list.php?mainmenu=mrp&leftmenu=mrp', 'MenuMRP', 1, 'mrp', '$user->rights->mrp->read', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5451__+MAX_llx_menu__, 'mrp', '', 5450__+MAX_llx_menu__, '/mrp/mo_card.php?mainmenu=mrp&leftmenu=mrp&action=create', 'NewMO', 2, 'mrp', '$user->rights->mrp->write', '', 0, 21, __ENTITY__); @@ -379,6 +431,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Project - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?mainmenu=project&leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?mainmenu=project&action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?mainmenu=tools&leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?mainmenu=tools&leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); @@ -388,6 +441,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4101__+MAX_llx_menu__, 'tools', '', 4100__+MAX_llx_menu__, '/exports/export.php?mainmenu=tools&leftmenu=export', 'NewExport', 1, 'exports', '$user->rights->export->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->import->enabled', __HANDLER__, 'left', 4130__+MAX_llx_menu__, 'tools', 'import', 8__+MAX_llx_menu__, '/imports/index.php?mainmenu=tools&leftmenu=import', 'FormatedImport', 0, 'exports', '$user->rights->import->run', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->import->enabled', __HANDLER__, 'left', 4131__+MAX_llx_menu__, 'tools', '', 4130__+MAX_llx_menu__, '/imports/import.php?mainmenu=tools&leftmenu=import', 'NewImport', 1, 'exports', '$user->rights->import->run', '', 2, 0, __ENTITY__); + -- Members insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4200__+MAX_llx_menu__, 'members', 'members', 13__+MAX_llx_menu__, '/adherents/index.php?mainmenu=members&leftmenu=members', 'Members', 0, 'members', '$user->rights->adherent->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4201__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/card.php?mainmenu=members&leftmenu=members&action=create', 'NewMember', 1, 'members', '$user->rights->adherent->creer', '', 2, 0, __ENTITY__); @@ -412,6 +466,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Members - Category member insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?mainmenu=members&leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?mainmenu=members&action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- HRM - Employee insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->user->user->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?mainmenu=hrm&action=create&employee=1', 'NewEmployee', 1, 'hrm', '$user->rights->user->user->creer', '', 0, 1, __ENTITY__); From bc60a1c819a2d332d8f8b6677be6e9c3a62f9a89 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:19:13 +0100 Subject: [PATCH 056/328] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 5a3bc2fa2c4..20946d73e55 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -10,18 +10,18 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- Top-Menu -insert into llx_menu (rowid, enabled, module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '1', '', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__,'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Sub-Menu From 7ff53ddb74740cbff02c719e067d0a54c498e431 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:25:49 +0100 Subject: [PATCH 057/328] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 20946d73e55..e3d8c76b7c1 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -10,9 +10,10 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- Top-Menu -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '1', '', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__,'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +-- old: (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); From 4438ef74f15db8a8d5550eb36ae7da32f6df63dd Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:29:10 +0100 Subject: [PATCH 058/328] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index e3d8c76b7c1..891decba79b 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -14,15 +14,15 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->projet->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Sub-Menu From 4134bf5890a900cf2ee612e5057138c760eb6556 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:31:52 +0100 Subject: [PATCH 059/328] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 891decba79b..0fc9968b7a3 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -11,18 +11,18 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- Top-Menu -- old: (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->projet->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->projet->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 14__+MAX_llx_menu__, 'banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 9__+MAX_llx_menu__, 'comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 8__+MAX_llx_menu__, '', '', __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 13__+MAX_llx_menu__, 'adherent', '$conf->adherent->enabled', __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 15__+MAX_llx_menu__, 'hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Sub-Menu From 993cb70a6fc12a838187796a321c9578b7fedc5c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:38:58 +0100 Subject: [PATCH 060/328] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 0fc9968b7a3..9a91aa58ac1 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -10,7 +10,7 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- Top-Menu --- old: (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) +-- old: (module, enabled, rowid, ...) insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); @@ -25,7 +25,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 15__+MAX_llx_menu__, 'hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); --- Sub-Menu +-- Sub-Menues -- Home - Dashboard insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'MyDashboard', 0, '', '', '', 2, 0, __ENTITY__); @@ -257,7 +257,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/card.php?mainmenu=billing&leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/payments.php?mainmenu=billing&leftmenu=tax_social', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); --- VAT +-- VAT/TVA/IVA insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'billing', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/list.php?mainmenu=billing&leftmenu=tax_vat', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?mainmenu=billing&leftmenu=tax_vat&action=create', 'New', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/list.php?mainmenu=billing&leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); @@ -418,21 +418,22 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?mainmenu=project&leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); +-- Project - Categories +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?mainmenu=project&leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?mainmenu=project&action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + + -- BOM insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5400__+MAX_llx_menu__, 'mrp', 'bom', 16__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'MenuBOM', 1, 'mrp', '$user->rights->bom->read', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5401__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_card.php?mainmenu=mrp&leftmenu=bom&action=create', 'NewBOM', 2, 'mrp', '$user->rights->bom->write', '', 0, 21, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5403__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'List', 2, 'mrp', '$user->rights->bom->read', '', 0, 22, __ENTITY__); --- MRP +-- MRP/MO insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5450__+MAX_llx_menu__, 'mrp', 'mrp', 16__+MAX_llx_menu__, '/mrp/mo_list.php?mainmenu=mrp&leftmenu=mrp', 'MenuMRP', 1, 'mrp', '$user->rights->mrp->read', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5451__+MAX_llx_menu__, 'mrp', '', 5450__+MAX_llx_menu__, '/mrp/mo_card.php?mainmenu=mrp&leftmenu=mrp&action=create', 'NewMO', 2, 'mrp', '$user->rights->mrp->write', '', 0, 21, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5453__+MAX_llx_menu__, 'mrp', '', 5450__+MAX_llx_menu__, '/mrp/mo_list.php?mainmenu=mrp&leftmenu=mrp', 'List', 2, 'mrp', '$user->rights->mrp->read', '', 0, 22, __ENTITY__); --- Project - Categories -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?mainmenu=project&leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?mainmenu=project&action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); - -- Tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?mainmenu=tools&leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?mainmenu=tools&leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); @@ -456,6 +457,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4209__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/stats/geo.php?mainmenu=members&leftmenu=members&mode=memberbycountry', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && $conf->adherent->enabled', __HANDLER__, 'left', 4502__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/htpasswd.php?mainmenu=members&leftmenu=export', 'Filehtpasswd', 1, 'members', '$user->rights->adherent->export', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4503__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/cartes/carte.php?mainmenu=members&leftmenu=export', 'MembersCards', 1, 'members', '$user->rights->adherent->export', '', 2, 10, __ENTITY__); + -- Members - Subscriptions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4300__+MAX_llx_menu__, 'members', '', 13__+MAX_llx_menu__, '/adherents/index.php?mainmenu=members&leftmenu=members', 'Subscriptions', 0, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4301__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&statut=-1&leftmenu=accountancy', 'NewSubscription', 1, 'compta', '$user->rights->adherent->cotisation->creer', '', 2, 0, __ENTITY__); @@ -464,14 +466,17 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4700__+MAX_llx_menu__, 'members', 'setup', 13__+MAX_llx_menu__, '/adherents/type.php?mainmenu=members&leftmenu=setup', 'MembersTypes', 0, 'members', '$user->rights->adherent->configurer', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4701__+MAX_llx_menu__, 'members', '', 4700__+MAX_llx_menu__, '/adherents/type.php?mainmenu=members&leftmenu=setup&action=create', 'New', 1, 'members', '$user->rights->adherent->configurer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4702__+MAX_llx_menu__, 'members', '', 4700__+MAX_llx_menu__, '/adherents/type.php?mainmenu=members&leftmenu=setup', 'List', 1, 'members', '$user->rights->adherent->configurer', '', 2, 1, __ENTITY__); + -- Members - Category member insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?mainmenu=members&leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?mainmenu=members&action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- HRM - Employee insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->user->user->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?mainmenu=hrm&action=create&employee=1', 'NewEmployee', 1, 'hrm', '$user->rights->user->user->creer', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist', 'List', 1, 'hrm', '$user->rights->user->user->lire', '', 0, 2, __ENTITY__); + -- HRM - Holiday insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?mainmenu=hrm&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?mainmenu=hrm&action=create', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); @@ -479,11 +484,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5002__+MAX_llx_menu__, '/holiday/list.php?mainmenu=hrm&search_statut=2&leftmenu=hrm', 'ListToApprove', 2, 'trips', '$user->rights->holiday->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?mainmenu=hrm&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5005__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?mainmenu=hrm&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 3, __ENTITY__); + -- HRM - Trips and expenses (old module) insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 15__+MAX_llx_menu__, '/compta/deplacement/index.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/card.php?mainmenu=accountancy&action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); + -- HRM - Expense reports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expensereport->enabled', __HANDLER__, 'left', 5300__+MAX_llx_menu__, 'hrm', 'expensereport', 15__+MAX_llx_menu__, '/expensereport/index.php?mainmenu=hrm&leftmenu=expensereport', 'TripsAndExpenses', 0, 'trips', '$user->rights->expensereport->lire', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expensereport->enabled', __HANDLER__, 'left', 5301__+MAX_llx_menu__, 'hrm', '', 5300__+MAX_llx_menu__, '/expensereport/card.php?mainmenu=hrm&action=create&leftmenu=expensereport', 'New', 1, 'trips', '$user->rights->expensereport->creer', '', 0, 1, __ENTITY__); From d36d962d36cb623b841d1155089990f2ee0a8c80 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 14:49:54 +0100 Subject: [PATCH 061/328] Update step2.php some english translations at //comments --- htdocs/install/step2.php | 55 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 45b7d742f3e..06fb7949397 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -34,12 +34,13 @@ $step = 2; $ok = 0; -// Cette page peut etre longue. On augmente le delai autorise. -// Ne fonctionne que si on est pas en safe_mode. +// This page can be long. We increase the time allowed. / Cette page peut etre longue. On augmente le delai autorise. +// Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode. + $err = error_reporting(); -error_reporting(0); // Disable all errors +error_reporting(0); // Disable all errors //error_reporting(E_ALL); -@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64 +@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64 error_reporting($err); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]); @@ -48,6 +49,9 @@ $langs->setDefaultLang($setuplang); $langs->loadLangs(array("admin", "install")); + +// Choice of DBMS + $choix = 0; if ($dolibarr_main_db_type == "mysqli") { $choix = 1; @@ -64,10 +68,11 @@ if ($dolibarr_main_db_type == "sqlite") { if ($dolibarr_main_db_type == "sqlite3") { $choix = 5; } - //if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page'); + // Now we load forced values from install.forced.php file. + $useforcedwizard = false; $forcedfile = "./install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") { @@ -124,8 +129,8 @@ if ($action == "set") { } } - - // Affiche version + + // Display version / Affiche version if ($ok) { $version = $db->getVersion(); $versionarray = $db->getVersionArray(); @@ -154,7 +159,7 @@ if ($action == "set") { /************************************************************************************** * - * Load files tables/*.sql (not the *.key.sql). Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx'). + * Load files tables/*.sql (not the *.key.sql). Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx'). * To do before the files *.key.sql * ***************************************************************************************/ @@ -208,18 +213,18 @@ if ($action == "set") { $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); } - //print "Creation de la table $name/td>"; + //print "Creation of table $name/td>"; $requestnb++; dolibarr_install_syslog("step2: request: ".$buffer); $resql = $db->query($buffer, 0, 'dml'); if ($resql) { - // print "OK requete ==== $buffer"; + // print "OK request ==== $buffer"; $db->free($resql); } else { if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' || - $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { - //print "Deja existante"; + $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { + //print "already existing"; } else { print "".$langs->trans("CreateTableAndPrimaryKey", $name); print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.'
Executed query : '.$db->lastquery; @@ -252,7 +257,7 @@ if ($action == "set") { /*************************************************************************************** * - * Load files tables/*.key.sql. Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx'). + * Load files tables/*.key.sql. Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx'). * To do after the files *.sql * ***************************************************************************************/ @@ -279,7 +284,7 @@ if ($action == "set") { sort($tabledata); foreach ($tabledata as $file) { $name = substr($file, 0, dol_strlen($file) - 4); - //print "Creation de la table $name"; + //print "Creation of table $name"; $buffer = ''; $fp = fopen($dir.$file, "r"); if ($fp) { @@ -287,6 +292,7 @@ if ($action == "set") { $buf = fgets($fp, 4096); // Special case of lines allowed for some version only + // MySQL if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) { $versioncommande = explode('.', $reg[1]); //print var_dump($versioncommande); @@ -298,6 +304,7 @@ if ($action == "set") { //print "Ligne $i qualifiee par version: ".$buf.'
'; } } + // PGSQL if ($choix == 2 && preg_match('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', $buf, $reg)) { $versioncommande = explode('.', $reg[1]); //print var_dump($versioncommande); @@ -310,14 +317,14 @@ if ($action == "set") { } } - // Ajout ligne si non commentaire + // Add line if no comment if (!preg_match('/^--/i', $buf)) { $buffer .= $buf; } } fclose($fp); - // Si plusieurs requetes, on boucle sur chaque + // If several requests, we loop on each $listesql = explode(';', $buffer); foreach ($listesql as $req) { $buffer = trim($req); @@ -327,13 +334,13 @@ if ($action == "set") { $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); } - //print "Creation des cles et index de la table $name: '$buffer'"; + //print "Creation of keys and table index $name: '$buffer'"; $requestnb++; dolibarr_install_syslog("step2: request: ".$buffer); $resql = $db->query($buffer, 0, 'dml'); if ($resql) { - //print "OK requete ==== $buffer"; + //print "OK request ==== $buffer"; $db->free($resql); } else { if ($db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' || @@ -372,7 +379,7 @@ if ($action == "set") { /*************************************************************************************** * - * Lod the file 'functions.sql' + * Load the file 'functions.sql' * ***************************************************************************************/ if ($ok && $createfunctions) { @@ -387,7 +394,7 @@ if ($action == "set") { $dir = "sqlite3/functions/"; } - // Creation donnees + // Creation of data $file = "functions.sql"; if (file_exists($dir.$file)) { $fp = fopen($dir.$file, "r"); @@ -449,7 +456,7 @@ if ($action == "set") { /*************************************************************************************** * - * Load files data/*.sql. Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx'). + * Load files data/*.sql. Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx'). * ***************************************************************************************/ if ($ok && $createdata) { @@ -465,7 +472,7 @@ if ($action == "set") { while (($file = readdir($handle)) !== false) { if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\-/', $file)) { if (preg_match('/^llx_accounting_account_/', $file)) { - continue; // We discard data file of chart of account. Will be loaded when a chart is selected. + continue; // We discard data file of chart of account. This will be loaded when a chart is selected. } //print 'x'.$file.'-'.$createdata.'
'; @@ -520,7 +527,7 @@ if ($action == "set") { // We loop on each requests of file foreach ($arrayofrequests as $buffer) { - // Replace the prefix tables + // Replace the tables prefixes if ($dolibarr_main_db_prefix != 'llx_') { $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); } @@ -570,8 +577,10 @@ dolibarr_install_syslog("Exit ".$ret); dolibarr_install_syslog("- step2: end"); + // Force here a value we need after because master.inc.php is not loaded into step2. // This code must be similar with the one into main.inc.php + $conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); From 277142dcab448facff9dfe2b9482e8bfe7143530 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 12 Mar 2022 13:53:15 +0000 Subject: [PATCH 062/328] Fixing style errors. --- htdocs/install/step2.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 06fb7949397..33e69377904 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -50,7 +50,7 @@ $langs->setDefaultLang($setuplang); $langs->loadLangs(array("admin", "install")); -// Choice of DBMS +// Choice of DBMS $choix = 0; if ($dolibarr_main_db_type == "mysqli") { @@ -129,7 +129,7 @@ if ($action == "set") { } } - + // Display version / Affiche version if ($ok) { $version = $db->getVersion(); @@ -223,7 +223,7 @@ if ($action == "set") { $db->free($resql); } else { if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' || - $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { + $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { //print "already existing"; } else { print "".$langs->trans("CreateTableAndPrimaryKey", $name); @@ -292,7 +292,7 @@ if ($action == "set") { $buf = fgets($fp, 4096); // Special case of lines allowed for some version only - // MySQL + // MySQL if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) { $versioncommande = explode('.', $reg[1]); //print var_dump($versioncommande); @@ -324,7 +324,7 @@ if ($action == "set") { } fclose($fp); - // If several requests, we loop on each + // If several requests, we loop on each $listesql = explode(';', $buffer); foreach ($listesql as $req) { $buffer = trim($req); From f3f1c9ba788f1ac427cf1d5910b96f645cb259ce Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 15:54:25 +0100 Subject: [PATCH 063/328] comm card order --- htdocs/comm/card.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index eabcb1a55bf..07743b21709 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; if (!empty($conf->facture->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; } @@ -112,6 +113,7 @@ $cancel = GETPOST('cancel', 'alpha'); $object = new Client($db); $extrafields = new ExtraFields($db); +$formfile = new FormFile($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -940,7 +942,17 @@ if ($object->id > 0) { print ''; print ''; print $commande_static->getNomUrl(1); - print ''.dol_print_date($db->jdate($objp->dc), 'day')."\n"; + + + + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/dolibarr/commande/card.php?id='.$objp->cid; + + print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); + print ''; + + print ''.dol_print_date($db->jdate($objp->dc), 'day')."\n"; print ''.price($objp->total_ht).''; print ''.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).''; $i++; @@ -1211,8 +1223,20 @@ if ($object->id > 0) { print ''; print ''; + + print $invoicetemplate->getNomUrl(1); print ''; + + // Other picto tool + print ''; + $filename = dol_sanitizeFileName($invoicetemplate->ref); + $filedir = $conf->propal->multidir_output[$invoicetemplate->propal_entity].'/'.dol_sanitizeFileName($invoicetemplate->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$invoicetemplate->rowid; + print $formfile->getDocumentsLink($invoicetemplate->element, $filename, $filedir); + print ''; + + if ($objp->frequency && $objp->date_last_gen > 0) { print ''.dol_print_date($db->jdate($objp->date_last_gen), 'day').''; } else { From 7d000e4c9f4e64976d2f7abc5fec844937d8c58e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 15:57:03 +0100 Subject: [PATCH 064/328] Update llx_adherent.sql --- htdocs/install/mysql/tables/llx_adherent.sql | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index bd74c33c688..eabb2d3c478 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -20,9 +20,9 @@ -- =================================================================== -- -- statut --- -1 : brouillon --- 0 : resilie --- 1 : valide +-- -1 : draft / brouillon +-- 0 : canceled / resilie +-- 1 : valid / valide create table llx_adherent ( @@ -39,7 +39,7 @@ create table llx_adherent pass varchar(50), -- password pass_crypted varchar(128), fk_adherent_type integer NOT NULL, - morphy varchar(3) NOT NULL, -- personne morale / personne physique + morphy varchar(3) NOT NULL, -- EN: legal entity / natural person FR: personne morale / personne physique societe varchar(128), -- company name (should be same length than societe.name). No more used. fk_soc integer NULL, -- Link to third party linked to member address text, @@ -64,20 +64,20 @@ create table llx_adherent phone varchar(30), phone_perso varchar(30), phone_mobile varchar(30), - birth date, -- birthday - photo varchar(255), -- filename or url of photo + birth date, -- birthday + photo varchar(255), -- filename or url of photo statut smallint NOT NULL DEFAULT 0, - public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ? - datefin datetime, -- date de fin de validite de la cotisation + public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ? + datefin datetime, -- end date of validity of the contribution / date de fin de validite de la cotisation note_private text DEFAULT NULL, note_public text DEFAULT NULL, model_pdf varchar(255), - datevalid datetime, -- date de validation - datec datetime, -- date de creation + datevalid datetime, -- date of validation + datec datetime, -- date of creation tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date - fk_user_author integer, -- can be null because member can be create by a guest + fk_user_author integer, -- can be null because member can be create by a guest fk_user_mod integer, fk_user_valid integer, - canvas varchar(32), -- type of canvas if used (null by default) - import_key varchar(14) -- Import key + canvas varchar(32), -- type of canvas if used (null by default) + import_key varchar(14) -- Import key )ENGINE=innodb; From db799d79133e5bab6fb1a67e4492bcde34707e0b Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 16:00:22 +0100 Subject: [PATCH 065/328] comm card propal preview --- htdocs/comm/card.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 07743b21709..0993f0c78ab 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -861,6 +861,13 @@ if ($object->id > 0) { $propal_static->total_tva = $objp->total_tva; $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); + + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/comm/propal/card.php?id='.$objp->cid; + + print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); + if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { print " ".img_warning(); } @@ -943,11 +950,9 @@ if ($object->id > 0) { print ''; print $commande_static->getNomUrl(1); - - $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/dolibarr/commande/card.php?id='.$objp->cid; + $urlsource = '/commande/card.php?id='.$objp->cid; print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); print ''; From 961636ea35b64fbe34befec338b413b86376e968 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Mar 2022 16:04:00 +0100 Subject: [PATCH 066/328] CSS --- htdocs/compta/facture/card.php | 8 +++++--- .../compta/facture/tpl/linkedobjectblock.tpl.php | 2 +- .../facture/tpl/linkedobjectblockForRec.tpl.php | 2 +- htdocs/theme/eldy/global.inc.php | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3ee76f1ec8c..a6aa30504e6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4805,6 +4805,7 @@ if ($action == 'create') { // List of previous situation invoices if (($object->situation_cycle_ref > 0) && !empty($conf->global->INVOICE_USE_SITUATION)) { + print ''; print ''; print ''; @@ -4943,15 +4944,16 @@ if ($action == 'create') { // List of payments already done + print ''; print '
'; print '
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; if (!empty($conf->banque->enabled)) { - print ''; + print ''; } print ''; print ''; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 0b22e31be4b..de7be8a81b3 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -45,7 +45,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { $trclass .= ' liste_sub_total'; } print ''; - print ' - + diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 123d24f54f3..0a1000cce05 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7397,6 +7397,21 @@ div.clipboardCPValue.hidewithsize { .a-mesure, .a-mesure-disabled { text-align: center; } + + + div.fichehalfright { + margin-top: 30px; + } + + .valuefield.fieldname_type span.badgeneutral { + margin-top: 5px; + display: inline-block; + } + + tr.trextrafieldseparator td, tr.trextrafields_collapse_last td { + /* border-bottom: 2px solid var(--colorbackhmenu1) !important; */ + border-bottom: 1px solid var(--colortopbordertitle1) !important; + } } @media only screen and (max-width: 320px) From 19b8d418e24f11948b603537bc78f4a204eeeb8b Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 16:18:09 +0100 Subject: [PATCH 067/328] Update 15.0.0-16.0.0.sql --- .../install/mysql/migration/15.0.0-16.0.0.sql | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 3f313c180eb..ea0e742559d 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -32,7 +32,10 @@ -- Missing in v15 or lower +ALTER TABLE llx_c_actioncomm MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_availability MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_barcode_type MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_chargesociales MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_civility MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_country MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_currencies MODIFY COLUMN label varchar(128); @@ -40,8 +43,10 @@ ALTER TABLE llx_c_effectif MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_exp_tax_cat MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_hrm_department MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_hrm_function MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_input_method MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_input_reason MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_lead_status MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_paiement MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_paper_format MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_partnership_type MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_product_nature MODIFY COLUMN label varchar(128); @@ -50,25 +55,21 @@ ALTER TABLE llx_c_propalst MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_prospectcontactlevel MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_prospectlevel MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_recruitment_origin MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_shipment_package_type MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_type_container MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_type_fees MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_type_resource MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_units MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_actioncomm MODIFY COLUMN libelle varchar(128); -ALTER TABLE llx_c_barcode_type MODIFY COLUMN libelle varchar(128); -ALTER TABLE llx_c_chargesociales MODIFY COLUMN libelle varchar(128); -ALTER TABLE llx_c_input_method MODIFY COLUMN libelle varchar(128); -ALTER TABLE llx_c_paiement MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_shipment_mode MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_shipment_package_type MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_stcomm MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_stcommcontact MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_type_contact MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_type_container MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_type_fees MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_type_resource MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_typent MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_units MODIFY COLUMN label varchar(128); + UPDATE llx_rights_def SET perms = 'writeall' WHERE perms = 'writeall_advance' AND module = 'holiday'; - +-- Insert company legal forms of Mexico INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); @@ -188,40 +189,40 @@ ALTER TABLE llx_facture_fourn_rec_extrafields ADD INDEX idx_facture_fourn_rec_ex CREATE TABLE llx_facture_fourn_det_rec ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_facture_fourn integer NOT NULL, - fk_parent_line integer NULL, - fk_product integer NULL, - ref varchar(50), - label varchar(255) DEFAULT NULL, - description text, - pu_ht double(24,8), - pu_ttc double(24,8), - qty real, - remise_percent real DEFAULT 0, - fk_remise_except integer NULL, - vat_src_code varchar(10) DEFAULT '', - tva_tx double(7,4), - localtax1_tx double(7,4) DEFAULT 0, - localtax1_type varchar(10) NULL, - localtax2_tx double(7,4) DEFAULT 0, - localtax2_type varchar(10) NULL, - total_ht double(24,8), - total_tva double(24,8), - total_localtax1 double(24,8) DEFAULT 0, - total_localtax2 double(24,8) DEFAULT 0, - total_ttc double(24,8), - product_type integer DEFAULT 0, - date_start integer DEFAULT NULL, - date_end integer DEFAULT NULL, - info_bits integer DEFAULT 0, - special_code integer UNSIGNED DEFAULT 0, - rang integer DEFAULT 0, - fk_unit integer DEFAULT NULL, - import_key varchar(14), - fk_user_author integer, - fk_user_modif integer, - fk_multicurrency integer, + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_facture_fourn integer NOT NULL, + fk_parent_line integer NULL, + fk_product integer NULL, + ref varchar(50), + label varchar(255) DEFAULT NULL, + description text, + pu_ht double(24,8), + pu_ttc double(24,8), + qty real, + remise_percent real DEFAULT 0, + fk_remise_except integer NULL, + vat_src_code varchar(10) DEFAULT '', + tva_tx double(7,4), + localtax1_tx double(7,4) DEFAULT 0, + localtax1_type varchar(10) NULL, + localtax2_tx double(7,4) DEFAULT 0, + localtax2_type varchar(10) NULL, + total_ht double(24,8), + total_tva double(24,8), + total_localtax1 double(24,8) DEFAULT 0, + total_localtax2 double(24,8) DEFAULT 0, + total_ttc double(24,8), + product_type integer DEFAULT 0, + date_start integer DEFAULT NULL, + date_end integer DEFAULT NULL, + info_bits integer DEFAULT 0, + special_code integer UNSIGNED DEFAULT 0, + rang integer DEFAULT 0, + fk_unit integer DEFAULT NULL, + import_key varchar(14), + fk_user_author integer, + fk_user_modif integer, + fk_multicurrency integer, multicurrency_code varchar(3), multicurrency_subprice double(24,8) DEFAULT 0, multicurrency_total_ht double(24,8) DEFAULT 0, @@ -252,7 +253,6 @@ ALTER TABLE llx_product_attribute_value MODIFY COLUMN value VARCHAR(255) NOT NUL ALTER TABLE llx_product_attribute_value ADD COLUMN position INTEGER NOT NULL DEFAULT 0; ALTER TABLE llx_product_attribute CHANGE rang position INTEGER DEFAULT 0 NOT NULL; - ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); @@ -264,8 +264,8 @@ create table llx_inventory_extrafields fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; -ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); +ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128); From f808756c3e1aa8a4ff5668de76c998f8b4682bb5 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 16:34:15 +0100 Subject: [PATCH 068/328] Update llx_00_c_country.sql MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bahreïn --> Bahrain Barbade --> Barbados Bénin --> Benin Bermudes --> Bermuda Bhoutan --> Bhutan Bolivie --> Bolivia Bosnie-Herzégovine --> Bosnia and Herzegovina Ile Bouvet --> Bouvet Island (Population: 0 ;-)) Territoire britannique de l''Océan Indien --> British Indian Ocean Territory Bulgarie --> Bulgaria --- .../install/mysql/data/llx_00_c_country.sql | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 7217fda7d09..61b3f346b39 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -71,22 +71,22 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (39 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (41,'AT','AUT','Austria',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (42,'AZ','AZE','Azerbaijan',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (43,'BS','BHS','Bahamas',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (44,'BH','BHR','Bahreïn',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (44,'BH','BHR','Bahrain',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (45,'BD','BGD','Bangladesh',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (46,'BB','BRB','Barbade',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (46,'BB','BRB','Barbados',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (47,'BY','BLR','Belarus',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (48,'BZ','BLZ','Belize',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (49,'BJ','BEN','Bénin',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (50,'BM','BMU','Bermudes',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (51,'BT','BTN','Bhoutan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (52,'BO','BOL','Bolivie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (53,'BA','BIH','Bosnie-Herzégovine',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (49,'BJ','BEN','Benin',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (50,'BM','BMU','Bermuda',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (51,'BT','BTN','Bhutan',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (52,'BO','BOL','Bolivia',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (53,'BA','BIH','Bosnia and Herzegovina',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (54,'BW','BWA','Botswana',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (55,'BV','BVT','Ile Bouvet',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (55,'BV','BVT','Bouvet Island',0,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (56,'BR','BRA','Brazil',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (57,'IO','IOT','Territoire britannique de l''Océan Indien',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (57,'IO','IOT','British Indian Ocean Territory',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (58,'BN','BRN','Brunei',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (59,'BG','BGR','Bulgarie',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (59,'BG','BGR','Bulgaria',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (60,'BF','BFA','Burkina Faso',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (61,'BI','BDI','Burundi',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (62,'KH','KHM','Cambodge',1,0); From 4f4c95344e840118831003dd865c17ff8c59e567 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 16:36:32 +0100 Subject: [PATCH 069/328] Other --- htdocs/comm/card.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 0993f0c78ab..86d70e04c9a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -861,13 +861,10 @@ if ($object->id > 0) { $propal_static->total_tva = $objp->total_tva; $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); $urlsource = '/comm/propal/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); - if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { print " ".img_warning(); } @@ -949,11 +946,9 @@ if ($object->id > 0) { print ''; print ''; @@ -1020,6 +1015,10 @@ if ($object->id > 0) { print ''; print ''; if ($objp->date_creation > 0) { print ''; @@ -1093,6 +1092,10 @@ if ($object->id > 0) { print ''; print '\n"; print '\n"; @@ -1154,6 +1157,10 @@ if ($object->id > 0) { print ''; print ''."\n"; //print ''."\n"; print ''."\n"; @@ -1228,20 +1235,9 @@ if ($object->id > 0) { print ''; print ''; - // Other picto tool - print ''; - - if ($objp->frequency && $objp->date_last_gen > 0) { print ''; } else { @@ -1330,6 +1326,10 @@ if ($object->id > 0) { print ''; print ''; if ($objp->df > 0) { print ''; From 8410298c7e5cd505eaa26182a3617cd8114e7d2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Mar 2022 18:20:15 +0100 Subject: [PATCH 070/328] Fix access to the bank receipt view --- htdocs/compta/bank/releve.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index d21717473ff..2385f2210a5 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -60,10 +60,11 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha'); // Security check $fieldid = (!empty($ref) ? $ref : $id); -$fieldname = isset($ref) ? 'ref' : 'rowid'; +$fieldname = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) { $socid = $user->socid; } + $result = restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname); if ($user->rights->banque->consolidate && $action == 'dvnext' && !empty($dvid)) { From 368a247f95b7b138a60dcb36cb6e62605f58e6c9 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 18:53:27 +0100 Subject: [PATCH 071/328] New method --- htdocs/comm/card.php | 190 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 171 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 86d70e04c9a..c829ec30550 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -10,6 +10,7 @@ * Copyright (C) 2015-2021 Frédéric France * Copyright (C) 2015 Marcos García * Copyright (C) 2020 Open-Dsi + * Copyright (C) 2022 Anthony Berton * * 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 @@ -861,10 +862,36 @@ if ($object->id > 0) { $propal_static->total_tva = $objp->total_tva; $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); + + // Preview $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/comm/propal/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/comm/propal/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { print " ".img_warning(); } @@ -946,10 +973,35 @@ if ($object->id > 0) { print ''; print ''; print '\n"; @@ -1015,10 +1067,35 @@ if ($object->id > 0) { print ''; print ''; if ($objp->date_creation > 0) { print ''; @@ -1092,10 +1169,35 @@ if ($object->id > 0) { print ''; print '\n"; print '\n"; @@ -1157,10 +1259,35 @@ if ($object->id > 0) { print ''; print ''."\n"; //print ''."\n"; print ''."\n"; @@ -1326,10 +1453,35 @@ if ($object->id > 0) { print ''; print ''; if ($objp->df > 0) { print ''; From a1ac38ae034ca0dc0ef5b3fbe896688c81cb60f3 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 21:03:11 +0100 Subject: [PATCH 072/328] entity --- htdocs/comm/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index c829ec30550..9e5ef8be35c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -864,7 +864,7 @@ if ($object->id > 0) { print $propal_static->getNomUrl(1); // Preview - $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -889,7 +889,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/comm/propal/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { @@ -974,7 +974,7 @@ if ($object->id > 0) { print ''; @@ -1068,7 +1068,7 @@ if ($object->id > 0) { print ''; @@ -1170,7 +1170,7 @@ if ($object->id > 0) { print ''."\n"; @@ -1454,7 +1454,7 @@ if ($object->id > 0) { print ''; From 22b3c0ccaec4cc60caf373cb973b49c2cce4baad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 12:59:52 +0100 Subject: [PATCH 073/328] Add forme juridique for croatia --- htdocs/install/mysql/data/llx_c_forme_juridique.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index a1293084a52..aadb47c3ff6 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -382,3 +382,16 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', ' INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag'); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening'); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse'); + +-- Croatia (id country=76) +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7601', 'Društvo s ograničenom odgovornošću (d.o.o.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7602', 'Jednostavno društvo s ograničenom odgovornošću (j.d.o.o.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7603', 'Dioničko društvo (d.d.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7604', 'Obrt'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7605', 'Javno trgovačko društvo (j.t.d.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7606', 'Komanditno društvo (k.d.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7607', 'Gospodarsko interesno udruženje (GIU)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7608', 'Predstavništvo'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7609', 'Državno tijelo'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7610', 'Kućna radinost'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7611', 'Sporedno zanimanje'); From ba4b72e59df4921b28b0f301e341ad8e7d98dafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 13:07:42 +0100 Subject: [PATCH 074/328] Add regions for Croatia --- htdocs/install/mysql/data/llx_10_c_regions.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index daf6e16ea9e..368b6d9dccf 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -11,6 +11,7 @@ -- Copyright (C) 2015 Ferran Marcet -- Copyright (C) 2019~ Lao Tian <281388879@qq.com> -- Copyright (C) 2020-2021 Udo Tamm +-- Copyright (C) 2022 Miro Sertić -- -- 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 @@ -55,6 +56,7 @@ -- Chile -- China -- Colombie -> for Departmements +-- Croatia -> for Departmements -- Denmark -- France -- Germany -> for Departmements @@ -207,6 +209,13 @@ insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 70, 7001, '', 0, 'Colombie'); +-- Croatia Regions (id country=76) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7601, '', 0, 'Središnja'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7602, '', 0, 'Dalmacija'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7603, '', 0, 'Slavonija'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7604, '', 0, 'Istra'); + + -- Denmark Regions (id country=80) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 80, 8001, '', 0, 'Nordjylland'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 80, 8002, '', 0, 'Midtjylland'); From 25d31e38ea5dea7033c23bb19bc08169edbed728 Mon Sep 17 00:00:00 2001 From: Khang Date: Sun, 13 Mar 2022 19:15:25 +0700 Subject: [PATCH 075/328] Add (llx_c_tva.sql) VIETNAM VAT --- htdocs/install/mysql/data/llx_c_tva.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 7a84c622b47..d35e439c2da 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -384,6 +384,11 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (23 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1); +-- VIETNAM (id country=233) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2331,233, '0','0','Thuế GTGT đươc khấu trừ 0%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2332,233, '5','0','Thuế GTGT đươc khấu trừ 5%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2333,233, '8','0','Thuế GTGT đươc khấu trừ 8%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2334,233, '10','0','Thuế GTGT đươc khấu trừ 10%',1); -- Example of code to insert a VAT rate 0 for each country --delete from llx_c_tva where rowid = 1181; -- to delete a record that does not follow rules for rowid (fk_pays+'1') --insert into llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) SELECT CONCAT(c.rowid, '1'), c.rowid, 0, 0, 'No VAT', 1 from llx_c_country as c where c.rowid not in (select fk_pays from llx_c_tva); From 339152cf68a89c74022e3c4517eeee014bcb202e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 13:50:11 +0100 Subject: [PATCH 076/328] Add departments for Croatia --- .../mysql/data/llx_20_c_departements.sql | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 47f51f33986..15c99b0b99b 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -10,6 +10,7 @@ -- Copyright (C) 2012 Ricardo Schluter -- Copyright (C) 2015 Ferran Marcet -- Copyright (C) 2020-2021 Udo Tamm +-- Copyright (C) 2022 Miro Sertić -- -- 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 @@ -47,6 +48,7 @@ -- Canada -- Chile -- Colombia +-- Croatia -- France -- Germany -- Honduras @@ -367,6 +369,29 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7001, 'CES', '', 0, 'CES', 'Cesar'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7001, 'MAG', '', 0, 'MAG', 'Magdalena'); +-- Croatia Departments (id country=76) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-01', 'Bjelovar', 0, NULL, 'Bjelovarsko-bilogorska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-02', 'Karlovac', 0, NULL, 'Karlovačka županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-03', 'Koprivnica', 0, NULL, 'Koprivničko-križevačka županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-04', 'Krapina', 0, NULL, 'Krapinsko-zagorska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-05', 'Gospić', 0, NULL, 'Ličko-senjska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-06', 'Čakovec', 0, NULL, 'Međimurska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-07', 'Rijeka', 0, NULL, 'Primorsko-goranska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-08', 'Sisak', 0, NULL, 'Sisačko-moslavačka županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-09', 'Varaždin', 0, NULL, 'Varaždinska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-10', 'Zagreb', 0, NULL, 'Zagrebačka županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-11', 'Zagreb', 0, NULL, 'Grad Zagreb'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7602, 'HR-12', 'Zadar', 0, NULL, 'Zadarska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7602, 'HR-13', 'Šibenik', 0, NULL, 'Šibensko-kninska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7602, 'HR-14', 'Split', 0, NULL, 'Splitsko-dalmatinska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7602, 'HR-15', 'Dubrovnik', 0, NULL, 'Dubrovačko-neretvanska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-16', 'Slavonski Brod', 0, NULL, 'Brodsko-posavska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-17', 'Osijek', 0, NULL, 'Osječko-baranjska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-18', 'Požega', 0, NULL, 'Požeško-slavonska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-19', 'Virovitica', 0, NULL, 'Virovitičko-podravska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-20', 'Vukovar', 0, NULL, 'Vukovarsko-srijemska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7604, 'HR-21', 'Pazin', 0, NULL, 'Istarska županija'); + -- France Departements (id country=1) insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 1, '971','97105',3,'GUADELOUPE','Guadeloupe'); From fc59f49b32f2b2466629318d0f91b9ab9bc0e2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 14:18:14 +0100 Subject: [PATCH 077/328] Add vat for Croatia --- htdocs/install/mysql/data/llx_c_tva.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 7a84c622b47..788aec5251e 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -8,6 +8,7 @@ -- Copyright (C) 2010-2016 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Ricardo Schluter +-- Copyright (C) 2022 Miro Sertić -- -- 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 @@ -106,6 +107,12 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 9 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT rate 18+0.9', 1); +-- CROATIA (id country=76) +insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (761, 76, '25','PDV 25%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (762, 76, '13','PDV 13%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (763, 76, '5', 'PDV 5%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (764, 76, '0', 'PDV 0%', 1); + -- CYPRUS (id country=78) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '0','0','VAT rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (782, 78, '9','0','VAT rate 9',1); From f22888e4267f699979543d86f84d8442d1d35161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 14:34:14 +0100 Subject: [PATCH 078/328] Add contributor to llx_c_forme_juridique.sql --- htdocs/install/mysql/data/llx_c_forme_juridique.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index aadb47c3ff6..2b3accc5482 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -11,6 +11,7 @@ -- Copyright (C) 2012 Ricardo Schluter -- Copyright (C) 2013 Cedric GROSS -- Copyright (C) 2020-2021 Udo Tamm +-- Copyright (C) 2022 Miro Sertić -- -- 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 From 45df52343b6d7048b615a70d0ff245be0a0948cc Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 13 Mar 2022 14:42:38 +0100 Subject: [PATCH 079/328] Fix Warning in htdocs/adherents/card.php Fix Warning: Creating default object from empty value in htdocs/adherents/card.php on line 1058 --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e081b126dfe..b36781a99b1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -789,8 +789,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->country = $tmparray['label']; } + $soc = new Societe($db); if (!empty($socid)) { - $soc = new Societe($db); if ($socid > 0) $soc->fetch($socid); if (!($soc->id > 0)) { From b1197d4f4e089c42dd44979a78ca6f0a7e30b6ef Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 13 Mar 2022 15:31:37 +0100 Subject: [PATCH 080/328] Fix for multicompany on online sign url --- htdocs/core/lib/signature.lib.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 1d529be6327..c57807800d7 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -119,11 +119,9 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1) } // For multicompany - /* - if (!empty($out)) { - $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities + if (!empty($out) && !empty($conf->multicompany->enabled)) { + $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities } - */ return $out; } From 44b6f8a48d9b1c1495a7d353fc58cd7b183c5b66 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 14 Mar 2022 09:20:10 +0100 Subject: [PATCH 081/328] FIX avoid php warning --- .../contract/doc/pdf_strato.modules.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 69a4d5ce96e..67dca0ecf1b 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -321,28 +321,28 @@ class pdf_strato extends ModelePDFContract // Description of product line - if ($objectligne->date_ouverture_prevue) { - $datei = dol_print_date($objectligne->date_ouverture_prevue, 'day', false, $outputlangs, true); + if (!empty($objectligne->date_start)) { + $datei = dol_print_date((int) $objectligne->date_start, 'day', false, $outputlangs, true); } else { $datei = $langs->trans("Unknown"); } - if ($objectligne->date_fin_validite) { - $durationi = convertSecondToTime($objectligne->date_fin_validite - $objectligne->date_ouverture_prevue, 'allwithouthour'); - $datee = dol_print_date($objectligne->date_fin_validite, 'day', false, $outputlangs, true); + if (!empty($objectligne->date_end)) { + $durationi = convertSecondToTime((int) $objectligne->date_end - (int) $objectligne->date_start, 'allwithouthour'); + $datee = dol_print_date($objectligne->date_end, 'day', false, $outputlangs, true); } else { $durationi = $langs->trans("Unknown"); $datee = $langs->trans("Unknown"); } - if ($objectligne->date_ouverture) { - $daters = dol_print_date($objectligne->date_ouverture, 'day', false, $outputlangs, true); + if (!empty($objectligne->date_start_real)) { + $daters = dol_print_date((int) $objectligne->date_start_real, 'day', false, $outputlangs, true); } else { $daters = $langs->trans("Unknown"); } - if ($objectligne->date_cloture) { - $datere = dol_print_date($objectligne->date_cloture, 'day', false, $outputlangs, true); + if (!empty($objectligne->date_end_real)) { + $datere = dol_print_date((int) $objectligne->date_end_real, 'day', false, $outputlangs, true); } else { $datere = $langs->trans("Unknown"); } @@ -363,7 +363,7 @@ class pdf_strato extends ModelePDFContract if (empty($conf->global->CONTRACT_HIDE_REAL_DATE_ON_PDF)) { $txt .= '
'; $txt .= $outputlangs->transnoentities("DateStartRealShort")." : ".$daters.''; - if ($objectligne->date_cloture) { + if (!empty($objectligne->date_end_real)) { $txt .= " - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.''; } } From 3eebbc0b14c8eb9f4d5a283651eb61b531ac9e29 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 14 Mar 2022 09:24:26 +0100 Subject: [PATCH 082/328] Fix #20263 Accountancy setup displayed with right Fix #20263 Accountancy setup is displayed only for user with rights->accounting->chartofaccount --- htdocs/accountancy/index.php | 151 ++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index f44b5bc72f8..c71e51ed427 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -93,88 +93,89 @@ if ($conf->accounting->enabled) print '
'; // hideobject is to start hidden print "
\n"; print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; - print "
\n"; print "
\n"; + if (!empty($user->rights->accounting->chartofaccount)){ + print "
\n"; print "
\n"; - print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; - print '
'; - print "
\n"; + print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; + print '
'; + print "
\n"; - // STEPS - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); - print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); - print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); - print "
\n"; + // STEPS + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); + print "
\n"; - print "
\n"; - print $langs->trans("AccountancyAreaDescActionOnceBis"); - print "
\n"; - print "
\n"; + print "
\n"; + print $langs->trans("AccountancyAreaDescActionOnceBis"); + print "
\n"; + print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; - print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; + print "
\n"; - $step++; - $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); - print "
\n"; - if (!empty($conf->tax->enabled)) - { - $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); - print "
\n"; + $step++; + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); + print "
\n"; + if (!empty($conf->tax->enabled)) + { + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); + print "
\n"; + } + /*if (! empty($conf->salaries->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + // htdocs/admin/salaries.php + print "
\n"; + print "
\n"; + }*/ + if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); + print "
\n"; + } + /* + if (! empty($conf->loan->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->don->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->adherents->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + }*/ + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); + print "
\n"; + + print '
'; } - /*if (! empty($conf->salaries->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - // htdocs/admin/salaries.php - print "
\n"; - print "
\n"; - }*/ - if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); - print "
\n"; - } - /* - if (! empty($conf->loan->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->don->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->adherents->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - }*/ - - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); - print "
\n"; - - - print '
'; - + // Step A - E print "
\n"; From 19be5f662d9fdbdb443a665da539519778fa0084 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 14 Mar 2022 08:25:15 +0000 Subject: [PATCH 083/328] Fixing style errors. --- htdocs/accountancy/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index c71e51ed427..b0305050840 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -175,7 +175,7 @@ if ($conf->accounting->enabled) print '
'; } - + // Step A - E print "
\n"; From 4b3b9ed66b9ee349f8bbac7ff995ec8077333487 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Mar 2022 11:29:17 +0100 Subject: [PATCH 084/328] Look and feel v15 --- htdocs/langs/en_US/products.lang | 3 ++- htdocs/product/composition/card.php | 5 +++++ htdocs/product/fournisseurs.php | 8 +++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 0fa5567cf11..aaa2fe0ead0 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -137,7 +137,8 @@ ConfirmDeleteProductLine=Are you sure you want to delete this product line? ProductSpecial=Special QtyMin=Min. purchase quantity PriceQtyMin=Price quantity min. -PriceQtyMinCurrency=Price (currency) for this qty. (no discount) +PriceQtyMinCurrency=Price (currency) for this qty. +WithoutDiscount=Without discount VATRateForSupplierProduct=VAT Rate (for this vendor/product) DiscountQtyMin=Discount for this qty. NoPriceDefinedForThisSupplier=No price/qty defined for this vendor/product diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index d5325029771..a6bb38adfe2 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -266,6 +266,11 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); + + print '
'; + print '
'; + print '
'; + print '
'; $prodsfather = $object->getFather(); // Parent Products diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 3bf563c82f7..d4785f101cf 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -523,7 +523,9 @@ if ($id > 0 || $ref) { $reshook = $hookmanager->executeHooks('formCreateThirdpartyOptions', $parameters, $object, $action); if (empty($reshook)) { if (empty($form->result)) { - print ' - '.$langs->trans("CreateDolibarrThirdPartySupplier").''; + print ''; + print img_picto($langs->trans("CreateDolibarrThirdPartySupplier"), 'add', 'class="marginleftonly"'); + print ''; } } } @@ -665,7 +667,7 @@ if ($id > 0 || $ref) { print '
'; // Currency price qty min - print ''; + print ''; $pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : '')); print ''; // Price qty min - print ''; + print ''; print '"; // Subledger account print "'; $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; From 92bfd6893d84d13410591d74b52c2ec6100b376e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 15 Mar 2022 09:10:41 +0100 Subject: [PATCH 091/328] fix:incoterm bad sql request --- htdocs/core/class/commonincoterm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonincoterm.class.php b/htdocs/core/class/commonincoterm.class.php index f98f3aaabad..f349925a00a 100644 --- a/htdocs/core/class/commonincoterm.class.php +++ b/htdocs/core/class/commonincoterm.class.php @@ -122,7 +122,7 @@ trait CommonIncoterm $this->fk_incoterms = $id_incoterm; $this->location_incoterms = $location; - $sql = 'SELECT libelle as label_incotermsFROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $sql = 'SELECT libelle as label_incoterms FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; $res = $this->db->query($sql); if ($res) { From 587b2076d85dc1b54e503460043b2a06c742a411 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 15 Mar 2022 08:11:44 +0000 Subject: [PATCH 092/328] Fixing style errors. --- htdocs/accountancy/journal/sellsjournal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 6f2fce7c10c..110919ce73b 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -412,7 +412,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; - if($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { + if ($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; } else { @@ -891,7 +891,7 @@ if (empty($action) || $action == 'view') { print ""; // Subledger account print ""; From 271857189c150593f6fc2369a96614b4b5660712 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 15 Mar 2022 13:29:34 +0100 Subject: [PATCH 097/328] Update llx_20_c_departements.sql --- .../mysql/data/llx_20_c_departements.sql | 363 +++++++++--------- 1 file changed, 187 insertions(+), 176 deletions(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 47f51f33986..d51bb70ec21 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -1,16 +1,21 @@ --- Copyright (C) 2001-2004 Rodolphe Quiedeville --- Copyright (C) 2003 Jean-Louis Bergamo --- Copyright (C) 2004-2010 Laurent Destailleur --- Copyright (C) 2004 Benoit Mortier --- Copyright (C) 2004 Guillaume Delecourt --- Copyright (C) 2005-2009 Regis Houssin --- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2010-2016 Juanjo Menent --- Copyright (C) 2012 Sebastian Neuwert --- Copyright (C) 2012 Ricardo Schluter --- Copyright (C) 2015 Ferran Marcet --- Copyright (C) 2020-2021 Udo Tamm +-- file: /htdocs/install/mysql/data/llx_20_c_departements.sql + +-- Authors ----------------------------------------------------------------------- +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2010 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2010-2016 Juanjo Menent +-- Copyright (C) 2012 Sebastian Neuwert +-- Copyright (C) 2012 Ricardo Schluter +-- Copyright (C) 2015 Ferran Marcet +-- Copyright (C) 2020-2021 Udo Tamm -- + +-- License ---------------------------------------------------------------------- -- 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 @@ -60,14 +65,19 @@ -- Portugal -- Romania -- Slovenia (need to check code SI-Id) +-- Switzerland / Suisse -- Taiwan -- Tunisia -- United States of America +-- +-- others .. unsorted + -- TEMPLATE ------------------------------------------------------------------------------------------------------------- -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 0, '0', '0',0,'-','-'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 0, '0', '0',0,'-','-'); +-- active is always set as on = 1 -- Algeria Provinces (id country=13) @@ -144,7 +154,7 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-HUI', NULL, NULL, 'HUÍLA', 'Huila'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-LUA', NULL, NULL, 'LUANDA', 'Luanda'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-LNO', NULL, NULL, 'LUNDA-NORTE', 'Lunda-Norte'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-LSU',NULL, NULL, 'LUNDA-SUL', 'Lunda-Sul'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-LSU', NULL, NULL, 'LUNDA-SUL', 'Lunda-Sul'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-MAL', NULL, NULL, 'MALANGE', 'Malange'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-MOX', NULL, NULL, 'MOXICO', 'Moxico'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-NAM', NULL, NULL, 'NAMÍBE', 'Namíbe'); @@ -182,26 +192,26 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc -- Australia States & Territories (id country=28) -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (2801, 'NSW','',1,'','New South Wales'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (2801, 'VIC','',1,'','Victoria'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (2801, 'QLD','',1,'','Queensland'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (2801, 'SA' ,'',1,'','South Australia'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (2801, 'ACT','',1,'','Australia Capital Territory'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (2801, 'TAS','',1,'','Tasmania'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (2801, 'WA' ,'',1,'','Western Australia'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (2801, 'NT' ,'',1,'','Northern Territory'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (2801, 'NSW', '', 1, '', 'New South Wales'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (2801, 'VIC', '', 1, '', 'Victoria'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (2801, 'QLD', '', 1, '', 'Queensland'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (2801, 'SA' , '', 1, '', 'South Australia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (2801, 'ACT', '', 1, '', 'Australia Capital Territory'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (2801, 'TAS', '', 1, '', 'Tasmania'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (2801, 'WA' , '', 1, '', 'Western Australia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (2801, 'NT' , '', 1, '', 'Northern Territory'); -- Austria States / Österreich Bundesländer (id country=41) -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'B','BURGENLAND','Burgenland',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'K','KAERNTEN','Kärnten',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'N','NIEDEROESTERREICH','Niederösterreich',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'O','OBEROESTERREICH','Oberösterreich',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'S','SALZBURG','Salzburg',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'ST','STEIERMARK','Steiermark',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'T','TIROL','Tirol',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'V','VORARLBERG','Vorarlberg',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'W','WIEN','Wien',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'B', 'BURGENLAND', 'Burgenland'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'K', 'KAERNTEN', 'Kärnten'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'N', 'NIEDEROESTERREICH', 'Niederösterreich'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'O', 'OBEROESTERREICH', 'Oberösterreich'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'S', 'SALZBURG', 'Salzburg'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'ST', 'STEIERMARK', 'Steiermark'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'T', 'TIROL', 'Tirol'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'V', 'VORARLBERG', 'Vorarlberg'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'W', 'WIEN', 'Wien'); -- Barbados Parish (id country=46) @@ -219,17 +229,17 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc -- Belgium Provinces (id country=2) -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201, '01','',1,'ANVERS','Anvers'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (203, '02','',3,'BRUXELLES-CAPITALE','Bruxelles-Capitale'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '03','',2,'BRABANT-WALLON','Brabant-Wallon'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201, '04','',1,'BRABANT-FLAMAND','Brabant-Flamand'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201, '05','',1,'FLANDRE-OCCIDENTALE','Flandre-Occidentale'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201, '06','',1,'FLANDRE-ORIENTALE','Flandre-Orientale'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '07','',2,'HAINAUT','Hainaut'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '08','',2,'LIEGE','Liège'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '09','',1,'LIMBOURG','Limbourg'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '10','',2,'LUXEMBOURG','Luxembourg'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '11','',2,'NAMUR','Namur'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (201, '01', '', 1, 'ANVERS', 'Anvers'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (203, '02', '', 3, 'BRUXELLES-CAPITALE', 'Bruxelles-Capitale'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '03', '', 2, 'BRABANT-WALLON', 'Brabant-Wallon'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (201, '04', '', 1, 'BRABANT-FLAMAND', 'Brabant-Flamand'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (201, '05', '', 1, 'FLANDRE-OCCIDENTALE', 'Flandre-Occidentale'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (201, '06', '', 1, 'FLANDRE-ORIENTALE', 'Flandre-Orientale'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '07', '', 2, 'HAINAUT', 'Hainaut'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '08', '', 2, 'LIEGE', 'Liège'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '09', '', 1, 'LIMBOURG', 'Limbourg'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '10', '', 2, 'LUXEMBOURG', 'Luxembourg'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '11', '', 2, 'NAMUR', 'Namur'); -- Brazil Provinces (id country=56) @@ -263,16 +273,16 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc -- Canada Provinces & Territories (id country=14) -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'ON','',1,'','Ontario'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'QC','',1,'','Quebec'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'NS','',1,'','Nova Scotia'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'NB','',1,'','New Brunswick'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'MB','',1,'','Manitoba'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'BC','',1,'','British Columbia'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'PE','',1,'','Prince Edward Island'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'SK','',1,'','Saskatchewan'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'AB','',1,'','Alberta'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'NL','',1,'','Newfoundland and Labrador'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'ON', '', 1, '', 'Ontario'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'QC', '', 1, '', 'Quebec'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'NS', '', 1, '', 'Nova Scotia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'NB', '', 1, '', 'New Brunswick'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'MB', '', 1, '', 'Manitoba'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'BC', '', 1, '', 'British Columbia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'PE', '', 1, '', 'Prince Edward Island'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'SK', '', 1, '', 'Saskatchewan'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'AB', '', 1, '', 'Alberta'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'NL', '', 1, '', 'Newfoundland and Labrador'); -- Chile Provinces (id country=67) @@ -375,102 +385,102 @@ insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 4, '974','97411',3,'REUNION','Réunion'); insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 6, '976','97601',3,'MAYOTTE','Mayotte'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'01','01053',5,'AIN','Ain'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'02','02408',5,'AISNE','Aisne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'03','03190',5,'ALLIER','Allier'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'07','07186',5,'ARDECHE','Ardèche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'08','08105',4,'ARDENNES','Ardennes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'09','09122',5,'ARIEGE','Ariège'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'10','10387',5,'AUBE','Aube'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'11','11069',5,'AUDE','Aude'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'12','12202',5,'AVEYRON','Aveyron'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'14','14118',2,'CALVADOS','Calvados'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'15','15014',2,'CANTAL','Cantal'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'16','16015',3,'CHARENTE','Charente'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'19','19272',3,'CORREZE','Corrèze'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'21','21231',3,'COTE-D OR','Côte-d Or'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D ARMOR','Côtes-d Armor'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'23','23096',3,'CREUSE','Creuse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'24','24322',3,'DORDOGNE','Dordogne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'25','25056',2,'DOUBS','Doubs'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'26','26362',3,'DROME','Drôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'27','27229',5,'EURE','Eure'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'30','30189',2,'GARD','Gard'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'32','32013',2,'GERS','Gers'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'33','33063',3,'GIRONDE','Gironde'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'34','34172',5,'HERAULT','Hérault'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'38','38185',5,'ISERE','Isère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'39','39300',2,'JURA','Jura'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'40','40192',4,'LANDES','Landes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'42','42218',3,'LOIRE','Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'46','46042',2,'LOT','Lot'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'48','48095',3,'LOZERE','Lozère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'50','50502',3,'MANCHE','Manche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'51','51108',3,'MARNE','Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'55','55029',3,'MEUSE','Meuse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'57','57463',3,'MOSELLE','Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'58','58194',3,'NIEVRE','Nièvre'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'59','59350',2,'NORD','Nord'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'60','60057',5,'OISE','Oise'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'61','61001',5,'ORNE','Orne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'67','67482',2,'BAS-RHIN','Bas-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'69','69123',2,'RHONE','Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'73','73065',3,'SAVOIE','Savoie'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'80','80021',3,'SOMME','Somme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'81','81004',2,'TARN','Tarn'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'86','86194',3,'VIENNE','Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'88','88160',4,'VOSGES','Vosges'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'89','89024',5,'YONNE','Yonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'94','94028',2,'VAL-DE-MARNE','Val-de-Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'95','95500',2,'VAL-D OISE','Val-d Oise'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'01','01053',5,'AIN','Ain'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'02','02408',5,'AISNE','Aisne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'03','03190',5,'ALLIER','Allier'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'07','07186',5,'ARDECHE','Ardèche'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'08','08105',4,'ARDENNES','Ardennes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'09','09122',5,'ARIEGE','Ariège'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'10','10387',5,'AUBE','Aube'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'11','11069',5,'AUDE','Aude'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'12','12202',5,'AVEYRON','Aveyron'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'14','14118',2,'CALVADOS','Calvados'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'15','15014',2,'CANTAL','Cantal'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'16','16015',3,'CHARENTE','Charente'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'19','19272',3,'CORREZE','Corrèze'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'21','21231',3,'COTE-D OR','Côte-d Or'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D ARMOR','Côtes-d Armor'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'23','23096',3,'CREUSE','Creuse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'24','24322',3,'DORDOGNE','Dordogne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'25','25056',2,'DOUBS','Doubs'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'26','26362',3,'DROME','Drôme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'27','27229',5,'EURE','Eure'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'30','30189',2,'GARD','Gard'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'32','32013',2,'GERS','Gers'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'33','33063',3,'GIRONDE','Gironde'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'34','34172',5,'HERAULT','Hérault'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'38','38185',5,'ISERE','Isère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'39','39300',2,'JURA','Jura'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'40','40192',4,'LANDES','Landes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'42','42218',3,'LOIRE','Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'46','46042',2,'LOT','Lot'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'48','48095',3,'LOZERE','Lozère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'50','50502',3,'MANCHE','Manche'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'51','51108',3,'MARNE','Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'55','55029',3,'MEUSE','Meuse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'57','57463',3,'MOSELLE','Moselle'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'58','58194',3,'NIEVRE','Nièvre'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'59','59350',2,'NORD','Nord'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'60','60057',5,'OISE','Oise'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'61','61001',5,'ORNE','Orne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'67','67482',2,'BAS-RHIN','Bas-Rhin'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'69','69123',2,'RHONE','Rhône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'73','73065',3,'SAVOIE','Savoie'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'80','80021',3,'SOMME','Somme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'81','81004',2,'TARN','Tarn'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'86','86194',3,'VIENNE','Vienne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'88','88160',4,'VOSGES','Vosges'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'89','89024',5,'YONNE','Yonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'94','94028',2,'VAL-DE-MARNE','Val-de-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'95','95500',2,'VAL-D OISE','Val-d Oise'); -- Germany States / Bundesländer (id country=5) @@ -1060,6 +1070,35 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst'); +-- Switzerland Cantons (id country=6) +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AG','ARGOVIE','Argovie'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AI','APPENZELL RHODES INTERIEURES','Appenzell Rhodes intérieures'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AR','APPENZELL RHODES EXTERIEURES','Appenzell Rhodes extérieures'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BE','BERNE','Berne'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BL','BALE CAMPAGNE','Bâle Campagne'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BS','BALE VILLE','Bâle Ville'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'FR','FRIBOURG','Fribourg'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GE','GENEVE','Genève'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GL','GLARIS','Glaris'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GR','GRISONS','Grisons'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'JU','JURA','Jura'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'LU','LUCERNE','Lucerne'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'NE','NEUCHATEL','Neuchâtel'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'NW','NIDWALD','Nidwald'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'OW','OBWALD','Obwald'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SG','SAINT-GALL','Saint-Gall'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SH','SCHAFFHOUSE','Schaffhouse'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SO','SOLEURE','Soleure'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SZ','SCHWYZ','Schwyz'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'TG','THURGOVIE','Thurgovie'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'TI','TESSIN','Tessin'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'UR','URI','Uri'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'VD','VAUD','Vaud'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'VS','VALAIS','Valais'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'ZG','ZUG','Zug'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'ZH','ZURICH','Zürich'); + + -- Taiwan Divisions / Provinces / Counties (rowid country=886) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KLU', 'KLU', NULL, '基隆市'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPE', 'TPE', NULL, '臺北市'); @@ -1417,34 +1456,6 @@ INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('65', 10204, '', 0, '', 'Χανιά', 1); --- Switzerland Cantons (id country=6) -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AG','ARGOVIE','Argovie'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AI','APPENZELL RHODES INTERIEURES','Appenzell Rhodes intérieures'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AR','APPENZELL RHODES EXTERIEURES','Appenzell Rhodes extérieures'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BE','BERNE','Berne'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BL','BALE CAMPAGNE','Bâle Campagne'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BS','BALE VILLE','Bâle Ville'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'FR','FRIBOURG','Fribourg'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GE','GENEVE','Genève'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GL','GLARIS','Glaris'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GR','GRISONS','Grisons'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'JU','JURA','Jura'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'LU','LUCERNE','Lucerne'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'NE','NEUCHATEL','Neuchâtel'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'NW','NIDWALD','Nidwald'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'OW','OBWALD','Obwald'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SG','SAINT-GALL','Saint-Gall'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SH','SCHAFFHOUSE','Schaffhouse'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SO','SOLEURE','Soleure'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SZ','SCHWYZ','Schwyz'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'TG','THURGOVIE','Thurgovie'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'TI','TESSIN','Tessin'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'UR','URI','Uri'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'VD','VAUD','Vaud'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'VS','VALAIS','Valais'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'ZG','ZUG','Zug'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'ZH','ZURICH','Zürich'); - -- Provinces GB (id country=7) INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('701', 701, NULL, 0,NULL, 'Bedfordshire', 1); From 64525349e01c78375b4c9beaf65cd6e97c4f1d34 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 15 Mar 2022 13:46:14 +0100 Subject: [PATCH 098/328] Update llx_c_hrm_public_holiday.sql add fk_departement see #16646 --- .../mysql/tables/llx_c_hrm_public_holiday.sql | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_c_hrm_public_holiday.sql b/htdocs/install/mysql/tables/llx_c_hrm_public_holiday.sql index f3f26e41866..f057d8e7d5c 100644 --- a/htdocs/install/mysql/tables/llx_c_hrm_public_holiday.sql +++ b/htdocs/install/mysql/tables/llx_c_hrm_public_holiday.sql @@ -18,14 +18,15 @@ create table llx_c_hrm_public_holiday ( - id integer AUTO_INCREMENT PRIMARY KEY, - entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all - fk_country integer, - code varchar(62), - dayrule varchar(64) DEFAULT '', -- 'easter', 'eastermonday', ... - day integer, - month integer, - year integer, -- 0 for all years - active integer DEFAULT 1, - import_key varchar(14) + id integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all + fk_country integer, + fk_departement integer, + code varchar(62), + dayrule varchar(64) DEFAULT '', -- 'easter', 'eastermonday', ... + day integer, + month integer, + year integer, -- 0 for all years + active integer DEFAULT 1, + import_key varchar(14) )ENGINE=innodb; From 6080e1f988d7860571d4af9f5d1199506a4118fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9=20GDSOFT?= Date: Tue, 15 Mar 2022 14:59:26 +0100 Subject: [PATCH 099/328] fix : keep lines order when creating invoices from receptions --- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/reception/class/reception.class.php | 1 + htdocs/reception/list.php | 13 ++++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 9a8ab1fa7ef..fda6d1aba4a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -709,7 +709,7 @@ if ($id > 0 || !empty($ref)) { $sql .= $hookmanager->resPrint; $sql .= " GROUP BY p.ref, p.label, p.tobatch, p.fk_default_warehouse, l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product - $sql .= " ORDER BY p.ref, p.label"; + $sql .= " ORDER BY l.rang, p.ref, p.label"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 5fb8e3b8af0..62a9c8a8dde 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1055,6 +1055,7 @@ class Reception extends CommonObject $sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent'; $sql_commfourndet .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet'; $sql_commfourndet .= ' WHERE rowid = '.((int) $line->fk_commandefourndet); + $sql_commfourndet .= ' ORDER BY rang'; $resql_commfourndet = $this->db->query($sql_commfourndet); if (!empty($resql_commfourndet)) { $obj = $this->db->fetch_object($resql_commfourndet); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 9f98202099a..cf12c6f8191 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -175,6 +175,7 @@ if (empty($reshook)) { $TFact = array(); $TFactThird = array(); + $TFactThirdNbLines = array(); $nb_bills_created = 0; $lastid= 0; @@ -182,6 +183,8 @@ if (empty($reshook)) { $db->begin(); + //sort ids to keep order if one bill per third + sort($receptions); foreach ($receptions as $id_reception) { $rcp = new Reception($db); // We only invoice reception that are validated @@ -254,6 +257,7 @@ if (empty($reshook)) { $lastid = $objecttmp->id; $TFactThird[$rcp->socid] = $objecttmp; + $TFactThirdNbLines[$rcp->socid] = 0; //init nblines to have lines ordered by expedition and rang } else { $langs->load("errors"); $errors[] = $rcp->ref.' : '.$langs->trans($objecttmp->error); @@ -343,6 +347,11 @@ if (empty($reshook)) { $objecttmp->context['createfromclone']; + $rang = $i; + //there may already be rows from previous receptions + if (!empty($createbills_onebythird)) + $rang = $TFactThirdNbLines[$rcp->socid]; + $result = $objecttmp->addline( $desc, $lines[$i]->subprice, @@ -358,7 +367,7 @@ if (empty($reshook)) { $lines[$i]->info_bits, 'HT', $product_type, - $i, + $rang, false, 0, null, @@ -371,6 +380,8 @@ if (empty($reshook)) { if ($result > 0) { $lineid = $result; + if (!empty($createbills_onebythird)) //increment rang to keep order + $TFactThirdNbLines[$rcp->socid]++; } else { $lineid = 0; $error++; From ffa6cb06106562aa1325296790f9df9a706ccd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9=20GDSOFT?= Date: Tue, 15 Mar 2022 15:47:36 +0100 Subject: [PATCH 100/328] fix : keep lines order when creating invoices from orders --- htdocs/core/actions_massactions.inc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 64578ad68bb..b70e17b2ebb 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -635,6 +635,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $TFact = array(); $TFactThird = array(); + $TFactThirdNbLines = array(); $nb_bills_created = 0; $lastid= 0; @@ -685,6 +686,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $lastid = $objecttmp->id; $TFactThird[$cmd->socid] = $objecttmp; + $TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang } else { $langs->load("errors"); $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->error); @@ -774,6 +776,11 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $objecttmp->context['createfromclone']; + $rang = $lines[$i]->rang; + //there may already be rows from previous orders + if (!empty($createbills_onebythird)) + $rang = $TFactThirdNbLines[$cmd->socid]; + $result = $objecttmp->addline( $desc, $lines[$i]->subprice, @@ -791,7 +798,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. 'HT', 0, $product_type, - $lines[$i]->rang, + $rang, $lines[$i]->special_code, $objecttmp->origin, $lines[$i]->rowid, @@ -806,6 +813,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. ); if ($result > 0) { $lineid = $result; + if (!empty($createbills_onebythird)) //increment rang to keep order + $TFactThirdNbLines[$rcp->socid]++; } else { $lineid = 0; $error++; From 58f5cafc3497e2b3bcece75fa45587d746a56fd7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Mar 2022 19:15:02 +0100 Subject: [PATCH 101/328] FIX #20359 --- htdocs/projet/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6f587a67a7f..433a933c75b 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -632,11 +632,11 @@ if ($action == 'create' && $user->rights->projet->creer) { } if (count($array) > 0) { - print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('public', $array, GETPOST('public'), 0, 0, 0, '', 0, 0, 0, '', '', 1); } else { - print ''; + print ''; - if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) { + if (GETPOST('public') == 0) { print $langs->trans("PrivateProject"); } else { print $langs->trans("SharedProject"); From 0899caf74d7ba437b539765cc6d49d71ab8b4668 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Mar 2022 19:23:17 +0100 Subject: [PATCH 102/328] Update lib_head.js.php --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 53e89182227..9a0eaf0e0ed 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { + if (window.location && window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From 5a2ed9461fbffdc083f92039507e3d0ca11c08a9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Mar 2022 08:58:01 +0100 Subject: [PATCH 103/328] FIX Reception - Error on trackid --- htdocs/reception/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index e5f5fccffad..48b0953e399 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -679,7 +679,7 @@ if (empty($reshook)) { $triggersendname = 'RECEPTION_SENTBYMAIL'; $paramname = 'id'; $mode = 'emailfromreception'; - $trackid = 'shi'.$object->id; + $trackid = 'rec'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } From cfa3f2f4a13ab5d069d88306fb2a5f0ee6d05004 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Mar 2022 09:36:52 +0100 Subject: [PATCH 104/328] fix: prededefault setup values for public field (visibility) works --- htdocs/projet/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 89bdb013a32..c2f7df6c222 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -615,11 +615,11 @@ if ($action == 'create' && $user->rights->projet->creer) { } if (count($array) > 0) { - print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('public', $array, GETPOST('public'), 0, 0, 0, '', 0, 0, 0, '', '', 1); } else { - print ''; + print ''; - if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) { + if (GETPOST('public') == 0) { print $langs->trans("PrivateProject"); } else { print $langs->trans("SharedProject"); From 9514062868456d7270dedd492373d4f09dd68d98 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 16 Mar 2022 09:40:31 +0100 Subject: [PATCH 105/328] FIX: holiday monthly report: wrong 'Employee' and holiday type translations --- htdocs/holiday/month_report.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 6f8b0830b2a..fe98779c516 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page -$langs->loadLangs(array("holiday")); +$langs->loadLangs(array('holiday', 'hrm')); // Security check $socid = 0; @@ -106,7 +106,7 @@ if (empty($reshook)) $arrayfields = array( 'cp.ref'=>array('label'=>$langs->trans('Ref'), 'checked'=>1), 'cp.fk_user'=>array('label'=>$langs->trans('Employee'), 'checked'=>1), - 'ct.label'=>array('label'=>$langs->trans('Type'), 'checked'=>1), + 'cp.fk_type'=>array('label'=>$langs->trans('Type'), 'checked'=>1), 'cp.date_debut'=>array('label'=>$langs->trans('DateDebCP'), 'checked'=>1), 'cp.date_fin'=>array('label'=>$langs->trans('DateFinCP'), 'checked'=>1), 'used_days'=>array('label'=>$langs->trans('NbUseDaysCPShort'), 'checked'=>1), @@ -133,10 +133,9 @@ $search_month = GETPOST("remonth", 'int') ?GETPOST("remonth", 'int') : date("m", $search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time()); $year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month); -$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, ct.label, cp.description, cp.halfday"; +$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid"; $sql .= " WHERE cp.rowid > 0"; $sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED; $sql .= " AND ("; @@ -223,7 +222,7 @@ if (!empty($arrayfields['cp.fk_user']['checked'])) { } // Filter: Type -if (!empty($arrayfields['ct.label']['checked'])) { +if (!empty($arrayfields['cp.fk_type']['checked'])) { $typeleaves = $holidaystatic->getTypes(1, -1); $arraytypeleaves = array(); foreach ($typeleaves as $key => $val) @@ -261,7 +260,7 @@ print ''; print ''; if (!empty($arrayfields['cp.ref']['checked'])) print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.fk_user']['checked'])) print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder); -if (!empty($arrayfields['ct.label']['checked'])) print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder); +if (!empty($arrayfields['cp.fk_type']['checked'])) print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.date_debut']['checked'])) print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], 'cp.date_debut', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.date_fin']['checked'])) print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], 'cp.date_fin', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['used_days']['checked'])) print_liste_field_titre($arrayfields['used_days']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder); @@ -323,7 +322,10 @@ else { if (!empty($arrayfields['cp.ref']['checked'])) print ''; if (!empty($arrayfields['cp.fk_user']['checked'])) print ''; - if (!empty($arrayfields['ct.label']['checked'])) print ''; + + if (!empty($arrayfields['cp.fk_type']['checked'])) { + print ''; + } if (!empty($arrayfields['cp.date_debut']['checked'])) { From 8a8462bf5785e8fb1aa165851b892a40edb0f047 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 16 Mar 2022 09:47:57 +0100 Subject: [PATCH 106/328] FIX: holiday monthly report: html entity codes showing in description with WYSIWYG activated --- htdocs/holiday/month_report.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index fe98779c516..b45444524f7 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -358,7 +358,10 @@ else { } if (!empty($arrayfields['used_days_month']['checked'])) print ''; - if (!empty($arrayfields['cp.description']['checked'])) print ''; + + if (!empty($arrayfields['cp.description']['checked'])) { + print ''; + } print ''; print ''; From 6d6e6ff70c8ada313776d1364b7da0f40da3b8d7 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 16 Mar 2022 10:49:16 +0100 Subject: [PATCH 107/328] NEW clean values and amount in FEC import --- .../class/accountancyimport.class.php | 40 +++++++++++++++++-- .../modules/import/import_csv.modules.php | 2 +- .../modules/import/import_xlsx.modules.php | 2 +- htdocs/core/modules/modAccounting.class.php | 2 + 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index ea88534b6ed..5231d3a0e36 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -39,6 +39,35 @@ */ class AccountancyImport { + /** + * Clean amount + * + * @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]... + * @param string $fieldname Field name with alias + * @param array $listfields Fields list to add + * @param array $listvalues Values list to add + * @param int $record_key Record key + * @return int <0 if KO, >0 if OK + */ + public function cleanAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) { + $value_trim = trim($arrayrecord[$record_key]['val']); + $arrayrecord[$record_key]['val'] = floatval($value_trim); + } + + /** + * Clean value with trim + * + * @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]... + * @param string $fieldname Field name with alias + * @param array $listfields Fields list to add + * @param array $listvalues Values list to add + * @param int $record_key Record key + * @return int <0 if KO, >0 if OK + */ + public function cleanValue(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) { + $arrayrecord[$record_key]['val'] = trim($arrayrecord[$record_key]['val']); + } + /** * Compute amount * @@ -55,13 +84,19 @@ class AccountancyImport $fieldname = $fieldArr[1]; } - $debit = floatval(trim($arrayrecord[11]['val'])); - $credit = floatval(trim($arrayrecord[12]['val'])); + $debit_index = 11; + $credit_index = 12; + $debit_val = trim($arrayrecord[$debit_index]['val']); + $credit_val = trim($arrayrecord[$credit_index]['val']); + $debit = floatval($debit_val); + $credit = floatval($credit_val); if (!empty($debit)) { $amount = $debit; } else { $amount = $credit; } + $listvalues[$debit_index] = "'" . $debit . "'"; + $listvalues[$credit_index] = "'" . $credit . "'"; $listfields[] = $fieldname; $listvalues[] = "'" . abs($amount) . "'"; @@ -69,7 +104,6 @@ class AccountancyImport return 1; } - /** * Compute sens * diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 781c22ce7e3..0ff69e9ffa0 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -612,7 +612,7 @@ class ImportCsv extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $key - 1)); if ($res < 0) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 1c38f52cbfc..804b4b00c2c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -653,7 +653,7 @@ class ImportXlsx extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $key - 1)); if ($res < 0) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 73494a6cb04..2331d4da118 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -354,8 +354,10 @@ class modAccounting extends DolibarrModules 'b.sens'=>'rule-computeDirection' ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_convertvalue_array[$r]=array( + 'b.piece_num' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanValue', 'element' => 'Accountancy'), 'b.numero_compte'=>array('rule'=>'accountingaccount'), 'b.subledger_account'=>array('rule'=>'accountingaccount'), + 'b.multicurrency_amount' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), 'b.montant' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'), 'b.sens' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'), ); From 4ad6cc6a65c77254581ac77dcec748da8286bec9 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 16 Mar 2022 11:00:14 +0100 Subject: [PATCH 108/328] FIX stickler-ci --- htdocs/accountancy/class/accountancyimport.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index 5231d3a0e36..b2211b8cf7c 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -49,7 +49,8 @@ class AccountancyImport * @param int $record_key Record key * @return int <0 if KO, >0 if OK */ - public function cleanAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) { + public function cleanAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) + { $value_trim = trim($arrayrecord[$record_key]['val']); $arrayrecord[$record_key]['val'] = floatval($value_trim); } @@ -64,7 +65,8 @@ class AccountancyImport * @param int $record_key Record key * @return int <0 if KO, >0 if OK */ - public function cleanValue(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) { + public function cleanValue(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) + { $arrayrecord[$record_key]['val'] = trim($arrayrecord[$record_key]['val']); } From cbbfe684824906e2d04e4c51d39223c1b622bfc8 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 16 Mar 2022 11:06:14 +0100 Subject: [PATCH 109/328] FIX stickler-ci --- htdocs/accountancy/class/accountancyimport.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index b2211b8cf7c..a79484b2a83 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -33,7 +33,6 @@ */ - /** * Manage the different format accountancy import */ From 4f395a836ea3b180f38c2d6e42d2d0cd76096a63 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 16 Mar 2022 12:10:10 +0100 Subject: [PATCH 110/328] fix crabe multidir output --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index e26b03cdc46..00f91b6399b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -290,11 +290,11 @@ class pdf_crabe extends ModelePDFFactures // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->facture->dir_output; + $dir = $conf->facture->multidir_output[$conf->entity]; $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->facture->dir_output."/".$objectref; + $dir = $conf->facture->multidir_output[$object->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; } if (!file_exists($dir)) { From 41fa1f968b47f8e12f5752974771160e1f3122be Mon Sep 17 00:00:00 2001 From: oscim Date: Wed, 16 Mar 2022 12:30:30 +0100 Subject: [PATCH 111/328] Update notify.class.php add in var $parameters transmited in hook outputlangs and labeltouse for customise by hook --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 853de6d0a41..7ecd4cde09b 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -608,7 +608,7 @@ class Notify $mimefilename_list[] = $ref.".pdf"; } - $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list); + $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list, 'outputlangs'=>$outputlangs, 'labeltouse'=>$labeltouse); if (!isset($action)) { $action = ''; } From a028e795f746c077db56a7cc65114331ca627f17 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Mar 2022 13:54:21 +0100 Subject: [PATCH 112/328] add missing colspan --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ee71cc48f07..0833929c82a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1491,7 +1491,7 @@ if ($id > 0) { print ''.$langs->trans("DateActionStart").''; print ' - '; print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").''; - print ' + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + + + + + global->MAIN_VIEW_LINE_NUMBER)) { + $coldisplay++; + echo ''; + } + $coldisplay++; + ?> + + + + + + + + diff --git a/htdocs/variants/tpl/productattributevalueline_edit.tpl.php b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php new file mode 100644 index 00000000000..3b842962258 --- /dev/null +++ b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php @@ -0,0 +1,77 @@ + + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $seller, $buyer + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $canchangeproduct (0 by default, 1 to allow to change the product if it is a predefined product) + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit; +} + +// Define colspan for the button 'Add' +$colspan = 3; // Column: col edit + col delete + move button + +print "\n"; + +$coldisplay = 0; +?> + +global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + + + + + + + diff --git a/htdocs/variants/tpl/productattributevalueline_title.tpl.php b/htdocs/variants/tpl/productattributevalueline_title.tpl.php new file mode 100644 index 00000000000..ac32a229d5b --- /dev/null +++ b/htdocs/variants/tpl/productattributevalueline_title.tpl.php @@ -0,0 +1,70 @@ + + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $element (used to test $user->rights->$element->creer) + * $permtoedit (used to replace test $user->rights->$element->creer) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $outputalsopricetotalwithtax + * $usemargins (0 to disable all margins columns, 1 to show according to margin setup) + * + * $type, $text, $description, $line + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit; +} + +print "\n"; + +// Title line +print "\n"; + +print ''; + +// Adds a line numbering column +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; +} + +// Ref +print ''; + +// Value +print ''; + +print ''; // No width to allow autodim + +print ''; + +print ''; + +if ($action == 'selectlines') { + print ''; +} + +print "\n"; +print "\n"; + +print "\n"; diff --git a/htdocs/variants/tpl/productattributevalueline_view.tpl.php b/htdocs/variants/tpl/productattributevalueline_view.tpl.php new file mode 100644 index 00000000000..6acf155f89a --- /dev/null +++ b/htdocs/variants/tpl/productattributevalueline_view.tpl.php @@ -0,0 +1,105 @@ + + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $element (used to test $user->rights->$element->creer) + * $permtoedit (used to replace test $user->rights->$element->creer) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $outputalsopricetotalwithtax + * $usemargins (0 to disable all margins columns, 1 to show according to margin setup) + * $object_rights->creer initialized from = $object->getRights() + * $disableedit, $disablemove, $disableremove + * + * $text, $description, $line + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit; +} + +// add html5 elements +$domData = ' data-element="'.$line->element.'"'; +$domData .= ' data-id="'.$line->id.'"'; + +$coldisplay = 0; +?> + + > +global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + +write) && $action != 'selectlines') { + print ''; + + print ''; + + if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { + print ''; + $coldisplay++; + } +} else { + print ''; + $coldisplay = $coldisplay + 3; +} + +if ($action == 'selectlines') { ?> + +\n"; + +print "\n"; From 26a462dce0babaa1d3f8fb093281672282c99d45 Mon Sep 17 00:00:00 2001 From: kamel Date: Fri, 18 Mar 2022 15:43:32 +0100 Subject: [PATCH 178/328] NEW : Update variants to standard card and list (permission) --- htdocs/core/modules/modVariants.class.php | 14 ++++++++++++++ htdocs/langs/en_US/admin.lang | 3 +++ htdocs/variants/card.php | 8 ++++---- htdocs/variants/class/ProductAttribute.class.php | 2 +- htdocs/variants/list.php | 6 +++--- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index 049377a561f..ad71d2ca300 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -109,5 +109,19 @@ class modVariants extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module + $r = 0; + + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read objects of ProductAttribute'; // Permission label + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/Update objects of ProductAttribute'; // Permission label + $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Delete objects of ProductAttribute'; // Permission label + $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) + $r++; } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cffd3532c05..0971771e9ca 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -883,6 +883,9 @@ Permission564=Record Debits/Rejections of credit transfer Permission601=Read stickers Permission602=Create/modify stickers Permission609=Delete stickers +Permission611=Read objects of ProductAttribute +Permission612=Create/Update objects of ProductAttribute +Permission613=Delete objects of ProductAttribute Permission650=Read Bills of Materials Permission651=Create/Update Bills of Materials Permission652=Delete Bills of Materials diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 1ee1543b9e4..1a97c2252df 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -58,10 +58,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productattributecard', 'globalcard')); -$permissiontoread = $user->rights->produit->lire || $user->rights->service->lire; -$permissiontoadd = $user->rights->produit->lire || $user->rights->service->lire; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontoedit = $user->rights->produit->lire || $user->rights->service->lire; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->produit->lire || $user->rights->service->lire; +$permissiontoread = $user->rights->variants->read; +$permissiontoadd = $user->rights->variants->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoedit = $user->rights->variants->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->variants->delete; $error = 0; diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 94aa87d6031..2a97b44009e 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -1346,7 +1346,7 @@ class ProductAttribute extends CommonObject global $form; global $object_rights, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this ! - $object_rights = $user->rights->produit->lire || $user->rights->service->lire; + $object_rights = $user->rights->variants; // Line in view mode if ($action != 'editline' || $selected != $line->id) { diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index 6881b17b781..950db09bb4b 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -131,9 +131,9 @@ $arrayfields['nb_products'] = array( $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->produit->lire || $user->rights->service->lire; -$permissiontoadd = $user->rights->produit->lire || $user->rights->service->lire; -$permissiontodelete = $user->rights->produit->lire || $user->rights->service->lire; +$permissiontoread = $user->rights->variants->read; +$permissiontoadd = $user->rights->variants->write; +$permissiontodelete = $user->rights->variants->delete; // Security check if (empty($conf->variants->enabled)) { From 84ef951a99d783cb2523382f6551ef84c74a1111 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:12:38 +0100 Subject: [PATCH 179/328] replacing to dolGetButtonAction on Salaries card --- htdocs/salaries/card.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 32be3b3013d..dd5e381cb5f 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1043,34 +1043,34 @@ if ($id) { if ($action != 'edit') { // Reopen if ($object->paye && $user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } // Edit if ($object->paye == 0 && $user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, ''); } // Emit payment if ($object->paye == 0 && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php'.'?action=create&token='.newToken().'&id='.$object->id, ''); } // Classify 'paid' // If payment complete $resteapayer <= 0 on a positive salary, or if amount is negative, we allow to classify as paid. if ($object->paye == 0 && (($resteapayer <= 0 && $object->amount > 0) || ($object->amount <= 0)) && $user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('ClassifyPaid'), 'default', $_SERVER["PHP_SELF"].'?action=paid&token='.newToken().'&id='.$object->id, ''); } // Clone if ($user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id, ''); } if (!empty($user->rights->salaries->delete) && empty($totalpaye)) { - print ''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { - print ''; + print dolGetButtonAction($langs->trans('DisabledBecausePayments'),$langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } print ""; From ed631b2b060742a1e894d93cc652f487cb7cde68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Mar 2022 16:14:20 +0100 Subject: [PATCH 180/328] Fix doxygen, missing error message --- htdocs/adherents/class/api_members.class.php | 2 +- .../class/api_memberstypes.class.php | 2 +- .../class/api_subscriptions.class.php | 4 +-- htdocs/api/class/api_documents.class.php | 6 ++-- .../comm/propal/class/api_proposals.class.php | 4 +-- htdocs/commande/class/api_orders.class.php | 8 ++--- .../facture/class/api_invoices.class.php | 14 ++++---- htdocs/don/class/api_donations.class.php | 2 +- .../class/api_expensereports.class.php | 2 +- .../class/api_supplier_invoices.class.php | 8 ++--- .../fourn/class/api_supplier_orders.class.php | 2 +- htdocs/product/class/api_products.class.php | 34 +++++++++---------- .../societe/class/api_thirdparties.class.php | 2 +- htdocs/ticket/class/api_tickets.class.php | 4 +-- htdocs/user/class/api_users.class.php | 2 +- 15 files changed, 48 insertions(+), 48 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 6fad266ea36..d30e851b9a2 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -358,7 +358,7 @@ class Members extends DolibarrApi if ($member->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); } else { - throw new RestException(500, $member->error); + throw new RestException(500, 'Error when updating member: '.$member->error); } } diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index be8f22f3c45..d95de755166 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -204,7 +204,7 @@ class MembersTypes extends DolibarrApi if ($membertype->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); } else { - throw new RestException(500, $membertype->error); + throw new RestException(500, 'Error when updating member type: '.$membertype->error); } } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 55b93df7663..f969017146b 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -159,7 +159,7 @@ class Subscriptions extends DolibarrApi $subscription->$field = $value; } if ($subscription->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors)); + throw new RestException(500, 'Error when creating contribution', array_merge(array($subscription->error), $subscription->errors)); } return $subscription->id; } @@ -193,7 +193,7 @@ class Subscriptions extends DolibarrApi if ($subscription->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { - throw new RestException(500, $subscription->error); + throw new RestException(500, 'Error when updating contribution: '.$subscription->error); } } diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 28dbef6887e..da49e4cbba7 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -126,7 +126,7 @@ class Documents extends DolibarrApi * @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language). * @return array List of documents * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 501 * @throws RestException 400 * @throws RestException 401 @@ -249,7 +249,7 @@ class Documents extends DolibarrApi * @throws RestException 400 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @url GET / */ @@ -546,7 +546,7 @@ class Documents extends DolibarrApi * @throws RestException 400 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @url POST /upload */ diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 41ed388e044..2cc17987224 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -533,7 +533,7 @@ class Proposals extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -707,7 +707,7 @@ class Proposals extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 48865f958a2..fb912139d5f 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -574,7 +574,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -704,7 +704,7 @@ class Orders extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ @@ -974,7 +974,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function getOrderShipments($id) { @@ -1030,7 +1030,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function createOrderShipment($id, $warehouse_id) { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 8282610d01d..61f0a9e8d15 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -507,7 +507,7 @@ class Invoices extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -649,7 +649,7 @@ class Invoices extends DolibarrApi $result = $this->invoice->delete(DolibarrApiAccess::$user); if ($result < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting invoice'); } return array( @@ -768,7 +768,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * */ public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0) @@ -817,7 +817,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * */ public function settodraft($id, $idwarehouse = -1) @@ -920,7 +920,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function settopaid($id, $close_code = '', $close_note = '') { @@ -970,7 +970,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function settounpaid($id) { @@ -1057,7 +1057,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function markAsCreditAvailable($id) { diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 597f15b7f10..f9af0568bf0 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -293,7 +293,7 @@ class Donations extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index df942ff93e6..37319a3ec71 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -401,7 +401,7 @@ class ExpenseReports extends DolibarrApi * * @throws RestException 401 Not allowed * @throws RestException 404 Expense report not found - * @throws RestException 500 + * @throws RestException 500 System error */ public function put($id, $request_data = null) { diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 06c836b4d77..35e783729ff 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -211,7 +211,7 @@ class SupplierInvoices extends DolibarrApi * @return int ID of supplier invoice * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error */ public function post($request_data = null) { @@ -283,7 +283,7 @@ class SupplierInvoices extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function delete($id) { @@ -300,7 +300,7 @@ class SupplierInvoices extends DolibarrApi } if ($this->invoice->delete(DolibarrApiAccess::$user) < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting invoice'); } return array( @@ -326,7 +326,7 @@ class SupplierInvoices extends DolibarrApi * @throws RestException 401 * @throws RestException 404 * @throws RestException 405 - * @throws RestException 500 + * @throws RestException 500 System error */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index e21eb3436dc..d55a398dbd6 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -309,7 +309,7 @@ class SupplierOrders extends DolibarrApi } if ($this->order->delete(DolibarrApiAccess::$user) < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting order'); } return array( diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index ec735da3865..0f21b2aac3c 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -742,7 +742,7 @@ class Products extends DolibarrApi * @param int $fk_barcode_type Barcode type * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST {id}/purchase_prices @@ -1158,7 +1158,7 @@ class Products extends DolibarrApi * @param string $ref_ext External reference of Attribute * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/ref_ext/{ref_ext} @@ -1206,7 +1206,7 @@ class Products extends DolibarrApi * @param string $ref_ext Reference of Attribute * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST attributes @@ -1283,7 +1283,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute * @return int Result of deletion * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE attributes/{id} @@ -1311,7 +1311,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute value * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/values/{id} @@ -1352,7 +1352,7 @@ class Products extends DolibarrApi * @param string $ref Ref of Attribute value * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/{id}/values/ref/{ref} @@ -1439,7 +1439,7 @@ class Products extends DolibarrApi * @return array * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error * * @url GET attributes/{id}/values */ @@ -1511,7 +1511,7 @@ class Products extends DolibarrApi * @param string $value Value of Attribute value * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST attributes/{id}/values @@ -1545,7 +1545,7 @@ class Products extends DolibarrApi * @return array * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error * * @url PUT attributes/values/{id} */ @@ -1590,7 +1590,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute value * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE attributes/values/{id} @@ -1617,7 +1617,7 @@ class Products extends DolibarrApi * @param int $includestock Default value 0. If parameter is set to 1 the response will contain stock data of each variant * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET {id}/variants @@ -1653,7 +1653,7 @@ class Products extends DolibarrApi * @param string $ref Ref of Product * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET ref/{ref}/variants @@ -1695,7 +1695,7 @@ class Products extends DolibarrApi * @param string $ref_ext External reference of variant * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * @@ -1752,7 +1752,7 @@ class Products extends DolibarrApi * @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * @@ -1807,7 +1807,7 @@ class Products extends DolibarrApi * @param array $request_data Datas * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url PUT variants/{id} @@ -1841,7 +1841,7 @@ class Products extends DolibarrApi * @param int $id ID of Variant * @return int Result of deletion * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE variants/{id} @@ -1869,7 +1869,7 @@ class Products extends DolibarrApi * @param int $selected_warehouse_id ID of warehouse * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 47e893846e6..962bbf021b8 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1409,7 +1409,7 @@ class Thirdparties extends DolibarrApi if ($result > 0) { return array("success" => $result); } else { - throw new RestException(500); + throw new RestException(500, 'Error generating the document '.$this->error); } } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 75c2db21224..3151f75877b 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -377,7 +377,7 @@ class Tickets extends DolibarrApi } $this->ticket->message = $ticketMessageText; if (!$this->ticket->createTicketMessage(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, 'Error when creating ticket'); } return $this->ticket->id; } @@ -438,7 +438,7 @@ class Tickets extends DolibarrApi } if (!$this->ticket->delete($id)) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting ticket'); } return array( diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 68aa2b650f7..66d842c3564 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -466,7 +466,7 @@ class Users extends DolibarrApi * * @throws RestException 401 Not allowed * @throws RestException 404 User not found - * @throws RestException 500 Error + * @throws RestException 500 System error * * @url GET {id}/setGroup/{group} */ From c336352ecbbeb152509c3cc9664c8636494a84cf Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 18 Mar 2022 15:19:53 +0000 Subject: [PATCH 181/328] Fixing style errors. --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index dd5e381cb5f..0e15abe113d 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1070,7 +1070,7 @@ if ($id) { if (!empty($user->rights->salaries->delete) && empty($totalpaye)) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { - print dolGetButtonAction($langs->trans('DisabledBecausePayments'),$langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('DisabledBecausePayments'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } print ""; From a64bb071cfb18489d29997eb8478a80a3e53e86d Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:20:18 +0100 Subject: [PATCH 182/328] fix dolGetButtonAction params --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 397d68e1efb..1db57a96cf8 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1424,7 +1424,7 @@ if ($action == 'create' || $action == 'presend') { // Link to create an intervention // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ if (!$object->fk_soc && $user->rights->ficheinter->creer) { - print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'),$langs->trans('TicketAddIntervention'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'),$langs->trans('TicketAddIntervention'),'default', $_SERVER['PHP_SELF'].'#', '', false); } if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php'.'?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, ''); From 4c4d18ebd6c1c0f91699400c66783e71593220c3 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:28:25 +0100 Subject: [PATCH 183/328] clean --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index dd5e381cb5f..0e15abe113d 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1070,7 +1070,7 @@ if ($id) { if (!empty($user->rights->salaries->delete) && empty($totalpaye)) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { - print dolGetButtonAction($langs->trans('DisabledBecausePayments'),$langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('DisabledBecausePayments'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } print ""; From 3ef36c566fbe74bbe8c143fd07e69c87703f3737 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 18 Mar 2022 15:32:11 +0000 Subject: [PATCH 184/328] Fixing style errors. --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 2e1dc59dd15..179edddf495 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1424,7 +1424,7 @@ if ($action == 'create' || $action == 'presend') { // Link to create an intervention // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ if (!$object->fk_soc && $user->rights->ficheinter->creer) { - print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'),'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php'.'?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, ''); From 006dc787c19b5c2fbca8e6c4b2d825b0c002e7a1 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 18 Mar 2022 16:34:44 +0100 Subject: [PATCH 185/328] method_exists skip fatal error --- htdocs/core/lib/functions.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 109f0fa3f13..b37eff45df6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8778,8 +8778,10 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, dol_include_once($labeltemp[2]); $obj = new $labeltemp[1]($db); $function = $labeltemp[3]; - $nbrec = $obj->$function($object->id, $obj); - $label .= ''.$nbrec.''; + if (method_exists($obj, $function)) { + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; + } } } else { $label = $langs->trans($values[2]); From e2068f1aa8fe8e22d20efb77db56238c050ee97e Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:41:18 +0100 Subject: [PATCH 186/328] clean --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 179edddf495..824fc143f3f 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1424,7 +1424,7 @@ if ($action == 'create' || $action == 'presend') { // Link to create an intervention // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ if (!$object->fk_soc && $user->rights->ficheinter->creer) { - print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php'.'?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, ''); From f0e3c33dc306aeed046ade52519ab2a5a0fb4235 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 18 Mar 2022 16:55:53 +0100 Subject: [PATCH 187/328] $labeltemp is alwase true --- htdocs/core/lib/functions.lib.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b37eff45df6..517d09ba453 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8772,19 +8772,15 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $label = make_substitutions($reg[1], $substitutionarray); } else { $labeltemp = explode(',', $values[2]); - if (is_array($labeltemp)) { - $label = $langs->trans($labeltemp[0]); - if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { - dol_include_once($labeltemp[2]); - $obj = new $labeltemp[1]($db); - $function = $labeltemp[3]; - if (method_exists($obj, $function)) { - $nbrec = $obj->$function($object->id, $obj); - $label .= ''.$nbrec.''; - } + $label = $langs->trans($labeltemp[0]); + if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { + dol_include_once($labeltemp[2]); + $obj = new $labeltemp[1]($db); + $function = $labeltemp[3]; + if (method_exists($obj, $function)) { + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; } - } else { - $label = $langs->trans($values[2]); } } From 457c76017744caa9eec28cb72dfa31ad878fa31e Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:57:42 +0100 Subject: [PATCH 188/328] clean --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 0e15abe113d..f9a0b17adfd 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1053,7 +1053,7 @@ if ($id) { // Emit payment if ($object->paye == 0 && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $user->rights->salaries->write) { - print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php'.'?action=create&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php?action=create&token='.newToken().'&id='. $object->id, ''); } // Classify 'paid' From 941754599758e4cc6a102aa60e0327f8efd84296 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:58:59 +0100 Subject: [PATCH 189/328] clean --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 824fc143f3f..3e37c2c28e5 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1427,7 +1427,7 @@ if ($action == 'create' || $action == 'presend') { print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { - print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php'.'?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, ''); } /* This is useless. We can already modify each field individually From 12acf2342c75be46cae1b1f6132d72a8940aa45e Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 18 Mar 2022 16:01:56 -0500 Subject: [PATCH 190/328] Fix delete link en Delivery Add actions dellink --- htdocs/delivery/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 00975946f6b..af78a36a33e 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -90,6 +90,9 @@ $error = 0; $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +// Delete Link +$permissiondellink = $user->rights->expedition->delivery->supprimer; // Used by the include of actions_dellink.inc.php +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once if ($action == 'add') { $db->begin(); From ef21def5cec3bf370dda7eddb67e622ee8a44936 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Mar 2022 14:09:53 +0100 Subject: [PATCH 191/328] NEW Add option MAIN_API_DEBUG to save API logs into a file --- htdocs/api/index.php | 19 +++++++++++++++++++ .../install/mysql/migration/15.0.0-16.0.0.sql | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index d5bc7e273e2..c66573e8022 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -158,6 +158,25 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $ $api = new DolibarrApi($db, '', $refreshcache); //var_dump($api->r->apiVersionMap); +// If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log" +if (!empty($conf->global->MAIN_API_DEBUG)) { + $r = $api->r; + $r->onCall(function () use ($r) { + // Don't log Luracast Restler Explorer recources calls + //if (!preg_match('/^explorer/', $r->url)) { + // 'method' => $api->r->requestMethod, + // 'url' => $api->r->url, + // 'route' => $api->r->apiMethodInfo->className.'::'.$api->r->apiMethodInfo->methodName, + // 'version' => $api->r->getRequestedApiVersion(), + // 'data' => $api->r->getRequestData(), + //dol_syslog("Debug API input ".var_export($r, true), LOG_DEBUG, 0, '_api'); + dol_syslog("Debug API url ".var_export($r->url, true), LOG_DEBUG, 0, '_api'); + dol_syslog("Debug API input ".var_export($r->getRequestData(), true), LOG_DEBUG, 0, '_api'); + //} + }); +} + + // Enable the Restler API Explorer. // See https://github.com/Luracast/Restler-API-Explorer for more info. $api->r->addAPIClass('Luracast\\Restler\\Explorer'); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 5e9a0250a38..2933acd00d7 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -91,6 +91,10 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); +ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_soc (fk_type, fk_soc, date_partnership_start); +ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_member (fk_type, fk_member, date_partnership_start); + + -- v16 ALTER TABLE llx_projet_task_time ADD COLUMN fk_product integer NULL; From 4c293aa49b47f4ddb1169e57cce2299adf2c1410 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 13:06:30 +0100 Subject: [PATCH 192/328] Update doc --- htdocs/core/db/mysqli.class.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index fa24e4a70ac..520fba66ce1 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -266,7 +266,7 @@ class DoliDBMysqli extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @param int $result_mode Result mode + * @param int $result_mode Result mode (Using 1=MYSQLI_USE_RESULT instead of 0=MYSQLI_STORE_RESULT will not buffer the result and save memory) * @return bool|mysqli_result Resultset of answer */ public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 589f4052724..67186fcf102 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -372,7 +372,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords++; }*/ /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),]+FROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $resql = $db->query($sqlforcount); $objforcount = $db->fetch_object($resql); $nbtotalofrecords = $objforcount->nbtotalofrecords; From 65ed94f9d0650e385414c0c393ae536a8c2f1ff1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 13:14:34 +0100 Subject: [PATCH 193/328] Fix sql is executed twice --- htdocs/contrat/list.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e6446e3585b..036331eecd0 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -352,12 +352,6 @@ if ($search_dfyear > 0 && $search_op2df) { } $sql .= $db->order($sortfield, $sortorder); -$totalnboflines = 0; -$result = $db->query($sql); -if ($result) { - $totalnboflines = $db->num_rows($result); -} - $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -508,7 +502,7 @@ print ''; print ''; print ''; -print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendContractRef"; $modelmail = "contract"; From 6a7309305b49e856f25782906c19a6640051cdb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 14:41:10 +0100 Subject: [PATCH 194/328] Fix out of memory with a lot of contracts --- htdocs/contrat/list.php | 42 +++++++++++++------ .../modulebuilder/template/myobject_list.php | 10 +++-- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e6446e3585b..0c8eefdef44 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -350,25 +350,43 @@ if ($search_dfyear > 0 && $search_op2df) { $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'"; } } -$sql .= $db->order($sortfield, $sortorder); -$totalnboflines = 0; -$result = $db->query($sql); -if ($result) { - $totalnboflines = $db->num_rows($result); -} - -$nbtotalofrecords = ''; +$nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); + //$result = $db->query($sql); + //$nbtotalofrecords = $db->num_rows($result); + + if ($search_dfyear > 0 && $search_op2df) { + $resql = $db->query($sql, 0, 'auto', 1); + while ($db->fetch_object($resql)) { + if (empty($nbtotalofrecords)) { + $nbtotalofrecords = 1; // We can't make +1 because init value is '' + } else { + $nbtotalofrecords++; + } + } + } else { + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat/', '', $sqlforcount); + $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product/', '', $sqlforcount); + $sqlforcount = preg_replace('/AND cp.fk_categorie = '.((int) $search_product_category).'/', '', $sqlforcount); + $sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount); + + $resql = $db->query($sqlforcount); + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } } -$sql .= $db->plimit($limit + 1, $offset); +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); +} $resql = $db->query($sql); if (!$resql) { @@ -508,7 +526,7 @@ print ''; print ''; print ''; -print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendContractRef"; $modelmail = "contract"; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 67186fcf102..902969ee430 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -369,10 +369,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { /* The slow method does not consume memory on mysql (not tested on pgsql) */ /*$resql = $db->query($sql, 0, 'auto', 1); while ($db->fetch_object($resql)) { - $nbtotalofrecords++; - }*/ + if (empty($nbtotalofrecords)) { + $nbtotalofrecords = 1; // We can't make +1 because init value is '' + } else { + $nbtotalofrecords++; + } + }*/ /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),]+FROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $resql = $db->query($sqlforcount); $objforcount = $db->fetch_object($resql); $nbtotalofrecords = $objforcount->nbtotalofrecords; From e48d29e4f23fae90e5685bd69ab1355490b267c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 14:48:22 +0100 Subject: [PATCH 195/328] Fix bad position of order --- htdocs/contrat/list.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 036331eecd0..8b00ec2a857 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -350,19 +350,22 @@ if ($search_dfyear > 0 && $search_op2df) { $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'"; } } -$sql .= $db->order($sortfield, $sortorder); $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } } -$sql .= $db->plimit($limit + 1, $offset); +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); +} $resql = $db->query($sql); if (!$resql) { From 1bb1475b54b383d75660d17f9c71a65675366e00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 15:03:32 +0100 Subject: [PATCH 196/328] Fix phpdoc --- htdocs/core/menus/standard/eldy.lib.php | 218 ++++++++++++------------ 1 file changed, 109 insertions(+), 109 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index efe8d87ff86..6edc4cb2c3c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -156,8 +156,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'name' => 'Products', 'link' => '/product/index.php?mainmenu=products&leftmenu=', 'title' => (!empty($conf->product->enabled) && !empty($conf->service->enabled)) - ? (array("TMenuProducts", " | ", "TMenuServices")) - : (!empty($conf->product->enabled) ? "TMenuProducts" : "TMenuServices"), + ? (array("TMenuProducts", " | ", "TMenuServices")) + : (!empty($conf->product->enabled) ? "TMenuProducts" : "TMenuServices"), 'level' => 0, 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, @@ -232,7 +232,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || !empty($conf->supplier_order->enabled) || !empty($conf->contrat->enabled) || !empty($conf->ficheinter->enabled) - ) ? 1 : 0, + ) ? 1 : 0, 'perms'=>(!empty($user->rights->propal->lire) || !empty($user->rights->commande->lire) || !empty($user->rights->supplier_proposal->lire) @@ -241,17 +241,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || !empty($user->rights->supplier_order->lire) || !empty($user->rights->contrat->lire) || !empty($user->rights->ficheinter->lire) - ), + ), 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' ); $onlysupplierorder = !empty($user->rights->fournisseur->commande->lire) && - empty($user->rights->propal->lire) && - empty($user->rights->commande->lire) && - empty($user->rights->supplier_order->lire) && - empty($user->rights->supplier_proposal->lire) && - empty($user->rights->contrat->lire) && - empty($user->rights->ficheinter->lire); + empty($user->rights->propal->lire) && + empty($user->rights->commande->lire) && + empty($user->rights->supplier_order->lire) && + empty($user->rights->supplier_proposal->lire) && + empty($user->rights->contrat->lire) && + empty($user->rights->ficheinter->lire); $menu_arr[] = array( 'name' => 'Commercial', @@ -524,7 +524,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $idsel, $classname, $newTabMenu[$i]['prefix'] - ); + ); } // Sort on position @@ -544,9 +544,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); /*} elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - }*/ + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ } else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png'; $logoContainerAdditionalClass = ''; @@ -798,7 +798,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu HRM - */ + */ if ($mainmenu == 'hrm') { get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } @@ -881,13 +881,13 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // TODO Use the position property in menu_array to reorder the $menu_array //var_dump($menu_array); /*$new_menu_array = array(); - $level=0; $cusor=0; $position=0; - $nbentry = count($menu_array); - while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) - { + $level=0; $cusor=0; $position=0; + $nbentry = count($menu_array); + while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) + { - $cursor++; - }*/ + $cursor++; + }*/ // Show menu $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; @@ -1046,11 +1046,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /** * Get left Menu HOME * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of user * @return void */ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1165,11 +1165,11 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = /** * Get left Menu THIRDPARTIES * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1197,12 +1197,12 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le $langs->load("commercial"); $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects'); /* no more required, there is a filter that can do more - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); - */ + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); + */ $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->rights->societe->creer); } @@ -1270,11 +1270,11 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le /** * Get left Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1386,11 +1386,11 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left /** * Get left COMPTA-FINANCIAL * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1567,17 +1567,17 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen /** * Get left COMPTA-FINANCIAL (accountancy) * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user - * @param DB $db + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ -function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0, $db) +function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { global $user, $conf, $langs; + global $db; if ($mainmenu == 'accountancy') { $langs->load("companies"); @@ -1679,7 +1679,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($objp->nature == 3 && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { - $nature = "purchases"; + $nature = "purchases"; } if ($objp->nature == 4 && !empty($conf->banque->enabled)) { $nature = "bank"; @@ -1697,7 +1697,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $nature = "hasnew"; } - // To enable when page exists + // To enable when page exists if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { if ($nature == 'hasnew' || $nature == 'inventory') { $nature = ''; @@ -1709,7 +1709,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); } - $i++; + $i++; } } else { // Should not happend. Entries are added @@ -1815,17 +1815,17 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); /* On verra ca avec module compabilite expert - $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); - */ + $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); + */ /* - $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); - if (! empty($conf->propal->enabled)) { - $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); - } - */ + $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); + if (! empty($conf->propal->enabled)) { + $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); + } + */ $modecompta = 'CREANCES-DETTES'; $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); @@ -1846,11 +1846,11 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); /* - $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - */ + $modecompta = 'RECETTES-DEPENSES'; + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + */ // Journals $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); @@ -1886,11 +1886,11 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef /** * Get left Menu BANK * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1969,11 +1969,11 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = /** * Get left Menu PRODUCTS-SERVICES * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -2100,17 +2100,17 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme /** * Get left Menu PRODUCTS-SERVICES MRP - GPAO * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { global $user, $conf, $langs; - + if ($mainmenu == 'mrp') { // BOM if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) { @@ -2134,17 +2134,17 @@ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = /** * Get left Menu PROJECTS * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { global $user, $conf, $langs; - + if ($mainmenu == 'project') { if (!empty($conf->projet->enabled)) { $langs->load("projects"); @@ -2208,11 +2208,11 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme /** * Get left Menu HRM * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -2315,17 +2315,17 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = /** * Get left Menu TOOLS * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { global $user, $conf, $langs; - + if ($mainmenu == 'tools') { if (empty($user->socid)) { // limit to internal users $langs->load("mails"); @@ -2356,11 +2356,11 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu /** * Get left Menu MEMBERS * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) From 9878b04a9817c0d8be38f8976b785a20f0d9b62d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 18:20:24 +0100 Subject: [PATCH 197/328] Fix position of text in PDF --- .../facture/doc/pdf_sponge.modules.php | 167 +++++++++--------- 1 file changed, 88 insertions(+), 79 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 5d5b3cf762a..a5e9c0b841b 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -870,9 +870,9 @@ class pdf_sponge extends ModelePDFFactures // Retrieve type from database for backward compatibility with old records if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax - $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); - $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : ''; - $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : ''; + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); + $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : ''; + $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : ''; } // retrieve global local tax @@ -989,9 +989,9 @@ class pdf_sponge extends ModelePDFFactures @chmod($file, octdec($conf->global->MAIN_UMASK)); } - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; @@ -1177,20 +1177,24 @@ class pdf_sponge extends ModelePDFFactures $posy = $pdf->GetY() + 4; } - $posxval = 52; + $posxval = 52; // Position of values of properties shown on left side + $posxend = 110; // End of x for text on left side + if ($this->page_largeur < 210) { // To work with US executive format + $posxend -= 10; + } // Show payments conditions if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(43, 4, $titre, 0, 'L'); + $pdf->MultiCell($posxval - $this->marge_gauche, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); - $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); + $pdf->MultiCell($posxend - $posxval, 4, $lib_condition_paiement, 0, 'L'); $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions } @@ -1198,42 +1202,42 @@ class pdf_sponge extends ModelePDFFactures if ($object->type != 2) { // Check a payment mode is defined if (empty($object->mode_reglement_code) - && empty($conf->global->FACTURE_CHQ_NUMBER) - && empty($conf->global->FACTURE_RIB_NUMBER)) { - $this->error = $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"); + && empty($conf->global->FACTURE_CHQ_NUMBER) + && empty($conf->global->FACTURE_RIB_NUMBER)) { + $this->error = $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"); } elseif (($object->mode_reglement_code == 'CHQ' && empty($conf->global->FACTURE_CHQ_NUMBER) && empty($object->fk_account) && empty($object->fk_bank)) - || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER) && empty($object->fk_account) && empty($object->fk_bank))) { - // Avoid having any valid PDF with setup that is not complete - $outputlangs->load("errors"); + || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER) && empty($object->fk_account) && empty($object->fk_bank))) { + // Avoid having any valid PDF with setup that is not complete + $outputlangs->load("errors"); - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size - 2); - $this->error = $outputlangs->transnoentities("ErrorPaymentModeDefinedToWithoutSetup", $object->mode_reglement_code); - $pdf->MultiCell(80, 3, $this->error, 0, 'L', 0); - $pdf->SetTextColor(0, 0, 0); + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $this->error = $outputlangs->transnoentities("ErrorPaymentModeDefinedToWithoutSetup", $object->mode_reglement_code); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $this->error, 0, 'L', 0); + $pdf->SetTextColor(0, 0, 0); - $posy = $pdf->GetY() + 1; + $posy = $pdf->GetY() + 1; } - // Show payment mode + // Show payment mode if (!empty($object->mode_reglement_code) - && $object->mode_reglement_code != 'CHQ' - && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->SetXY($this->marge_gauche, $posy); - $titre = $outputlangs->transnoentities("PaymentMode").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + && $object->mode_reglement_code != 'CHQ' + && $object->mode_reglement_code != 'VIR') { + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->transnoentities("PaymentMode").':'; + $pdf->MultiCell($posxend - $this->marge_gauche, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posxval, $posy); - $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); - $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posxval, $posy); + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); + $pdf->MultiCell($posxend - $posxval, 5, $lib_mode_reg, 0, 'L'); - $posy = $pdf->GetY(); + $posy = $pdf->GetY(); } - // Show online payment link + // Show online payment link if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') { $useonlinepayment = 0; if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) { @@ -1258,13 +1262,13 @@ class pdf_sponge extends ModelePDFFactures $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); - $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); + $pdf->writeHTMLCell($posxend - $this->marge_gauche, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); $posy = $pdf->GetY() + 1; } } - // Show payment mode CHQ + // Show payment mode CHQ if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // If payment mode unregulated or payment mode forced to CHQ if (!empty($conf->global->FACTURE_CHQ_NUMBER)) { @@ -1276,33 +1280,33 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); $posy = $pdf->GetY() + 1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); $posy = $pdf->GetY() + 2; } } if ($conf->global->FACTURE_CHQ_NUMBER == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); $posy = $pdf->GetY() + 1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy = $pdf->GetY() + 2; } } } } - // If payment mode not forced or forced to VIR, show payment with BAN + // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || !empty($conf->global->FACTURE_RIB_NUMBER)) { $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); @@ -1350,7 +1354,11 @@ class pdf_sponge extends ModelePDFFactures $tab2_top = $posy; $tab2_hl = 4; - $pdf->SetFont('', '', $default_font_size - 1); + if (is_object($outputlangsbis)) { // When we show 2 languages we need more room for text, so we use a smaller font. + $pdf->SetFont('', '', $default_font_size - 2); + } else { + $pdf->SetFont('', '', $default_font_size - 1); + } // Total table $col1x = 120; @@ -1482,9 +1490,10 @@ class pdf_sponge extends ModelePDFFactures $tab2_top = $posy; $index = 0; + + $tab2_top += 3; } - $tab2_top += 3; // Get Total HT $total_ht = (!empty($conf->multicurrency->enabled) && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); @@ -1805,19 +1814,19 @@ class pdf_sponge extends ModelePDFFactures } /* - if ($object->close_code == Facture::CLOSECODE_DISCOUNTVAT) - { - $index++; - $pdf->SetFillColor(255, 255, 255); + if ($object->close_code == Facture::CLOSECODE_DISCOUNTVAT) + { + $index++; + $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("EscompteOfferedShort") : ''), $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("EscompteOfferedShort") : ''), $useborder, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1); - $resteapayer = 0; - } - */ + $resteapayer = 0; + } + */ $index++; $pdf->SetTextColor(0, 0, 60); @@ -1937,7 +1946,7 @@ class pdf_sponge extends ModelePDFFactures // Show Draft Watermark if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK))) { - pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); } $pdf->SetTextColor(0, 0, 60); @@ -2024,15 +2033,15 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', 'B', $default_font_size); /* - $posy += 5; - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref); - if ($object->statut == $object::STATUS_DRAFT) { - $pdf->SetTextColor(128, 0, 0); - $textref .= ' - '.$outputlangs->transnoentities("NotValidated"); - } - $pdf->MultiCell($w, 4, $textref, '', 'R');*/ + $posy += 5; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref); + if ($object->statut == $object::STATUS_DRAFT) { + $pdf->SetTextColor(128, 0, 0); + $textref .= ' - '.$outputlangs->transnoentities("NotValidated"); + } + $pdf->MultiCell($w, 4, $textref, '', 'R');*/ $posy += 3; $pdf->SetFont('', '', $default_font_size - 2); @@ -2296,21 +2305,21 @@ class pdf_sponge extends ModelePDFFactures /* * For exemple - $this->cols['theColKey'] = array( - 'rank' => $rank, // int : use for ordering columns - 'width' => 20, // the column width in mm - 'title' => array( - 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label - 'label' => ' ', // the final label : used fore final generated text - 'align' => 'L', // text alignement : R,C,L - 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - 'content' => array( - 'align' => 'L', // text alignement : R,C,L - 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - ); - */ + $this->cols['theColKey'] = array( + 'rank' => $rank, // int : use for ordering columns + 'width' => 20, // the column width in mm + 'title' => array( + 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + 'label' => ' ', // the final label : used fore final generated text + 'align' => 'L', // text alignement : R,C,L + 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'L', // text alignement : R,C,L + 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); + */ $rank = 0; // do not use negative rank $this->cols['desc'] = array( From cb93ab472dfc734e5de28bf9b8aab5639d137098 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 19:14:12 +0100 Subject: [PATCH 198/328] FIX ZATCA Encoding --- .../iso-normes/QR code for invoices.txt | 8 +- htdocs/core/class/commoninvoice.class.php | 8 +- test/phpunit/BarcodeTest.php | 203 ++++++++++++++++++ 3 files changed, 214 insertions(+), 5 deletions(-) create mode 100644 test/phpunit/BarcodeTest.php diff --git a/dev/resources/iso-normes/QR code for invoices.txt b/dev/resources/iso-normes/QR code for invoices.txt index a55c9569297..f03351f453f 100644 --- a/dev/resources/iso-normes/QR code for invoices.txt +++ b/dev/resources/iso-normes/QR code for invoices.txt @@ -8,6 +8,10 @@ https://en.wikipedia.org/wiki/EPC_QR_code#Generators -* For ZATCA QR Code format (Saudi Arabia) ------------------------------------------ +* For ZATCA QR Code format (Saudi Arabia). Used when INVOICE_ADD_ZATCA_QR_CODE is set +------------------------------------------------------------------------------------- https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html + +https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-fatoora-compliant-qr-code + +Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 29fd230a61b..eedc1b2fa10 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -827,8 +827,10 @@ abstract class CommonInvoice extends CommonObject $tmplang->load("main"); $datestring = dol_print_date($this->date, 'dayhourrfc'); - $pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2); - $pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2); + //$pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2); + //$pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2); + $pricewithtaxstring = price2num($this->total_ttc, 2, 1); + $pricetaxstring = price2num($this->total_tva, 2, 1); /* $name = implode(unpack("H*", $this->thirdparty->name)); @@ -857,7 +859,7 @@ abstract class CommonInvoice extends CommonObject // Using TLV format $s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name; $s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra; - $s .= pack('C1', 3).pack('C1', strlen($datestring)).$this->date; + $s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring; $s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; $s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring; $s .= ''; // Hash of xml invoice diff --git a/test/phpunit/BarcodeTest.php b/test/phpunit/BarcodeTest.php new file mode 100644 index 00000000000..132ba8c1126 --- /dev/null +++ b/test/phpunit/BarcodeTest.php @@ -0,0 +1,203 @@ + + * + * 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 . + * or see https://www.gnu.org/ + */ + +/** + * \file test/phpunit/BarcodeTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php'; + + +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + +$langs->load("main"); + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class BarcodeTest extends PHPUnit\Framework\TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return BarcodeTest + */ + public function __construct() + { + parent::__construct(); + + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + /** + * setUpBeforeClass + * + * @return void + */ + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + /** + * tearDownAfterClass + * + * @return void + */ + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + + /** + * testBarcodeZATCAEncode + * + * @return int + */ + public function testBarcodeZATCAEncode() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $company = new Societe($db); + $company->name = 'Specimen company'; + $company->tva_intra = '123456789'; + + $tmpinvoice = new Facture($db); + + $tmpinvoice->thirdparty = $company; + $tmpinvoice->total_ht = 100; + $tmpinvoice->total_tva = 20; + $tmpinvoice->total_ttc = $tmpinvoice->total_ht + $tmpinvoice->total_tva; + $tmpinvoice->date = dol_mktime(12, 34, 56, 1, 1, 2020, 'gmt'); + + $string_zatca = $tmpinvoice->buildZATCAQRString(); + + $this->assertEquals($string_zatca, "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"); + + return 1; + } + + + + /** + * testBarcodeZATCADecode + * + * @return int + */ + public function testBarcodeZATCADecode() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + //$string_zatca_base64 = "AQZSYWZlZXECDTEyMzQ1Njc4OVQxMjUDFDIwMjEtMDctMTJUMTQ6MjU6MDlaBAM3ODYFAjI1"; + $string_zatca_base64 = "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"; + + $decoded = base64_decode($string_zatca_base64); + + //print_r($decoded) + //raw data + //\u0001\u0006Rafeeq\u0002\t123456789\u0003\u00142021-07-12T14:25:09Z\u0004\u0003786\u0005\u000225 + + $result_data = preg_replace('/[\x00-\x1F\x80-\xFF]/', ',', $decoded); + + $arrayOfData = explode(',,', $result_data); + + + print __METHOD__." result=".var_export($arrayOfData, true)."\n"; + $this->assertEquals("", $arrayOfData[0]); + $this->assertEquals("Specimen company", $arrayOfData[1]); + $this->assertEquals("123456789", $arrayOfData[2]); + $this->assertEquals("2020-01-01T09:34:56Z", $arrayOfData[3]); + $this->assertEquals("120", $arrayOfData[4]); + $this->assertEquals("20", $arrayOfData[5]); + + return 1; + } +} From 592a27709100eef14ddec5765b4388884e292613 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 19:14:12 +0100 Subject: [PATCH 199/328] FIX ZATCA Encoding --- .../iso-normes/QR code for invoices.txt | 8 +- htdocs/core/class/commoninvoice.class.php | 8 +- test/phpunit/BarcodeTest.php | 203 ++++++++++++++++++ 3 files changed, 214 insertions(+), 5 deletions(-) create mode 100644 test/phpunit/BarcodeTest.php diff --git a/dev/resources/iso-normes/QR code for invoices.txt b/dev/resources/iso-normes/QR code for invoices.txt index a55c9569297..f03351f453f 100644 --- a/dev/resources/iso-normes/QR code for invoices.txt +++ b/dev/resources/iso-normes/QR code for invoices.txt @@ -8,6 +8,10 @@ https://en.wikipedia.org/wiki/EPC_QR_code#Generators -* For ZATCA QR Code format (Saudi Arabia) ------------------------------------------ +* For ZATCA QR Code format (Saudi Arabia). Used when INVOICE_ADD_ZATCA_QR_CODE is set +------------------------------------------------------------------------------------- https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html + +https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-fatoora-compliant-qr-code + +Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 6043814dc45..795c0550ae1 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -827,8 +827,10 @@ abstract class CommonInvoice extends CommonObject $tmplang->load("main"); $datestring = dol_print_date($this->date, 'dayhourrfc'); - $pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2); - $pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2); + //$pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2); + //$pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2); + $pricewithtaxstring = price2num($this->total_ttc, 2, 1); + $pricetaxstring = price2num($this->total_tva, 2, 1); /* $name = implode(unpack("H*", $this->thirdparty->name)); @@ -857,7 +859,7 @@ abstract class CommonInvoice extends CommonObject // Using TLV format $s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name; $s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra; - $s .= pack('C1', 3).pack('C1', strlen($datestring)).$this->date; + $s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring; $s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; $s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring; $s .= ''; // Hash of xml invoice diff --git a/test/phpunit/BarcodeTest.php b/test/phpunit/BarcodeTest.php new file mode 100644 index 00000000000..132ba8c1126 --- /dev/null +++ b/test/phpunit/BarcodeTest.php @@ -0,0 +1,203 @@ + + * + * 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 . + * or see https://www.gnu.org/ + */ + +/** + * \file test/phpunit/BarcodeTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php'; + + +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + +$langs->load("main"); + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class BarcodeTest extends PHPUnit\Framework\TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return BarcodeTest + */ + public function __construct() + { + parent::__construct(); + + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + /** + * setUpBeforeClass + * + * @return void + */ + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + /** + * tearDownAfterClass + * + * @return void + */ + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + + /** + * testBarcodeZATCAEncode + * + * @return int + */ + public function testBarcodeZATCAEncode() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $company = new Societe($db); + $company->name = 'Specimen company'; + $company->tva_intra = '123456789'; + + $tmpinvoice = new Facture($db); + + $tmpinvoice->thirdparty = $company; + $tmpinvoice->total_ht = 100; + $tmpinvoice->total_tva = 20; + $tmpinvoice->total_ttc = $tmpinvoice->total_ht + $tmpinvoice->total_tva; + $tmpinvoice->date = dol_mktime(12, 34, 56, 1, 1, 2020, 'gmt'); + + $string_zatca = $tmpinvoice->buildZATCAQRString(); + + $this->assertEquals($string_zatca, "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"); + + return 1; + } + + + + /** + * testBarcodeZATCADecode + * + * @return int + */ + public function testBarcodeZATCADecode() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + //$string_zatca_base64 = "AQZSYWZlZXECDTEyMzQ1Njc4OVQxMjUDFDIwMjEtMDctMTJUMTQ6MjU6MDlaBAM3ODYFAjI1"; + $string_zatca_base64 = "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"; + + $decoded = base64_decode($string_zatca_base64); + + //print_r($decoded) + //raw data + //\u0001\u0006Rafeeq\u0002\t123456789\u0003\u00142021-07-12T14:25:09Z\u0004\u0003786\u0005\u000225 + + $result_data = preg_replace('/[\x00-\x1F\x80-\xFF]/', ',', $decoded); + + $arrayOfData = explode(',,', $result_data); + + + print __METHOD__." result=".var_export($arrayOfData, true)."\n"; + $this->assertEquals("", $arrayOfData[0]); + $this->assertEquals("Specimen company", $arrayOfData[1]); + $this->assertEquals("123456789", $arrayOfData[2]); + $this->assertEquals("2020-01-01T09:34:56Z", $arrayOfData[3]); + $this->assertEquals("120", $arrayOfData[4]); + $this->assertEquals("20", $arrayOfData[5]); + + return 1; + } +} From d5dc29e79437bd60bb709de68b042e32125c802e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 19:26:58 +0100 Subject: [PATCH 200/328] Fix position of image on line --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- htdocs/core/modules/delivery/doc/pdf_storm.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index d30107fcbfb..3b946d1f3ce 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -609,7 +609,7 @@ class pdf_eratosthene extends ModelePDFCommandes } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 742d06e2e34..65912a8b9a0 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -461,7 +461,7 @@ class pdf_storm extends ModelePDFDeliveryOrder if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index fc1094ea949..efc061b9e67 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -562,7 +562,7 @@ class pdf_espadon extends ModelePdfExpedition if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index a5e9c0b841b..26b5a064a57 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -685,7 +685,7 @@ class pdf_sponge extends ModelePDFFactures } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 86e311b1306..4ceaf99c2cf 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -622,7 +622,7 @@ class pdf_cyan extends ModelePDFPropales if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 8d8df36e088..2be12805685 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -566,7 +566,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } From 3293a6f8b85298f68334e1861a6c5e99d7c951ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 19:40:20 +0100 Subject: [PATCH 201/328] Fix position of table on new page of PDF --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index df4bfeedb9c..8046347e881 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -477,7 +477,7 @@ class pdf_crabe extends ModelePDFFactures } $tab_top += $extra_under_address_shift; - $tab_top_newpage += $extra_under_address_shift; + $tab_top_newpage += 0; // Incoterm $height_incoterms = 0; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 26b5a064a57..c1e0468b868 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -460,7 +460,7 @@ class pdf_sponge extends ModelePDFFactures } $tab_top += $extra_under_address_shift; - $tab_top_newpage += $extra_under_address_shift; + $tab_top_newpage += 0; // Define heigth of table for lines (for first page) From 6c0e333c7d7e5a92b8b1902919bb90a8100c1723 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Mar 2022 16:33:35 +0100 Subject: [PATCH 202/328] Fix we must user relative timezone of date. --- htdocs/comm/action/card.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 1d084c915d8..ee8fff4adc8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1546,19 +1546,19 @@ if ($id > 0) { print ''; @@ -1996,11 +1996,15 @@ if ($id > 0) { // Date start print '
'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' 
'; + print ''; switch ($objectlink->type) { case Facture::TYPE_REPLACEMENT: echo $langs->trans("InvoiceReplacement"); diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index d222dfd21dc..efe2e6f6029 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?>
trans("RepeatableInvoice"); ?>trans("RepeatableInvoice"); ?> getNomUrl(1); ?> date_when, 'day'); ?>
'; print $commande_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); $urlsource = '/commande/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); print '
'; print $sendingstatic->getNomUrl(1); + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/expedition/card.php?id='.$objp->cid; + print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->date_creation), 'day').'
'; print $contrat->getNomUrl(1, 12); + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/contrat/card.php?id='.$objp->cid; + print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); print $late; print "'.dol_trunc($objp->refsup, 12)."
'; print $fichinter_static->getNomUrl(1); + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/fichinter/card.php?id='.$objp->cid; + print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->startdate)).''.convertSecondToTime($objp->duration).'
'; - - print $invoicetemplate->getNomUrl(1); print ''; - $filename = dol_sanitizeFileName($invoicetemplate->ref); - $filedir = $conf->propal->multidir_output[$invoicetemplate->propal_entity].'/'.dol_sanitizeFileName($invoicetemplate->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$invoicetemplate->rowid; - print $formfile->getDocumentsLink($invoicetemplate->element, $filename, $filedir); - print ''.dol_print_date($db->jdate($objp->date_last_gen), 'day').'
'; print $facturestatic->getNomUrl(1); + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/compta/facture/card.php?id='.$objp->cid; + print $formfile->getDocumentsLink($invoicetemplate->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->df), 'day').'
'; print $commande_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); - $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/commande/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); + // Preview + $filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/commande/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->dc), 'day')."
'; print $sendingstatic->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); + // Preview $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/expedition/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $sendingstatic->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/expedition/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->date_creation), 'day').'
'; print $contrat->getNomUrl(1, 12); - $filename = dol_sanitizeFileName($objp->ref); + // Preview $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/contrat/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/contrat/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); print $late; print "'.dol_trunc($objp->refsup, 12)."
'; print $fichinter_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); + // Preview $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/fichinter/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/fichinter/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->startdate)).''.convertSecondToTime($objp->duration).'
'; print $facturestatic->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); + // Preview $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/compta/facture/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($invoicetemplate->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/compta/facture/card.php?id='.$objp->cid; + //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->df), 'day').''; print $commande_static->getNomUrl(1); // Preview - $filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -999,7 +999,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->order->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/commande/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); print ''; print $sendingstatic->getNomUrl(1); // Preview - $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -1093,7 +1093,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $sendingstatic->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/expedition/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir); print ''; print $contrat->getNomUrl(1, 12); // Preview - $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -1195,7 +1195,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/contrat/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); print $late; @@ -1260,7 +1260,7 @@ if ($object->id > 0) { print ''; print $fichinter_static->getNomUrl(1); // Preview - $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -1285,7 +1285,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/fichinter/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir); print ''; print $facturestatic->getNomUrl(1); // Preview - $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -1479,7 +1479,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/compta/facture/card.php?id='.$objp->cid; //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print '
'.$langs->trans("PriceQtyMinCurrency").'
'.$form->textwithpicto($langs->trans("PriceQtyMinCurrency"), $langs->transnoentitiesnoconv("WithoutDiscount")).''; print ' '; @@ -673,7 +675,7 @@ if ($id > 0 || $ref) { print '
'.$langs->trans("PriceQtyMin").'
'.$form->textwithpicto($langs->trans("PriceQtyMin"), $langs->transnoentitiesnoconv("WithoutDiscount")).''; print ''; print ''; From 57c0e7109af25aee84328adc6b2373970c6ab28c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Mar 2022 14:35:06 +0100 Subject: [PATCH 085/328] Fix parntership module --- htdocs/partnership/class/partnership.class.php | 4 ++-- htdocs/partnership/class/partnership_type.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index adc9e115aa5..45f4decc740 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -106,7 +106,7 @@ class Partnership extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), - 'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php', 'label' => 'Type', 'notnull'=>1, 'enabled' => 1, 'visible' => 1, 'position' => 20), + 'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php:0:active=1', 'label' => 'Type', 'notnull'=>1, 'enabled' => 1, 'visible' => 1, 'position' => 20), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -201,7 +201,7 @@ class Partnership extends CommonObject if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150'); } else { - $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'csslist'=>'tdoverflowmax150'); + $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150'); } if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index 6916d95e4f3..536ccdf0c88 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -69,7 +69,7 @@ class PartnershipType extends CommonObject public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1), - 'code' =>array('type'=>'varchar(32)', 'label'=>'Code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20, 'showoncombobox'=>1), + 'code' =>array('type'=>'varchar(32)', 'label'=>'Code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), 'label' =>array('type'=>'varchar(64)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25, 'showoncombobox'=>1), 'active' =>array('type'=>'integer', 'label'=>'Active', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30), ); From 1a20afe29b7ce023ddc3574a11c4f35b3dc93acf Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Mar 2022 16:11:34 +0100 Subject: [PATCH 086/328] Fix #20351 : top navbar no longer hiden in extarnal site --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index c0d4f0f3829..3037fe29c4f 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location !== window.parent.location ) { + if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 &&window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From f789fc24f7807dd02571d8d0eedc57c4d66fb82c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Mar 2022 16:20:57 +0100 Subject: [PATCH 087/328] Fix filter --- htdocs/core/js/lib_head.js.php | 2 +- htdocs/ecm/class/ecmfiles.class.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 68bb8236d72..5606586a6e2 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1167,7 +1167,7 @@ $(document).ready(function() { }); -// Force to hide menus when page is inside an iFrame +// Force to hide menus when page is inside an iFrame so we can show any page into a dialog popup $(document).ready(function() { if (window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 1ffe39f26ce..3fe71278101 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -369,7 +369,7 @@ class EcmFiles extends CommonObject * @param string $ref Hash of file name (filename+filepath). Not always defined on some version. * @param string $relativepath Relative path of file from document directory. Example: 'path/path2/file' or 'path/path2/*' * @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed. - * @param string $hashforshare Hash of file sharing. + * @param string $hashforshare Hash of file sharing or 'shared' * @param string $src_object_type src_object_type to search (value of object->table_element) * @param string $src_object_id src_object_id to search * @return int <0 if KO, 0 if not found, >0 if OK @@ -425,12 +425,16 @@ class EcmFiles extends CommonObject $sql .= " AND t.label = '".$this->db->escape($hashoffile)."'"; $sql .= " AND t.entity = ".$conf->entity; // unique key include the entity so each company has its own index } elseif (!empty($hashforshare)) { - $sql .= " AND t.share = '".$this->db->escape($hashforshare)."'"; + if ($hashforshare != 'shared') { + $sql .= " AND t.share = '".$this->db->escape($hashforshare)."'"; + } else { + $sql .= " AND t.share IS NOT NULL AND t.share <> ''"; + } //$sql .= " AND t.entity = ".$conf->entity; // hashforshare already unique } elseif ($src_object_type && $src_object_id) { // Warning: May return several record, and only first one is returned ! $sql .= " AND t.src_object_type = '".$this->db->escape($src_object_type)."' AND t.src_object_id = ".((int) $src_object_id); - $sql .= " AND t.entity = ".$conf->entity; + $sql .= " AND t.entity = ".((int) $conf->entity); } else { $sql .= ' AND t.rowid = '.((int) $id); // rowid already unique } From 22706b70e9fde88e7a31e1d19a035fd4714dafaa Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Mar 2022 16:21:12 +0100 Subject: [PATCH 088/328] fix syntax error --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 3037fe29c4f..53e89182227 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 &&window.location !== window.parent.location ) { + if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From 207aba2e9895a4697632d8c7ad95a5dfb9bfb86e Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 14 Mar 2022 17:59:18 +0100 Subject: [PATCH 089/328] FIX: Stock move on shipment close and reception close also moves lot/serial type. --- htdocs/core/class/conf.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 60ee78bbff5..023546494b6 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -532,15 +532,15 @@ class Conf if (!empty($this->productbatch->enabled)) { $this->global->STOCK_CALCULATE_ON_BILL = 0; $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0; - $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1; - $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0; + if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1; + if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT)) $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 1; $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0; $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0; if (empty($this->reception->enabled)) { $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1; } else { - $this->global->STOCK_CALCULATE_ON_RECEPTION = 1; - $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 0; + if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) $this->global->STOCK_CALCULATE_ON_RECEPTION = 1; + if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION)) $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 1; } } From 5fafa8b642d7ed55868c9e7633c9810fbc852677 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 15 Mar 2022 06:29:26 +0100 Subject: [PATCH 090/328] NEW Accountancy - Add subledger account when we generate a transaction with a deposit invoice --- htdocs/accountancy/journal/sellsjournal.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 884c56ee6f2..6f2fce7c10c 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -412,8 +412,13 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; + if($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { + $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + } else { + $bookkeeping->subledger_account = ''; + $bookkeeping->subledger_label = ''; + } $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $label_account; @@ -886,6 +891,13 @@ if (empty($action) || $action == 'view') { print ""; + if($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { + if (($accountoshow == "") || $accountoshow == 'NotDefined') { + print ''.$langs->trans("ThirdpartyAccountNotDefined").''; + } else { + print length_accounta($tabcompany[$key]['code_compta']); + } + } print '"; - if($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { + if ($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ThirdpartyAccountNotDefined").''; } else { From 0766355cbae1b32ab9ab5f740662391785691d4e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 15 Mar 2022 11:04:56 +0100 Subject: [PATCH 093/328] Update llx_adherent.sql add state -2 --- htdocs/install/mysql/tables/llx_adherent.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index eabb2d3c478..01a87167411 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -19,10 +19,12 @@ -- -- =================================================================== -- --- statut +-- state / statut +-- -2 : excluded / exclu -- -1 : draft / brouillon -- 0 : canceled / resilie -- 1 : valid / valide +-- create table llx_adherent ( From 0be989dceb6ed3a60859a952306d2a811b9d2105 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 15 Mar 2022 11:18:11 +0100 Subject: [PATCH 094/328] add more specific context and doAction hook --- htdocs/admin/dict.php | 733 ++++++++++++++++++++++-------------------- 1 file changed, 380 insertions(+), 353 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 5245e60ad67..20b1461ad4f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -94,7 +94,7 @@ if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 $search_code = GETPOST('search_code', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('admin')); +$hookmanager->initHooks(array('admin', 'dictionaryadmin')); // This page is a generic page to edit dictionaries // Put here declaration of dictionaries properties @@ -683,407 +683,434 @@ if ($id == 10) { * Actions */ -if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { - $search_country_id = ''; - $search_code = ''; +$parameters = array( + 'id' =>$id, + 'rowid' =>$rowid, + 'code' =>$code, + 'confirm' =>$confirm, + 'entity' =>$entity, + 'taborder' =>$taborder, + 'tabname' =>$tabname, + 'tablib' =>$tablib, + 'tabsql' =>$tabsql, + 'tabsqlsort' =>$tabsqlsort, + 'tabfield' =>$tabfield, + 'tabfieldvalue' =>$tabfieldvalue, + 'tabfieldinsert'=>$tabfieldinsert, + 'tabrowid' =>$tabrowid, + 'tabcond' =>$tabcond, + 'tabhelp' =>$tabhelp, + 'tabcomplete' =>$tabcomplete +); +$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'); } -// Actions add or modify an entry into a dictionary -if (GETPOST('actionadd') || GETPOST('actionmodify')) { - $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); - $listfieldinsert = explode(',', $tabfieldinsert[$id]); - $listfieldmodify = explode(',', $tabfieldinsert[$id]); - $listfieldvalue = explode(',', $tabfieldvalue[$id]); - - // Check that all mandatory fields are filled - $ok = 1; - foreach ($listfield as $f => $value) { - // Discard check of mandatory fields for country for some tables - if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { - continue; // For some pages, country is not mandatory - } - if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { - continue; // For some pages, country is not mandatory - } - // Discard check of mandatory fiedls for other fields - if ($value == 'localtax1' && empty($_POST['localtax1_type'])) { - continue; - } - if ($value == 'localtax2' && empty($_POST['localtax2_type'])) { - continue; - } - if ($value == 'color' && empty($_POST['color'])) { - continue; - } - if ($value == 'formula' && empty($_POST['formula'])) { - continue; - } - if ($value == 'dayrule' && empty($_POST['dayrule'])) { - continue; - } - if ($value == 'sortorder') { - continue; // For a column name 'sortorder', we use the field name 'position' - } - if ((!GETPOSTISSET($value) || GETPOST($value) == '') - && (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory - && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10 - ) - ) { - $ok = 0; - $fieldnamekey = $value; - // We take translate key of field - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { - $fieldnamekey = 'Label'; - } - if ($fieldnamekey == 'libelle_facture') { - $fieldnamekey = 'LabelOnDocuments'; - } - if ($fieldnamekey == 'nbjour') { - $fieldnamekey = 'NbOfDays'; - } - if ($fieldnamekey == 'decalage') { - $fieldnamekey = 'Offset'; - } - if ($fieldnamekey == 'module') { - $fieldnamekey = 'Module'; - } - if ($fieldnamekey == 'code') { - $fieldnamekey = 'Code'; - } - if ($fieldnamekey == 'note') { - $fieldnamekey = 'Note'; - } - if ($fieldnamekey == 'taux') { - $fieldnamekey = 'Rate'; - } - if ($fieldnamekey == 'type') { - $fieldnamekey = 'Type'; - } - if ($fieldnamekey == 'position') { - $fieldnamekey = 'Position'; - } - if ($fieldnamekey == 'unicode') { - $fieldnamekey = 'Unicode'; - } - if ($fieldnamekey == 'deductible') { - $fieldnamekey = 'Deductible'; - } - if ($fieldnamekey == 'sortorder') { - $fieldnamekey = 'SortOrder'; - } - if ($fieldnamekey == 'category_type') { - $fieldnamekey = 'Calculated'; - } - if ($fieldnamekey == 'revenuestamp_type') { - $fieldnamekey = 'TypeOfRevenueStamp'; - } - if ($fieldnamekey == 'use_default') { - $fieldnamekey = 'UseByDefault'; - } - - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); - } - } - // Other checks - if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { - $ok = 0; - setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); - } - if (GETPOSTISSET("code")) { - if (GETPOST("code") == '0') { - $ok = 0; - setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); - } - /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base - { - $ok = 0; - $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; - }*/ - } - if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { - if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) { // Field country is no mandatory for such dictionaries - $_POST["country"] = ''; - } else { - $ok = 0; - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); - } - } - if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) { - $ok = 0; - setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); +if (empty($reshook)) +{ + if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { + $search_country_id = ''; + $search_code = ''; } - // Clean some parameters - if ((GETPOST("localtax1_type") || (GETPOST('localtax1_type') == '0')) && !GETPOST("localtax1")) { - $_POST["localtax1"] = '0'; // If empty, we force to 0 - } - if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { - $_POST["localtax2"] = '0'; // If empty, we force to 0 - } - if (GETPOST("accountancy_code") <= 0) { - $_POST["accountancy_code"] = ''; // If empty, we force to null - } - if (GETPOST("accountancy_code_sell") <= 0) { - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null - } - if (GETPOST("accountancy_code_buy") <= 0) { - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - } - if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary - $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', $_POST["code"]); - } + // Actions add or modify an entry into a dictionary + if (GETPOST('actionadd') || GETPOST('actionmodify')) { + $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); + $listfieldinsert = explode(',', $tabfieldinsert[$id]); + $listfieldmodify = explode(',', $tabfieldinsert[$id]); + $listfieldvalue = explode(',', $tabfieldvalue[$id]); - // If check ok and action add, add the line - if ($ok && GETPOST('actionadd')) { - if ($tabrowid[$id]) { - // Get free id for insert - $newid = 0; - $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; - $result = $db->query($sql); - if ($result) { - $obj = $db->fetch_object($result); - $newid = ($obj->newid + 1); + // Check that all mandatory fields are filled + $ok = 1; + foreach ($listfield as $f => $value) { + // Discard check of mandatory fields for country for some tables + if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { + continue; // For some pages, country is not mandatory + } + if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { + continue; // For some pages, country is not mandatory + } + // Discard check of mandatory fiedls for other fields + if ($value == 'localtax1' && empty($_POST['localtax1_type'])) { + continue; + } + if ($value == 'localtax2' && empty($_POST['localtax2_type'])) { + continue; + } + if ($value == 'color' && empty($_POST['color'])) { + continue; + } + if ($value == 'formula' && empty($_POST['formula'])) { + continue; + } + if ($value == 'dayrule' && empty($_POST['dayrule'])) { + continue; + } + if ($value == 'sortorder') { + continue; // For a column name 'sortorder', we use the field name 'position' + } + if ((!GETPOSTISSET($value) || GETPOST($value) == '') + && (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory + && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10 + ) + ) { + $ok = 0; + $fieldnamekey = $value; + // We take translate key of field + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { + $fieldnamekey = 'Label'; + } + if ($fieldnamekey == 'libelle_facture') { + $fieldnamekey = 'LabelOnDocuments'; + } + if ($fieldnamekey == 'nbjour') { + $fieldnamekey = 'NbOfDays'; + } + if ($fieldnamekey == 'decalage') { + $fieldnamekey = 'Offset'; + } + if ($fieldnamekey == 'module') { + $fieldnamekey = 'Module'; + } + if ($fieldnamekey == 'code') { + $fieldnamekey = 'Code'; + } + if ($fieldnamekey == 'note') { + $fieldnamekey = 'Note'; + } + if ($fieldnamekey == 'taux') { + $fieldnamekey = 'Rate'; + } + if ($fieldnamekey == 'type') { + $fieldnamekey = 'Type'; + } + if ($fieldnamekey == 'position') { + $fieldnamekey = 'Position'; + } + if ($fieldnamekey == 'unicode') { + $fieldnamekey = 'Unicode'; + } + if ($fieldnamekey == 'deductible') { + $fieldnamekey = 'Deductible'; + } + if ($fieldnamekey == 'sortorder') { + $fieldnamekey = 'SortOrder'; + } + if ($fieldnamekey == 'category_type') { + $fieldnamekey = 'Calculated'; + } + if ($fieldnamekey == 'revenuestamp_type') { + $fieldnamekey = 'TypeOfRevenueStamp'; + } + if ($fieldnamekey == 'use_default') { + $fieldnamekey = 'UseByDefault'; + } + + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); + } + } + // Other checks + if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { + $ok = 0; + setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); + } + if (GETPOSTISSET("code")) { + if (GETPOST("code") == '0') { + $ok = 0; + setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); + } + /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base + { + $ok = 0; + $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; + }*/ + } + if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { + if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) { // Field country is no mandatory for such dictionaries + $_POST["country"] = ''; } else { - dol_print_error($db); + $ok = 0; + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); } } - - // Add new entry - $sql = "INSERT INTO ".$tabname[$id]." ("; - // List of fields - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { - $sql .= $tabrowid[$id].","; + if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) { + $ok = 0; + setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); } - $sql .= $tabfieldinsert[$id]; - $sql .= ",active)"; - $sql .= " VALUES("; - // List of values - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { - $sql .= $newid.","; + // Clean some parameters + if ((GETPOST("localtax1_type") || (GETPOST('localtax1_type') == '0')) && !GETPOST("localtax1")) { + $_POST["localtax1"] = '0'; // If empty, we force to 0 } - $i = 0; - foreach ($listfieldinsert as $f => $value) { - $keycode = $listfieldvalue[$i]; - if (empty($keycode)) { - $keycode = $value; + if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { + $_POST["localtax2"] = '0'; // If empty, we force to 0 + } + if (GETPOST("accountancy_code") <= 0) { + $_POST["accountancy_code"] = ''; // If empty, we force to null + } + if (GETPOST("accountancy_code_sell") <= 0) { + $_POST["accountancy_code_sell"] = ''; // If empty, we force to null + } + if (GETPOST("accountancy_code_buy") <= 0) { + $_POST["accountancy_code_buy"] = ''; // If empty, we force to null + } + if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary + $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', $_POST["code"]); + } + + // If check ok and action add, add the line + if ($ok && GETPOST('actionadd')) { + if ($tabrowid[$id]) { + // Get free id for insert + $newid = 0; + $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; + $result = $db->query($sql); + if ($result) { + $obj = $db->fetch_object($result); + $newid = ($obj->newid + 1); + } else { + dol_print_error($db); + } } - if ($value == 'price' || preg_match('/^amount/i', $value)) { - $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); - } elseif ($value == 'taux' || $value == 'localtax1') { - $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z - } elseif ($value == 'entity') { - $_POST[$keycode] = getEntity($tabname[$id]); + // Add new entry + $sql = "INSERT INTO ".$tabname[$id]." ("; + // List of fields + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { + $sql .= $tabrowid[$id].","; } + $sql .= $tabfieldinsert[$id]; + $sql .= ",active)"; + $sql .= " VALUES("; - if ($i) { - $sql .= ","; + // List of values + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { + $sql .= $newid.","; } + $i = 0; + foreach ($listfieldinsert as $f => $value) { + $keycode = $listfieldvalue[$i]; + if (empty($keycode)) { + $keycode = $value; + } - if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' - $sql .= (int) GETPOST('position', 'int'); - } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } elseif ($keycode == 'content') { - $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { - $sql .= (int) GETPOST($keycode, 'int'); + if ($value == 'price' || preg_match('/^amount/i', $value)) { + $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); + } elseif ($value == 'taux' || $value == 'localtax1') { + $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z + } elseif ($value == 'entity') { + $_POST[$keycode] = getEntity($tabname[$id]); + } + + if ($i) { + $sql .= ","; + } + + if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + $sql .= (int) GETPOST('position', 'int'); + } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { + $sql .= "null"; // For vat, we want/accept code = '' + } elseif ($keycode == 'content') { + $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; + } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { + $sql .= (int) GETPOST($keycode, 'int'); + } else { + $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + } + + $i++; + } + $sql .= ",1)"; + + dol_syslog("actionadd", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) { // Add is ok + setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); + + // Clean $_POST array, we keep only id of dictionary + if ($id == 10 && GETPOST('country', 'int') > 0) { + $search_country_id = GETPOST('country', 'int'); + } + $_POST = array('id'=>$id); } else { - $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + } else { + dol_print_error($db); + } } - - $i++; } - $sql .= ",1)"; - dol_syslog("actionadd", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { // Add is ok - setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); - - // Clean $_POST array, we keep only id of dictionary - if ($id == 10 && GETPOST('country', 'int') > 0) { - $search_country_id = GETPOST('country', 'int'); - } - $_POST = array('id'=>$id); - } else { - if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + // If verif ok and action modify, modify the line + if ($ok && GETPOST('actionmodify')) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; } else { - dol_print_error($db); + $rowidcol = "rowid"; + } + + // Modify entry + $sql = "UPDATE ".$tabname[$id]." SET "; + // Modifie valeur des champs + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { + $sql .= $tabrowid[$id]."="; + $sql .= "'".$db->escape($rowid)."', "; + } + $i = 0; + foreach ($listfieldmodify as $field) { + $keycode = $listfieldvalue[$i]; + if (empty($keycode)) { + $keycode = $field; + } + + if ($field == 'price' || preg_match('/^amount/i', $field)) { + $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); + } elseif ($field == 'taux' || $field == 'localtax1') { + $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z + } elseif ($field == 'entity') { + $_POST[$keycode] = getEntity($tabname[$id]); + } + + if ($i) { + $sql .= ","; + } + $sql .= $field."="; + if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + $sql .= (int) GETPOST('position', 'int'); + } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { + $sql .= "null"; // For vat, we want/accept code = '' + } elseif ($keycode == 'content') { + $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; + } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { + $sql .= (int) GETPOST($keycode, 'int'); + } else { + $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + } + + $i++; + } + if (in_array($rowidcol, array('code', 'code_iso'))) { + $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; + } else { + $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); + } + if (in_array('entity', $listfieldmodify)) { + $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0)); + } + + dol_syslog("actionmodify", LOG_DEBUG); + //print $sql; + $resql = $db->query($sql); + if (!$resql) { + setEventMessages($db->error(), null, 'errors'); } } + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } - // If verif ok and action modify, modify the line - if ($ok && GETPOST('actionmodify')) { + if (GETPOST('actioncancel')) { + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition + } + + if ($action == 'confirm_delete' && $confirm == 'yes') { // delete if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } - // Modify entry - $sql = "UPDATE ".$tabname[$id]." SET "; - // Modifie valeur des champs - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { - $sql .= $tabrowid[$id]."="; - $sql .= "'".$db->escape($rowid)."', "; - } - $i = 0; - foreach ($listfieldmodify as $field) { - $keycode = $listfieldvalue[$i]; - if (empty($keycode)) { - $keycode = $field; - } + $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - if ($field == 'price' || preg_match('/^amount/i', $field)) { - $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); - } elseif ($field == 'taux' || $field == 'localtax1') { - $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z - } elseif ($field == 'entity') { - $_POST[$keycode] = getEntity($tabname[$id]); - } - - if ($i) { - $sql .= ","; - } - $sql .= $field."="; - if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' - $sql .= (int) GETPOST('position', 'int'); - } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } elseif ($keycode == 'content') { - $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { - $sql .= (int) GETPOST($keycode, 'int'); + dol_syslog("delete", LOG_DEBUG); + $result = $db->query($sql); + if (!$result) { + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } else { - $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + dol_print_error($db); } - - $i++; - } - if (in_array($rowidcol, array('code', 'code_iso'))) { - $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; - } else { - $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); - } - if (in_array('entity', $listfieldmodify)) { - $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0)); - } - - dol_syslog("actionmodify", LOG_DEBUG); - //print $sql; - $resql = $db->query($sql); - if (!$resql) { - setEventMessages($db->error(), null, 'errors'); } } - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} -if (GETPOST('actioncancel')) { - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} - -if ($action == 'confirm_delete' && $confirm == 'yes') { // delete - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - - dol_syslog("delete", LOG_DEBUG); - $result = $db->query($sql); - if (!$result) { - if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); + // activate + if ($action == $acts[0]) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { dol_print_error($db); } } -} -// activate -if ($action == $acts[0]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; + // disable + if ($action == $acts[1]) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + // favorite + if ($action == 'activate_favorite') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} + // disable favorite + if ($action == 'disable_favorite') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } -// disable -if ($action == $acts[1]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// favorite -if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// disable favorite -if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } From 43ab784be254ca3396213b22ad324ad3b0c42f35 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 15 Mar 2022 10:26:47 +0000 Subject: [PATCH 095/328] Fixing style errors. --- htdocs/admin/dict.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 20b1461ad4f..8b96bee60ab 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -707,8 +707,7 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -if (empty($reshook)) -{ +if (empty($reshook)) { if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { $search_country_id = ''; $search_code = ''; From 69654b2b4398bfec1bb3f1c88cb9b73617ebb618 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Mar 2022 12:14:46 +0100 Subject: [PATCH 096/328] Fix sort not working on security page to test file upload --- htdocs/admin/security_file.php | 12 +++++++++--- htdocs/core/class/html.formfile.class.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 82df4bed430..67c6914f1cf 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -36,6 +36,14 @@ if (!$user->admin) { } $action = GETPOST('action', 'aZ09'); +$sortfield = GETPOST('sortfield', 'aZ09'); +$sortorder = GETPOST('sortorder', 'aZ09'); +if (empty($sortfield)) { + $sortfield = 'date'; +} +if (empty($sortorder)) { + $sortorder = 'desc'; +} $upload_dir = $conf->admin->dir_temp; @@ -73,8 +81,6 @@ if ($action == 'updateform') { } else { setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors'); } - Header('Location: '.$_SERVER["PHP_SELF"]); - exit; } @@ -190,7 +196,7 @@ $formfile = new FormFile($db); $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0); // List of document -$filearray = dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); +$filearray = dol_dir_list($upload_dir, "files", 0, '', '', $sortfield, $sortorder == 'desc' ? SORT_DESC : SORT_ASC, 1); $formfile->list_of_documents($filearray, null, 'admin_temp', ''); // End of page diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cad584e8731..c01ff5af541 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1504,7 +1504,7 @@ class FormFile if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) { $useajax = 0; } - print ''.img_delete().''; + print ''.img_delete().''; } print "
'.$holidaystatic->getNomUrl(1, 1).''.$user->getFullName($langs).''.$obj->label.''.$arraytypeleaves[$obj->fk_type].''.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).''.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).''.dolGetFirstLineOfText($obj->description).'
'; + print ''; //print '
'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); From d2005a3bb96723d9f5ccda5df2442d27411923d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Mar 2022 15:40:17 +0100 Subject: [PATCH 113/328] Fix regression on extrafields not visible --- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index f14052766ee..ac243396c72 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -122,7 +122,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l print ' trextrafields_collapse_last'; } print '"'; - if (empty($extrafields->expand_display[$collapse_group])) { + if (isset($extrafields->expand_display) && empty($extrafields->expand_display[$collapse_group])) { print ' style="display: none;"'; } print '>'; From 536bae97e8dda9b720720bee954902cf24367b9c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Mar 2022 15:49:49 +0100 Subject: [PATCH 114/328] FIX Update icon of module reception --- htdocs/admin/mails_templates.php | 2 +- htdocs/core/boxes/box_supplier_orders_awaiting_reception.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 0adc526d69e..3abeb0bde54 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -205,7 +205,7 @@ if (!empty($conf->expedition->enabled)) { $elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment')); } if (!empty($conf->reception->enabled)) { - $elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception')); + $elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception')); } if (!empty($conf->ficheinter->enabled)) { $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention')); diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 78d38455d83..6345e13cce0 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -162,7 +162,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => $delayIcon.' '.dol_print_date($delivery_date, 'day', 'tzuserrel').'', + 'text' => $delayIcon.' '.dol_print_date($delivery_date, 'day', 'tzuserrel').'', 'asis' => 1 ); From 43c39d833ac8fd11e6229d8edc7ece333dbac589 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 16 Mar 2022 15:56:39 +0100 Subject: [PATCH 115/328] Fix bug preview on closed status page --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/website.inc.php | 7 ++++++- htdocs/website/index.php | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index af5671437ae..54090cf2fc6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10563,7 +10563,7 @@ function isAFileWithExecutableContent($filename) */ function newToken() { - return $_SESSION['newtoken']; + return !empty($_SESSION['newtoken']) ? $_SESSION['newtoken'] : ""; } /** diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 97199614ece..8205696751b 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -27,6 +27,11 @@ include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; +$website = null; +$websitepage = null; +$weblangs = null; +$pagelangs = null; + // Detection browser (copy of code from main.inc.php) if (isset($_SERVER["HTTP_USER_AGENT"]) && is_object($conf) && empty($conf->browser->name)) { $tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]); @@ -68,7 +73,7 @@ if ($pageid > 0) { $weblangs->setDefaultLang(GETPOSTISSET('lang') ? GETPOST('lang', 'aZ09') : (empty($_COOKIE['weblangs-shortcode']) ? 'auto' : preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['weblangs-shortcode']))); $pagelangs->setDefaultLang($websitepage->lang ? $websitepage->lang : $weblangs->shortlang); - if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'other')) || empty($websitepage->status))) { + if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'other')) || empty($websitepage->status) && !defined('USEDOLIBARRSERVER'))) { $weblangs->load("website"); http_response_code(404); print '


'.$weblangs->trans("YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).'
'; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ee279343a6f..d916d0a0e5f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2520,6 +2520,7 @@ $form = new Form($db); $formadmin = new FormAdmin($db); $formwebsite = new FormWebsite($db); $formother = new FormOther($db); +$formconfirm = ""; // Confirm generation of website sitemaps if ($action == 'confirmgeneratesitemaps') { @@ -3040,7 +3041,7 @@ if (!GETPOST('hide_websitemenu')) { print ''."\n"; print ' - - - - - - - - - $attribute) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; -} -print '
trans('Ref') ?>trans('Label') ?>trans('NbOfDifferentValues') ?>trans('NbProducts') ?>
'.dol_htmlentities($attribute->ref).''.dol_htmlentities($attribute->label).''.$attribute->countChildValues().''.$attribute->countChildProducts().''; - print ''.img_edit().''; - print ''.img_delete().''; - print ''; - if ($key > 0) { - print ''.img_up('default', 0, 'imgupforline').''; - } - if ($key < count($variants) - 1) { - print ''.img_down('default', 0, 'imgdownforline').''; - } - print '
'; +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; + } + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); + + $filedir = $diroutputmassaction; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; + + print $formfile->showdocuments('massfilesarea_productattribute', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); +} // End of page llxFooter(); diff --git a/htdocs/variants/tpl/README b/htdocs/variants/tpl/README new file mode 100644 index 00000000000..432895e939f --- /dev/null +++ b/htdocs/variants/tpl/README @@ -0,0 +1,3 @@ +README (english) + +This directory is used for storing the common default templates of the system core. (outside any modules) \ No newline at end of file diff --git a/htdocs/variants/tpl/productattributevalueline_create.tpl.php b/htdocs/variants/tpl/productattributevalueline_create.tpl.php new file mode 100644 index 00000000000..cc16302a68d --- /dev/null +++ b/htdocs/variants/tpl/productattributevalueline_create.tpl.php @@ -0,0 +1,91 @@ + + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error: this template page cannot be called directly as an URL"; + exit; +} + +global $forcetoshowtitlelines; + +// Define colspan for the button 'Add' +$colspan = 3; // Columns: col edit + col delete + move button + +// Lines for extrafield +$objectline = null; + +print "\n"; +$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines); +if ($nolinesbefore) { + ?> +
+
trans('AddNewLine'); ?> +
trans('Value'); ?> 
+ trans('Ref') . ': '; } ?> + " autofocus> + executeHooks('formCreateValueOptions', $parameters, $object, $action); + if (!empty($hookmanager->resPrint)) { + print $hookmanager->resPrint; + } + } + ?> + + "> + + +
+
+ + + + ref); ?>"> + $line); + $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $object, $action); + if (!empty($hookmanager->resPrint)) { + print $hookmanager->resPrint; + } + } + ?> +
+ value); ?>"> + + ">
+ "> +
 '.$langs->trans('Ref').''.$langs->trans('Value').''; + print ''; + print ''; + print '
+ ref ?> +
value ?>'; + $coldisplay++; + if (empty($disableedit)) { ?> + id.'#line_'.$line->id; ?>"> + '; + } + print ''; + $coldisplay++; + if (empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company. + print 'id.'">'; + print img_delete(); + print ''; + } + print ''; + $coldisplay++; + if ($i > 0) { ?> + id; ?>"> + + + + id; ?>"> + + + '; + } else { + print 'browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>'; $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); if (GETPOST("afaire") == 1) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } else { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } else { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } print '
'.$langs->trans("DateActionStart").''; + // Test a date before the 27 march and one after + //print dol_print_date($object->datep, 'dayhour', 'gmt'); + //print dol_print_date($object->datep, 'dayhour', 'tzuser'); + //print dol_print_date($object->datep, 'dayhour', 'tzuserrel'); if (empty($object->fulldayevent)) { - print dol_print_date($object->datep, 'dayhour', 'tzuser'); + print dol_print_date($object->datep, 'dayhour', 'tzuserrel'); } else { $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); - print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); + print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel')); } if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -2011,10 +2015,10 @@ if ($id > 0) { // Date end print '
'.$langs->trans("DateActionEnd").''; if (empty($object->fulldayevent)) { - print dol_print_date($object->datef, 'dayhour', 'tzuser'); + print dol_print_date($object->datef, 'dayhour', 'tzuserrel'); } else { $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); - print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); + print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel')); } if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); From cd37d4b403080089399601540d9aa3d67c2432c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 00:14:42 +0100 Subject: [PATCH 203/328] Code comment --- htdocs/core/class/doleditor.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 4a2e65ba1f3..23c04a98a81 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -193,10 +193,10 @@ class DolEditor removePlugins : \''.$pluginstodisable.'\', readOnly : '.($this->readonly ? 'true' : 'false').', htmlEncodeOutput :'.$htmlencode_force.', - allowedContent :'.($disallowAnyContent ? 'false' : 'true').', - extraAllowedContent : \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */ - disallowedContent : '.($disallowAnyContent ? '\'\'' : '\'\'').', - fullPage : '.($fullpage ? 'true' : 'false').', + allowedContent :'.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is own when allowedContent is false */ + extraAllowedContent : \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */ + disallowedContent : '.($disallowAnyContent ? '\'\'' : '\'\'').', /* Tags that are not allowed */ + fullPage : '.($fullpage ? 'true' : 'false').', /* if true, the html, header and body tags are kept */ toolbar: \''.$this->toolbarname.'\', toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').', width: '.($this->width ? '\''.$this->width.'\'' : '\'\'').', From 1313be410af4309dc4cfd27b69637a185dcdf23c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 21 Mar 2022 10:49:37 +0100 Subject: [PATCH 204/328] Update fournisseurs.php $helpurl for DE --- htdocs/product/fournisseurs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 15b861ce812..8a8f3793b8f 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -383,11 +383,11 @@ $helpurl = ''; $shortlabel = dol_trunc($object->label, 16); if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) { $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('BuyingPrices'); - $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos|DE:Modul_Produkte'; } if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) { $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('BuyingPrices'); - $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios|DE:Modul_Lesitungen'; } llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs'); From bf7c707d0535de8539b556e0e73f1ae1a090565a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 11:11:36 +0100 Subject: [PATCH 205/328] Doc --- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 60e3d6bcfdd..50f4c1a60eb 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -383,10 +383,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures } // Define substitution array - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); // Set tags __...__ $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs); - $array_objet = $this->get_substitutionarray_object($object, $outputlangs); - $array_user = $this->get_substitutionarray_user($user, $outputlangs); + $array_objet = $this->get_substitutionarray_object($object, $outputlangs); // Set tags object_... + $array_user = $this->get_substitutionarray_user($user, $outputlangs); // Set tags myuser_... $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); $array_propal = is_object($propal_object) ? $this->get_substitutionarray_object($propal_object, $outputlangs, 'propal') : array(); From 362352b1986f41b683ed161eef45aa968f7e14f6 Mon Sep 17 00:00:00 2001 From: GregM Date: Mon, 21 Mar 2022 12:18:36 +0100 Subject: [PATCH 206/328] replacing to dolGetButtonAction on Expedition card --- htdocs/expedition/card.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 163761c1f6f..5079f11ac2f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2460,9 +2460,9 @@ if ($action == 'create') { if ($object->statut == Expedition::STATUS_DRAFT && $num_prod > 0) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate))) { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); } else { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } @@ -2470,9 +2470,9 @@ if ($action == 'create') { // 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order) if ($object->statut == Expedition::STATUS_CLOSED && $user->rights->expedition->creer) { if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ? - print ''.$langs->trans("ClassifyUnbilled").''; + print dolGetButtonAction('', $langs->trans('ClassifyUnbilled'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } else { - print ''.$langs->trans("ReOpen").''; + print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } } @@ -2480,9 +2480,9 @@ if ($action == 'create') { if (empty($user->socid)) { if ($object->statut > 0) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) { - print ''.$langs->trans('SendMail').''; + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } else { - print ''.$langs->trans('SendMail').''; + print dolGetButtonAction('',$langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } } @@ -2492,14 +2492,14 @@ if ($action == 'create') { if ($user->rights->facture->creer) { // TODO show button only if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // If we do that, we must also make this option official. - print ''.$langs->trans("CreateBill").''; + print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); } } // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->delivery->creer && empty($object->linkedObjectsIds['delivery'])) { - print ''.$langs->trans("CreateDeliveryOrder").''; + print dolGetButtonAction('', $langs->trans('CreateDeliveryOrder'), 'default', $_SERVER["PHP_SELF"].'?action=create_delivery&token='.newToken().'&id='.$object->id, ''); } // Close if ($object->statut == Expedition::STATUS_VALIDATED) { @@ -2510,20 +2510,20 @@ if ($action == 'create') { $label = "ClassifyBilled"; $paramaction = 'classifybilled'; } - print ''.$langs->trans($label).''; + print dolGetButtonAction('', $langs->trans($label), 'default', $_SERVER["PHP_SELF"].'?action='. $paramaction .'&token='.newToken().'&id='.$object->id, ''); } } // Cancel if ($object->statut == Expedition::STATUS_VALIDATED) { if ($user->rights->expedition->supprimer) { - print ''.$langs->trans("Cancel").''; + print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } } // Delete if ($user->rights->expedition->supprimer) { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } From aec5f4da13cd4885b67c893a51fd38109026463f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 21 Mar 2022 11:25:46 +0000 Subject: [PATCH 207/328] Fixing style errors. --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 5079f11ac2f..428fb6c7438 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2482,7 +2482,7 @@ if ($action == 'create') { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) { print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } else { - print dolGetButtonAction('',$langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false); + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } } From dd38f6c35b46b97c63ccb54a0d0d50a978cc5d08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 12:53:03 +0100 Subject: [PATCH 208/328] Prepare 15.0.2 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 771cd4ec8a0..3d03730f9ba 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '15.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '15.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From 5fd2ec3fdadda4e94b6bdc141df391c941dd3221 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 21 Mar 2022 15:43:37 +0100 Subject: [PATCH 209/328] add hook for more buttons --- htdocs/compta/prelevement/card.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index a076299b4cd..0b1b82998b2 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -309,20 +309,23 @@ if ($id > 0 || $ref) { // Actions if ($action != 'settransmitted' && $action != 'setcredited') { print "\n".'
'."\n"; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { - if (empty($object->date_trans)) { - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); - else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); + if (empty($object->date_trans)) { + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); + else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); + } + + if (!empty($object->date_trans) && $object->date_credit == 0) { + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); + else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); + } + + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); + else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); } - - if (!empty($object->date_trans) && $object->date_credit == 0) { - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); - else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); - } - - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); - else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); - print '
'; } From 14d91a98fa5d74c3ba9cac664c8713c1b6123dbe Mon Sep 17 00:00:00 2001 From: GregM Date: Mon, 21 Mar 2022 15:55:53 +0100 Subject: [PATCH 210/328] replacing to dolGetButtonAction on Delivery card --- htdocs/delivery/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 00975946f6b..5b413459445 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -649,15 +649,15 @@ if ($action == 'create') { // Create. Seems to no be used if ($object->statut == 0 && $num_prod > 0) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); } } if ($user->rights->expedition->delivery->supprimer) { if ($conf->expedition_bon->enabled) { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); } else { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } From 40fbaf15fef5c4aeb06075b20abeb0ec82117ead Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 17:12:26 +0100 Subject: [PATCH 211/328] Add welsh language --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 7c2a0f8b6ec..820339e6875 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -16,6 +16,7 @@ Language_bg_BG=Bulgarian Language_bs_BA=Bosnian Language_ca_ES=Catalan Language_cs_CZ=Czech +Language_cy_GB=Welsh Language_da_DA=Danish Language_da_DK=Danish Language_de_DE=German From 2e27c40de4a233c89dd71c9cbc4607676145f662 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 22:02:34 +0100 Subject: [PATCH 212/328] Fix customreport with link to parents --- htdocs/contrat/class/contrat.class.php | 4 +- htdocs/core/customreports.php | 58 +++++++++++++++++++++----- htdocs/langs/en_US/contracts.lang | 4 +- 3 files changed, 52 insertions(+), 14 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4e4437c1b2c..c9341d23ee3 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2750,8 +2750,8 @@ class ContratLigne extends CommonObjectLine //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), //'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserOpen', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), - 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCloture', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), + 'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserStartingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), + 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed')) ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 7331b08e13e..ec0ce330dc4 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -556,9 +556,26 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')'; } } + + // Add INNER JOIN for all parent tables + //var_dump($arrayofxaxis); var_dump($search_xaxis); + $listoftablesalreadyadded = array($object->table_element => $object->table_element); + foreach ($search_xaxis as $key => $val) { + if (!empty($arrayofxaxis[$val])) { + $tmpval = explode('.', $val); + //var_dump($arrayofxaxis[$val]['table']); + if (! in_array($arrayofxaxis[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$tmpval[0]; + $listoftablesalreadyadded[$arrayofxaxis[$val]['table']] = $arrayofxaxis[$val]['table']; + } + } else { + dol_print_error($db, 'Found an key into search_xaxis not found into arrayofxaxis'); + } + } + $sql .= ' WHERE 1 = 1'; if ($object->ismultientitymanaged == 1) { - $sql .= ' AND entity IN ('.getEntity($object->element).')'; + $sql .= ' AND t.entity IN ('.getEntity($object->element).')'; } // Add the where here $sqlfilters = $search_component_params_hidden; @@ -914,7 +931,7 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu * Fill arrayofmesures for an object * * @param mixed $object Any object - * @param string $tablealias Alias of table + * @param string $tablealias Alias of table ('t' for example) * @param string $labelofobject Label of object * @param array $arrayofxaxis Array of xaxis already filled * @param int $level Level @@ -964,14 +981,31 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $arrayofxaxis[$tablealias.'.'.$key.'-year'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', 'position' => ($val['position']+($count * 100000)).'.1'); - $arrayofxaxis[$tablealias.'.'.$key.'-month'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => ($val['position']+($count * 100000)).'.2'); - $arrayofxaxis[$tablealias.'.'.$key.'-day'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => ($val['position']+($count * 100000)).'.3'); + $arrayofxaxis[$tablealias.'.'.$key.'-year'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', + 'position' => ($val['position']+($count * 100000)).'.1', + 'table' => $object->table_element + ); + $arrayofxaxis[$tablealias.'.'.$key.'-month'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', + 'position' => ($val['position']+($count * 100000)).'.2', + 'table' => $object->table_element + ); + $arrayofxaxis[$tablealias.'.'.$key.'-day'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', + 'position' => ($val['position']+($count * 100000)).'.3', + 'table' => $object->table_element + ); } else { - $arrayofxaxis[$tablealias.'.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($val['position']+($count * 100000))); + $arrayofxaxis[$tablealias.'.'.$key] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), + 'position' => ($val['position']+($count * 100000)), + 'table' => $object->table_element + ); } } } + // Add extrafields to X-Axis if ($object->isextrafieldmanaged) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -981,9 +1015,14 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) { continue; } - $arrayofxaxis[$tablealias.'e.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000)); + $arrayofxaxis[$tablealias.'e.'.$key] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), + 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000), + 'table' => $object->table_element + ); } } + // Add fields for parent objects foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { @@ -993,10 +1032,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, dol_include_once($tmptype[2]); if (class_exists($newobject)) { $tmpobject = new $newobject($db); - /*var_dump($val['label']); - var_dump($tmptype); - var_dump($arrayofmesures); - var_dump('t-'.$key);*/ + //var_dump($key); var_dump($tmpobject->element); var_dump($val['label']); var_dump($tmptype); var_dump('t-'.$key); $count++; $arrayofxaxis = fillArrayOfXAxis($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofxaxis, $level + 1, $count); } else { diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index 746c7fdfeb6..8d209623c1b 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -102,4 +102,6 @@ TypeContact_contrat_external_CUSTOMER=Follow-up customer contact TypeContact_contrat_external_SALESREPSIGN=Signing contract customer contact HideClosedServiceByDefault=Hide closed services by default ShowClosedServices=Show Closed Services -HideClosedServices=Hide Closed Services \ No newline at end of file +HideClosedServices=Hide Closed Services +UserStartingService=User starting service +UserClosingService=User closing service From 8ef55eae0734cfc71f80082a791dc08625333eeb Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:04:05 +0100 Subject: [PATCH 213/328] FIX: propal list: missing translation keys for transifex --- htdocs/langs/en_US/propal.lang | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 557df2f840f..afab92970ef 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -84,6 +84,17 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +IsNotADraft=is not a draft +PassedInOpenStatus=has been validated +CantBeSign=cannot be signed +Sign=Sign +Signed=signed +CantBeSign=cannot be signed +CantBeValidated=cannot be validated +ConfirmMassValidation=Bulk Validate confirmation +ConfirmMassSignature=Bulk Signature confirmation +ConfirmMassValidationQuestion=Are you sure you want to validate the selected records ? +ConfirmMassSignatureQuestion=Are you sure you want to sign the selected records ? IdProposal=Proposal ID IdProduct=Product ID PrParentLine=Proposal Parent Line From 33398a3031b651693b45884f60db731cf18555f4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 10:10:42 +0100 Subject: [PATCH 214/328] FIX missing object and action hooks parameters --- htdocs/contact/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 66561730829..b661bc61713 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -384,7 +384,7 @@ if (!empty($conf->mailing->enabled)) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { @@ -543,7 +543,7 @@ if (!empty($socid)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Add order if ($view == "recent") { @@ -767,7 +767,7 @@ $moreforfilter .= ''; print '
'; print $moreforfilter; $parameters = array('type'=>$type); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; @@ -910,7 +910,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['p.datec']['checked'])) { @@ -1018,7 +1018,7 @@ $parameters = array( 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, ); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) { print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -1255,7 +1255,7 @@ while ($i < min($num, $limit)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['p.datec']['checked'])) { @@ -1312,7 +1312,7 @@ while ($i < min($num, $limit)) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print "
"; From d4f55ae1167087452c177cdded0ae7b5973131af Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:11:10 +0100 Subject: [PATCH 215/328] FIX: propal list: bad error management in mass actions --- htdocs/comm/propal/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index d92ec87ca29..5b25fd89819 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -272,9 +272,9 @@ if ($action == 'validate') { $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) { - if ($tmpproposal->valid($user)) { + if ($tmpproposal->valid($user) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); } else { setEventMessage($langs->trans('CantBeValidated'), 'errors'); @@ -285,7 +285,7 @@ if ($action == 'validate') { $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } @@ -305,14 +305,14 @@ if ($action == "sign") { $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { $tmpproposal->statut = $tmpproposal::STATUS_SIGNED; - if ($tmpproposal->update($user)) { + if ($tmpproposal->update($user) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } else { @@ -320,7 +320,7 @@ if ($action == "sign") { $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } From f24e1862eec65fc9452d62977bcb61509823a597 Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 22 Mar 2022 10:29:34 +0100 Subject: [PATCH 216/328] replacing to dolGetButtonAction on Fourn card --- htdocs/fourn/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 77932cf4e3d..42b29fc74aa 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -837,24 +837,24 @@ if ($object->id > 0) { // modified by hook if (empty($reshook)) { if ($object->status != 1) { - print ''; + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('ThirdPartyIsClosed'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } if (!empty($conf->supplier_proposal->enabled) && !empty($user->rights->supplier_proposal->creer)) { $langs->load("supplier_proposal"); if ($object->status == 1) { - print ''.$langs->trans("AddSupplierProposal").''; + print dolGetButtonAction('', $langs->trans('AddSupplierProposal'), 'default', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id, ''); } else { - print ''.$langs->trans("AddSupplierProposal").''; + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierProposalGR'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { $langs->load("orders"); if ($object->status == 1) { - print ''.$langs->trans("AddSupplierOrderShort").''; + print dolGetButtonAction('', $langs->trans('AddSupplierOrderShort'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&token='.newToken().'&socid='.$object->id, ''); } else { - print ''.$langs->trans("AddSupplierOrderShort").''; + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierOrderShort'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } @@ -862,30 +862,30 @@ if ($object->id > 0) { if (!empty($orders2invoice) && $orders2invoice > 0) { if ($object->status == 1) { // Company is open - print ''; + print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisSupplierGR'), 'default', DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1', ''); } else { - print ''; + print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } else { - print ''; + print dolGetButtonAction($langs->trans("NoOrdersToInvoice").' ('.$langs->trans("WithReceptionFinished").')', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) { $langs->load("bills"); if ($object->status == 1) { - print ''.$langs->trans("AddBill").''; + print dolGetButtonAction('', $langs->trans('AddBill'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id, ''); } else { - print ''.$langs->trans("AddBill").''; + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddBill'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } // Add action if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) { if ($user->rights->agenda->myactions->create) { - print ''.$langs->trans("AddAction").''; + print dolGetButtonAction('', $langs->trans('AddAction'), 'default', DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id, ''); } else { - print ''.$langs->trans("AddAction").''; + print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddAction'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } } From 4efe10a9a55367baf5eb76a4db7bfd448511e43b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 10:46:26 +0100 Subject: [PATCH 217/328] NEW add hook printFieldListWhere in "show_contacts" function --- htdocs/core/lib/company.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 4bf8a0e7219..7f1f03cd121 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1102,6 +1102,10 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') // Add where from extra fields $extrafieldsobjectkey = $contactstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + // Add where from hooks + $parameters = array('socid' => $object->id); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; if ($sortfield == "t.name") { $sql .= " ORDER BY t.lastname $sortorder, t.firstname $sortorder"; } else { From cf64fc288d36fb1bbf2433949b3e831dcf3cf580 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:49:03 +0100 Subject: [PATCH 218/328] FIX: propal list: missing not signed massaction translation keys for transifex --- htdocs/langs/en_US/propal.lang | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index edbc08236d3..86ee94ceee3 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -85,6 +85,11 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +NoSign=Set not signed +NoSigned=set not signed +CantBeSign=cannot be set not signed +ConfirmMassNoSignature=Bulk Not signed confirmation +ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ? IdProposal=Proposal ID IdProduct=Product ID PrParentLine=Proposal Parent Line From 00fab67225ff883d1dcd67bf7eaade04a7fab849 Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 22 Mar 2022 10:52:58 +0100 Subject: [PATCH 219/328] add & --- htdocs/delivery/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 5b413459445..b699e044c84 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -649,15 +649,15 @@ if ($action == 'create') { // Create. Seems to no be used if ($object->statut == 0 && $num_prod > 0) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) { - print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); } } if ($user->rights->expedition->delivery->supprimer) { if ($conf->expedition_bon->enabled) { - print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); } else { - print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } From 3aae8cc3bbc10f5f07333e54f3b7430146808a4b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:54:04 +0100 Subject: [PATCH 220/328] FIX: propal list: bad error management for set not ssigned mass action --- htdocs/comm/propal/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3e467539c88..16a754a61bb 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -405,27 +405,28 @@ if ($action == "sign" && $permissiontoclose) { } } } + if ($action == "nosign" && $permissiontoclose) { if (GETPOST('confirm') == 'yes') { $tmpproposal = new Propal($db); $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED; - if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) { + if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs'); } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } else { - setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors'); + setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors'); $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } From 5914f2ac65622478c06d6f396e601e0a8c365f90 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 22 Mar 2022 11:17:27 +0100 Subject: [PATCH 221/328] FIX include discount price for PMP after a reception (Issue #20029) --- htdocs/reception/class/reception.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index ef12d844ddc..2b458f9d57c 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -554,7 +554,7 @@ class Reception extends CommonObject // Loop on each product line to add a stock movement // TODO in future, reception lines may not be linked to order line - $sql = "SELECT cd.fk_product, cd.subprice,"; + $sql = "SELECT cd.fk_product, cd.subprice, cd.remise_percent,"; $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; $sql .= " ed.eatby, ed.sellby, ed.batch"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; @@ -580,12 +580,18 @@ class Reception extends CommonObject $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + // get unit price with discount + $up_ht_disc = $obj->subprice; + if (!empty($obj->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { + $up_ht_disc = price2num($up_ht_disc * (100 - $obj->remise_percent) / 100, 'MU'); + } + if (empty($obj->batch)) { // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref)); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref)); if ($result < 0) { $error++; $this->errors[] = $mouvS->error; @@ -597,7 +603,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); if ($result < 0) { $error++; $this->errors[] = $mouvS->error; From 344c29ae151fa0c7cb1ba865802c4ce1a69966f7 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 11:35:37 +0100 Subject: [PATCH 222/328] FIX: trans --- htdocs/langs/en_US/propal.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 86ee94ceee3..c7332005f86 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -87,7 +87,7 @@ CaseFollowedBy=Case followed by SignedOnly=Signed only NoSign=Set not signed NoSigned=set not signed -CantBeSign=cannot be set not signed +CantBeNoSign=cannot be set not signed ConfirmMassNoSignature=Bulk Not signed confirmation ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ? IdProposal=Proposal ID From 02e2f9815def4051bfbd4350c72e7331937089a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Mar 2022 11:47:25 +0100 Subject: [PATCH 223/328] NEW Add option INVOICEREC_SET_AUTOFILL_DATE_START/END --- htdocs/compta/facture/card-rec.php | 24 +++--- htdocs/compta/facture/card.php | 1 - .../facture/class/facture-rec.class.php | 13 ++-- htdocs/core/customreports.php | 75 +++++++++++++------ htdocs/core/tpl/objectline_title.tpl.php | 4 +- htdocs/core/tpl/objectline_view.tpl.php | 15 +++- 6 files changed, 90 insertions(+), 42 deletions(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 1266232a46e..6116db707e2 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -208,6 +208,9 @@ if (empty($reshook)) { $object->model_pdf = GETPOST('modelpdf', 'alpha'); $object->usenewprice = GETPOST('usenewprice', 'alpha'); + $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); + $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); + $object->frequency = $frequency; $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); $object->nb_gen_max = $nb_gen_max; @@ -261,8 +264,6 @@ if (empty($reshook)) { } else { $db->rollback(); - $error++; - setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; } } @@ -1027,12 +1028,14 @@ if ($action == 'create') { // Payment term print "".$langs->trans("PaymentConditions").""; - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); + print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $object->cond_reglement_id, 'cond_reglement_id', -1, 0, 0, ''); + //$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); print ""; // Payment mode print "".$langs->trans("PaymentMode").""; - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none', '', 1); + print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $object->mode_reglement_id, 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1); + //$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', '', 1); print ""; // Project @@ -1040,8 +1043,9 @@ if ($action == 'create') { $projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project; $langs->load('projects'); print ''.$langs->trans('Project').''; + print img_picto('', 'project'); $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''); - print '   thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").''; + print '   thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.img_object($langs->trans("AddProject"), 'add').''; print ''; } @@ -1074,7 +1078,8 @@ if ($action == 'create') { // Frequency + unit print ''.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')).""; - print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm')); + print " "; + print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm')); print ""; // Date next run @@ -1474,15 +1479,16 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; + print ''; print '
'; - print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); + print " "; + print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); print '
'; } else { if ($object->frequency > 0) { print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); } else { - print $langs->trans("NotARecurringInvoiceTemplate"); + print ''.$langs->trans("NotARecurringInvoiceTemplate").''; } } print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2bfbe368aa8..4b78f22ceac 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3857,7 +3857,6 @@ if ($action == 'create') { print "\n"; } elseif ($id > 0 || !empty($ref)) { if (empty($object->id)) { - llxHeader(); $langs->load('errors'); echo '
'.$langs->trans("ErrorRecordNotFound").'
'; llxFooter(); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index ae264f7a813..6d61316f168 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -309,10 +309,10 @@ class FactureRec extends CommonInvoice $sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); $sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL"); $sql .= ", ".((int) $user->id); - $sql .= ", ".(!empty($facsrc->fk_project) ? ((int) $facsrc->fk_project) : "null"); + $sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : "null"); $sql .= ", ".(!empty($facsrc->fk_account) ? ((int) $facsrc->fk_account) : "null"); - $sql .= ", ".($facsrc->cond_reglement_id > 0 ? ((int) $facsrc->cond_reglement_id) : "null"); - $sql .= ", ".($facsrc->mode_reglement_id > 0 ? ((int) $facsrc->mode_reglement_id) : "null"); + $sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : "null"); + $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "null"); $sql .= ", ".((int) $this->usenewprice); $sql .= ", ".((int) $this->frequency); $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; @@ -344,6 +344,9 @@ class FactureRec extends CommonInvoice $tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')'; } + $default_start_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_START'); + $default_end_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_END'); + $result_insert = $this->addline( $facsrc->lines[$i]->desc, $facsrc->lines[$i]->subprice, @@ -363,8 +366,8 @@ class FactureRec extends CommonInvoice $facsrc->lines[$i]->label, $facsrc->lines[$i]->fk_unit, $facsrc->lines[$i]->multicurrency_subprice, - 0, - 0, + $default_start_fill, + $default_end_fill, null, $facsrc->lines[$i]->pa_ht ); diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index ec0ce330dc4..f208baee872 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -212,6 +212,28 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) { print dol_get_fiche_head($head, 'customreports', $title, -1, $picto); } +$newarrayoftype = array(); +foreach ($arrayoftype as $key => $val) { + if (dol_eval($val['enabled'], 1, 1, '1')) { + $newarrayoftype[$key] = $arrayoftype[$key]; + } + if ($val['langs']) { + $langs->load($val['langs']); + } +} + +$count = 0; +$arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count); + +$count = 0; +$arrayofxaxis = fillArrayOfXAxis($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofxaxis, 0, $count); +$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1); + +$count = 0; +$arrayofgroupby = fillArrayOfGroupBy($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofgroupby, 0, $count); +$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1); + + // Check parameters if ($action == 'viewgraph') { if (!count($search_measures)) { @@ -252,6 +274,8 @@ if (is_array($search_groupby) && count($search_groupby)) { $fieldtocount = $search_groupby[$gkey]; } + var_dump($fieldtocount); + var_dump($arrayofgroupby); $sql = "SELECT DISTINCT ".$fieldtocount." as val"; if (strpos($fieldtocount, 'te.') === 0) { $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te'; @@ -380,15 +404,6 @@ print '
'; // Select object print '
'; print '
'.$langs->trans("StatisticsOn").'
'; -$newarrayoftype = array(); -foreach ($arrayoftype as $key => $val) { - if (dol_eval($val['enabled'], 1, 1, '1')) { - $newarrayoftype[$key] = $arrayoftype[$key]; - } - if ($val['langs']) { - $langs->load($val['langs']); - } -} print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1); if (empty($conf->use_javascript_ajax)) { print ''; @@ -412,7 +427,6 @@ print '
'; // Add measures into array $count = 0; -$arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count); //var_dump($arrayofmesures); print '
'; print '
'; @@ -421,8 +435,6 @@ print '
'; // XAxis $count = 0; -$arrayofxaxis = fillArrayOfXAxis($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofxaxis, 0, $count); -$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1); print '
'; print '
'; //var_dump($arrayofxaxis); @@ -431,8 +443,6 @@ print '
'; // Group by $count = 0; -$arrayofgroupby = fillArrayOfGroupBy($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofgroupby, 0, $count); -$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1); print '
'; print '
'; print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields @@ -1100,14 +1110,31 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $arrayofgroupby[$tablealias.'.'.$key.'-year'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', 'position' => ($val['position']+($count * 100000)).'.1'); - $arrayofgroupby[$tablealias.'.'.$key.'-month'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => ($val['position']+($count * 100000)).'.2'); - $arrayofgroupby[$tablealias.'.'.$key.'-day'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => ($val['position']+($count * 100000)).'.3'); + $arrayofgroupby[$tablealias.'.'.$key.'-year'] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', 'position' => ($val['position']+($count * 100000)).'.1', + 'table' => $object->table_element + ); + $arrayofgroupby[$tablealias.'.'.$key.'-month'] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => ($val['position']+($count * 100000)).'.2', + 'table' => $object->table_element + ); + $arrayofgroupby[$tablealias.'.'.$key.'-day'] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => ($val['position']+($count * 100000)).'.3', + 'table' => $object->table_element + ); } else { - $arrayofgroupby[$tablealias.'.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($val['position']+($count * 100000))); + $arrayofgroupby[$tablealias.'.'.$key] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($val['position']+($count * 100000)), + 'table' => $object->table_element + ); } } } + // Add extrafields to Group by if ($object->isextrafieldmanaged) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -1117,9 +1144,14 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) { continue; } - $arrayofgroupby[$tablealias.'e.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000)); + $arrayofgroupby[$tablealias.'e.'.$key] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000), + 'table' => $object->table_element + ); } } + // Add fields for parent objects foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { @@ -1129,10 +1161,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup dol_include_once($tmptype[2]); if (class_exists($newobject)) { $tmpobject = new $newobject($db); - /*var_dump($val['label']); - var_dump($tmptype); - var_dump($arrayofmesures); - var_dump('t-'.$key);*/ + //var_dump($key); var_dump($tmpobject->element); var_dump($val['label']); var_dump($tmptype); var_dump('t-'.$key); $count++; $arrayofgroupby = fillArrayOfGroupBy($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofgroupby, $level + 1, $count); } else { diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index c40f07716f2..e8dbec2ac77 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -71,7 +71,9 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; + if (empty($disableedit)) { + print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; + } //print ''; if (GETPOST('mode', 'aZ09') == 'vatforalllines') { print '
'; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e8316392043..c2d81b81eb5 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -172,13 +172,13 @@ if (($line->info_bits & 2) == 2) { print '
'; } if ($line->date_start_fill) { - print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); + print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); } if ($line->date_start_fill && $line->date_end_fill) { print ' - '; } if ($line->date_end_fill) { - print ''.$langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); + print ''.$langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); } if ($line->date_start_fill || $line->date_end_fill) { print '
'; @@ -200,7 +200,16 @@ if (($line->info_bits & 2) == 2) { } } - //print get_date_range($line->date_start, $line->date_end, $format); + // If we show the lines in a context to create a recurring sale invoice + if (basename($_SERVER["PHP_SELF"]) == 'card-rec.php') { + $default_start_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_START'); + $default_end_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_END'); + print '
'; + print ''.$langs->trans('AutoFillDateFromShort').': '.yn($default_start_fill); + print ' - '; + print ''.$langs->trans('AutoFillDateToShort').': '.yn($default_end_fill); + print '
'; + } } // Add description in form From ca3a4839e5fdd4ae74802e58ccfed4ad2990868e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 12:06:37 +0100 Subject: [PATCH 224/328] FIX try to fix CodingPhpTest::testPHP error --- htdocs/core/customreports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index ec0ce330dc4..df7ff549bbb 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -565,7 +565,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $tmpval = explode('.', $val); //var_dump($arrayofxaxis[$val]['table']); if (! in_array($arrayofxaxis[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$tmpval[0]; + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$db->escape($tmpval[0]); $listoftablesalreadyadded[$arrayofxaxis[$val]['table']] = $arrayofxaxis[$val]['table']; } } else { From 5adcdd6b4e9715189a2a40b70ba70c3e55b1df0a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 12:27:36 +0100 Subject: [PATCH 225/328] FIX use sanitize instead escape --- htdocs/core/customreports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index df7ff549bbb..b640df8768f 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -565,7 +565,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $tmpval = explode('.', $val); //var_dump($arrayofxaxis[$val]['table']); if (! in_array($arrayofxaxis[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$db->escape($tmpval[0]); + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$db->sanitize($tmpval[0]); $listoftablesalreadyadded[$arrayofxaxis[$val]['table']] = $arrayofxaxis[$val]['table']; } } else { From 8686e37fa9e4c21903033c517308f4ad44257fbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Mar 2022 13:23:16 +0100 Subject: [PATCH 226/328] Work on generic report. --- htdocs/contrat/class/contrat.class.php | 10 +- htdocs/core/customreports.php | 193 +++++++++++++++++++------ 2 files changed, 154 insertions(+), 49 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c9341d23ee3..1a31e478f56 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -233,10 +233,10 @@ class Contrat extends CommonObject 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), + 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), @@ -245,7 +245,7 @@ class Contrat extends CommonObject 'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')) + 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'notnull'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')) ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index f208baee872..4ded4498add 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -224,6 +224,7 @@ foreach ($arrayoftype as $key => $val) { $count = 0; $arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count); +$arrayofmesures = dol_sort_array($arrayofmesures, 'position', 'asc', 0, 0, 1); $count = 0; $arrayofxaxis = fillArrayOfXAxis($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofxaxis, 0, $count); @@ -274,13 +275,19 @@ if (is_array($search_groupby) && count($search_groupby)) { $fieldtocount = $search_groupby[$gkey]; } - var_dump($fieldtocount); - var_dump($arrayofgroupby); $sql = "SELECT DISTINCT ".$fieldtocount." as val"; + if (strpos($fieldtocount, 'te.') === 0) { $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te'; } else { - $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t'; + $tabletouse = $object->table_element; + $tablealiastouse = 't'; + if (!empty($arrayofgroupby[$gval])) { + $tmpval = explode('.', $gval); + $tabletouse = $arrayofgroupby[$gval]['table']; + $tablealiastouse = $tmpval[0]; + } + $sql .= ' FROM '.MAIN_DB_PREFIX.$tabletouse.' as '.$tablealiastouse; } // Add the where here @@ -343,8 +350,17 @@ if (is_array($search_groupby) && count($search_groupby)) { $arrayofvaluesforgroupby['g_'.$gkey][$keytouse] = $valuetranslated; } + // Add also the possible NULL value if field is a parent field that is not a strict join + $tmpfield = explode('.', $gval); + if ($tmpfield[0] != 't' || (is_array($object->fields[$tmpfield[1]]) && empty($object->fields[$tmpfield[1]]['notnull']))) { + dol_syslog("The group by field ".$gval." may be null (because field is null or it is a left join), so we add __NULL__ entry in list of possible values"); + //var_dump($gval); var_dump($object->fields); + $arrayofvaluesforgroupby['g_'.$gkey]['__NULL__'] = $langs->transnoentitiesnoconv("NotDefined"); + } + asort($arrayofvaluesforgroupby['g_'.$gkey]); + // Add a protection/error to refuse the request if number of differentr values for the group by is higher than $MAXUNIQUEVALFORGROUP if (count($arrayofvaluesforgroupby['g_'.$gkey]) > $MAXUNIQUEVALFORGROUP) { $langs->load("errors"); if (strpos($fieldtocount, 'te.') === 0) { @@ -430,7 +446,11 @@ $count = 0; //var_dump($arrayofmesures); print '
'; print '
'; -print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields +$simplearrayofmesures = array(); +foreach ($arrayofmesures as $key => $val) { + $simplearrayofmesures[$key] = $arrayofmesures[$key]['label']; +} +print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields print '
'; // XAxis @@ -464,18 +484,38 @@ if ($mode == 'grid') { continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $arrayofyaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position']); - $arrayofyaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position']); - $arrayofyaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position']); + $arrayofyaxis['t.'.$key.'-year'] = array( + 'label' => $langs->trans($val['label']).' ('.$YYYY.')', + 'position' => $val['position'], + 'table' => $object->table_element + ); + $arrayofyaxis['t.'.$key.'-month'] = array( + 'label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', + 'position' => $val['position'], + 'table' => $object->table_element + ); + $arrayofyaxis['t.'.$key.'-day'] = array( + 'label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', + 'position' => $val['position'], + 'table' => $object->table_element + ); } else { - $arrayofyaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']); + $arrayofyaxis['t.'.$key] = array( + 'label' => $val['label'], + 'position' => (int) $val['position'], + 'table' => $object->table_element + ); } } // Add measure from extrafields if ($object->isextrafieldmanaged) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) { - $arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]); + $arrayofyaxis['te.'.$key] = array( + 'label' => $extrafields->attributes[$object->table_element]['label'][$key], + 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key], + 'table' => $object->table_element + ); } } } @@ -505,7 +545,7 @@ $sql = ''; if (!empty($search_measures) && !empty($search_xaxis)) { $fieldid = 'rowid'; - $sql = 'SELECT '; + $sql = "SELECT "; foreach ($search_xaxis as $key => $val) { if (preg_match('/\-year$/', $val)) { $tmpval = preg_replace('/\-year$/', '', $val); @@ -552,40 +592,72 @@ if (!empty($search_measures) && !empty($search_xaxis)) { } } $sql = preg_replace('/,\s*$/', '', $sql); - $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t'; + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; // Add measure from extrafields if ($object->isextrafieldmanaged) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as te ON te.fk_object = t.".$fieldid; } - if ($object->ismultientitymanaged) { + // Add table for link for multientity + if ($object->ismultientitymanaged) { // 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table if ($object->ismultientitymanaged == 1) { - // Nothing here + // No table to add here } else { $tmparray = explode('@', $object->ismultientitymanaged); - $sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttable ON t.".$tmparray[0]." = parenttable.rowid"; - $sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')'; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttableforentity ON t.".$tmparray[0]." = parenttableforentity.rowid"; + $sql .= " AND parenttableforentity.entity IN (".getEntity($tmparray[1]).")"; } } - // Add INNER JOIN for all parent tables - //var_dump($arrayofxaxis); var_dump($search_xaxis); $listoftablesalreadyadded = array($object->table_element => $object->table_element); + + // Add LEFT JOIN for all parent tables mentionned into the Xaxis + //var_dump($arrayofxaxis); var_dump($search_xaxis); foreach ($search_xaxis as $key => $val) { if (!empty($arrayofxaxis[$val])) { $tmpval = explode('.', $val); //var_dump($arrayofxaxis[$val]['table']); if (! in_array($arrayofxaxis[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$tmpval[0]; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$arrayofxaxis[$val]['table']." as ".$tmpval[0]." ON t.".str_replace('t__', '', $tmpval[0])." = ".$tmpval[0].".rowid"; $listoftablesalreadyadded[$arrayofxaxis[$val]['table']] = $arrayofxaxis[$val]['table']; } } else { - dol_print_error($db, 'Found an key into search_xaxis not found into arrayofxaxis'); + dol_print_error($db, 'Found a key into search_xaxis not found into arrayofxaxis'); } } - $sql .= ' WHERE 1 = 1'; - if ($object->ismultientitymanaged == 1) { - $sql .= ' AND t.entity IN ('.getEntity($object->element).')'; + // Add LEFT JOIN for all parent tables mentionned into the Group by + //var_dump($arrayofgroupby); var_dump($search_groupby); + foreach ($search_groupby as $key => $val) { + if (!empty($arrayofgroupby[$val])) { + $tmpval = explode('.', $val); + //var_dump($arrayofxaxis[$val]['table']); + if (! in_array($arrayofgroupby[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$arrayofgroupby[$val]['table']." as ".$tmpval[0]." ON t.".str_replace('t__', '', $tmpval[0])." = ".$tmpval[0].".rowid"; + $listoftablesalreadyadded[$arrayofgroupby[$val]['table']] = $arrayofgroupby[$val]['table']; + } + } else { + dol_print_error($db, 'Found a key into search_groupby not found into arrayofgroupby'); + } + } + + // Add LEFT JOIN for all parent tables mentionned into the Yaxis + //var_dump($arrayofgroupby); var_dump($search_groupby); + foreach ($search_measures as $key => $val) { + if (!empty($arrayofmesures[$val])) { + $tmpval = explode('.', $val); + //var_dump($arrayofxaxis[$val]['table']); + if (! in_array($arrayofmesures[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$arrayofmesures[$val]['table']." as ".$tmpval[0]." ON t.".str_replace('t__', '', $tmpval[0])." = ".$tmpval[0].".rowid"; + $listoftablesalreadyadded[$arrayofmesures[$val]['table']] = $arrayofmesures[$val]['table']; + } + } else { + dol_print_error($db, 'Found a key into search_measures not found into arrayofmesures'); + } + } + + $sql .= " WHERE 1 = 1"; + if ($object->ismultientitymanaged == 1) { // 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table + $sql .= " AND t.entity IN (".getEntity($object->element).")"; } // Add the where here $sqlfilters = $search_component_params_hidden; @@ -598,7 +670,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { print $errormessage; } } - $sql .= ' GROUP BY '; + $sql .= " GROUP BY "; foreach ($search_xaxis as $key => $val) { if (preg_match('/\-year$/', $val)) { $tmpval = preg_replace('/\-year$/', '', $val); @@ -663,7 +735,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $legend = array(); foreach ($search_measures as $key => $val) { - $legend[] = $langs->trans($arrayofmesures[$val]); + $legend[] = $langs->trans($arrayofmesures[$val]['label']); } $useagroupby = (is_array($search_groupby) && count($search_groupby)); @@ -694,7 +766,7 @@ if ($sql) { if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) { $xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey]; } - $labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined"))); + $labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->transnoentitiesnoconv("Empty") : $langs->transnoentitiesnoconv("NotDefined"))); if ($oldlabeltouse && ($labeltouse != $oldlabeltouse)) { $xi++; // Increase $xi @@ -888,26 +960,62 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu if ($level == 0) { // Add the count of record only for the main/first level object. Parents are necessarly unique for each record. - $arrayofmesures[$tablealias.'.count'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': Count'; + $arrayofmesures[$tablealias.'.count'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': Count', + 'position' => 0, + 'table' => $object->table_element + ); } // Add main fields of object foreach ($object->fields as $key => $val) { if (!empty($val['isameasure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1, 1, '1'))) { - $arrayofmesures[$tablealias.'.'.$key.'-sum'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Sum").')'; - $arrayofmesures[$tablealias.'.'.$key.'-average'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Average").')'; - $arrayofmesures[$tablealias.'.'.$key.'-min'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Minimum").')'; - $arrayofmesures[$tablealias.'.'.$key.'-max'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Maximum").')'; + $arrayofmesures[$tablealias.'.'.$key.'-sum'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Sum").')', + 'position' => ($val['position']+($count * 100000)).'.1', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'.'.$key.'-average'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Average").')', + 'position' => ($val['position']+($count * 100000)).'.2', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'.'.$key.'-min'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Minimum").')', + 'position' => ($val['position']+($count * 100000)).'.3', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'.'.$key.'-max'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Maximum").')', + 'position' => ($val['position']+($count * 100000)).'.4', + 'table' => $object->table_element + ); } } // Add extrafields to Measures if ($object->isextrafieldmanaged) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) { - $arrayofmesures[$tablealias.'e.'.$key.'-sum'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Sum").')'; - $arrayofmesures[$tablealias.'e.'.$key.'-average'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Average").')'; - $arrayofmesures[$tablealias.'e.'.$key.'-min'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Minimum").')'; - $arrayofmesures[$tablealias.'e.'.$key.'-max'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Maximum").')'; + $arrayofmesures[$tablealias.'e.'.$key.'-sum'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Sum").')', + 'position' => ($val['position']+($count * 100000)).'.1', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'e.'.$key.'-average'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Average").')', + 'position' => ($val['position']+($count * 100000)).'.2', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'e.'.$key.'-min'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Minimum").')', + 'position' => ($val['position']+($count * 100000)).'.3', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'e.'.$key.'-max'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Maximum").')', + 'position' => ($val['position']+($count * 100000)).'.4', + 'table' => $object->table_element + ); } } } @@ -915,19 +1023,16 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { $tmptype = explode(':', $val['type'], 4); - if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) { + if ($tmptype[0] == 'integer' && $tmptype[1] && $tmptype[2]) { $newobject = $tmptype[1]; dol_include_once($tmptype[2]); if (class_exists($newobject)) { $tmpobject = new $newobject($db); - /*var_dump($val['label']); - var_dump($tmptype); - var_dump($arrayofmesures); - var_dump('t-'.$key);*/ + //var_dump($key); var_dump($tmpobject->element); var_dump($val['label']); var_dump($tmptype); var_dump('t-'.$key); $count++; $arrayofmesures = fillArrayOfMeasures($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofmesures, $level + 1, $count); } else { - print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n"; + print 'For property '.$object->element.'->'.$key.', type="'.$val['type'].'": Failed to find class '.$newobject." in file ".$tmptype[2]."
\n"; } } } @@ -1037,7 +1142,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { $tmptype = explode(':', $val['type'], 4); - if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) { + if ($tmptype[0] == 'integer' && $tmptype[1] && $tmptype[2]) { $newobject = $tmptype[1]; dol_include_once($tmptype[2]); if (class_exists($newobject)) { @@ -1046,7 +1151,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, $count++; $arrayofxaxis = fillArrayOfXAxis($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofxaxis, $level + 1, $count); } else { - print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n"; + print 'For property '.$object->element.'->'.$key.', type="'.$val['type'].'": Failed to find class '.$newobject." in file ".$tmptype[2]."
\n"; } } } @@ -1156,7 +1261,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { $tmptype = explode(':', $val['type'], 4); - if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) { + if ($tmptype[0] == 'integer' && $tmptype[1] && $tmptype[2]) { $newobject = $tmptype[1]; dol_include_once($tmptype[2]); if (class_exists($newobject)) { @@ -1165,7 +1270,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup $count++; $arrayofgroupby = fillArrayOfGroupBy($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofgroupby, $level + 1, $count); } else { - print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n"; + print 'For property '.$object->element.'->'.$key.', type="'.$val['type'].'": Failed to find class '.$newobject." in file ".$tmptype[2]."
\n"; } } } From f662afa7624524f57d27f1b425ec8e44981f79d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Mar 2022 13:37:33 +0100 Subject: [PATCH 227/328] Fix sql syntax --- htdocs/core/customreports.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 4ded4498add..030762fd0aa 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -278,7 +278,7 @@ if (is_array($search_groupby) && count($search_groupby)) { $sql = "SELECT DISTINCT ".$fieldtocount." as val"; if (strpos($fieldtocount, 'te.') === 0) { - $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te'; + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element."_extrafields as te"; } else { $tabletouse = $object->table_element; $tablealiastouse = 't'; @@ -287,7 +287,7 @@ if (is_array($search_groupby) && count($search_groupby)) { $tabletouse = $arrayofgroupby[$gval]['table']; $tablealiastouse = $tmpval[0]; } - $sql .= ' FROM '.MAIN_DB_PREFIX.$tabletouse.' as '.$tablealiastouse; + $sql .= " FROM ".MAIN_DB_PREFIX.$tabletouse." as ".$tablealiastouse; } // Add the where here @@ -303,7 +303,7 @@ if (is_array($search_groupby) && count($search_groupby)) { } }*/ - $sql .= ' LIMIT '.($MAXUNIQUEVALFORGROUP + 1); + $sql .= " LIMIT ".((int) ($MAXUNIQUEVALFORGROUP + 1)); //print $sql; $resql = $db->query($sql); From ccf8b01020330d0d012e131a13fe6ce68649901d Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 22 Mar 2022 13:46:55 +0100 Subject: [PATCH 228/328] Fix: The origin of the stock movement is not being recorded --- htdocs/commande/class/commande.class.php | 5 ++++- htdocs/compta/facture/class/facture.class.php | 5 ++++- htdocs/expedition/class/expedition.class.php | 5 ++++- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- htdocs/fourn/class/fournisseur.facture.class.php | 4 +++- htdocs/fourn/commande/dispatch.php | 4 +++- htdocs/reception/class/reception.class.php | 6 +++++- 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 429996ee314..f51c8026672 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -518,6 +518,7 @@ class Commande extends CommonOrder if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrement stock of product (and sub-products) $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr", $num)); if ($result < 0) { @@ -645,6 +646,7 @@ class Commande extends CommonOrder if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We increment stock of product (and sub-products) $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr", $this->ref)); if ($result < 0) { @@ -823,6 +825,7 @@ class Commande extends CommonOrder for ($i = 0; $i < $num; $i++) { if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); + $mouvP->setOrigin($this->element, $this->id); // We increment stock of product (and sub-products) $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr", $this->ref)); // price is 0, we don't want WAP to be changed if ($result < 0) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5e61499464c..55fa26d3c6b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -14,7 +14,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Cedric Gross * Copyright (C) 2013 Florian Henry - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2022 Sylvain Legrand @@ -2323,6 +2323,7 @@ class Facture extends CommonInvoice if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrease stock for product if ($this->type == self::TYPE_CREDIT_NOTE) { $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceDeleteDolibarr", $this->ref)); @@ -2759,6 +2760,7 @@ class Facture extends CommonInvoice if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrease stock for product if ($this->type == self::TYPE_CREDIT_NOTE) { $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr", $num)); @@ -3051,6 +3053,7 @@ class Facture extends CommonInvoice if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrease stock for product if ($this->type == self::TYPE_CREDIT_NOTE) { $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref)); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 600f498da7c..a29919b7346 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2014-2017 Francis Appels * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2016-2021 Ferran Marcet + * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2020 Lenin Rivas @@ -753,6 +753,7 @@ class Expedition extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = dol_clone($this, 1); + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->edbrowid)) { // line without batch detail @@ -2233,6 +2234,7 @@ class Expedition extends CommonObject $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->edbrowid)) { // line without batch detail @@ -2404,6 +2406,7 @@ class Expedition extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->edbrowid)) { // line without batch detail diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 649fb0e106f..a20075295d9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2020 Frédéric France - * Copyright (C) 2018-2021 Ferran Marcet + * Copyright (C) 2018-2022 Ferran Marcet * Copyright (C) 2021 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify @@ -1071,6 +1071,7 @@ class CommandeFournisseur extends CommonOrder $this->line = $this->lines[$i]; $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrement stock of product (and sub-products) $up_ht_disc = $this->lines[$i]->subprice; if (!empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { @@ -2037,8 +2038,7 @@ class CommandeFournisseur extends CommonOrder if ($product > 0) { // $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on) $mouv->origin = &$this; - $mouv->origin_type = $this->element; - $mouv->origin_id = $this->id; + $mouv->setOrigin($this->element, $this->id); $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch); if ($result < 0) { $this->error = $mouv->error; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 2a1a54e70d3..bd25fbea6ec 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García * Copyright (C) 2015 Bahfir Abbes - * Copyright (C) 2015-2019 Ferran Marcet + * Copyright (C) 2015-2022 Ferran Marcet * Copyright (C) 2016-2021 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2022 Frédéric France @@ -1605,6 +1605,7 @@ class FactureFournisseur extends CommonInvoice $this->line = $this->lines[$i]; $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We increase stock for product $up_ht_disc = $this->lines[$i]->pu_ht; if (!empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { @@ -1734,6 +1735,7 @@ class FactureFournisseur extends CommonInvoice if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We increase stock for product if ($this->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref)); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index bb56e5d4555..a1ddef959a0 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -6,7 +6,7 @@ * Copyright (C) 2010-2021 Juanjo Menent * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry - * Copyright (C) 2017-2020 Ferran Marcet + * Copyright (C) 2017-2022 Ferran Marcet * Copyright (C) 2018 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel * @@ -423,6 +423,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive $mouv = new MouvementStock($db); if ($product > 0) { $mouv->origin = &$object; + $mouv->setOrigin($object->element, $object->id); $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch); if ($result < 0) { $errors = $mouv->errors; @@ -469,6 +470,7 @@ if ($action == 'updateline' && $permissiontoreceive) { $mouv = new MouvementStock($db); if ($product > 0) { $mouv->origin = &$object; + $mouv->setOrigin($object->element, $object->id); $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch); if ($result < 0) { $errors = $mouv->errors; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 28fb783e2c9..b8246b7fe8e 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2014-2020 Francis Appels * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Quentin Vial-Gouteyron * * This program is free software; you can redistribute it and/or modify @@ -591,6 +591,7 @@ class Reception extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->batch)) { // line without batch detail @@ -1632,6 +1633,7 @@ class Reception extends CommonObject $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->batch)) { // line without batch detail @@ -1796,6 +1798,7 @@ class Reception extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->batch)) { // line without batch detail @@ -1926,6 +1929,7 @@ class Reception extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->batch)) { // line without batch detail From e3a375b948309e68355417049e654a75dc474a8c Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 22 Mar 2022 14:18:48 +0100 Subject: [PATCH 229/328] add & --- htdocs/delivery/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index b699e044c84..4b4e88c94c3 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -657,7 +657,7 @@ if ($action == 'create') { // Create. Seems to no be used if ($conf->expedition_bon->enabled) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); } else { - print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } From 4ca3d45ecaf814f98102a982c409412e8bc50c97 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 15:51:30 +0100 Subject: [PATCH 230/328] NEW add hook printFieldWhere in load_state_board function --- htdocs/contact/class/contact.class.php | 8 +++++++- htdocs/fourn/class/fournisseur.class.php | 8 +++++++- htdocs/product/class/product.class.php | 2 +- htdocs/societe/class/client.class.php | 8 +++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 589d09ce1e7..92549312e59 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -376,7 +376,7 @@ class Contact extends CommonObject public function load_state_board() { // phpcs:enable - global $user; + global $user, $hookmanager; $this->nb = array(); $clause = "WHERE"; @@ -394,6 +394,12 @@ class Contact extends CommonObject if ($user->socid > 0) { $sql .= " AND sp.fk_soc = ".((int) $user->socid); } + // Add where from hooks + if (is_object($hookmanager)) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + } $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index b47cfa263c0..baed7051ef8 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -106,7 +106,7 @@ class Fournisseur extends Societe public function load_state_board() { // phpcs:enable - global $conf, $user; + global $conf, $user, $hookmanager; $this->nb = array(); $clause = "WHERE"; @@ -120,6 +120,12 @@ class Fournisseur extends Societe } $sql .= " ".$clause." s.fournisseur = 1"; $sql .= " AND s.entity IN (".getEntity('societe').")"; + // Add where from hooks + if (is_object($hookmanager)) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + } $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 839a9f18ba2..c809a41f824 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5692,7 +5692,7 @@ class Product extends CommonObject // Add where from hooks if (is_object($hookmanager)) { $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; } $sql .= ' GROUP BY fk_product_type'; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 4e55a914339..eeae4e77731 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -57,7 +57,7 @@ class Client extends Societe public function load_state_board() { // phpcs:enable - global $user; + global $user, $hookmanager; $this->nb = array("prospects" => 0, "customers" => 0); $clause = "WHERE"; @@ -71,6 +71,12 @@ class Client extends Societe } $sql .= " ".$clause." s.client IN (1,2,3)"; $sql .= ' AND s.entity IN ('.getEntity($this->element).')'; + // Add where from hooks + if (is_object($hookmanager)) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + } $sql .= " GROUP BY s.client"; $resql = $this->db->query($sql); From b95bb58ba053e5a4321e4bfe021bf536e29a2ed2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 16:49:29 +0100 Subject: [PATCH 231/328] FIX remove unused global --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c809a41f824..d87f60525e3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5682,7 +5682,7 @@ class Product extends CommonObject public function load_state_board() { // phpcs:enable - global $conf, $user, $hookmanager; + global $hookmanager; $this->nb = array(); From 2943e68c42dc421e8f51fb55428be792630283dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Mar 2022 16:57:39 +0100 Subject: [PATCH 232/328] Fix regression --- htdocs/compta/prelevement/class/bonprelevement.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0b419dacace..6181bafdca8 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1831,7 +1831,7 @@ class BonPrelevement extends CommonObject $DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d'); if ($type != 'bank-transfer') { - // SEPA Paiement Information of buyer for Direct debit + // SEPA Paiement Information of buyer for Direct Debit $XML_DEBITOR = ''; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; @@ -1884,7 +1884,7 @@ class BonPrelevement extends CommonObject // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) $XML_CREDITOR .= ' '.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_CREDITOR .= ' '.$CrLf; - if ($this->sepa_xml_pti_in_ctti) { + if (!empty($this->sepa_xml_pti_in_ctti)) { $XML_CREDITOR .= ' ' . $CrLf; // Can be 'NORM' for normal or 'HIGH' for high priority level @@ -2076,7 +2076,7 @@ class BonPrelevement extends CommonObject $RefBon = $obj->ref; if ($type != 'bank-transfer') { - // SEPA Paiement Information of my company for Direct debit + // SEPA Paiement Information of my company for Direct Debit $XML_SEPA_INFO = ''; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).''.$CrLf; @@ -2147,7 +2147,7 @@ class BonPrelevement extends CommonObject //$XML_SEPA_INFO .= ' False'.$CrLf; $XML_SEPA_INFO .= ' '.$nombre.''.$CrLf; $XML_SEPA_INFO .= ' '.$total.''.$CrLf; - if (!$this->sepa_xml_pti_in_ctti) { + if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) { // @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange. $XML_SEPA_INFO .= ' ' . $CrLf; $XML_SEPA_INFO .= ' ' . $CrLf; $XML_SEPA_INFO .= ' SEPA' . $CrLf; From 100c48372b7f806dbac0a6e43725221ac306944a Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 17:13:48 +0100 Subject: [PATCH 233/328] FIX: permit access to medias when logged in a different entity --- htdocs/viewimage.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 69d0b38571c..fda4cdfbf20 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -186,6 +186,13 @@ $refname = basename(dirname($original_file)."/"); // Security check if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart', 0, 0, 1); +// When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output +// is not set on the requested entity, but they are public documents, so reset entity +if ($modulepart === 'medias' && $entity != $conf->entity) { + $conf->entity = $entity; + $conf->setValues($db); +} + $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; From 8ad310c8a04def966dfa0aff400472ed20594de6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 13:01:24 +0100 Subject: [PATCH 234/328] FIX Bad filter on date on salary list --- htdocs/salaries/list.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 2e77c29cd01..4f7ea9d777c 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -260,12 +260,19 @@ if ($search_user) { if ($search_label) { $sql .= natural_search(array('s.label'), $search_label); } -if (!empty($search_date_start_from) && !empty($search_date_start_to)) { - $sql .= " AND s.datesp BETWEEN '".$db->idate($search_date_start_from)."' AND '".$db->idate($search_date_start_to)."'"; +if (!empty($search_date_start_from)) { + $sql .= " AND s.datesp >= '".$db->idate($search_date_start_from)."'"; } -if (!empty($search_date_end_from) && !empty($search_date_end_to)) { - $sql .= " AND s.dateep BETWEEN '".$db->idate($search_date_end_from)."' AND '".$db->idate($search_date_end_to)."'"; +if (!empty($search_date_end_from)) { + $sql .= " AND s.dateep >= '".$db->idate($search_date_end_from)."'"; } +if (!empty($search_date_start_to)) { + $sql .= " AND s.datesp <= '".$db->idate($search_date_start_to)."'"; +} +if (!empty($search_date_end_to)) { + $sql .= " AND s.dateep <= '".$db->idate($search_date_end_to)."'"; +} + if ($search_amount) { $sql .= natural_search("s.amount", $search_amount, 1); } From 12db2a8f67f31e41179d969622511c4d86ff96e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 13:02:49 +0100 Subject: [PATCH 235/328] Doc --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0f57222a6ce..6a1bac203bb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9111,6 +9111,7 @@ function dol_getmypid() * 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4' * @param integer $nofirstand 1=Do not output the first 'AND' * @return string $res The statement to append to the SQL query + * @see dolSqlDateFilter() */ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) { From 279a8c9df5f5996b7ee1403595e46cbf41fcab34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 14:39:10 +0100 Subject: [PATCH 236/328] Code comment --- htdocs/core/modules/import/import_csv.modules.php | 2 ++ htdocs/core/modules/import/import_xlsx.modules.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 781c22ce7e3..7d535520496 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -716,6 +716,8 @@ class ImportCsv extends ModeleImports } // We add hidden fields (but only if there is at least one field to add into table) + // We process here all the fields that were declared into the array ->import_fieldshidden_array of the descriptor file. + // Previously we processed the ->import_fields_array. if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 1c38f52cbfc..0effa87cb3c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -757,6 +757,8 @@ class ImportXlsx extends ModeleImports } // We add hidden fields (but only if there is at least one field to add into table) + // We process here all the fields that were declared into the array $this->import_fieldshidden_array of the descriptor file. + // Previously we processed the ->import_fields_array. if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { From 2b7797fa75c3252c119e3409f916d627e0be8350 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 15:02:45 +0100 Subject: [PATCH 237/328] Clean code --- .../modules/import/import_csv.modules.php | 24 ++++--------------- .../modules/import/import_xlsx.modules.php | 22 +++-------------- 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 7d535520496..da4e884d30f 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -613,18 +613,7 @@ class ImportCsv extends ModeleImports } $classinstance = new $class($this->db); $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); - if ($res < 0) { - if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { - $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); - } else { - $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; - } - $this->errors[$error]['type'] = 'FOREIGNKEY'; - $errorforthistable++; - $error++; - } else { - $newval = $arrayrecord[($key - 1)]['val']; //We get new value computed. - } + $newval = $res; // We get new value computed. } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { @@ -751,14 +740,9 @@ class ImportCsv extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); - if ($res < 0) { - if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); - else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; - $this->errors[$error]['type'] = 'FOREIGNKEY'; - $errorforthistable++; - $error++; - } + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname)); + $listfields[] = $fieldname; + $listvalues[] = $res; } } } else { diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 0effa87cb3c..2b9d4f9af7c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -654,18 +654,7 @@ class ImportXlsx extends ModeleImports } $classinstance = new $class($this->db); $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); - if ($res < 0) { - if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { - $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); - } else { - $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; - } - $this->errors[$error]['type'] = 'FOREIGNKEY'; - $errorforthistable++; - $error++; - } else { - $newval = $arrayrecord[($key)]['val']; //We get new value computed. - } + $newval = $res; // We get new value computed. } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { @@ -793,13 +782,8 @@ class ImportXlsx extends ModeleImports } $classinstance = new $class($this->db); $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); - if ($res < 0) { - if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); - else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; - $this->errors[$error]['type'] = 'FOREIGNKEY'; - $errorforthistable++; - $error++; - } + $listfields[] = $fieldname; + $listvalues[] = $res; } } } else { From b59196d3f9717be7a11e18b818f39a01e671b38d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 23 Mar 2022 15:55:50 +0100 Subject: [PATCH 238/328] fix : Nested ternary expressions (without parentheses) deprecated in PHP 7.4. Targeting PHP 8.1.0. --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index c1e0468b868..39c76e780c8 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1805,7 +1805,7 @@ class pdf_sponge extends ModelePDFFactures // Credit note if ($creditnoteamount) { $labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes"); - $labeltouse .= (is_object($outputlangsbis) ? ' / '.($outputlangsbis->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangsbis->transnoentities("CreditNotesOrExcessReceived") : $outputlangsbis->transnoentities("CreditNotes") : ''); + $labeltouse .= (is_object($outputlangsbis) ? (' / '.($outputlangsbis->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangsbis->transnoentities("CreditNotesOrExcessReceived") : $outputlangsbis->transnoentities("CreditNotes")) : ''); $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $labeltouse, 0, 'L', 0); From 01396cc07aea83ae20565bb4feadb62e1348d362 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 15:58:55 +0100 Subject: [PATCH 239/328] Code comment --- htdocs/core/actions_dellink.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index fbecacce515..9bf56b2f876 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -32,7 +32,7 @@ $addlinkid = GETPOST('idtolinkto', 'int'); $addlinkref = GETPOST('reftolinkto', 'alpha'); $cancellink = GETPOST('cancel', 'alpha'); -// Link invoice to order +// Link object to another object if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id > 0 && $addlinkid > 0) { $object->fetch($id); $object->fetch_thirdparty(); @@ -61,7 +61,7 @@ if ($action == 'addlinkbyref' && ! empty($permissiondellink) && !$cancellink && } } -// Delete link +// Delete link in table llx_element_element if ($action == 'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) { $result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid); if ($result < 0) { From 61ed36e1814470398bb941dbff7651eb3ba6b6ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:19:06 +0100 Subject: [PATCH 240/328] Update other.lang --- htdocs/langs/en_US/other.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 7b4c2d86bc9..3b71c29da24 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -302,4 +302,4 @@ SelectTheTypeOfObjectToAnalyze=Select an object to view its statistics... ConfirmBtnCommonContent = Are you sure you want to "%s" ? ConfirmBtnCommonTitle = Confirm your action CloseDialog = Close -Autofill = Auto fill +Autofill = Autofill From eac3a6cf86ac872f7cb868468fd715a44d08f634 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:38:57 +0100 Subject: [PATCH 241/328] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 517d09ba453..89ba7147694 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8771,15 +8771,18 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, complete_substitutions_array($substitutionarray, $langs, $object, array('needforkey'=>$values[2])); $label = make_substitutions($reg[1], $substitutionarray); } else { - $labeltemp = explode(',', $values[2]); + $labeltemp = explode(':', $values[2]); $label = $langs->trans($labeltemp[0]); if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { dol_include_once($labeltemp[2]); - $obj = new $labeltemp[1]($db); - $function = $labeltemp[3]; - if (method_exists($obj, $function)) { - $nbrec = $obj->$function($object->id, $obj); - $label .= ''.$nbrec.''; + $classtoload = $labeltemp[1]; + if (class_exists($classtoload)) { + $obj = new $classtoload($db); + $function = $labeltemp[3]; + if (method_exists($obj, $function)) { + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; + } } } } From d82aae1871989014ca26d049e3540ba199e1ce04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:39:55 +0100 Subject: [PATCH 242/328] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 89ba7147694..4dd675f9a28 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8779,7 +8779,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, if (class_exists($classtoload)) { $obj = new $classtoload($db); $function = $labeltemp[3]; - if (method_exists($obj, $function)) { + if ($obj && $function && method_exists($obj, $function)) { $nbrec = $obj->$function($object->id, $obj); $label .= ''.$nbrec.''; } From fcc8a953ae6479c956ff34ef0689fa82eb1d1da7 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Wed, 23 Mar 2022 16:51:36 +0100 Subject: [PATCH 243/328] Update 15.0.0-16.0.0.sql --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 2933acd00d7..8eb37fb4f31 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -30,6 +30,8 @@ -- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); +ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT 0; + -- Missing in v15 or lower ALTER TABLE llx_c_actioncomm MODIFY COLUMN libelle varchar(128); From 95c8dfcaa0676bde719be1db7fd305c69eb14d73 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Wed, 23 Mar 2022 16:53:12 +0100 Subject: [PATCH 244/328] Update llx_holiday.sql --- htdocs/install/mysql/tables/llx_holiday.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index 992f9502394..d21889e3116 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -31,7 +31,8 @@ description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning -statut integer NOT NULL DEFAULT '1', +nb_open_day double(24,8) DEFAULT 0, +statut integer NOT NULL DEFAULT 1, fk_validator integer NOT NULL, -- who should approve date_valid DATETIME DEFAULT NULL, -- date approval (both date valid and date_approval) fk_user_valid integer DEFAULT NULL, -- user approval (both user valid and user that approved) From ee611e8517f2c0e5cc9520bc892f5a95a3615803 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:56:07 +0100 Subject: [PATCH 245/328] Hide not important options --- htdocs/admin/propal.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index da886630ac9..3bc745a1101 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -625,6 +625,7 @@ print ''; print ''; // default update prices on cloning a proposal +/* print '
'; print ''; print ''; @@ -643,6 +644,7 @@ if (!empty($conf->use_javascript_ajax)) { print ''; print ''; print '
'; +*/ /* print '
'; From 161e79575905270a14f182a1591f861053db546a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 17:12:25 +0100 Subject: [PATCH 246/328] Look and feel --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 4b78f22ceac..00b57141f68 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3058,7 +3058,7 @@ if ($action == 'create') { if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE)) { $text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')); } - print info_admin($text, 0, 0, 0).'
'; + print info_admin($text, 0, 0, 0, 'opacitymedium').'
'; } print ''; From 1266da05ef060cb09f594684138afb02e7115860 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 23 Mar 2022 19:43:34 +0100 Subject: [PATCH 247/328] Lang fr --- htdocs/langs/fr_FR/bills.lang | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index d1a0dbbbe92..f03afd6a6b3 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -81,14 +81,14 @@ PaymentsReports=Rapports de règlements PaymentsAlreadyDone=Versements déjà effectués PaymentsBackAlreadyDone=Remboursements déjà effectués PaymentRule=Mode de paiement -PaymentMode=Payment method -PaymentModes=Payment methods -DefaultPaymentMode=Default Payment method +PaymentMode=Mode de paiement +PaymentModes=Modes de paiement +DefaultPaymentMode=Default Mode de paiement DefaultBankAccount=Compte bancaire par défaut -IdPaymentMode=Payment method (id) -CodePaymentMode=Payment method (code) -LabelPaymentMode=Payment method (label) -PaymentModeShort=Payment method +IdPaymentMode=Mode de paiement (id) +CodePaymentMode=Mode de paiement (code) +LabelPaymentMode=Mode de paiement (label) +PaymentModeShort=Mode de paiement PaymentTerm=Condition de règlement PaymentConditions=Conditions de règlement PaymentConditionsShort=Conditions de règlement From f70ceb93989921f906bf86c67be09b1b937a6543 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 15 Mar 2022 11:18:11 +0100 Subject: [PATCH 248/328] add more specific context and doAction hook --- htdocs/admin/dict.php | 806 ++++++++++++++++++++++-------------------- 1 file changed, 416 insertions(+), 390 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 05699347806..7ea895c506a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -694,445 +694,471 @@ if ($id == 10) { * Actions */ +$parameters = array( + 'id' =>$id, + 'rowid' =>$rowid, + 'code' =>$code, + 'confirm' =>$confirm, + 'entity' =>$entity, + 'taborder' =>$taborder, + 'tabname' =>$tabname, + 'tablib' =>$tablib, + 'tabsql' =>$tabsql, + 'tabsqlsort' =>$tabsqlsort, + 'tabfield' =>$tabfield, + 'tabfieldvalue' =>$tabfieldvalue, + 'tabfieldinsert'=>$tabfieldinsert, + 'tabrowid' =>$tabrowid, + 'tabcond' =>$tabcond, + 'tabhelp' =>$tabhelp, + 'tabcomplete' =>$tabcomplete +); +$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 (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { $search_country_id = ''; $search_code = ''; } -// Actions add or modify an entry into a dictionary -if (GETPOST('actionadd') || GETPOST('actionmodify')) { - $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); - $listfieldinsert = explode(',', $tabfieldinsert[$id]); - $listfieldmodify = explode(',', $tabfieldinsert[$id]); - $listfieldvalue = explode(',', $tabfieldvalue[$id]); +if (empty($reshook)) +{ + // Actions add or modify an entry into a dictionary + if (GETPOST('actionadd') || GETPOST('actionmodify')) { + $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); + $listfieldinsert = explode(',', $tabfieldinsert[$id]); + $listfieldmodify = explode(',', $tabfieldinsert[$id]); + $listfieldvalue = explode(',', $tabfieldvalue[$id]); - // Check that all mandatory fields are filled - $ok = 1; - foreach ($listfield as $f => $value) { - // Discard check of mandatory fields for country for some tables - if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { - continue; // For some pages, country is not mandatory + // Check that all mandatory fields are filled + $ok = 1; + foreach ($listfield as $f => $value) { + // Discard check of mandatory fields for country for some tables + if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { + continue; // For some pages, country is not mandatory + } + if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { + continue; // For some pages, country is not mandatory + } + // Discard check of mandatory fiedls for other fields + if ($value == 'localtax1' && !GETPOST('localtax1_type')) { + continue; + } + if ($value == 'localtax2' && !GETPOST('localtax2_type')) { + continue; + } + if ($value == 'color' && !GETPOST('color')) { + continue; + } + if ($value == 'formula' && !GETPOST('formula')) { + continue; + } + if ($value == 'dayrule' && !GETPOST('dayrule')) { + continue; + } + if ($value == 'sortorder') { + continue; // For a column name 'sortorder', we use the field name 'position' + } + if ((!GETPOSTISSET($value) || GETPOST($value) == '') + && (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory + && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10 + ) + ) { + $ok = 0; + $fieldnamekey = $value; + // We take translate key of field + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { + $fieldnamekey = 'Label'; + } + if ($fieldnamekey == 'libelle_facture') { + $fieldnamekey = 'LabelOnDocuments'; + } + if ($fieldnamekey == 'nbjour') { + $fieldnamekey = 'NbOfDays'; + } + if ($fieldnamekey == 'decalage') { + $fieldnamekey = 'Offset'; + } + if ($fieldnamekey == 'module') { + $fieldnamekey = 'Module'; + } + if ($fieldnamekey == 'code') { + $fieldnamekey = 'Code'; + } + if ($fieldnamekey == 'note') { + $fieldnamekey = 'Note'; + } + if ($fieldnamekey == 'taux') { + $fieldnamekey = 'Rate'; + } + if ($fieldnamekey == 'type') { + $fieldnamekey = 'Type'; + } + if ($fieldnamekey == 'position') { + $fieldnamekey = 'Position'; + } + if ($fieldnamekey == 'unicode') { + $fieldnamekey = 'Unicode'; + } + if ($fieldnamekey == 'deductible') { + $fieldnamekey = 'Deductible'; + } + if ($fieldnamekey == 'sortorder') { + $fieldnamekey = 'SortOrder'; + } + if ($fieldnamekey == 'category_type') { + $fieldnamekey = 'Calculated'; + } + if ($fieldnamekey == 'revenuestamp_type') { + $fieldnamekey = 'TypeOfRevenueStamp'; + } + if ($fieldnamekey == 'use_default') { + $fieldnamekey = 'UseByDefault'; + } + + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); + } } - if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { - continue; // For some pages, country is not mandatory + // Other checks + if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { + $ok = 0; + setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); } - // Discard check of mandatory fiedls for other fields - if ($value == 'localtax1' && !GETPOST('localtax1_type')) { - continue; - } - if ($value == 'localtax2' && !GETPOST('localtax2_type')) { - continue; - } - if ($value == 'color' && !GETPOST('color')) { - continue; - } - if ($value == 'formula' && !GETPOST('formula')) { - continue; - } - if ($value == 'dayrule' && !GETPOST('dayrule')) { - continue; - } - if ($value == 'sortorder') { - continue; // For a column name 'sortorder', we use the field name 'position' - } - if ((!GETPOSTISSET($value) || GETPOST($value) == '') - && (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory - && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10 - ) - ) { + if (GETPOSTISSET("code")) { + if (GETPOST("code") == '0') { $ok = 0; - $fieldnamekey = $value; - // We take translate key of field - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { - $fieldnamekey = 'Label'; + setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); } - if ($fieldnamekey == 'libelle_facture') { - $fieldnamekey = 'LabelOnDocuments'; - } - if ($fieldnamekey == 'nbjour') { - $fieldnamekey = 'NbOfDays'; - } - if ($fieldnamekey == 'decalage') { - $fieldnamekey = 'Offset'; - } - if ($fieldnamekey == 'module') { - $fieldnamekey = 'Module'; - } - if ($fieldnamekey == 'code') { - $fieldnamekey = 'Code'; - } - if ($fieldnamekey == 'note') { - $fieldnamekey = 'Note'; - } - if ($fieldnamekey == 'taux') { - $fieldnamekey = 'Rate'; - } - if ($fieldnamekey == 'type') { - $fieldnamekey = 'Type'; - } - if ($fieldnamekey == 'position') { - $fieldnamekey = 'Position'; - } - if ($fieldnamekey == 'unicode') { - $fieldnamekey = 'Unicode'; - } - if ($fieldnamekey == 'deductible') { - $fieldnamekey = 'Deductible'; - } - if ($fieldnamekey == 'sortorder') { - $fieldnamekey = 'SortOrder'; - } - if ($fieldnamekey == 'category_type') { - $fieldnamekey = 'Calculated'; - } - if ($fieldnamekey == 'revenuestamp_type') { - $fieldnamekey = 'TypeOfRevenueStamp'; - } - if ($fieldnamekey == 'use_default') { - $fieldnamekey = 'UseByDefault'; - } - - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } - } - // Other checks - if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { - $ok = 0; - setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); - } - if (GETPOSTISSET("code")) { - if (GETPOST("code") == '0') { + if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { + if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) { // Field country is no mandatory for such dictionaries + $_POST["country"] = ''; + } else { + $ok = 0; + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); + } + } + if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) { $ok = 0; - setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); + setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); } - } - if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { - if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) { // Field country is no mandatory for such dictionaries - $_POST["country"] = ''; - } else { - $ok = 0; - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); + + // Clean some parameters + if ((GETPOST("localtax1_type") || (GETPOST('localtax1_type') == '0')) && !GETPOST("localtax1")) { + $_POST["localtax1"] = '0'; // If empty, we force to 0 + } + if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { + $_POST["localtax2"] = '0'; // If empty, we force to 0 + } + if (GETPOST("accountancy_code") <= 0) { + $_POST["accountancy_code"] = ''; // If empty, we force to null + } + if (GETPOST("accountancy_code_sell") <= 0) { + $_POST["accountancy_code_sell"] = ''; // If empty, we force to null + } + if (GETPOST("accountancy_code_buy") <= 0) { + $_POST["accountancy_code_buy"] = ''; // If empty, we force to null + } + if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary + $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', GETPOST("code")); } - } - if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) { - $ok = 0; - setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); - } - // Clean some parameters - if ((GETPOST("localtax1_type") || (GETPOST('localtax1_type') == '0')) && !GETPOST("localtax1")) { - $_POST["localtax1"] = '0'; // If empty, we force to 0 - } - if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { - $_POST["localtax2"] = '0'; // If empty, we force to 0 - } - if (GETPOST("accountancy_code") <= 0) { - $_POST["accountancy_code"] = ''; // If empty, we force to null - } - if (GETPOST("accountancy_code_sell") <= 0) { - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null - } - if (GETPOST("accountancy_code_buy") <= 0) { - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - } - if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary - $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', GETPOST("code")); - } + // If check ok and action add, add the line + if ($ok && GETPOST('actionadd')) { + if ($tabrowid[$id]) { + // Get free id for insert + $newid = 0; + $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; + $result = $db->query($sql); + if ($result) { + $obj = $db->fetch_object($result); + $newid = ($obj->newid + 1); + } else { + dol_print_error($db); + } + } - // If check ok and action add, add the line - if ($ok && GETPOST('actionadd')) { - if ($tabrowid[$id]) { - // Get free id for insert - $newid = 0; - $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; - $result = $db->query($sql); - if ($result) { - $obj = $db->fetch_object($result); - $newid = ($obj->newid + 1); + // Add new entry + $sql = "INSERT INTO ".$tabname[$id]." ("; + // List of fields + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { + $sql .= $tabrowid[$id].","; + } + $sql .= $tabfieldinsert[$id]; + $sql .= ",active)"; + $sql .= " VALUES("; + + // List of values + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { + $sql .= $newid.","; + } + $i = 0; + foreach ($listfieldinsert as $f => $value) { + $keycode = $listfieldvalue[$i]; + if (empty($keycode)) { + $keycode = $value; + } + + if ($value == 'price' || preg_match('/^amount/i', $value)) { + $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); + } elseif ($value == 'taux' || $value == 'localtax1') { + $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z + } elseif ($value == 'entity') { + $_POST[$keycode] = getEntity($tabname[$id]); + } + + if ($i) { + $sql .= ","; + } + + if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + $sql .= (int) GETPOST('position', 'int'); + } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { + $sql .= "null"; // For vat, we want/accept code = '' + } elseif ($keycode == 'content') { + $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; + } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { + $sql .= (int) GETPOST($keycode, 'int'); + } else { + $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + } + + $i++; + } + $sql .= ",1)"; + + dol_syslog("actionadd", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) { // Add is ok + setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); + + // Clean $_POST array, we keep only id of dictionary + if ($id == 10 && GETPOST('country', 'int') > 0) { + $search_country_id = GETPOST('country', 'int'); + } + $_POST = array('id'=>$id); } else { - dol_print_error($db); + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + } else { + dol_print_error($db); + } } } - // Add new entry - $sql = "INSERT INTO ".$tabname[$id]." ("; - // List of fields - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { - $sql .= $tabrowid[$id].","; - } - $sql .= $tabfieldinsert[$id]; - $sql .= ",active)"; - $sql .= " VALUES("; - - // List of values - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { - $sql .= $newid.","; - } - $i = 0; - foreach ($listfieldinsert as $f => $value) { - $keycode = $listfieldvalue[$i]; - if (empty($keycode)) { - $keycode = $value; - } - - if ($value == 'price' || preg_match('/^amount/i', $value)) { - $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); - } elseif ($value == 'taux' || $value == 'localtax1') { - $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z - } elseif ($value == 'entity') { - $_POST[$keycode] = getEntity($tabname[$id]); - } - - if ($i) { - $sql .= ","; - } - - if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' - $sql .= (int) GETPOST('position', 'int'); - } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } elseif ($keycode == 'content') { - $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { - $sql .= (int) GETPOST($keycode, 'int'); + // If verif ok and action modify, modify the line + if ($ok && GETPOST('actionmodify')) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; } else { - $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + $rowidcol = "rowid"; } - $i++; - } - $sql .= ",1)"; - - dol_syslog("actionadd", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { // Add is ok - setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); - - // Clean $_POST array, we keep only id of dictionary - if ($id == 10 && GETPOST('country', 'int') > 0) { - $search_country_id = GETPOST('country', 'int'); + // Modify entry + $sql = "UPDATE ".$tabname[$id]." SET "; + // Modifie valeur des champs + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { + $sql .= $tabrowid[$id]."="; + $sql .= "'".$db->escape($rowid)."', "; } - $_POST = array('id'=>$id); - } else { - if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + $i = 0; + foreach ($listfieldmodify as $field) { + $keycode = $listfieldvalue[$i]; + if (empty($keycode)) { + $keycode = $field; + } + + if ($field == 'price' || preg_match('/^amount/i', $field)) { + $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); + } elseif ($field == 'taux' || $field == 'localtax1') { + $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z + } elseif ($field == 'entity') { + $_POST[$keycode] = getEntity($tabname[$id]); + } + + if ($i) { + $sql .= ","; + } + $sql .= $field."="; + if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + $sql .= (int) GETPOST('position', 'int'); + } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { + $sql .= "null"; // For vat, we want/accept code = '' + } elseif ($keycode == 'content') { + $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; + } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { + $sql .= (int) GETPOST($keycode, 'int'); + } else { + $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + } + + $i++; + } + if (in_array($rowidcol, array('code', 'code_iso'))) { + $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; } else { - dol_print_error($db); + $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); + } + if (in_array('entity', $listfieldmodify)) { + $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0)); + } + + dol_syslog("actionmodify", LOG_DEBUG); + //print $sql; + $resql = $db->query($sql); + if (!$resql) { + setEventMessages($db->error(), null, 'errors'); } } + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } - // If verif ok and action modify, modify the line - if ($ok && GETPOST('actionmodify')) { + if (GETPOST('actioncancel')) { + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition + } + + if ($action == 'confirm_delete' && $confirm == 'yes') { // delete if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } - // Modify entry - $sql = "UPDATE ".$tabname[$id]." SET "; - // Modifie valeur des champs - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { - $sql .= $tabrowid[$id]."="; - $sql .= "'".$db->escape($rowid)."', "; - } - $i = 0; - foreach ($listfieldmodify as $field) { - $keycode = $listfieldvalue[$i]; - if (empty($keycode)) { - $keycode = $field; - } + $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - if ($field == 'price' || preg_match('/^amount/i', $field)) { - $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); - } elseif ($field == 'taux' || $field == 'localtax1') { - $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z - } elseif ($field == 'entity') { - $_POST[$keycode] = getEntity($tabname[$id]); - } - - if ($i) { - $sql .= ","; - } - $sql .= $field."="; - if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' - $sql .= (int) GETPOST('position', 'int'); - } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } elseif ($keycode == 'content') { - $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { - $sql .= (int) GETPOST($keycode, 'int'); + dol_syslog("delete", LOG_DEBUG); + $result = $db->query($sql); + if (!$result) { + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } else { - $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + dol_print_error($db); } - - $i++; - } - if (in_array($rowidcol, array('code', 'code_iso'))) { - $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; - } else { - $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); - } - if (in_array('entity', $listfieldmodify)) { - $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0)); - } - - dol_syslog("actionmodify", LOG_DEBUG); - //print $sql; - $resql = $db->query($sql); - if (!$resql) { - setEventMessages($db->error(), null, 'errors'); } } - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} -if (GETPOST('actioncancel')) { - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} + // activate + if ($action == $acts[0]) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } -if ($action == 'confirm_delete' && $confirm == 'yes') { // delete - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } - $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - - dol_syslog("delete", LOG_DEBUG); - $result = $db->query($sql); - if (!$result) { - if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); + // disable + if ($action == $acts[1]) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } + } + + // favorite + if ($action == 'activate_favorite') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } + } + + // disable favorite + if ($action == 'disable_favorite') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } + } + + // Is in EEC - Activate + if ($action == 'activate_eec') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } + } + + // Is in EEC - Disable + if ($action == 'disable_eec') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { dol_print_error($db); } } } - -// activate -if ($action == $acts[0]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// disable -if ($action == $acts[1]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// favorite -if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// disable favorite -if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// Is in EEC - Activate -if ($action == 'activate_eec') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// Is in EEC - Disable -if ($action == 'disable_eec') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - /* * View */ From efbaf030ec90c0003843d36f5e90e46c6eff716e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 24 Mar 2022 08:41:13 +0000 Subject: [PATCH 249/328] Fixing style errors. --- htdocs/admin/dict.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7ea895c506a..e0daa01c417 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -723,8 +723,7 @@ if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', $search_code = ''; } -if (empty($reshook)) -{ +if (empty($reshook)) { // Actions add or modify an entry into a dictionary if (GETPOST('actionadd') || GETPOST('actionmodify')) { $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); From 7fb343b3ef66b8e2835f4676c0a17ecffdeec7a4 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 24 Mar 2022 09:42:02 +0100 Subject: [PATCH 250/328] add context --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7ea895c506a..346d6bec216 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -94,7 +94,7 @@ if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 $search_code = GETPOST('search_code', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('admin')); +$hookmanager->initHooks(array('admin', 'dictionaryadmin')); // This page is a generic page to edit dictionaries // Put here declaration of dictionaries properties From 37e589807d6ae1e6178d281a56f68068ff7aefbd Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Mar 2022 14:01:30 +0100 Subject: [PATCH 251/328] add trigger create on expensereportdet --- .../class/expensereport.class.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index be49b0a8c0c..fa8f9a6e1a8 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2752,6 +2752,17 @@ class ExpenseReportLine if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'expensereport_det'); + + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('EXPENSE_REPORT_DET_CREATE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + if (!$fromaddline) { $tmpparent = new ExpenseReport($this->db); $tmpparent->fetch($this->fk_expensereport); @@ -2908,4 +2919,40 @@ class ExpenseReportLine return -2; } } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Call trigger based on this instance. + * Some context information may also be provided into array property this->context. + * NB: Error from trigger are stacked in interface->errors + * NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction. + * + * @param string $triggerName trigger's name to execute + * @param User $user Object user + * @return int Result of run_triggers + */ + public function call_trigger($triggerName, $user) + { + // phpcs:enable + global $langs, $conf; + + if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. + include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; + $langs = new Translate('', $conf); + } + + include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; + $interface = new Interfaces($this->db); + $result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf); + + if ($result < 0) { + if (!empty($this->errors)) { + $this->errors = array_unique(array_merge($this->errors, $interface->errors)); // We use array_unique because when a trigger call another trigger on same object, this->errors is added twice. + } else { + $this->errors = $interface->errors; + } + } + return $result; + } + } From a577956b737813fb4625496361a0431afd82cc9c Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Mar 2022 14:57:30 +0100 Subject: [PATCH 252/328] ajout de nom de class dans les entes de ligne det en affichage --- htdocs/expensereport/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 307294d5422..696faf88514 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2043,24 +2043,24 @@ if ($action == 'create') { $i = 0; $total = 0; print ''; - print ''.$langs->trans('LineNb').''; + print ''.$langs->trans('LineNb').''; //print ''.$langs->trans('Piece').''; - print ''.$langs->trans('Date').''; + print ''.$langs->trans('Date').''; if (!empty($conf->projet->enabled)) { - print ''.$langs->trans('Project').''; + print ''.$langs->trans('Project').''; } - print ''.$langs->trans('Type').''; + print ''.$langs->trans('Type').''; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - print ''.$langs->trans('CarCategory').''; + print ''.$langs->trans('CarCategory').''; } - print ''.$langs->trans('Description').''; - print ''.$langs->trans('VAT').''; - print ''.$langs->trans('PriceUHT').''; - print ''.$langs->trans('PriceUTTC').''; - print ''.$langs->trans('Qty').''; + print ''.$langs->trans('Description').''; + print ''.$langs->trans('VAT').''; + print ''.$langs->trans('PriceUHT').''; + print ''.$langs->trans('PriceUTTC').''; + print ''.$langs->trans('Qty').''; if ($action != 'editline') { - print ''.$langs->trans('AmountHT').''; - print ''.$langs->trans('AmountTTC').''; + print ''.$langs->trans('AmountHT').''; + print ''.$langs->trans('AmountTTC').''; } // Picture print ''; From 4bc75f6487a83db12b85dd91d7b8457bc6e3bcc1 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Mar 2022 15:05:38 +0100 Subject: [PATCH 253/328] ajout class name on create det --- htdocs/expensereport/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 696faf88514..14b0b381ba7 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2473,21 +2473,21 @@ if ($action == 'create') { include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php'; include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php'; - print ''; + print ''; print ''; - print ''.$langs->trans('Date').''; + print ''.$langs->trans('Date').''; if (!empty($conf->projet->enabled)) { print ''.$form->textwithpicto($langs->trans('Project'), $langs->trans("ClosedProjectsAreHidden")).''; } - print ''.$langs->trans('Type').''; + print ''.$langs->trans('Type').''; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''.$langs->trans('CarCategory').''; } - print ''.$langs->trans('Description').''; - print ''.$langs->trans('VAT').''; - print ''.$langs->trans('PriceUHT').''; - print ''.$langs->trans('PriceUTTC').''; - print ''.$langs->trans('Qty').''; + print ''.$langs->trans('Description').''; + print ''.$langs->trans('VAT').''; + print ''.$langs->trans('PriceUHT').''; + print ''.$langs->trans('PriceUTTC').''; + print ''.$langs->trans('Qty').''; print ''; print ''; print ''; From 7be3c8b64d7577b7419cd65e2995019d2a91f6b6 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Mar 2022 17:21:11 +0100 Subject: [PATCH 254/328] ajout de class pour les --- htdocs/expensereport/card.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 14b0b381ba7..79dd5e3b1c1 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2042,7 +2042,7 @@ if ($action == 'create') { if (!empty($object->lines)) { $i = 0; $total = 0; - print ''; + print ''; print ''.$langs->trans('LineNb').''; //print ''.$langs->trans('Piece').''; print ''.$langs->trans('Date').''; @@ -2080,19 +2080,19 @@ if ($action == 'create') { $numline = $i + 1; if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int')) { - print ''; + print ''; // Num - print ''; + print ''; print $numline; print ''; // Date - print ''.dol_print_date($db->jdate($line->date), 'day').''; + print ''.dol_print_date($db->jdate($line->date), 'day').''; // Project if (!empty($conf->projet->enabled)) { - print ''; + print ''; if ($line->fk_project > 0) { $projecttmp->id = $line->fk_project; $projecttmp->ref = $line->projet_ref; @@ -2118,26 +2118,26 @@ if ($action == 'create') { } // Type of fee - print ''; + print ''; $labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code)); print $labeltype; print ''; // IK if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - print ''; + print ''; print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label'); print ''; } // Comment - print ''.dol_nl2br($line->comments).''; + print ''.dol_nl2br($line->comments).''; // VAT rate - print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; + print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; // Unit price HT - print ''; + print ''; if (!empty($line->value_unit_ht)) { print price($line->value_unit_ht); } else { @@ -2147,13 +2147,13 @@ if ($action == 'create') { } print ''; - print ''.price($line->value_unit).''; + print ''.price($line->value_unit).''; - print ''.dol_escape_htmltag($line->qty).''; + print ''.dol_escape_htmltag($line->qty).''; if ($action != 'editline') { - print ''.price($line->total_ht).''; - print ''.price($line->total_ttc).''; + print ''.price($line->total_ht).''; + print ''.price($line->total_ttc).''; } // Column with preview From 71c1f2de3cb2474928bf7a0039495e230e6e4576 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 24 Mar 2022 09:38:23 +0100 Subject: [PATCH 255/328] add class td --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 79dd5e3b1c1..1f874acca91 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2420,7 +2420,7 @@ if ($action == 'create') { // Add line with link to add new file or attach to an existing file print ''; - print ''; + print ''; print ''.$langs->trans("UploadANewFileNow"); print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; From 671ab9a412b64cd926c08158cf2b3ab605f6f56b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 24 Mar 2022 08:55:18 +0000 Subject: [PATCH 256/328] Fixing style errors. --- htdocs/expensereport/class/expensereport.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index fa8f9a6e1a8..b85691c586d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2954,5 +2954,4 @@ class ExpenseReportLine } return $result; } - } From 5f6437cbde2bac5d408b7f8ff5b21b8373bfbd77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 24 Mar 2022 10:46:30 +0100 Subject: [PATCH 257/328] remove debug --- htdocs/partnership/partnership_list.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index dc9958fa3df..0f4aa61f621 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -245,10 +245,8 @@ if (empty($reshook)) { $nbok = 0; foreach ($toselect as $toselectid) { $result = $objecttmp->fetch($toselectid); - var_dump($objecttmp->status); if ($result > 0) { $result = $objecttmp->cancel($user, 0); - var_dump($result); if ($result == 0) { setEventMessages($langs->trans('StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)), null, 'warnings'); $error++; From e157dc117db796e51061982685d8a03968e21c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 24 Mar 2022 10:51:01 +0100 Subject: [PATCH 258/328] replace debug --- htdocs/salaries/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 935b8deb83d..ebb46d775c7 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2014-2020 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Charlie BENKE - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -270,7 +270,7 @@ if ($action == 'add' && empty($cancel)) { $ret = $object->create($user); if ($ret < 0) { - var_dump($ret); + setEventMessages($object->error, $object->errors, 'errors'); $error++; } if (!empty($auto_create_paiement) && !$error) { From 6dfad5d69fc97ae12f681e1ab974db66dc621b3d Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 24 Mar 2022 11:09:39 +0100 Subject: [PATCH 259/328] facture/card.php: replace redirection by = '' --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 1540846d99a..02120c57d99 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -306,8 +306,7 @@ if (empty($reshook)) { $last_of_type = $object->willBeLastOfSameType(); if (empty($object->date_validation) && !$last_of_type[0]) { setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); - header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); - exit; + $action = ''; } } From 6abeb2804eefa77cc9b1bce8ebad1534c147147e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:47:12 +0100 Subject: [PATCH 260/328] Fix phpcs --- htdocs/comm/propal/list.php | 1 - htdocs/projet/card.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ae9ff62c5b0..f193a9ab87b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -382,7 +382,6 @@ if ($action == "sign" && $permissiontoclose) { foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { - $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;; if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6ce6e20e753..93344b39cd0 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -186,7 +186,7 @@ if (empty($reshook)) { // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case if ($result == -3) { setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors'); - $error++; + $error++; } elseif ($result < 0) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); From 6438a9996036f7e47e1c87e5d0761889fa91f947 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:48:51 +0100 Subject: [PATCH 261/328] Fix php syntax --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f193a9ab87b..7a8fe187570 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -382,7 +382,7 @@ if ($action == "sign" && $permissiontoclose) { foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { - $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;; + $tmpproposal->statut = $tmpproposal::STATUS_SIGNED; if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); } else { From 6c28426b3aacd6917f39196b3fe0eab83cdd037c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:49:34 +0100 Subject: [PATCH 262/328] Fix tab --- htdocs/viewimage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 45f46159aa8..db03a0a79e6 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -113,7 +113,7 @@ if (is_numeric($entity)) { * @ignore * @return void */ -function llxHeader() +function llxHeader()sql { } /** @@ -237,8 +237,8 @@ if (empty($modulepart)) { // When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output // is not set on the requested entity, but they are public documents, so reset entity if ($modulepart === 'medias' && $entity != $conf->entity) { - $conf->entity = $entity; - $conf->setValues($db); + $conf->entity = $entity; + $conf->setValues($db); } $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname); From 154069179b5958ccde7531e58c43f38bcfb4594d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:51:06 +0100 Subject: [PATCH 263/328] Fix php syntax --- htdocs/viewimage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index db03a0a79e6..feec8acf254 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -113,7 +113,7 @@ if (is_numeric($entity)) { * @ignore * @return void */ -function llxHeader()sql +function llxHeader() { } /** From fdfbf05705751fd852e4957bd262c92d48fb8ddd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:00:11 +0100 Subject: [PATCH 264/328] Update card.php --- htdocs/expensereport/card.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1f874acca91..1718425e907 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2080,15 +2080,15 @@ if ($action == 'create') { $numline = $i + 1; if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int')) { - print ''; + print ''; // Num - print ''; + print ''; print $numline; print ''; // Date - print ''.dol_print_date($db->jdate($line->date), 'day').''; + print ''.dol_print_date($db->jdate($line->date), 'day').''; // Project if (!empty($conf->projet->enabled)) { @@ -2118,26 +2118,26 @@ if ($action == 'create') { } // Type of fee - print ''; + print ''; $labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code)); print $labeltype; print ''; // IK if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - print ''; + print ''; print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label'); print ''; } // Comment - print ''.dol_nl2br($line->comments).''; + print ''.dol_nl2br($line->comments).''; // VAT rate - print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; + print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; // Unit price HT - print ''; + print ''; if (!empty($line->value_unit_ht)) { print price($line->value_unit_ht); } else { @@ -2147,17 +2147,17 @@ if ($action == 'create') { } print ''; - print ''.price($line->value_unit).''; + print ''.price($line->value_unit).''; - print ''.dol_escape_htmltag($line->qty).''; + print ''.dol_escape_htmltag($line->qty).''; if ($action != 'editline') { - print ''.price($line->total_ht).''; - print ''.price($line->total_ttc).''; + print ''.price($line->total_ht).''; + print ''.price($line->total_ttc).''; } // Column with preview - print ''; + print ''; if ($line->fk_ecm_files > 0) { $modulepart = 'expensereport'; $maxheightmini = 32; @@ -2227,13 +2227,13 @@ if ($action == 'create') { } print ''; - print ''; + print ''; print !empty($line->rule_warning_message) ? img_warning(html_entity_decode($line->rule_warning_message)) : ' '; print ''; // Ajout des boutons de modification/suppression if (($object->status < ExpenseReport::STATUS_VALIDATED || $object->status == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) { - print ''; + print ''; print 'rowid.'">'; print img_edit(); From ea4b842c865d40cf61c9b224cb81e0e0615228a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:01:53 +0100 Subject: [PATCH 265/328] Update card.php --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1718425e907..9d9eebae245 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2080,7 +2080,7 @@ if ($action == 'create') { $numline = $i + 1; if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int')) { - print ''; + print ''; // Num print ''; From cd969449f23acd0ae78170faf99dd0d2c22421c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:07:04 +0100 Subject: [PATCH 266/328] Replaced duplicated code with extends of CommonObjectLine --- .../class/expensereport.class.php | 38 +------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b85691c586d..f2f0b7dbf0d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -26,6 +26,7 @@ * \brief File to manage Expense Reports */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php'; @@ -2545,7 +2546,7 @@ class ExpenseReport extends CommonObject /** * Class of expense report details lines */ -class ExpenseReportLine +class ExpenseReportLine extends CommonObjectLine { /** * @var DoliDB Database handler. @@ -2919,39 +2920,4 @@ class ExpenseReportLine return -2; } } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Call trigger based on this instance. - * Some context information may also be provided into array property this->context. - * NB: Error from trigger are stacked in interface->errors - * NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction. - * - * @param string $triggerName trigger's name to execute - * @param User $user Object user - * @return int Result of run_triggers - */ - public function call_trigger($triggerName, $user) - { - // phpcs:enable - global $langs, $conf; - - if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. - include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; - $langs = new Translate('', $conf); - } - - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf); - - if ($result < 0) { - if (!empty($this->errors)) { - $this->errors = array_unique(array_merge($this->errors, $interface->errors)); // We use array_unique because when a trigger call another trigger on same object, this->errors is added twice. - } else { - $this->errors = $interface->errors; - } - } - return $result; - } } From 6302e114714752651beec391dd9c8c1a3872da34 Mon Sep 17 00:00:00 2001 From: GregM Date: Thu, 24 Mar 2022 12:24:33 +0100 Subject: [PATCH 267/328] update GRH redirection position --- htdocs/hrm/position.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 86f7a5c74d3..f2fc49197a7 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -160,9 +160,9 @@ if (empty($reshook)) { $backurlforlist = dol_buildpath('/hrm/position_list.php', 1); //$backtopage = dol_buildpath('/hrm/position.php', 1) . '?fk_job=' . ($fk_job > 0 ? $fk_job : '__ID__'); - if (!empty($backtopage) || ($cancel && empty($fk_job))) { + if (!empty($backtopage) || ($cancel && $fk_job <= 0)) { if (!empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { - if (empty($fk_job) && (($action != 'add' && $action != 'create') || $cancel)) { + if ($fk_job == -1 && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { if ($fk_job > 0) { @@ -631,7 +631,7 @@ function DisplayPositionList() print ''; print ''; - $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1) . '?action=create&backtopage=' . urlencode($_SERVER['PHP_SELF'].'?fk_job=' . $fk_job).'&fk_job=' . $fk_job, '', $permissiontoadd); + $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1) . '?action=create&backtopage=' . urlencode($_SERVER['PHP_SELF']).'&fk_job=' . $fk_job, '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); From d952419fac2ef68ca1e062141bd09e352a007e90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:25:42 +0100 Subject: [PATCH 268/328] Update llx_holiday.sql --- htdocs/install/mysql/tables/llx_holiday.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index d21889e3116..85bf97ebe62 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -31,7 +31,7 @@ description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning -nb_open_day double(24,8) DEFAULT 0, +nb_open_day double(24,8) DEFAULT 0, -- denormalized number of open days of holiday. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). statut integer NOT NULL DEFAULT 1, fk_validator integer NOT NULL, -- who should approve date_valid DATETIME DEFAULT NULL, -- date approval (both date valid and date_approval) From 8661902bfa51caf629d3679f52dcefad3f13db60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:26:31 +0100 Subject: [PATCH 269/328] Update llx_holiday.sql --- htdocs/install/mysql/tables/llx_holiday.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index 85bf97ebe62..54d5525bd54 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -31,7 +31,7 @@ description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning -nb_open_day double(24,8) DEFAULT 0, -- denormalized number of open days of holiday. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). +nb_open_day double(24,8) DEFAULT 0, -- denormalized number of open days of holiday. Not always set. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). statut integer NOT NULL DEFAULT 1, fk_validator integer NOT NULL, -- who should approve date_valid DATETIME DEFAULT NULL, -- date approval (both date valid and date_approval) From 27d8691fccec80f6db4d0bf956f86008552e54c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:30:26 +0100 Subject: [PATCH 270/328] Use default to null --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_holiday.sql | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 8eb37fb4f31..26e424fca35 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -30,7 +30,7 @@ -- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); -ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT 0; +ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT NULL; -- Missing in v15 or lower diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index 54d5525bd54..be468bd32a5 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -31,11 +31,11 @@ description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning -nb_open_day double(24,8) DEFAULT 0, -- denormalized number of open days of holiday. Not always set. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). -statut integer NOT NULL DEFAULT 1, -fk_validator integer NOT NULL, -- who should approve -date_valid DATETIME DEFAULT NULL, -- date approval (both date valid and date_approval) -fk_user_valid integer DEFAULT NULL, -- user approval (both user valid and user that approved) +nb_open_day double(24,8) DEFAULT NULL, -- denormalized number of open days of holiday. Not always set. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). +statut integer NOT NULL DEFAULT 1, -- status of leave request +fk_validator integer NOT NULL, -- who should approve the leave +date_valid DATETIME DEFAULT NULL, -- date approval (currently both date valid and date_approval) +fk_user_valid integer DEFAULT NULL, -- user approval (currently both user valid and user that approved) date_approve DATETIME DEFAULT NULL, -- date approval (not used yet) fk_user_approve integer DEFAULT NULL, -- user approval (not used yet) date_refuse DATETIME DEFAULT NULL, From ef204b26206f9bfbc489d3afc21c634b19eb36fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:52:04 +0100 Subject: [PATCH 271/328] Fix column conditions --- htdocs/mrp/mo_production.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index bc1a0457325..1c6f3f7ec39 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -735,9 +735,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $langs->trans("Warehouse"); } print ''; - if ($conf->productbatch->enabled) { + if ($conf->stock->enabled) { // Available - print ''; + print ''; if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print $langs->trans("Stock"); } @@ -958,12 +958,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Lot Batch - print ''; - if ($line2['batch'] != '') { - $tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']); - print $tmpbatch->getNomUrl(1); + if ($conf->productbatch->enabled) { + print ''; + if ($line2['batch'] != '') { + $tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']); + print $tmpbatch->getNomUrl(1); + } + print ''; } - print ''; // Action delete line if ($permissiontodelete) { From a22d66b021344eae2a0ea7352ad37da73c5d63a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 13:31:03 +0100 Subject: [PATCH 272/328] css --- htdocs/bom/class/bom.class.php | 4 ++-- htdocs/core/class/commonobject.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 20ff5fe27b1..09f69993310 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -78,7 +78,7 @@ class BOM extends CommonObject * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). - * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200' + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. @@ -97,7 +97,7 @@ class BOM extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'minwidth300 maxwidth400', 'csslist'=>'tdoverflowmax200'), 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d76d39230ab..a0d1079072a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6668,7 +6668,7 @@ abstract class CommonObject // Add validation state class if (!empty($validationClass)) { - $morecss.= ' '.$validationClass; + $morecss.= $validationClass; } if (in_array($type, array('date'))) { From 8f25477db6844fa8530e1b192da9e88897427d48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 13:41:11 +0100 Subject: [PATCH 273/328] Debug v16 --- htdocs/bom/bom_net_needs.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 4b2d5cdecab..b0e8b544cb0 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("mrp", "other")); +$langs->loadLangs(array("mrp", "other", "stocks")); // Get parameters $id = GETPOST('id', 'int'); @@ -211,9 +211,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; } print ''; - print ''.$langs->trans('Quantity').''; - print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''; - print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).''; + print ''.$langs->trans('Quantity').''; + print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''; + print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).''; print ''; if (! empty($TChildBom)) { if ($action == 'treeview') { @@ -227,9 +227,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print img_picto('', 'folder-open'); print ''; print ''; - print ''.$TProduct['qty'].''; - print ''; - print ''; + print ''.$TProduct['qty'].''; + print ''; + print ''; print ''; } if (! empty($TProduct['product'])) { @@ -241,9 +241,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($fk_bom != $object->id) print ''; else print ''; print ''.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''; - print ''.$TInfos['qty'].''; - print ''.$prod->stock_reel.''; - print ''.$prod->stock_theorique.''; + print ''.$TInfos['qty'].''; + print ''.price2num($prod->stock_reel, 'MS').''; + print ''.$prod->stock_theorique.''; print ''; } } @@ -256,9 +256,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($prod->stock_reel)) $prod->stock_reel = 0; print ''; print ''.$prod->getNomUrl(1).''; - print ''.$qty.''; - print ''.$prod->stock_reel.''; - print ''.$prod->stock_theorique.''; + print ''.$qty.''; + print ''.price2num($prod->stock_reel, 'MS').''; + print ''.$prod->stock_theorique.''; print ''; } } From 3056635aafc498519069befd631fb5d46af35430 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 14:04:03 +0100 Subject: [PATCH 274/328] css --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/bom_net_needs.php | 2 +- htdocs/bom/tpl/objectline_view.tpl.php | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index f6e40b511f1..96fb68b6e9b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -519,7 +519,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; $object->calculateCosts(); - print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; + print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; print ''.$langs->trans("UnitCost").''.price($object->unit_cost).''; // Other attributes diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index b0e8b544cb0..30cd6792c55 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -170,7 +170,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; + print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; print ''.$langs->trans("UnitCost").''.price($object->unit_cost).''; // Other attributes diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 8040310ea53..61b394a3b0f 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -126,7 +126,7 @@ print ''; $total_cost = 0; print ''; $coldisplay++; -echo price($line->total_cost); +echo ''.price($line->total_cost).''; print ''; if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') { @@ -152,12 +152,12 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') { print ''; $coldisplay++; if ($i > 0) { - print 'id.'">'; + print 'id.'">'; echo img_up('default', 0, 'imgupforline'); print ''; } if ($i < $num - 1) { - print 'id.'">'; + print 'id.'">'; echo img_down('default', 0, 'imgdownforline'); print ''; } @@ -236,15 +236,16 @@ if ($resql) { // Efficiency print ''.$sub_bom_line->efficiency.''; + // Cost if (!empty($sub_bom->id)) { $sub_bom->calculateCosts(); - print ''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''; + print ''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->cost_price > 0) { - print ''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).''; + print ''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).''; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined - print ''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).''; + print ''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).''; $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; @@ -254,7 +255,7 @@ if ($resql) { $obj = $object->db->fetch_object($resql_supplier_price); $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty; - print ''.price($line_cost).''; + print ''.price($line_cost).''; $total_cost+= $line_cost; } } @@ -266,11 +267,12 @@ if ($resql) { } // Replace of the total_cost value by the sum of all sub-BOM lines total_cost +// TODO Remove this bad practice. We should not replace content of ouput using javascript but value should be good during generation of output. if ($total_cost > 0) { $line->total_cost = price($total_cost); ?> Date: Thu, 24 Mar 2022 14:09:46 +0100 Subject: [PATCH 275/328] Fix phpcs --- htdocs/compta/prelevement/card.php | 1 - htdocs/variants/card.php | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 0b1b82998b2..a56ba593a9c 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -312,7 +312,6 @@ if ($id > 0 || $ref) { $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - if (empty($object->date_trans)) { if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 1a97c2252df..68bb8d60998 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -191,10 +191,8 @@ if ($action == 'create') { print ''; dol_set_focus('input[name="label"]'); -} - -// Part to edit record -elseif (($id || $ref) && $action == 'edit') { +} elseif (($id || $ref) && $action == 'edit') { + // Part to edit record print load_fiche_titre($langs->trans("ProductAttribute"), '', 'object_' . $object->picto); print '
'; @@ -224,10 +222,8 @@ elseif (($id || $ref) && $action == 'edit') { print '
'; print ''; -} - -// Part to show record -elseif ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { +} elseif ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { + // Part to show record $res = $object->fetch_optionals(); $head = productAttributePrepareHead($object); From e9aab2188ece8c83c7e994a6a0fdb066d4ac6a6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 15:39:02 +0100 Subject: [PATCH 276/328] css --- htdocs/website/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index d916d0a0e5f..5a093e898cd 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2825,13 +2825,13 @@ if (!GETPOST('hide_websitemenu')) { if (in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesite', 'replacesiteconfirm'))) { if ($action == 'editcss') { - print ''; + print ''; } if (preg_match('/^create/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') { - print ''; + print ''; } if (preg_match('/^edit/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') { - print ''; + print ''; } if ($action != 'preview') { print ''; From d91db3fe55e7734babaf33fda0991aa7f75f2a89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 15:42:01 +0100 Subject: [PATCH 277/328] Fix: when cloning a website page, the page has the status draft. --- htdocs/website/class/websitepage.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 0126f8a4dc4..db9e1e035e7 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -725,6 +725,7 @@ class WebsitePage extends CommonObject $object->fk_website = $newwebsite; } $object->import_key = ''; + $object->status = self::STATUS_DRAFT; // Create clone $object->context['createfromclone'] = 'createfromclone'; From e8dae7a8dbf556b01028fcaec1ca2e02d1754840 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 16:34:08 +0100 Subject: [PATCH 278/328] FIX Multiccompany sharings compatibility --- htdocs/core/class/commonobject.class.php | 30 ++++++++++++++++-------- htdocs/product/class/product.class.php | 14 +++++------ htdocs/societe/class/societe.class.php | 24 +++++++++---------- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a0d1079072a..bedc17a8fc2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4374,9 +4374,10 @@ abstract class CommonObject * Check is done into this->childtables. There is no check into llx_element_element. * * @param int $id Force id of object + * @param int $entity Force entity to check * @return int <0 if KO, 0 if not used, >0 if already used */ - public function isObjectUsed($id = 0) + public function isObjectUsed($id = 0, $entity = 0) { global $langs; @@ -4399,11 +4400,21 @@ abstract class CommonObject // Test if child exists $haschild = 0; - foreach ($arraytoscan as $table => $elementname) { + foreach ($arraytoscan as $table => $element) { //print $id.'-'.$table.'-'.$elementname.'
'; - // Check if third party can be deleted - $sql = "SELECT COUNT(*) as nb from ".$this->db->prefix().$table; - $sql .= " WHERE ".$this->fk_element." = ".((int) $id); + // Check if element can be deleted + $sql = "SELECT COUNT(*) as nb"; + $sql.= " FROM ".$this->db->prefix().$table." as c"; + if (!empty($element['parent']) && !empty($element['parentkey'])) { + $sql.= ", ".$this->db->prefix().$element['parent']." as p"; + } + $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); + if (!empty($element['parent']) && !empty($element['parentkey'])) { + $sql.= " AND c.".$element['parentkey']." = p.rowid"; + } + if (!empty($entity)) { + $sql.= " AND entity = ".((int) $entity); + } $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -4411,11 +4422,10 @@ abstract class CommonObject $langs->load("errors"); //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; - if (is_numeric($elementname)) { // old usage - $this->errors[] = $langs->transnoentities("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); - } else // new usage: $elementname=Translation key - { - $this->errors[] = $langs->transnoentities("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($elementname)); + if (is_numeric($element) || empty($element['name'])) { // old usage + $this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); + } else { // new usage: $element['name']=Translation key + $this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); } break; // We found at least one, we stop here } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6e97e80fece..9792b11ce39 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -64,13 +64,13 @@ class Product extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array( - 'supplier_proposaldet', - 'propaldet', - 'commandedet', - 'facturedet', - 'contratdet', - 'facture_fourn_det', - 'commande_fournisseurdet' + 'supplier_proposaldet' => array('parent' => 'supplier_proposal', 'parentkey' => 'fk_supplier_proposal'), + 'propaldet' => array('parent' => 'propal', 'parentkey' => 'fk_propal'), + 'commandedet' => array('parent' => 'commande', 'parentkey' => 'fk_commande'), + 'facturedet' => array('parent' => 'facture', 'parentkey' => 'fk_facture'), + 'contratdet' => array('parent' => 'contrat', 'parentkey' => 'fk_contrat'), + 'facture_fourn_det' => array('parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), + 'commande_fournisseurdet' => array('parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande') ); /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 89eeeaca8e5..bfcdce7d348 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -73,18 +73,18 @@ class Societe extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array( - "supplier_proposal" => 'SupplierProposal', - "propal" => 'Proposal', - "commande" => 'Order', - "facture" => 'Invoice', - "facture_rec" => 'RecurringInvoiceTemplate', - "contrat" => 'Contract', - "fichinter" => 'Fichinter', - "facture_fourn" => 'SupplierInvoice', - "commande_fournisseur" => 'SupplierOrder', - "projet" => 'Project', - "expedition" => 'Shipment', - "prelevement_lignes" => 'DirectDebitRecord', + "supplier_proposal" => array('name' => 'SupplierProposal'), + "propal" => array('name' => 'Proposal'), + "commande" => array('name' => 'Order'), + "facture" => array('name' => 'Invoice'), + "facture_rec" => array('name' => 'RecurringInvoiceTemplate'), + "contrat" => array('name' => 'Contract'), + "fichinter" => array('name' => 'Fichinter'), + "facture_fourn" => array('name' => 'SupplierInvoice'), + "commande_fournisseur" => array('name' => 'SupplierOrder'), + "projet" => array('name' => 'Project'), + "expedition" => array('name' => 'Shipment'), + "prelevement_lignes" => array('name' => 'DirectDebitRecord'), ); /** From 6fdb140f0402a598ae7e2482f38b680859a94fb8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 16:54:02 +0100 Subject: [PATCH 279/328] FIX missing table alias --- 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 bedc17a8fc2..23e66ed2064 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4413,7 +4413,7 @@ abstract class CommonObject $sql.= " AND c.".$element['parentkey']." = p.rowid"; } if (!empty($entity)) { - $sql.= " AND entity = ".((int) $entity); + $sql.= " AND p.entity = ".((int) $entity); } $resql = $this->db->query($sql); if ($resql) { From c38437f0ded7c54fad4c363f6d44ff07119b2339 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 17:12:37 +0100 Subject: [PATCH 280/328] FIX wrong error message --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 23e66ed2064..ea7d0265ec1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4423,9 +4423,9 @@ abstract class CommonObject //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; if (is_numeric($element) || empty($element['name'])) { // old usage - $this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); } else { // new usage: $element['name']=Translation key - $this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); } break; // We found at least one, we stop here } From 1c43617d9363eb26a4a65bb0c39bb87531fb103f Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 24 Mar 2022 17:34:50 +0100 Subject: [PATCH 281/328] FIX: contact card: single extrafield update failed --- htdocs/contact/card.php | 23 +++++++++++++++++++++++ htdocs/core/tpl/extrafields_view.tpl.php | 3 +++ 2 files changed, 26 insertions(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 0c95ecb7fd4..28a61ce5190 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -479,6 +479,29 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } + // Update extrafields + if ($action == 'update_extras' && ! empty($user->rights->societe->contact->creer)) { + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); + if ($ret < 0) { + $error++; + } + + if (!$error) { + $result = $object->insertExtraFields('CONTACT_MODIFY'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + if ($error) { + $action = 'edit_extras'; + } + } + // Actions to send emails $triggersendname = 'CONTACT_SENTBYMAIL'; $paramname = 'id'; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 40ea3e0ce50..7f1ee1f37cb 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -150,6 +150,9 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if ($object->element == 'mo') $permok = $user->rights->mrp->write; + if ($object->element == 'contact') { + $permok = $user->rights->societe->contact->creer; + } $isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0)); if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra])) From 1db60116e160344a4660901dd27e7f42175acb65 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 24 Mar 2022 18:02:32 +0100 Subject: [PATCH 282/328] FIX search bracode rule and avoid undefined quantity on search in takepos --- htdocs/takepos/ajax/ajax.php | 4 +++- htdocs/takepos/index.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 9b44e536a2b..a3bcc04b5c8 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -142,7 +142,7 @@ if ($action == 'getProducts') { } if (isset($barcode_value_list['ref'])) { - //search product from reference + // search product from reference $sql = "SELECT rowid, ref, label, tosell, tobuy, barcode, price"; $sql .= " FROM " . $db->prefix() . "product as p"; $sql .= " WHERE entity IN (" . getEntity('product') . ")"; @@ -151,6 +151,7 @@ if ($action == 'getProducts') { $sql .= " AND EXISTS (SELECT cp.fk_product FROM " . $db->prefix() . "categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN (".$db->sanitize($filteroncategids)."))"; } $sql .= " AND tosell = 1"; + $sql .= " AND (barcode IS NULL OR barcode != '" . $db->escape($term) . "')"; $resql = $db->query($sql); if ($resql && $db->num_rows($resql) == 1) { @@ -263,6 +264,7 @@ if ($action == 'getProducts') { 'price' => $obj->price, 'object' => 'product', 'img' => $ig, + 'qty' => 1, //'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) ); } diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 24a30b8ea7e..5650c0d4fdd 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -620,7 +620,7 @@ function Search2(keyCodeForEnter) { ChangeThirdparty(data[0]['rowid']); } else if ('product' == data[0]['object']) { - console.log("There is only 1 answer with barcode matching the search, so we add the product in basket"); + console.log("There is only 1 answer matching the search, so we add the product in basket, qty="+data[0]['qty']); ClickProduct(0, data[0]['qty']); } } From 08bc2a7ac0ce88ebd5fa58cbd485a95eef8c2b9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 19:27:42 +0100 Subject: [PATCH 283/328] Better modulebuilder design pattern --- .../class/fournisseur.commande.class.php | 113 +++++++++++------- htdocs/fourn/commande/list.php | 92 +++++++------- htdocs/langs/en_US/orders.lang | 2 + .../template/class/myobject.class.php | 2 +- .../modulebuilder/template/myobject_list.php | 2 +- 5 files changed, 116 insertions(+), 95 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4c6ee247aeb..a195a2ed2e1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -185,56 +185,79 @@ class CommandeFournisseur extends CommonOrder public $multicurrency_total_ttc; - + /** + * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'picto' is code of a picto to show before value in forms + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' + * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'validate' is 1 if need to validate with $this->validateField() + * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), - 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>25), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1), + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), + 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), - 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'date_approve' =>array('type'=>'datetime', 'label'=>'Date approve', 'enabled'=>1, 'visible'=>-1, 'position'=>60), - 'date_approve2' =>array('type'=>'datetime', 'label'=>'Date approve2', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'date_commande' =>array('type'=>'date', 'label'=>'Date commande', 'enabled'=>1, 'visible'=>-1, 'position'=>70), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80), - 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'fk_user_approve' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserApproval', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'fk_user_approve2' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserSecondApproval', 'enabled'=>1, 'visible'=>-1, 'position'=>95), - 'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>100), - 'billed' =>array('type'=>'smallint(6)', 'label'=>'Billed', 'enabled'=>1, 'visible'=>-1, 'position'=>110), - 'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'Amount ht', 'enabled'=>1, 'visible'=>-1, 'position'=>115), - 'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>120), - 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'total_tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1), - 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), - 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), - 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1), + 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefOrderSupplierShort', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>1), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'date_approve' =>array('type'=>'datetime', 'label'=>'DateApprove', 'enabled'=>1, 'visible'=>-1, 'position'=>62), + 'date_approve2' =>array('type'=>'datetime', 'label'=>'DateApprove2', 'enabled'=>1, 'visible'=>3, 'position'=>64), + 'date_commande' =>array('type'=>'date', 'label'=>'OrderDateShort', 'enabled'=>1, 'visible'=>1, 'position'=>70), + 'date_livraison' =>array('type'=>'datetime', 'label'=>'DeliveryDate', 'enabled'=>'empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)', 'visible'=>1, 'position'=>74), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>75), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'notnull'=>-1, 'position'=>80), + 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>3, 'position'=>85), + 'fk_user_approve' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserApproval', 'enabled'=>1, 'visible'=>3, 'position'=>90), + 'fk_user_approve2' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserApproval2', 'enabled'=>1, 'visible'=>3, 'position'=>95), + 'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>100), + 'billed' =>array('type'=>'smallint(6)', 'label'=>'Billed', 'enabled'=>1, 'visible'=>1, 'position'=>110), + 'total_tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>1, 'position'=>130, 'isameasure'=>1), + 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>3, 'position'=>135, 'isameasure'=>1), + 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>3, 'position'=>140, 'isameasure'=>1), + 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>1, 'position'=>145, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1), 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160), + 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165), - 'fk_input_method' =>array('type'=>'integer', 'label'=>'InputMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>170), - 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>175), - 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>180), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190), - 'date_livraison' =>array('type'=>'datetime', 'label'=>'DeliveryDate', 'enabled'=>1, 'visible'=>-1, 'position'=>195), - 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>200), - 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>205), - 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLocation', 'enabled'=>1, 'visible'=>-1, 'position'=>210), - 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>215), - 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>220), - 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>1, 'visible'=>-1, 'position'=>225), - 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyTotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>230), - 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyTotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>235), - 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyTotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>240), - 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>245), - 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), + 'fk_input_method' =>array('type'=>'integer', 'label'=>'OrderMode', 'enabled'=>1, 'visible'=>3, 'position'=>170), + 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>3, 'position'=>175), + 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>3, 'position'=>180), + 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>0, 'position'=>190), + 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>3, 'position'=>200), + 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>3, 'position'=>205), + 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLocation', 'enabled'=>1, 'visible'=>3, 'position'=>210), + 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>0, 'position'=>215), + 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>220), + 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>225), + 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>230), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>235), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>240), + 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>500), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>46), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>1000, 'index'=>1), + 'tms'=>array('type'=>'datetime', 'label'=>"DateModificationShort", 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501), + 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'position'=>700), + 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>701), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>900), ); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index e5cc12fe1c4..cd9a1922524 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -162,49 +162,45 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 'cf.ref'=>'Ref', - 'cf.ref_supplier'=>'RefOrderSupplier', - 'pd.description'=>'Description', - 's.nom'=>"ThirdParty", - 's.name_alias'=>"AliasNameShort", - 's.zip'=>"Zip", - 's.town'=>"Town", - 'cf.note_public'=>'NotePublic', -); +$fieldstosearchall = array(); +foreach ($object->fields as $key => $val) { + if (!empty($val['searchall'])) { + $fieldstosearchall['cf.'.$key] = $val['label']; + } +} +$fieldstosearchall['pd.description'] = 'Description'; +$fieldstosearchall['s.nom'] = "ThirdParty"; +$fieldstosearchall['s.name_alias'] = "AliasNameShort"; +$fieldstosearchall['s.zip'] = "Zip"; +$fieldstosearchall['s.town'] = "Town"; if (empty($user->socid)) { $fieldstosearchall["cf.note_private"] = "NotePrivate"; } $checkedtypetiers = 0; + +// Definition of array of fields for columns $arrayfields = array( - 'cf.ref'=>array('label'=>"Ref", 'checked'=>1), - 'cf.ref_supplier'=>array('label'=>"RefOrderSupplierShort", 'checked'=>1, 'enabled'=>1), - 'p.project_ref'=>array('label'=>"ProjectRef", 'checked'=>0, 'enabled'=>1), - 'u.login'=>array('label'=>"AuthorRequest", 'checked'=>1), - 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), - 's.town'=>array('label'=>"Town", 'checked'=>1), - 's.zip'=>array('label'=>"Zip", 'checked'=>1), - 'state.nom'=>array('label'=>"StateShort", 'checked'=>0), - 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), - 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), - 'cf.date_commande'=>array('label'=>"OrderDateShort", 'checked'=>1), - 'cf.date_livraison'=>array('label'=>"DateDeliveryPlanned", 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)), - 'cf.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), - 'cf.total_tva'=>array('label'=>"AmountVAT", 'checked'=>0), - 'cf.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), - 'cf.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.multicurrency_total_tva'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 'cf.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), - 'cf.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), - 'cf.billed'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>1), - 'cf.date_valid' =>array('label' => 'DateValidation', 'checked' => 0), - 'cf.date_approve' =>array('label' => 'DateApprove', 'checked' => 0) + 's.town'=>array('label'=>"Town", 'enabled'=>1, 'position'=>47, 'checked'=>1), + 's.zip'=>array('label'=>"Zip", 'enabled'=>1, 'position'=>47, 'checked'=>1), + 'state.nom'=>array('label'=>"StateShort", 'enabled'=>1, 'position'=>48), + 'country.code_iso'=>array('label'=>"Country", 'enabled'=>1, 'position'=>49), + 'typent.code'=>array('label'=>"ThirdPartyType", 'enabled'=>$checkedtypetiers, 'position'=>50), + 'u.login'=>array('label'=>"AuthorRequest", 'enabled'=>1, 'position'=>51) ); +foreach ($object->fields as $key => $val) { + // If $val['visible']==0, then we never show the field + if (!empty($val['visible'])) { + $visible = (int) dol_eval($val['visible'], 1); + $arrayfields['cf.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($visible < 0) ? 0 : 1), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), + 'position'=>$val['position'], + 'help'=> isset($val['help']) ? $val['help'] : '' + ); + } +} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -1262,7 +1258,7 @@ if ($resql) { print ''; } // Project ref - if (!empty($arrayfields['p.project_ref']['checked'])) { + if (!empty($arrayfields['cf.fk_projet']['checked'])) { print ''; } // Request author @@ -1272,7 +1268,7 @@ if ($resql) { print ''; } // Thirpdarty - if (!empty($arrayfields['s.nom']['checked'])) { + if (!empty($arrayfields['cf.fk_soc']['checked'])) { print ''; } // Town @@ -1379,7 +1375,7 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation - if (!empty($arrayfields['cf.datec']['checked'])) { + if (!empty($arrayfields['cf.date_creation']['checked'])) { print ''; print ''; } @@ -1438,14 +1434,14 @@ if ($resql) { if (!empty($arrayfields['cf.ref_supplier']['checked'])) { print_liste_field_titre($arrayfields['cf.ref_supplier']['label'], $_SERVER["PHP_SELF"], "cf.ref_supplier", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax100imp '); } - if (!empty($arrayfields['p.project_ref']['checked'])) { - print_liste_field_titre($arrayfields['p.project_ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['cf.fk_projet']['checked'])) { + print_liste_field_titre($arrayfields['cf.fk_projet']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], "u.login", "", $param, '', $sortfield, $sortorder); } - if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['cf.fk_soc']['checked'])) { + print_liste_field_titre($arrayfields['cf.fk_soc']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['s.town']['checked'])) { print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); @@ -1501,8 +1497,8 @@ if ($resql) { $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (!empty($arrayfields['cf.datec']['checked'])) { - print_liste_field_titre($arrayfields['cf.datec']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (!empty($arrayfields['cf.date_creation']['checked'])) { + print_liste_field_titre($arrayfields['cf.date_creation']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } if (!empty($arrayfields['cf.tms']['checked'])) { print_liste_field_titre($arrayfields['cf.tms']['label'], $_SERVER["PHP_SELF"], "cf.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -1584,7 +1580,7 @@ if ($resql) { } } // Project - if (!empty($arrayfields['p.project_ref']['checked'])) { + if (!empty($arrayfields['cf.fk_projet']['checked'])) { $projectstatic->id = $obj->project_id; $projectstatic->ref = $obj->project_ref; $projectstatic->title = $obj->project_title; @@ -1616,7 +1612,7 @@ if ($resql) { } } // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { + if (!empty($arrayfields['cf.fk_soc']['checked'])) { print ''; $thirdpartytmp->id = $obj->socid; $thirdpartytmp->name = $obj->name; @@ -1783,7 +1779,7 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation - if (!empty($arrayfields['cf.datec']['checked'])) { + if (!empty($arrayfields['cf.date_creation']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 11220633d61..aa78c97f2e3 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -68,6 +68,8 @@ CreateOrder=Create Order RefuseOrder=Refuse order ApproveOrder=Approve order Approve2Order=Approve order (second level) +UserApproval=User for approval +UserApproval2=User for approval (second level) ValidateOrder=Validate order UnvalidateOrder=Unvalidate order DeleteOrder=Delete order diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 4e88703b454..d6e59e4b2bd 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -74,7 +74,7 @@ class MyObject extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 902969ee430..040dc074be1 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -165,7 +165,7 @@ foreach ($object->fields as $key => $val) { $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); From 391c02993d2a6d2fc8257ebe77d6f5b866eb35e0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 20:26:47 +0100 Subject: [PATCH 284/328] FIX better test for all usage --- htdocs/core/class/commonobject.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ea7d0265ec1..7dcf9d09805 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4422,8 +4422,10 @@ abstract class CommonObject $langs->load("errors"); //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; - if (is_numeric($element) || empty($element['name'])) { // old usage + if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); + } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); } else { // new usage: $element['name']=Translation key $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); } From ffa79c59f97561f4761fbc939c2ca60e74ebfc3d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 20:48:43 +0100 Subject: [PATCH 285/328] FIX wrong alias of table if no parent and parentkey --- htdocs/core/class/commonobject.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7dcf9d09805..3bb84eac492 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4413,7 +4413,11 @@ abstract class CommonObject $sql.= " AND c.".$element['parentkey']." = p.rowid"; } if (!empty($entity)) { - $sql.= " AND p.entity = ".((int) $entity); + if (!empty($element['parent']) && !empty($element['parentkey'])) { + $sql.= " AND p.entity = ".((int) $entity); + } else { + $sql.= " AND c.entity = ".((int) $entity); + } } $resql = $this->db->query($sql); if ($resql) { From 9db7d29237cb56347f6828e6af16d25a2474b986 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 24 Mar 2022 23:14:23 +0100 Subject: [PATCH 286/328] Accountancy - Removed old code for reconciled (or lettering...) --- .../thirdparty_lettering_customer.php | 325 ------------------ .../thirdparty_lettering_supplier.php | 322 ----------------- htdocs/core/lib/company.lib.php | 18 - 3 files changed, 665 deletions(-) delete mode 100644 htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php delete mode 100644 htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php deleted file mode 100644 index a563b653ac1..00000000000 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ /dev/null @@ -1,325 +0,0 @@ - - * Copyright (C) 2005 Laurent Destailleur - * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2019 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France - * - * 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/accountancy/bookkeeping/thirdparty_lettering_customer.php - * \ingroup accountancy - * \brief Tab to manage customer lettering - */ -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("compta", "accountancy")); - -$action = GETPOST('action', 'aZ09'); -$massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); -// $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); -// Security check -$socid = GETPOSTINT("socid"); -// if ($user->socid) $socid=$user->socid; - -$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == - 1) { - $page = 0; -} // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if ($sortorder == "") { - $sortorder = "ASC"; -} -if ($sortfield == "") { - $sortfield = "bk.doc_date"; -} - -/* -$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); -$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); -//$search_doc_type = GETPOST("search_doc_type", 'alpha'); -$search_doc_ref = GETPOST("search_doc_ref", 'alpha'); -*/ - -$lettering = GETPOST('lettering', 'alpha'); -if (!empty($lettering)) { - $action = $lettering; -} - -/* -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers -{ - $search_date_start = ''; - $search_date_end = ''; - //$search_doc_type = ''; - $search_doc_ref = ''; -} -*/ - -$lettering = new Lettering($db); -$object = new Societe($db); -$object->id = $socid; -$result = $object->fetch($socid); -if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); -} - -if (empty($conf->accounting->enabled)) { - accessforbidden(); -} -if ($user->socid > 0) { - accessforbidden(); -} -if (empty($user->rights->accounting->mouvements->lire)) { - accessforbidden(); -} - - -/* - * Action - */ - -if ($action == 'lettering') { - $result = $lettering->updateLettering($toselect); - - if ($result < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error++; - } -} - -/* -if ($action == 'autolettrage') { - - $result = $lettering->letteringThirdparty($socid); - - if ($result < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error++; - } -} -*/ - -/* - * View - */ - -$form = new Form($db); -$formaccounting = new FormAccounting($db); - -$title = $object->name." - ".$langs->trans('TabLetteringCustomer'); -$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner'; -llxHeader('', $title, $help_url); - -$head = societe_prepare_head($object); - -dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); - -print dol_get_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'company'); - -$linkback = ''.$langs->trans("BackToList").''; - -dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); - -print dol_get_fiche_end(); - -$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; -$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; -$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code"; -$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; -$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )"; - -/* -if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { - $sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($search_date_start) . "' AND '" . $db->idate($search_date_end) . "' )"; -} -*/ - -$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')'; -$sql .= $db->order($sortfield, $sortorder); - -$debit = 0; -$credit = 0; -$solde = 0; -// Count total nb of records and calc total sum -$nbtotalofrecords = ''; -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit(); -} -$nbtotalofrecords = $db->num_rows($resql); - -while ($obj = $db->fetch_object($resql)) { - $debit += $obj->debit; - $credit += $obj->credit; - - $solde += ($obj->credit - $obj->debit); -} - -$sql .= $db->plimit($limit + 1, $offset); - -dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG); -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit(); -} - -$param = ''; -$param .= "&socid=".urlencode($socid); - -$num = $db->num_rows($resql); - -dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG); -if ($resql) { - $i = 0; - - $param = "&socid=".$socid; - print '
'; - print ''; - print ''; - - $letteringbutton = ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit); - - print '
'; - print ''."\n"; - - /* - print ''; - //print ''; - - // Date - print ''; - - // Piece - print ''; - print ''; - print ''; - print ''; - */ - - print ''; - //print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center '); - print "\n"; - - $solde = 0; - $tmp = ''; - - while ($obj = $db->fetch_object($resql)) { - if ($tmp != $obj->lettering_code || empty($tmp)) { - $tmp = $obj->lettering_code; - } - /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); - - print ''; - - //print '' . "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Journal - $accountingjournal = new AccountingJournal($db); - $result = $accountingjournal->fetch('', $obj->code_journal); - $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal); - print ''; - - if (empty($obj->lettering_code) && empty($obj->date_validated)) { - print ''; - print ''."\n"; - } else { - print ''; - print ''; - } - - print "\n"; - } - - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print "
'; - print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); - print '
'; - print '
 '; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
' . $obj->doc_type . ''.dol_print_date($db->jdate($obj->doc_date), 'day').''.$obj->doc_ref.''.$obj->label_compte.''.price($obj->debit).''.price($obj->credit).''.price(round($solde, 2)).''.$journaltoshow.''; - print img_edit(); - print ''.$obj->lettering_code.'
'.$langs->trans("Total").':'.price($debit).''.price($credit).'
'.$langs->trans("Balancing").': '.price($credit - $debit).'
"; - - print '
'."\n"; - print $letteringbutton; - print '
'; - - print ""; - $db->free($resql); -} else { - dol_print_error($db); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php deleted file mode 100644 index 5c315bee9fc..00000000000 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ /dev/null @@ -1,322 +0,0 @@ - - * Copyright (C) 2005 Laurent Destailleur - * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2019 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France - * - * 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/accountancy/bookkeeping/thirdparty_lettering_supplier.php - * \ingroup Accountancy (Double entries) - * \brief Tab to setup lettering - */ -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("compta", "accountancy")); - -$action = GETPOST('action', 'aZ09'); -$massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); -// $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int')); -// Security check -$socid = GETPOSTINT("socid"); -// if ($user->socid) $socid=$user->socid; - - -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == - 1) { - $page = 0; -} // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if ($sortorder == "") { - $sortorder = "ASC"; -} -if ($sortfield == "") { - $sortfield = "bk.doc_date"; -} - -/* -$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); -$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); -//$search_doc_type = GETPOST("search_doc_type",'alpha'); -$search_doc_ref = GETPOST("search_doc_ref",'alpha'); -*/ - -$lettering = GETPOST('lettering', 'alpha'); -if (!empty($lettering)) { - $action = $lettering; -} - -/* -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers -{ - $search_date_start = ''; - $search_date_end = ''; - //$search_doc_type=''; - $search_doc_ref=''; -} -*/ - -$lettering = new Lettering($db); -$object = new Societe($db); -$object->id = $socid; -$result = $object->fetch($socid); -if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); -} - -if (empty($conf->accounting->enabled)) { - accessforbidden(); -} -if ($user->socid > 0) { - accessforbidden(); -} -if (empty($user->rights->accounting->mouvements->lire)) { - accessforbidden(); -} - - -/* - * Action - */ - -if ($action == 'lettering') { - $result = $lettering->updateLettering($toselect); - - if ($result < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error++; - } -} - -/* -if ($action == 'autolettrage') { - - $result = $lettering->letteringThirdparty($socid); - - if ($result < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error++; - } -} -*/ - -/* - * View - */ - -$form = new Form($db); -$formaccounting = new FormAccounting($db); - -$title = $object->name." - ".$langs->trans('TabLetteringSupplier'); -$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner'; -llxHeader('', $title, $help_url); - -$head = societe_prepare_head($object); - -dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); - -print dol_get_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'company'); - -$linkback = ''.$langs->trans("BackToList").''; - -dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); - -print dol_get_fiche_end(); - -$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; -$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; -$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated "; -$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; -$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)."' )"; -if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { - $sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )"; -} -$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')'; -$sql .= $db->order($sortfield, $sortorder); - -$debit = 0; -$credit = 0; -$solde = 0; -// Count total nb of records and calc total sum -$nbtotalofrecords = ''; -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit; -} -$nbtotalofrecords = $db->num_rows($resql); - -while ($obj = $db->fetch_object($resql)) { - $debit += $obj->debit; - $credit += $obj->credit; - - $solde += ($obj->credit - $obj->debit); -} - -$sql .= $db->plimit($limit + 1, $offset); - -dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG); -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit; -} - -$param = ''; -$param .= "&socid=".urlencode($socid); - -$num = $db->num_rows($resql); - -dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG); -$resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - - $param = "&socid=".$socid; - print '
'; - print ''; - print ''; - - $letteringbutton = ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit); - - print '
'; - print ''."\n"; - - /* - print ''; - //print ''; - - // Date - print ''; - - // Piece - print ''; - print ''; - print ''; - print ''; - */ - - print ''; - //print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center '); - print "\n"; - - $solde = 0; - $tmp = ''; - while ($obj = $db->fetch_object($resql)) { - if ($tmp != $obj->lettering_code || empty($tmp)) { - $tmp = $obj->lettering_code; - } - /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); - - print ''; - - //print '' . "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Journal - $accountingjournal = new AccountingJournal($db); - $result = $accountingjournal->fetch('', $obj->code_journal); - $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal); - print ''; - - if (empty($obj->lettering_code) && empty($obj->date_validated)) { - print ''; - print ''."\n"; - } else { - print ''; - print ''; - } - - print "\n"; - } - - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print "
'; - print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); - print '
'; - print '
 '; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
' . $obj->doc_type . ''.dol_print_date($db->jdate($obj->doc_date), 'day').''.$obj->doc_ref.''.$obj->label_compte.''.price($obj->debit).''.price($obj->credit).''.price(round($solde, 2)).''.$journaltoshow.''; - print img_edit(); - print ''.$obj->lettering_code.'
'.$langs->trans("Total").':'.price($debit).''.price($credit).'
'.$langs->trans("Balancing").': '.price($credit - $debit).'
"; - - print '
'."\n"; - print $letteringbutton; - print '
'; - - print ""; - $db->free($resql); -} else { - dol_print_error($db); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 7f1f03cd121..8ebf2e02047 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -168,24 +168,6 @@ function societe_prepare_head(Societe $object) $h++; } - if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { - // Tab to accountancy - if (!empty($conf->accounting->enabled) && $object->client > 0) { - $head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettering_customer.php?socid='.$object->id; - $head[$h][1] = $langs->trans("TabLetteringCustomer"); - $head[$h][2] = 'lettering_customer'; - $h++; - } - - // Tab to accountancy - if (!empty($conf->accounting->enabled) && $object->fournisseur > 0) { - $head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettering_supplier.php?socid='.$object->id; - $head[$h][1] = $langs->trans("TabLetteringSupplier"); - $head[$h][2] = 'lettering_supplier'; - $h++; - } - } - // Related items if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) { From 6774f0e57130c0ef8a07d7a7e89b56fdea0fe459 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 25 Mar 2022 11:53:27 +0100 Subject: [PATCH 287/328] new: entities is now updated on project update method --- htdocs/projet/class/project.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8aa25154111..510d7e23e62 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -479,6 +479,8 @@ class Project extends CommonObject return -3; } + $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + if (dol_strlen(trim($this->ref)) > 0) { $this->db->begin(); @@ -507,6 +509,7 @@ class Project extends CommonObject $sql .= ", accept_booth_suggestions = ".($this->accept_booth_suggestions ? 1 : 0); $sql .= ", price_registration = ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : "null"); $sql .= ", price_booth = ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : "null"); + $sql .= ", entity = ".((int) $this->entity); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); From 8d2d0f1e847d3e87db6d20ad3cf67fac173e99d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Mar 2022 12:22:52 +0100 Subject: [PATCH 288/328] Fix trans --- htdocs/core/tpl/filemanager.tpl.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index e776388ac53..573ae315913 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -34,6 +34,8 @@ if (empty($conf) || !is_object($conf)) { require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; +$langs->load("ecm"); + if (empty($module)) { $module = 'ecm'; } From 644e50926592bd658a13f3eac94397f99206433d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Mar 2022 14:43:48 +0100 Subject: [PATCH 289/328] Rename "Reconciled" with "BankLineReconciled" for bank conciliation --- htdocs/adherents/class/subscription.class.php | 2 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/core/modules/modBanque.class.php | 2 +- htdocs/langs/en_US/banks.lang | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 885c8981d93..9aef78174de 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -358,7 +358,7 @@ class Subscription extends CommonObject $result = $member->update_end_date($user); if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined) - $result = $accountline->delete($user); // Return false if refused because line is conciliated + $result = $accountline->delete($user); // Return false if refused because line is reconciled if ($result > 0) { $this->db->commit(); return 1; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index e991831a6dd..8893f91c2c2 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -170,7 +170,7 @@ $arrayfields = array( 'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000), 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001), 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), - 'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020), + 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 6b1053240c8..451a18ab05b 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -730,7 +730,7 @@ class RemiseCheque extends CommonObject $bankline = new AccountLine($db); $bankline->fetch($bank_id); - /* Conciliation is allowed because when check is returned, a new line is created onto bank transaction log. + /* Reconciliation is allowed because when check is returned, a new line is created onto bank transaction log. if ($bankline->rappro) { $this->error='ActionRefusedLineAlreadyConciliated'; @@ -739,7 +739,7 @@ class RemiseCheque extends CommonObject $this->db->begin(); - // Not conciliated, we can delete it + // Not reconciled, we can delete it //$bankline->delete($user); // We delete $bankaccount = $payment->fk_account; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 3a0b077be6b..eae29bf4036 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -628,7 +628,7 @@ function dol_print_object_info($object, $usetable = 0) if ($usetable) { print ''; } - print $langs->trans("ConciliatedBy"); + print $langs->trans("ReconciledBy"); if ($usetable) { print ''; } else { diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index b4135294293..e44d8b59374 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -151,7 +151,7 @@ class modBanque extends DolibarrModules $this->export_fields_array[$r] = array( 'b.rowid'=>'IdTransaction', 'ba.ref'=>'AccountRef', 'ba.label'=>'AccountLabel', 'b.datev'=>'DateValue', 'b.dateo'=>'DateOperation', 'b.label'=>'Label', 'b.num_chq'=>'ChequeOrTransferNumber', 'b.fk_bordereau'=>'ChequeBordereau', '-b.amount'=>'Debit', 'b.amount'=>'Credit', - 'b.num_releve'=>'AccountStatement', 'b.rappro'=>'Conciliated', 'b.datec'=>"DateCreation", "bu.url_id"=>"IdThirdParty", + 'b.num_releve'=>'AccountStatement', 'b.rappro'=>'BankLineReconciled', 'b.datec'=>"DateCreation", "bu.url_id"=>"IdThirdParty", "s.nom"=>"ThirdParty", "s.code_compta"=>"CustomerAccountancyCode", "s.code_compta_fournisseur"=>"SupplierAccountancyCode" ); $this->export_TypeFields_array[$r] = array('ba.ref'=>'Text', 'ba.label'=>'Text', 'b.datev'=>'Date', 'b.dateo'=>'Date', 'b.label'=>'Text', 'b.num_chq'=>'Text', 'b.fk_bordereau'=>'Text', '-b.amount'=>'Numeric', 'b.amount'=>'Numeric', 'b.num_releve'=>'Text', 'b.rappro'=>'Boolean', 'b.datec'=>"Date", "bu.url_id"=>"Text", "s.nom"=>"Text", "s.code_compta"=>"Text", "s.code_compta_fournisseur"=>"Text"); diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 959db0f1a5f..331ddb62e7f 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -95,11 +95,11 @@ LineRecord=Transaction AddBankRecord=Add entry AddBankRecordLong=Add entry manually Conciliated=Reconciled -ConciliatedBy=Reconciled by +ReConciliedBy=Reconciled by DateConciliating=Reconcile date BankLineConciliated=Entry reconciled with bank receipt -Reconciled=Reconciled -NotReconciled=Not reconciled +BankLineReconciled=Reconciled +BankLineNotReconciled=Not reconciled CustomerInvoicePayment=Customer payment SupplierInvoicePayment=Vendor payment SubscriptionPayment=Subscription payment From 4d91e448cec7865f6556f32125f55a8aeca5c236 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Mar 2022 15:35:49 +0100 Subject: [PATCH 290/328] Fix bad test for button to show / hide canceled orders --- htdocs/projet/element.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index b5e789ec3f2..80fccce7912 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1050,7 +1050,8 @@ foreach ($listofreferent as $key => $value) { } $addform .= '
'; } - if (is_array($elementarray) && !count($elementarray) > 0 && $key == "order_supplier") { + + if (is_array($elementarray) && count($elementarray) > 0 && $key == "order_supplier") { $addform = '
'.$langs->trans("CanceledShown").' @@ -1061,13 +1062,13 @@ foreach ($listofreferent as $key => $value) { if (typeof attr !== "undefined" && attr !== false) { console.log("Show canceled"); $(".tr_canceled").show(); - $("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledShown")).'"); + $("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledShown")).'"); $("#btnShow").removeAttr("data-canceledarehidden"); $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye"); } else { console.log("Hide canceled"); $(".tr_canceled").hide(); - $("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledHidden")).'"); + $("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledHidden")).'"); $("#btnShow").attr("data-canceledarehidden", 1); $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash"); } From 8236a8e846e49cf6ea6597ac38495012853f3297 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Mar 2022 15:35:49 +0100 Subject: [PATCH 291/328] Fix bad test for button to show / hide canceled orders --- htdocs/projet/element.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index b5e789ec3f2..80fccce7912 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1050,7 +1050,8 @@ foreach ($listofreferent as $key => $value) { } $addform .= '
'; } - if (is_array($elementarray) && !count($elementarray) > 0 && $key == "order_supplier") { + + if (is_array($elementarray) && count($elementarray) > 0 && $key == "order_supplier") { $addform = '
'.$langs->trans("CanceledShown").' @@ -1061,13 +1062,13 @@ foreach ($listofreferent as $key => $value) { if (typeof attr !== "undefined" && attr !== false) { console.log("Show canceled"); $(".tr_canceled").show(); - $("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledShown")).'"); + $("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledShown")).'"); $("#btnShow").removeAttr("data-canceledarehidden"); $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye"); } else { console.log("Hide canceled"); $(".tr_canceled").hide(); - $("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledHidden")).'"); + $("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledHidden")).'"); $("#btnShow").attr("data-canceledarehidden", 1); $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash"); } From ab2e6ddf4359584ff1d33ecaccdd1d219c7536d2 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 25 Mar 2022 16:41:41 +0100 Subject: [PATCH 292/328] FIX : forgotten form confirm before various payment delete --- htdocs/compta/bank/various_payment/card.php | 8 +++++++- htdocs/langs/en_US/compta.lang | 4 +++- htdocs/langs/fr_FR/compta.lang | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index dd734074481..def2abba3a1 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -179,7 +179,7 @@ if (empty($reshook)) { $action = 'create'; } - if ($action == 'delete') { + if ($action == 'confirm_delete' && $confirm == 'yes') { $result = $object->fetch($id); if ($object->rappro == 0) { @@ -548,6 +548,12 @@ if ($id) { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); } + // Confirmation of the removal of the Social Contribution + if ($action == 'delete') { + $text = $langs->trans('ConfirmDeleteVariousPayment'); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2); + } + print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref = '
'; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index c5e1a58d243..efe1e51482b 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -146,9 +146,11 @@ ConfirmPaySalary=Are you sure you want to classify this salary card as paid? DeleteSocialContribution=Delete a social or fiscal tax payment DeleteVAT=Delete a VAT declaration DeleteSalary=Delete a salary card +DeleteVariousPayment=Delete a various payment ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fiscal tax payment ? ConfirmDeleteVAT=Are you sure you want to delete this VAT declaration ? -ConfirmDeleteSalary=Are you sure you want to delete this salary? +ConfirmDeleteSalary=Are you sure you want to delete this salary ? +ConfirmDeleteVariousPayment=Are you sure you want to delete this various payment ? ExportDataset_tax_1=Social and fiscal taxes and payments CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 280069f5cf9..be7a5f464ff 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -146,9 +146,11 @@ ConfirmPaySalary=Voulez-vous vraiment classer ce salaire comme payé ? DeleteSocialContribution=Effacer une charge fiscale ou sociale DeleteVAT=Supprimer une déclaration de TVA DeleteSalary=Supprimer un salaire +DeleteVariousPayment=Supprimer un paiement divers ConfirmDeleteSocialContribution=Voulez-vous vraiment supprimer ce paiement de taxe sociale / fiscale? ConfirmDeleteVAT=Voulez-vous vraiment supprimer cette déclaration de TVA ? ConfirmDeleteSalary=Êtes-vous sûr de vouloir supprimer ce salaire ? +ConfirmDeleteVariousPayment=Voulez-vous vraiment supprimer ce paiement divers ? ExportDataset_tax_1=Taxes sociales et fiscales et paiements CalcModeVATDebt=Mode %sTVA sur débit%s. CalcModeVATEngagement=Mode %sTVA sur encaissement%s. From fdf8a3f4adc655d9e51ac71e1e84f02e93170d82 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 25 Mar 2022 16:43:54 +0100 Subject: [PATCH 293/328] FIX : comment --- htdocs/compta/bank/various_payment/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index def2abba3a1..a2c6c2b21ae 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -548,7 +548,7 @@ if ($id) { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); } - // Confirmation of the removal of the Social Contribution + // Confirmation of the removal of the Various Payment if ($action == 'delete') { $text = $langs->trans('ConfirmDeleteVariousPayment'); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2); From 8a7b97bed150e33f37e9601ef1b75e2fd42f644e Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 25 Mar 2022 16:47:41 +0100 Subject: [PATCH 294/328] FIX check thirdparty object loaded and properties exist --- htdocs/compta/facture/class/facture.class.php | 14 ++++++++++++++ htdocs/langs/en_US/errors.lang | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 00734ccb680..0269babd064 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2518,6 +2518,20 @@ class Facture extends CommonInvoice { $keymin = strtolower($key); $i = (int) preg_replace('/[^0-9]/', '', $key); + if ($i == 1) { + if (!is_object($this->thirdparty)) { + $langs->load('errors'); + $this->error = $langs->trans('ErrorInvoiceLoadThirdParty', $this->ref); + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + if (!property_exists($this->thirdparty, $keymin)) { + $langs->load('errors'); + $this->error = $langs->trans('ErrorInvoiceLoadThirdPartyKey', $keymin, $this->ref); + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } $vallabel = $this->thirdparty->$keymin; if ($i > 0) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 087fcba9e56..94a1cf16a38 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -257,6 +257,8 @@ ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation ErrorYouMustFirstSetupYourChartOfAccount=You must first setup your chart of account +ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s" +ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s" # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. @@ -289,4 +291,4 @@ WarningFailedToAddFileIntoDatabaseIndex=Warning, failed to add file entry into E WarningTheHiddenOptionIsOn=Warning, the hidden option %s is on. WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection. -WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. \ No newline at end of file +WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. From 4479ba801552c09e462e2346f9ec9880f4c651c7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 26 Mar 2022 08:32:20 +0100 Subject: [PATCH 295/328] FIX missing translation keys --- htdocs/product/class/product.class.php | 14 +++---- htdocs/projet/class/task.class.php | 4 +- htdocs/societe/class/societe.class.php | 56 +++++++++++++------------- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9792b11ce39..d308ceb8e53 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -64,13 +64,13 @@ class Product extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array( - 'supplier_proposaldet' => array('parent' => 'supplier_proposal', 'parentkey' => 'fk_supplier_proposal'), - 'propaldet' => array('parent' => 'propal', 'parentkey' => 'fk_propal'), - 'commandedet' => array('parent' => 'commande', 'parentkey' => 'fk_commande'), - 'facturedet' => array('parent' => 'facture', 'parentkey' => 'fk_facture'), - 'contratdet' => array('parent' => 'contrat', 'parentkey' => 'fk_contrat'), - 'facture_fourn_det' => array('parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), - 'commande_fournisseurdet' => array('parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande') + 'supplier_proposaldet' => array('name' => 'SupplierProposal', 'parent' => 'supplier_proposal', 'parentkey' => 'fk_supplier_proposal'), + 'propaldet' => array('name' => 'Proposal', 'parent' => 'propal', 'parentkey' => 'fk_propal'), + 'commandedet' => array('name' => 'Order', 'parent' => 'commande', 'parentkey' => 'fk_commande'), + 'facturedet' => array('name' => 'Invoice', 'parent' => 'facture', 'parentkey' => 'fk_facture'), + 'contratdet' => array('name' => 'Contract', 'parent' => 'contrat', 'parentkey' => 'fk_contrat'), + 'facture_fourn_det' => array('name' => 'SupplierInvoice', 'parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), + 'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande') ); /** diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 443e945aecb..d99b13b29c7 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -59,7 +59,9 @@ class Task extends CommonObjectLine /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables = array('projet_task_time'); + protected $childtables = array( + 'projet_task_time' => array('name' => 'Task', 'parent' => 'projet_task', 'parentkey' => 'fk_task') + ); /** * @var int ID parent task diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bfcdce7d348..7fab734a12c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -73,18 +73,18 @@ class Societe extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array( - "supplier_proposal" => array('name' => 'SupplierProposal'), - "propal" => array('name' => 'Proposal'), - "commande" => array('name' => 'Order'), - "facture" => array('name' => 'Invoice'), - "facture_rec" => array('name' => 'RecurringInvoiceTemplate'), - "contrat" => array('name' => 'Contract'), - "fichinter" => array('name' => 'Fichinter'), - "facture_fourn" => array('name' => 'SupplierInvoice'), - "commande_fournisseur" => array('name' => 'SupplierOrder'), - "projet" => array('name' => 'Project'), - "expedition" => array('name' => 'Shipment'), - "prelevement_lignes" => array('name' => 'DirectDebitRecord'), + 'supplier_proposal' => array('name' => 'SupplierProposal'), + 'propal' => array('name' => 'Proposal'), + 'commande' => array('name' => 'Order'), + 'facture' => array('name' => 'Invoice'), + 'facture_rec' => array('name' => 'RecurringInvoiceTemplate'), + 'contrat' => array('name' => 'Contract'), + 'fichinter' => array('name' => 'Fichinter'), + 'facture_fourn' => array('name' => 'SupplierInvoice'), + 'commande_fournisseur' => array('name' => 'SupplierOrder'), + 'projet' => array('name' => 'Project'), + 'expedition' => array('name' => 'Shipment'), + 'prelevement_lignes' => array('name' => 'DirectDebitRecord'), ); /** @@ -92,22 +92,22 @@ class Societe extends CommonObject * if name like with @ClassName:FilePathClass:ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object */ protected $childtablesoncascade = array( - "societe_prices", - "societe_address", - "product_fournisseur_price", - "product_customer_price_log", - "product_customer_price", - "@Contact:/contact/class/contact.class.php:fk_soc", - "adherent", - "societe_account", - "societe_rib", - "societe_remise", - "societe_remise_except", - "societe_commerciaux", - "categorie", - "notify", - "notify_def", - "actioncomm", + 'societe_prices', + 'societe_address', + 'product_fournisseur_price', + 'product_customer_price_log', + 'product_customer_price', + '@Contact:/contact/class/contact.class.php:fk_soc', + 'adherent', + 'societe_account', + 'societe_rib', + 'societe_remise', + 'societe_remise_except', + 'societe_commerciaux', + 'categorie', + 'notify', + 'notify_def', + 'actioncomm', ); /** From 396b5324001257e0e6bae997c211b3dc2bf2c05b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 09:40:22 +0100 Subject: [PATCH 296/328] Can cumulate error message on different authentication modes --- htdocs/core/lib/security2.lib.php | 4 +++- htdocs/main.inc.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index e156c83b147..1cacd70d602 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -69,6 +69,8 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Validation of login/pass/entity with standard modules if (empty($login)) { + unset($_SESSION["dol_loginmesg"]); + $test = true; foreach ($authmode as $mode) { if ($test && $mode && !$login) { @@ -111,7 +113,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Load translation files required by the page $langs->loadLangs(array('other', 'main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); + $_SESSION["dol_loginmesg"] = (isset($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"].', ' : '').$langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); } } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a8e99f05856..51a7dcfafcb 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -736,6 +736,7 @@ if (!defined('NOLOGIN')) { // Validation of login/pass/entity // If ok, the variable login will be returned // If error, we will put error message in session under the name dol_loginmesg + // Note authmode is an array for example: array('0'=>'dolibarr', '1'=>'google'); if ($test && $goontestloop && (GETPOST('actionlogin', 'aZ09') == 'login' || $dolibarr_main_authentication != 'dolibarr')) { $login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode); if ($login === '--bad-login-validity--') { From e8a9a7b73213eafcf3448e728faa088e5420111d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 09:40:34 +0100 Subject: [PATCH 297/328] Responsive --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/core/tpl/objectline_edit.tpl.php | 6 +++--- htdocs/fourn/facture/card.php | 11 +++++++---- htdocs/theme/eldy/global.inc.php | 6 ++++++ htdocs/theme/md/style.css.php | 6 ++++++ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 9c5ddf44229..428a1163df9 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -371,7 +371,7 @@ if ($nolinesbefore) { if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines $coldisplay++; ?> - "> + "> '; $coldisplay++; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index b07ea5042f0..c59949d5fb7 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -90,7 +90,7 @@ $coldisplay = 0; $coldisplay++; ?> - +
@@ -196,7 +196,7 @@ $coldisplay++; if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines $coldisplay++; ?> - + - + info_bits & 2) != 2) { print ''.$langs->trans('AmountHT').''.price($object->total_ht, 1, $langs, 0, -1, -1, $conf->currency).''; - print ''.$langs->trans('AmountVAT').''.price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency).'
        '; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency); if (GETPOST('calculationrule')) { $calculationrule = GETPOST('calculationrule', 'alpha'); } else { @@ -3177,13 +3177,16 @@ if ($action == 'create') { } // Show link for "recalculate" if ($object->getVentilExportCompta() == 0) { - $s = $langs->trans("ReCalculate").' '; + $s = ''.$langs->trans("ReCalculate").' '; $s .= ''.$langs->trans("Mode1").''; $s .= ' / '; $s .= ''.$langs->trans("Mode2").''; - print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'
'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help')); + print '
'; + print '         '; + print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'
'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); + print '
'; } - print '
'; + print ''; // Amount Local Taxes //TODO: Place into a function to control showing by country or study better option diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 65b8bdcf542..4ce28a34cf2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1555,6 +1555,11 @@ table[summary="list_of_modules"] .fa-cog { .maxwidth1000 { max-width: 1000px; } .maxwidth50imp { max-width: 50px !important; } .maxwidth75imp { max-width: 75px !important; } + +.minwidth100onall { min-width: 100px !important; } +.minwidth200onall { min-width: 200px !important; } +.minwidth250onall { min-width: 250px !important; } + .minheight20 { min-height: 20px; } .minheight30 { min-height: 30px; } .minheight40 { min-height: 40px; } @@ -1763,6 +1768,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select .maxwidth50onsmartphone { max-width: 40px; } .maxwidth75onsmartphone { max-width: 50px; } .maxwidth100onsmartphone { max-width: 70px; } + .maxwidth125onsmartphone { max-width: 100px; } .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8fbe02beba9..15095b3b3e8 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1643,6 +1643,11 @@ tr.nobottom td { .maxwidth500 { max-width: 500px; } .maxwidth50imp { max-width: 50px !important; } .maxwidth75imp { max-width: 75px !important; } + +.minwidth100onall { min-width: 100px !important; } +.minwidth200onall { min-width: 200px !important; } +.minwidth250onall { min-width: 250px !important; } + .minheight20 { min-height: 20px; } .minheight30 { min-height: 30px; } .minheight40 { min-height: 40px; } @@ -1835,6 +1840,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select .maxwidth50onsmartphone { max-width: 40px; } .maxwidth75onsmartphone { max-width: 50px; } .maxwidth100onsmartphone { max-width: 70px; } + .maxwidth125onsmartphone { max-width: 100px; } .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } From bc938d86bae39a8d6b0ed5cc79299c0624a31b60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 11:22:54 +0100 Subject: [PATCH 298/328] NEW Can enter price with tax for predefined products on purchase objects --- htdocs/core/tpl/objectline_create.tpl.php | 12 +- .../class/fournisseur.commande.class.php | 4 +- htdocs/fourn/commande/card.php | 66 +++++----- htdocs/fourn/facture/card.php | 25 +++- htdocs/supplier_proposal/card.php | 123 +++++++++++++----- 5 files changed, 153 insertions(+), 77 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 428a1163df9..b09a33f44f6 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -1034,18 +1034,18 @@ if (!empty($usemargins) && $user->rights->margins->creer) { jQuery("#multicurrency_price_ht").val('').show(); jQuery("#title_up_ht, #title_up_ht_currency").show(); - jQuery("#price_ht").val('').hide(); + //jQuery("#price_ht").val('').hide(); jQuery("#multicurrency_price_ht").val('').hide(); jQuery("#title_up_ht, #title_up_ht_currency").hide(); - global->MAIN_ENABLE_EDIT_PREDEF_PRICETTC)) { ?> - jQuery("#price_ttc").val('').hide(); - jQuery("#multicurrency_price_ttc").val('').hide(); - jQuery("#title_up_ttc, #title_up_ttc_currency").hide(); - + global->MAIN_DISABLE_EDIT_PREDEF_PRICETTC)) { ?> jQuery("#price_ttc").val('').show(); jQuery("#multicurrency_price_ttc").val('').show(); jQuery("#title_up_ttc, #title_up_ttc_currency").show(); + + jQuery("#price_ttc").val('').hide(); + jQuery("#multicurrency_price_ttc").val('').hide(); + jQuery("#title_up_ttc, #title_up_ttc_currency").hide(); jQuery("#fourn_ref, #tva_tx, #title_vat").hide(); /* jQuery("#title_fourn_ref").hide(); */ diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a195a2ed2e1..2dcf70765f9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1718,7 +1718,7 @@ class CommandeFournisseur extends CommonOrder * Add order line * * @param string $desc Description - * @param float $pu_ht Unit price + * @param float $pu_ht Unit price (used if $price_base_type is 'HT') * @param float $qty Quantity * @param float $txtva Taux tva * @param float $txlocaltax1 Localtax1 tax @@ -1728,7 +1728,7 @@ class CommandeFournisseur extends CommonOrder * @param string $ref_supplier Supplier reference price * @param float $remise_percent Remise * @param string $price_base_type HT or TTC - * @param float $pu_ttc Unit price TTC + * @param float $pu_ttc Unit price TTC (used if $price_base_type is 'TTC') * @param int $type Type of line (0=product, 1=service) * @param int $info_bits More information * @param bool $notrigger Disable triggers diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c7a937518d7..b71ba0de941 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -412,10 +412,9 @@ if (empty($reshook)) { // Set if we used free entry or predefined product $predef = ''; $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); - $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); - $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $prod_entry_mode = GETPOST('prod_entry_mode'); if ($prod_entry_mode == 'free') { $idprod = 0; @@ -425,6 +424,8 @@ if (empty($reshook)) { $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' + $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); + $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); $price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2); $price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); @@ -461,7 +462,7 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); $error++; } - if (GETPOST('qty', 'int') == '') { + if (GETPOST('qty', 'alpha') == '') { // 0 is allowed for order setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error++; } @@ -506,13 +507,14 @@ if (empty($reshook)) { } } elseif (GETPOST('idprodfournprice', 'alpha') > 0) { $qtytosearch = $qty; // Just to see if a price exists for the quantity. Not used to found vat. - //$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist + //$qtytosearch = -1; // We force qty to -1 to be sure to find if a supplier price exist $idprod = $productsupplier->get_buyprice(GETPOST('idprodfournprice', 'alpha'), $qtytosearch); $res = $productsupplier->fetch($idprod); } if ($idprod > 0) { $label = $productsupplier->label; + // Define output language if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; @@ -550,41 +552,44 @@ if (empty($reshook)) { $ref_supplier = $productsupplier->ref_supplier; - $type = $productsupplier->type; - if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') { - $price_base_type = 'HT'; - $pu = price2num($price_ht, 'MU'); - $pu_ht_devise = price2num($price_ht_devise, 'CU'); - } elseif (GETPOST('price_ttc') != '' || GETPOST('price_ttc_devise') != '') { - $price_base_type = 'TTC'; - $pu = price2num($price_ttc, 'MU'); - $pu_ht_devise = price2num($price_ttc_devise, 'CU'); - } else { - $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); - if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency - $pu = $productsupplier->fourn_pu; - $pu_ht_devise = 0; - } else { - $pu = $productsupplier->fourn_pu; - $pu_ht_devise = $productsupplier->fourn_multicurrency_unitprice; - } + // Get vat rate + if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority) + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); } - - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); if (empty($tva_tx)) { $tva_npr = 0; } $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); + $type = $productsupplier->type; + if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') { + $price_base_type = 'HT'; + $pu = price2num($price_ht, 'MU'); + $pu_devise = price2num($price_ht_devise, 'CU'); + } elseif (GETPOST('price_ttc') != '' || GETPOST('price_ttc_devise') != '') { + $price_base_type = 'TTC'; + $pu = price2num($price_ttc, 'MU'); + $pu_devise = price2num($price_ttc_devise, 'CU'); + } else { + $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); + if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency + $pu = $productsupplier->fourn_pu; + $pu_devise = 0; + } else { + $pu = $productsupplier->fourn_pu; + $pu_devise = $productsupplier->fourn_multicurrency_unitprice; + } + } + if (empty($pu)) { $pu = 0; // If pu is '' or null, we force to have a numeric value } $result = $object->addline( $desc, - $pu, + ($price_base_type == 'HT' ? $pu : 0), $qty, $tva_tx, $localtax1_tx, @@ -594,7 +599,7 @@ if (empty($reshook)) { $ref_supplier, $remise_percent, $price_base_type, - $pu_ttc, + ($price_base_type == 'TTC' ? $pu : 0), $type, $tva_npr, '', @@ -602,7 +607,7 @@ if (empty($reshook)) { $date_end, $array_options, $productsupplier->fk_unit, - $pu_ht_devise, + $pu_devise, '', 0 ); @@ -645,7 +650,7 @@ if (empty($reshook)) { } $price_base_type = 'HT'; $pu_ht_devise = price2num($price_ht_devise, 'CU'); - // var_dump($pu_ht.' '.$tva_tx.' '.$pu_ttc.' '.$price_base_type.' '.$pu_ht_devise); exit; + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, '', '', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise); } @@ -759,6 +764,7 @@ if (empty($reshook)) { $price_base_type = 'HT'; $ht = price2num(GETPOST('price_ht'), '', 2); } else { + $reg = array(); $vatratecleaned = $vat_rate; if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) { // If vat is "xx (yy)" $vatratecleaned = trim($reg[1]); @@ -770,7 +776,7 @@ if (empty($reshook)) { $price_base_type = 'HT'; } - $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); + $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU', 2); // Extrafields Lines $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8778e0d40b8..f4d628d5882 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1447,7 +1447,7 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); $error++; } - if (!GETPOST('qty')) { + if (!GETPOST('qty', 'alpha')) { // 0 is NOT allowed for invoices setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error++; } @@ -1499,12 +1499,27 @@ if (empty($reshook)) { if ($idprod > 0) { $label = $productsupplier->label; - + // Define output language + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } + if (empty($newlang)) { + $newlang = $object->thirdparty->default_lang; + } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $desc = (!empty($productsupplier->multilangs[$outputlangs->defaultlang]["description"])) ? $productsupplier->multilangs[$outputlangs->defaultlang]["description"] : $productsupplier->description; + } else { + $desc = $productsupplier->description; + } // if we use supplier description of the products if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { $desc = $productsupplier->desc_supplier; - } else { - $desc = $productsupplier->description; } //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time @@ -3555,7 +3570,7 @@ if ($action == 'create') { } print '
'; - print ''; + print '
'; global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index b66dfc94ed6..f0594b90b6f 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -541,21 +541,28 @@ if (empty($reshook)) { $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $ref_supplier = GETPOST('fourn_ref', 'alpha'); + $prod_entry_mode = GETPOST('prod_entry_mode'); if ($prod_entry_mode == 'free') { $idprod = 0; - $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } else { $idprod = GETPOST('idprod', 'int'); - $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); - $tva_tx = ''; } - $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' + + $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); + $price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2); + $price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2); + $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); + + $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0); + if (empty($remise_percent)) { + $remise_percent = 0; + } // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -568,6 +575,10 @@ if (empty($reshook)) { } } + if ($prod_entry_mode == 'free' && GETPOST('price_ht') < 0 && $qty < 0) { + setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); + $error++; + } if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && GETPOST('type') < 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $error++; @@ -589,10 +600,7 @@ if (empty($reshook)) { $db->begin(); - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $txtva par celui du produit - if (($prod_entry_mode != 'free') && empty($error)) { // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' + if ($prod_entry_mode != 'free' && empty($error)) { // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' $productsupplier = new ProductFournisseur($db); $idprod = 0; @@ -603,7 +611,7 @@ if (empty($reshook)) { $reg = array(); if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg)) { $idprod = $reg[1]; - $res = $productsupplier->fetch($idprod); // Load product from its ID + $res = $productsupplier->fetch($idprod); // Load product from its id // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price if (!empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) { @@ -626,42 +634,85 @@ if (empty($reshook)) { if ($idprod > 0) { $label = $productsupplier->label; - // if we use supplier description of the products - if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { - $desc = $productsupplier->desc_supplier; + // Define output language + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } + if (empty($newlang)) { + $newlang = $object->thirdparty->default_lang; + } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $desc = (!empty($productsupplier->multilangs[$outputlangs->defaultlang]["description"])) ? $productsupplier->multilangs[$outputlangs->defaultlang]["description"] : $productsupplier->description; } else { $desc = $productsupplier->description; } + // if we use supplier description of the products + if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { + $desc = $productsupplier->desc_supplier; + } - if (trim($product_desc) != trim($desc)) { + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if (trim($product_desc) == trim($desc) && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { + $product_desc=''; + } + + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) { + $desc = $product_desc; + } + if (!empty($product_desc) && trim($product_desc) != trim($desc)) { $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); } - $type = $productsupplier->type; - $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); - $ref_supplier = $productsupplier->ref_supplier; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + // Get vat rate + if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority) + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + } if (empty($tva_tx)) { $tva_npr = 0; } $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); - if (empty($pu_ht)) { - $pu_ht = 0; // If pu is '' or null, we force to have a numeric value + $type = $productsupplier->type; + if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') { + $price_base_type = 'HT'; + $pu = price2num($price_ht, 'MU'); + $pu_devise = price2num($price_ht_devise, 'CU'); + } elseif (GETPOST('price_ttc') != '' || GETPOST('price_ttc_devise') != '') { + $price_base_type = 'TTC'; + $pu = price2num($price_ttc, 'MU'); + $pu_devise = price2num($price_ttc_devise, 'CU'); + } else { + $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); + if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency + $pu = $productsupplier->fourn_pu; + $pu_devise = 0; + } else { + $pu = $productsupplier->fourn_pu; + $pu_devise = $productsupplier->fourn_multicurrency_unitprice; + } + } + + if (empty($pu)) { + $pu = 0; // If pu is '' or null, we force to have a numeric value } // If GETPOST('idprodfournprice') is a numeric, we can use it. If it is empty or if it is 'idprod_123', we should use -1 (not used) $fournprice = (is_numeric(GETPOST('idprodfournprice', 'alpha')) ? GETPOST('idprodfournprice', 'alpha') : -1); $buyingprice = 0; - $pu_ht_devise = price2num($price_ht_devise, 'MU'); $result = $object->addline( $desc, - $pu_ht, + ($price_base_type == 'HT' ? $pu : 0), $qty, $tva_tx, $localtax1_tx, @@ -669,7 +720,7 @@ if (empty($reshook)) { $productsupplier->id, $remise_percent, $price_base_type, - $pu_ttc, + ($price_base_type == 'TTC' ? $pu : 0), $tva_npr, $type, -1, @@ -683,7 +734,7 @@ if (empty($reshook)) { $productsupplier->fk_unit, '', 0, - $pu_ht_devise, + $pu_devise, $date_start, $date_end ); @@ -709,6 +760,7 @@ if (empty($reshook)) { } elseif ((GETPOST('price_ht') !== '' || GETPOST('price_ttc') !== '' || GETPOST('multicurrency_price_ht') != '') && empty($error)) { // Free product. // $price_ht is already set $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); $tva_tx = str_replace('*', '', $tva_tx); $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); @@ -718,21 +770,22 @@ if (empty($reshook)) { $fk_unit = GETPOST('units', 'alpha'); if (!preg_match('/\((.*)\)/', $tva_tx)) { - $tva_tx = price2num($tva_tx); // When vat is text input field + $tva_tx = price2num($tva_tx); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' } // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); - if ($price_ht !== '') { + if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') { $pu_ht = price2num($price_ht, 'MU'); // $pu_ht must be rounded according to settings } else { $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } $price_base_type = 'HT'; - $pu_ht_devise = price2num($price_ht_devise, 'MU'); + $pu_ht_devise = price2num($price_ht_devise, 'CU'); + $info_bits = 0; $result = $object->addline( $desc, @@ -800,6 +853,7 @@ if (empty($reshook)) { unset($_POST['price_ht']); unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); + unset($_POST['fourn_ref']); unset($_POST['tva_tx']); unset($_POST['label']); unset($_POST['product_ref']); @@ -813,6 +867,8 @@ if (empty($reshook)) { unset($_POST['np_markRate']); unset($_POST['dp_desc']); unset($_POST['idprodfournprice']); + unset($_POST['units']); + unset($_POST['idprod']); unset($_POST['date_starthour']); @@ -852,10 +908,9 @@ if (empty($reshook)) { $localtax2_rate = get_localtax($vat_rate, 2, $mysoc, $object->thirdparty); if (GETPOST('price_ht') != '') { + $price_base_type = 'HT'; $ht = price2num(GETPOST('price_ht'), '', 2); - } - - if (GETPOST('price_ttc') != '') { + } else { $reg = array(); $vatratecleaned = $vat_rate; if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) { // If vat is "xx (yy)" @@ -865,10 +920,10 @@ if (empty($reshook)) { $ttc = price2num(GETPOST('price_ttc'), '', 2); $ht = $ttc / (1 + ($vatratecleaned / 100)); + $price_base_type = 'HT'; } - $price_base_type = 'HT'; - $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU'); + $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU', 2); // Add buying price $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); From 50847efdf8fe0f5bd0e248c916f852937b72d768 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 11:44:36 +0100 Subject: [PATCH 299/328] Add the country into the popup with info on company. --- htdocs/core/tpl/objectline_create.tpl.php | 17 ++++++++++------- htdocs/main.inc.php | 5 ++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index b09a33f44f6..17683562be5 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -645,17 +645,20 @@ if (!empty($usemargins) && $user->rights->margins->creer) { $("#select_type").change(function() { setforfree(); - if (jQuery('#select_type').val() >= 0) - { - /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ + + if (jQuery('#select_type').val() >= 0) { + console.log("Set focus on description field"); + /* this focus code works on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); - /* focus if CKEDITOR */ - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") - { + /* this focus code works for CKEDITOR */ + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { var editor = CKEDITOR.instances['dp_desc']; - if (editor) { editor.focus(); } + if (editor) { + editor.focus(); + } } } + console.log("Hide/show date according to product type"); if (jQuery('#select_type').val() == '0') { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 51a7dcfafcb..fe0986e8d13 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2104,6 +2104,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $dropdownBody .= '
'.$langs->transcountry("ProfId6", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6"), 6).''; } $dropdownBody .= '
'.$langs->trans("VATIntraShort").': '.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA"), 'VAT').''; + $dropdownBody .= '
'.$langs->trans("Country").': '.$langs->trans("Country".$mysoc->country_code).''; $dropdownBody .= ''; @@ -2242,7 +2243,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') '; } else { $btnUser = ' -
'; } + print ''; } else { print ''; @@ -501,26 +503,27 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Bank check number print ''; print ''; // Check transmitter print ''; print ''; // Bank name print ''; print ''; // Comments print ''; print ''; + print ''; + print ''; print '
'; + print '
aa'; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); + $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; print '
'; @@ -314,6 +315,7 @@ if ($action == 'edit') { $setupnotempty++; print '
'; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); + $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print $form->textwithpicto($langs->trans($constname), $tooltiphelp); print '
'; diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 516c2b41e13..3bec23d0d37 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -75,7 +75,7 @@ class modPartnership extends DolibarrModules // $this->editor_url = 'https://www.example.com'; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = 'development'; + $this->version = 'experimental'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index bc334fe08cf..9cd52930714 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -37,7 +37,8 @@ EventOrganization=Event organization Settings=Settings EventOrganizationSetupPage = Event Organization setup page EVENTORGANIZATION_TASK_LABEL = Label of tasks to create automatically when project is validated -EVENTORGANIZATION_TASK_LABELTooltip = When you validate an organized event, some tasks can be automatically created in the project

For example:
Send Call for Conference
Send Call for Booth
Receive call for conferences
Receive call for Booth
Open subscriptions to events for attendees
Send remind of event to speakers
Send remind of event to Booth hoster
Send remind of event to attendees +EVENTORGANIZATION_TASK_LABELTooltip = When you validate an event to organize, some tasks can be automatically created in the project

For example:
Send Call for Conferences
Send Call for Booths
Validate suggestions of Conferences
Validate application for Booths
Open subscriptions to the event for attendees
Send a remind of the event to speakers
Send a remind of the event to Booth hosters
Send a remind of the event to attendees +EVENTORGANIZATION_TASK_LABELTooltip2=Keep empty if you don't need to create tasks automatically. EVENTORGANIZATION_CATEG_THIRDPARTY_CONF = Category to add to third-parties automatically created when someone suggests a conference EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH = Category to add to third-parties automatically created when they suggests a booth EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF = Template of email to send after receiving a suggestion of a conference. diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4ce28a34cf2..062f0592020 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2402,7 +2402,7 @@ img.photorefnoborder { } .trextrafieldseparator td, .trextrafields_collapse_last td { /* border-bottom: 2px solid var(--colorbackhmenu1) !important; */ - border-bottom: 2px solid var(--colortopbordertitle1) !important; + /* border-bottom: 2px solid var(--colortopbordertitle1) !important; */ } .tdhrthin { From 453c8981e835c6dbd956be607dfdc5325e1da4b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 12:24:28 +0100 Subject: [PATCH 301/328] CSS --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 996f1f90f9c..08e4503748f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1886,7 +1886,7 @@ class ExtraFields $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">'; $out .= '<'.$tagtype_dyn.' '.(!empty($colspan)?'colspan="' . $colspan . '"':'').'>'; // Some js code will be injected here to manage the collapsing of extrafields - $out .= ' '; + $out .= ' '; $out .= ''; $out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out .= ''; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index ac243396c72..da6f90892c4 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021 Frédéric France * * 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 From c2a088c5ff022e3eec4eb4342f401950fde1a5a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 12:34:52 +0100 Subject: [PATCH 302/328] Fix regression in phpunit --- htdocs/core/lib/security2.lib.php | 4 +--- test/phpunit/SecurityTest.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 1cacd70d602..4b70419630f 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -69,8 +69,6 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Validation of login/pass/entity with standard modules if (empty($login)) { - unset($_SESSION["dol_loginmesg"]); - $test = true; foreach ($authmode as $mode) { if ($test && $mode && !$login) { @@ -113,7 +111,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Load translation files required by the page $langs->loadLangs(array('other', 'main', 'errors')); - $_SESSION["dol_loginmesg"] = (isset($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"].', ' : '').$langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); + $_SESSION["dol_loginmesg"] = (empty($_SESSION["dol_loginmesg"]) ? '' : $_SESSION["dol_loginmesg"].', ').$langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); } } } diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index eabfe389174..e1180c980ef 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -604,7 +604,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $login=checkLoginPassEntity('admin', 'admin', 1, array('forceuser')); print __METHOD__." login=".$login."\n"; - $this->assertEquals($login, ''); // Expected '' because should failed because login 'auto' does not exists + $this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists } /** From d75483552d3400da9b7a8e1919460032c19ae4df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 15:48:36 +0100 Subject: [PATCH 303/328] Responsive --- htdocs/compta/paiement.php | 13 ++++++++----- htdocs/fourn/facture/paiement.php | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 9f40d2daa88..324c4161ac6 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -491,8 +491,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($facture->type == 2) { print '
'.$langs->trans('AccountToDebit').''; - print $form->select_comptes($accountid, 'accountid', 0, '', 2, '', 0, '', 1); + print img_picto('', 'bank_account'); + print $form->select_comptes($accountid, 'accountid', 0, '', 2, '', 0, 'widthcentpercentminusx maxwidth500', 1); print ' 
'.$langs->trans('Numero'); - print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print '
'.$langs->trans('CheckTransmitter'); - print ' ('.$langs->trans("ChequeMaker").')'; + print ' ('.$langs->trans("ChequeMaker").')'; print '
'.$langs->trans('Bank'); - print ' ('.$langs->trans("ChequeBank").')'; + print ' ('.$langs->trans("ChequeBank").')'; print '
'.$langs->trans('Comments').''; - print '
'; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 4b6e5bf151c..2662e38951d 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -499,7 +499,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($conf->banque->enabled)) { print ''.$langs->trans('Account').''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid, 'accountid', 0, '', 2); + print $form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid, 'accountid', 0, '', 2, '', 0, 'widthcentpercentminusx maxwidth500', 1); print ''; } else { print ' '; From 55e414ca306aae45118a7ba5f271421fb8b527e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 16:02:53 +0100 Subject: [PATCH 304/328] Fix sql --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 85e9350eac3..59f0d640ba7 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -261,7 +261,7 @@ ALTER TABLE llx_product_attribute CHANGE rang position INTEGER DEFAULT 0 NOT NUL ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; -ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); +ALTER TABLE llx_mailing ADD UNIQUE INDEX uk_mailing(titre, entity); create table llx_inventory_extrafields ( From 35c57988a06a84c359d2fa691fafb024b0fe70cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 20:06:50 +0100 Subject: [PATCH 305/328] Responsive --- htdocs/takepos/css/pos.css.php | 16 +++++++++++++++- htdocs/takepos/index.php | 4 ++-- htdocs/takepos/invoice.php | 2 +- htdocs/takepos/split.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 3 ++- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index c57b145d94c..ba85c111bcd 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -794,7 +794,8 @@ div#moreinfo, div#infowarehouse { .headersplit { height: 10%; width: 100%; - padding: 10px; + padding-top: 20px; + padding-bottom: 2px; } .headercontent { @@ -806,6 +807,19 @@ div#moreinfo, div#infowarehouse { background-color: rgb(233,234,237); } + +@media only screen and (max-width: 767px) +{ + .headercontent { + width: 80%; + } + + .headersplit .headercontent { + font-size: 1em; + } +} + + .row:after { content: ""; display: table; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 5650c0d4fdd..31c51a4c7b1 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -910,7 +910,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {