From c3a23b0415b51831136cad52e6d7281f2b0327ea Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Aug 2020 06:23:35 +0200 Subject: [PATCH 01/50] Remove admin access on option --- htdocs/accountancy/admin/index.php | 215 ++++++++++++++--------------- 1 file changed, 103 insertions(+), 112 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 26ea76d2277..89ba3a200b8 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -226,82 +226,78 @@ print ''; print ''.$langs->trans('Options').''; print "\n"; -if (!empty($user->admin)) +// TO DO Mutualize code for yes/no constants + +/* Set this option as a hidden option but keep it for some needs. +print ''; +print ''.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").''; +if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; +*/ + +print ''; +print ''.$langs->trans("BANK_DISABLE_DIRECT_INPUT").''; +if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +print ''; +print ''.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").''; +if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +print ''; +print ''.$langs->trans("ACCOUNTING_MANAGE_ZERO").''; +if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +// Param a user $user->rights->accounting->chartofaccount can access +foreach ($list as $key) { - // TO DO Mutualize code for yes/no constants + print ''; - /* Set this option as a hidden option but keep it for some needs. - print ''; - print ''.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").''; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; + + // Param + $label = $langs->trans($key); + print ''.$label.''; + // Value + print ''; + print ''; + + print ''; print ''; - */ - - print ''; - print ''.$langs->trans("BANK_DISABLE_DIRECT_INPUT").''; - if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - - print ''; - print ''.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").''; - if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - - print ''; - print ''.$langs->trans("ACCOUNTING_MANAGE_ZERO").''; - if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - - // Param a user $user->rights->accounting->chartofaccount can access - foreach ($list as $key) - { - print ''; - - if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; - - // Param - $label = $langs->trans($key); - print ''.$label.''; - // Value - print ''; - print ''; - - print ''; - - print ''; - } } print ''; print '
'; @@ -312,58 +308,53 @@ print ''; print ''.$langs->trans('BindingOptions').''; print "\n"; -if (!empty($user->admin)) -{ - // TO DO Mutualize code for yes/no constants - print ''; - print ''.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").''; - if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - - print ''; - print ''.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").''; - if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; +// TO DO Mutualize code for yes/no constants +print ''; +print ''.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").''; +if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; } +print ''; + +print ''; +print ''.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").''; +if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; // Param a user $user->rights->accounting->chartofaccount can access foreach ($list_binding as $key) { - print ''; + print ''; - // Param - $label = $langs->trans($key); - print ''.$label.''; - // Value - print ''; - if ($key == 'ACCOUNTING_DATE_START_BINDING') { + // Param + $label = $langs->trans($key); + print ''.$label.''; + // Value + print ''; + if ($key == 'ACCOUNTING_DATE_START_BINDING') { print $form->selectDate(($conf->global->$key ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1); } else { print ''; } - print ''; - - print ''; + print ''; + print ''; } - print ''; print '
'; From 8e0dfc8621f2783328659173e612876370d2ca76 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Aug 2020 06:28:16 +0200 Subject: [PATCH 02/50] Fix oddeven --- htdocs/accountancy/admin/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 89ba3a200b8..69823456692 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -256,7 +256,7 @@ if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { } print ''; -print ''; +print ''; print ''.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").''; if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print ''; @@ -269,7 +269,7 @@ if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { } print ''; -print ''; +print ''; print ''.$langs->trans("ACCOUNTING_MANAGE_ZERO").''; if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { print ''; @@ -322,7 +322,7 @@ if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { } print ''; -print ''; +print ''; print ''.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").''; if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { print ''; From 3e80c71713ee08754e9b66952973e75fd8418fc0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Aug 2020 07:38:46 +0200 Subject: [PATCH 03/50] NEW Accountancy - Add options to disable binding on sales, purchases & expense reports independently of the modules --- htdocs/accountancy/admin/index.php | 75 ++++++++++++++++++++++ htdocs/core/menus/init_menu_auguria.sql | 18 +++--- htdocs/core/menus/standard/auguria.lib.php | 9 ++- htdocs/core/menus/standard/eldy.lib.php | 15 +++-- htdocs/langs/en_US/accountancy.lang | 3 + 5 files changed, 102 insertions(+), 18 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 69823456692..24c605bd930 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -174,6 +174,42 @@ if ($action == 'setenablesubsidiarylist') { } } +if ($action == 'setdisablebindingonsales') { + $setdisablebindingonsales = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity); + if (!$res > 0) + $error++; + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + +if ($action == 'setdisablebindingonpurchases') { + $setdisablebindingonpurchases = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity); + if (!$res > 0) + $error++; + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + +if ($action == 'setdisablebindingonexpensereports') { + $setdisablebindingonexpensereports = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity); + if (!$res > 0) + $error++; + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View */ @@ -355,6 +391,45 @@ foreach ($list_binding as $key) print ''; } +print ''; +print ''.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").''; +if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +print ''; +print ''.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").''; +if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +print ''; +print ''.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").''; +if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + print ''; print '
'; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index ec75b35073c..7a715bd397f 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -273,15 +273,15 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- 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', __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 && $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__); - 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 && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 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->accounting->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier', 'SuppliersVentilation', 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 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/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 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 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->accounting->enabled && $conf->expensereport->enabled', __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 && $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 && $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__); + 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__); + 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', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 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->accounting->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier', 'SuppliersVentilation', 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 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/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 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 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->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__); -- 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__); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index f6312f41015..820cb6090e1 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -385,10 +385,13 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $nature = ''; // Must match array $sourceList defined into journals_list.php - if ($objp->nature == 2 && ! empty($conf->facture->enabled)) $nature="sells"; - if ($objp->nature == 3 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))) $nature="purchases"; + 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)) $nature="expensereports"; + 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"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 65be4ba0e4b..11c55124b82 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1231,7 +1231,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Binding // $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch'); - if (!empty($conf->facture->enabled)) + 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)) { @@ -1239,7 +1239,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $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)) + 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)) { @@ -1247,7 +1247,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $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)) + 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)) { @@ -1283,10 +1283,13 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $nature = ''; // Must match array $sourceList defined into journals_list.php - if ($objp->nature == 2 && !empty($conf->facture->enabled)) $nature = "sells"; - if ($objp->nature == 3 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))) $nature = "purchases"; + 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)) $nature = "expensereports"; + 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"; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 7b59e33b296..1091f387cd6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -305,6 +305,9 @@ ErrorAccountingJournalIsAlreadyUse=This journal is already use AccountingAccountForSalesTaxAreDefinedInto=Note: Accounting account for Sales tax are defined into menu %s - %s NumberOfAccountancyEntries=Number of entries NumberOfAccountancyMovements=Number of movements +ACCOUNTING_DISABLE_BINDING_ON_SALES=Disable binding on sales +ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding on purchases +ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding on expense reports ## Export ExportDraftJournal=Export draft journal From b6af4014dec821d583e8e6b6d6205a241bfa2646 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 13 Jul 2020 13:08:15 +0200 Subject: [PATCH 04/50] hide eatby, sellby dates --- htdocs/fourn/commande/dispatch.php | 60 +++++++++++++++++------- htdocs/product/stock/productlot_card.php | 29 +++++++----- 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c64d158ac2c..4b077d861f3 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -733,8 +733,12 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Description").''; if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("EatByDate").''; - print ''.$langs->trans("SellByDate").''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + } } else { print ''; print ''; @@ -819,8 +823,12 @@ if ($id > 0 || !empty($ref)) { print $linktoprod; print ""; print ''; - print ''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + } } else { print ''; print $linktoprod; @@ -828,8 +836,12 @@ if ($id > 0 || !empty($ref)) { print ''; print $langs->trans("ProductDoesNotUseBatchSerial"); print ''; - print ''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + } } } else { print ''; @@ -896,14 +908,18 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; - print ''; - $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); - print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, '', '', 1, ''); - print ''; - print ''; - $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); - print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, ''); - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + $dlcdatesuffix = dol_mktime( 0, 0, 0, GETPOST( 'dlc' . $suffix . 'month' ), GETPOST( 'dlc' . $suffix . 'day' ), GETPOST( 'dlc' . $suffix . 'year' ) ); + print $form->selectDate( $dlcdatesuffix, 'dlc' . $suffix, '', '', 1, '' ); + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); + print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, ''); + print ''; + } print ' '; // Supplier ref + Qty ordered + qty already dispatched } else { $type = 'dispatch'; @@ -1118,8 +1134,12 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("DateDeliveryPlanned").''; if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("EatByDate").''; - print ''.$langs->trans("SellByDate").''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print '' . $langs->trans( "EatByDate" ) . ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print '' . $langs->trans( "SellByDate" ) . ''; + } } print ''.$langs->trans("QtyDispatched").''; print ''.$langs->trans("Warehouse").''; @@ -1174,8 +1194,12 @@ if ($id > 0 || !empty($ref)) { $lot=new Productlot($db); $lot->fetch(0, $objp->pid, $objp->batch); print ''.$lot->getNomUrl(1).''; - print ''.dol_print_date($lot->eatby, 'day').''; - print ''.dol_print_date($lot->sellby, 'day').''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print '' . dol_print_date( $lot->eatby, 'day' ) . ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print '' . dol_print_date( $lot->sellby, 'day' ) . ''; + } } else { print ''; print ''; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 9b6de313b65..f091de9d78e 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -327,21 +327,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Eat by - print ''; - print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; - print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + print $form->editfieldkey( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' ); + print ''; + print $form->editfieldval( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' ); + print ''; + print ''; + } // Sell by - print ''; - print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; - print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; - print ''; - + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + print $form->editfieldkey( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' ); + print ''; + print $form->editfieldval( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' ); + print ''; + print ''; + } // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; From 819144700794ecc50e657c00a580fd4ec56aa14d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 13 Jul 2020 11:12:53 +0000 Subject: [PATCH 05/50] Fixing style errors. --- htdocs/fourn/commande/dispatch.php | 12 ++++++------ htdocs/product/stock/productlot_card.php | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4b077d861f3..f3a1b1d86dd 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -910,8 +910,8 @@ if ($id > 0 || !empty($ref)) { print ''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''; - $dlcdatesuffix = dol_mktime( 0, 0, 0, GETPOST( 'dlc' . $suffix . 'month' ), GETPOST( 'dlc' . $suffix . 'day' ), GETPOST( 'dlc' . $suffix . 'year' ) ); - print $form->selectDate( $dlcdatesuffix, 'dlc' . $suffix, '', '', 1, '' ); + $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year')); + print $form->selectDate($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, ''); print ''; } if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { @@ -1135,10 +1135,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print '' . $langs->trans( "EatByDate" ) . ''; + print '' . $langs->trans("EatByDate") . ''; } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - print '' . $langs->trans( "SellByDate" ) . ''; + print '' . $langs->trans("SellByDate") . ''; } } print ''.$langs->trans("QtyDispatched").''; @@ -1195,10 +1195,10 @@ if ($id > 0 || !empty($ref)) { $lot->fetch(0, $objp->pid, $objp->batch); print ''.$lot->getNomUrl(1).''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print '' . dol_print_date( $lot->eatby, 'day' ) . ''; + print '' . dol_print_date($lot->eatby, 'day') . ''; } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - print '' . dol_print_date( $lot->sellby, 'day' ) . ''; + print '' . dol_print_date($lot->sellby, 'day') . ''; } } else { print ''; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index f091de9d78e..0f706c3ccae 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -329,9 +329,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Eat by if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''; - print $form->editfieldkey( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' ); + print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print ''; - print $form->editfieldval( $langs->trans( 'EatByDate' ), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker' ); + print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print ''; print ''; } @@ -339,9 +339,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Sell by if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; - print $form->editfieldkey( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' ); + print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print ''; - print $form->editfieldval( $langs->trans( 'SellByDate' ), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker' ); + print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print ''; print ''; } From 2873e6bdcab43f696cfa0fdbaf32f4afd4874505 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 6 Aug 2020 15:51:12 +0200 Subject: [PATCH 06/50] hide dates in productlot_list --- htdocs/product/stock/productlot_list.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 0fb3c4a0388..58a03fd2563 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -99,6 +99,12 @@ $arrayfields = array( 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); +if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + unset($arrayfields['t.sellby']); +} +if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) { + unset($arrayfields['t.eatby']); +} // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { @@ -338,8 +344,8 @@ if ($resql) if (!empty($arrayfields['t.entity']['checked'])) print ''; if (!empty($arrayfields['t.batch']['checked'])) print ''; if (!empty($arrayfields['t.fk_product']['checked'])) print ''; - if (!empty($arrayfields['t.sellby']['checked'])) print ''; - if (!empty($arrayfields['t.eatby']['checked'])) print ''; + if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) print ''; + if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) print ''; if (!empty($arrayfields['t.fk_user_creat']['checked'])) print ''; if (!empty($arrayfields['t.fk_user_modif']['checked'])) print ''; if (!empty($arrayfields['t.import_key']['checked'])) print ''; @@ -381,8 +387,8 @@ if ($resql) if (!empty($arrayfields['t.entity']['checked'])) print_liste_field_titre($arrayfields['t.entity']['label'], $_SERVER['PHP_SELF'], 't.entity', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.batch']['checked'])) print_liste_field_titre($arrayfields['t.batch']['label'], $_SERVER['PHP_SELF'], 't.batch', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_product']['checked'])) print_liste_field_titre($arrayfields['t.fk_product']['label'], $_SERVER['PHP_SELF'], 't.fk_product', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.sellby']['checked'])) print_liste_field_titre($arrayfields['t.sellby']['label'], $_SERVER['PHP_SELF'], 't.sellby', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.eatby']['checked'])) print_liste_field_titre($arrayfields['t.eatby']['label'], $_SERVER['PHP_SELF'], 't.eatby', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) print_liste_field_titre($arrayfields['t.sellby']['label'], $_SERVER['PHP_SELF'], 't.sellby', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) print_liste_field_titre($arrayfields['t.eatby']['label'], $_SERVER['PHP_SELF'], 't.eatby', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_user_creat']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_creat']['label'], $_SERVER['PHP_SELF'], 't.fk_user_creat', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_user_modif']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_modif']['label'], $_SERVER['PHP_SELF'], 't.fk_user_modif', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.import_key']['checked'])) print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER['PHP_SELF'], 't.import_key', '', $param, '', $sortfield, $sortorder); @@ -442,12 +448,12 @@ if ($resql) print ''.$productstatic->getNomUrl(1).''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['t.sellby']['checked'])) + if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.dol_print_date($db->jdate($obj->sellby), 'day').''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['t.eatby']['checked'])) + if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''.dol_print_date($db->jdate($obj->eatby), 'day').''; if (!$i) $totalarray['nbfield']++; From df3fcec6c6349e1faa10118cb51316a6b0cbe396 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 19 Aug 2020 16:44:45 +0200 Subject: [PATCH 07/50] hide dates on erassortlot.php --- htdocs/product/reassortlot.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index de49a11fbc7..050d0d12f4b 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -284,8 +284,12 @@ if ($resql) print ''; print ' '; print ' '; - print ' '; - print ' '; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ' '; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ' '; + } print ' '; print ' '; print ''; @@ -302,8 +306,12 @@ if ($resql) print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.ref", $param, "", '', $sortfield, $sortorder); //print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'',$sortfield,$sortorder, 'right ); print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", $param, "", '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", $param, "", '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", $param, "", '', $sortfield, $sortorder, 'center '); + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", $param, "", '', $sortfield, $sortorder, 'center '); + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", $param, "", '', $sortfield, $sortorder, 'center '); + } print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", '', $sortfield, $sortorder, 'right '); // TODO Add info of running suppliers/customers orders //print_liste_field_titre("TheoreticalStock",$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'',$sortfield,$sortorder, 'right '); @@ -400,8 +408,12 @@ if ($resql) } print ''; - print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; - print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; + } print ''; //if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; print $objp->stock_physique; From b777c625575d29875cba64caef27a8aae42ece94 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 20 Aug 2020 12:13:05 +0200 Subject: [PATCH 08/50] hide eatby sellby on product/stock/product --- htdocs/product/stock/product.php | 46 +++++++++++++------ .../product/stock/tpl/stockcorrection.tpl.php | 20 ++++---- .../product/stock/tpl/stocktransfer.tpl.php | 16 ++++--- 3 files changed, 54 insertions(+), 28 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index af7a95fb95a..f4669c44cea 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -805,11 +805,18 @@ if (!$variants) { print ''.$langs->trans("EstimatedStockValueSellShort").''; print ''; if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) { + $colspan = 3; print ''; print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("EatByDate").''; - print ''.$langs->trans("SellByDate").''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $colspan--; + print ''.$langs->trans("EatByDate").''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $colspan--; + print ''.$langs->trans("SellByDate").''; + } + print ''; print ''; print ''; print ''; @@ -887,14 +894,18 @@ if (!$variants) { print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print ''; +// print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + } + print ''; print ''; print '
'; - print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); - print ''; - print $form->selectDate($pdluo->sellby, 'sellby', '', '', 1, '', 1, 0); - print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; + print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); + print ''; + print $form->selectDate($pdluo->sellby, 'sellby', '', '', 1, '', 1, 0); + print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; print '
'; @@ -911,9 +922,16 @@ if (!$variants) { print ''; print $product_lot_static->getNomUrl(1); print ''; - print ''.dol_print_date($pdluo->eatby, 'day').''; - print ''.dol_print_date($pdluo->sellby, 'day').''; - print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; + $colspan = 3; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $colspan--; + print ''.dol_print_date($pdluo->eatby, 'day').''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $colspan--; + print ''.dol_print_date($pdluo->sellby, 'day').''; + } + print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; print ''; print ''; } diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 98826ca6799..88cced3b99d 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -103,14 +103,18 @@ if (!empty($conf->productbatch->enabled) && print ''; print ''; print ''; - print ''.$langs->trans("EatByDate").''; - $eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); - print ''; - print ''.$langs->trans("SellByDate").''; - $sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + $eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + $sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); + print ''; + } print ''; } diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index f725a5ebbfe..0164e99bd37 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -107,12 +107,16 @@ if (!empty($conf->productbatch->enabled) && print ''; print ''; - print ''.$langs->trans("EatByDate").''; - print $form->selectDate(($d_eatby ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print ''; - print ''.$langs->trans("SellByDate").''; - print $form->selectDate(($d_sellby ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + print $form->selectDate(($d_eatby ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + print $form->selectDate(($d_sellby ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print ''; + } print ''; } From b74113e2eb7e4964b705e064f38c3d77c58b379f Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 20 Aug 2020 12:13:27 +0200 Subject: [PATCH 09/50] hide eatby sellby on expedition --- htdocs/expedition/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 929e7ecafd0..94ace4ab64f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1300,8 +1300,12 @@ if ($action == 'create') $detail = ''; $detail .= $langs->trans("Batch").': '.$dbatch->batch; - $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); - $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + } $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail .= '
'; print $detail; From a5b4fcedb7a055329ab9c05693166850aa2865b9 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 20 Aug 2020 12:48:23 +0200 Subject: [PATCH 10/50] hide eatby sellby in reception --- htdocs/reception/card.php | 45 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 7bc99977943..27722c29ed4 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -966,8 +966,12 @@ if ($action == 'create') if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("EatByDate").''; - print ''.$langs->trans("SellByDate").''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + } } print "\n"; } @@ -1114,12 +1118,16 @@ if ($action == 'create') if (!empty($product->status_batch)) { print ''; - print ''; - print $form->selectDate($dispatchLines[$indiceAsked]['DLC'], 'dlc'.$indiceAsked, '', '', 1, ""); - print ''; - print ''; - print $form->selectDate($dispatchLines[$indiceAsked]['DLUO'], 'dluo'.$indiceAsked, '', '', 1, ""); - print ''; + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + print $form->selectDate($dispatchLines[$indiceAsked]['DLC'], 'dlc'.$indiceAsked, '', '', 1, ""); + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + print $form->selectDate($dispatchLines[$indiceAsked]['DLUO'], 'dluo'.$indiceAsked, '', '', 1, ""); + print ''; + } } else { print ''; } @@ -1807,10 +1815,14 @@ if ($action == 'create') if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) { print '
'; - print $langs->trans('EatByDate').' : '; - print $form->selectDate($lines[$i]->eatby, 'dlc'.$line_id, '', '', 1, "").'
'; - print $langs->trans('SellByDate').' : '; - print $form->selectDate($lines[$i]->sellby, 'dluo'.$line_id, '', '', 1, ""); + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print $langs->trans('EatByDate').' : '; + print $form->selectDate($lines[$i]->eatby, 'dlc'.$line_id, '', '', 1, "").'
'; + } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print $langs->trans('SellByDate').' : '; + print $form->selectDate($lines[$i]->sellby, 'dluo'.$line_id, '', '', 1, ""); + } print ''; } print ''; @@ -1856,11 +1868,14 @@ if ($action == 'create') $detail = ''; if ($lines[$i]->product->status_batch) { - $detail .= $langs->trans("Batch").': '.$lines[$i]->batch; + $detail .= $langs->trans("Batch").': '.$lines[$i]->batch; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($lines[$i]->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($lines[$i]->eatby, "day"); - - $detail .= '
'; + } + $detail .= '
'; print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); } else { From 179fc2e70a341b6c929872299bc2dae84618ab5d Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 20 Aug 2020 15:27:34 +0200 Subject: [PATCH 11/50] hide other eatby sellby dates --- htdocs/expedition/card.php | 8 ++++++-- htdocs/mrp/mo_movements.php | 6 ++++++ htdocs/product/stock/index.php | 16 ++++++++++++---- htdocs/product/stock/movement_list.php | 6 ++++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 94ace4ab64f..621d6421d2d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2307,8 +2307,12 @@ if ($action == 'create') foreach ($lines[$i]->detail_batch as $dbatch) // $dbatch is instance of ExpeditionLineBatch { $detail .= $langs->trans("Batch").': '.$dbatch->batch; - $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); - $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + } $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail .= '
'; } diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index f43ccd3dcd4..e281d45ee74 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -143,6 +143,12 @@ $arrayfields = array( //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) ); +if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) { + unset($arrayfields['pl.eatby']); +} +if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + unset($arrayfields['pl.sellby']); +} $objectlist->fields = dol_sort_array($objectlist->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index fc43d5e8ce3..5a7cd3b2d3d 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -159,8 +159,12 @@ if ($resql) if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("Batch").''; - print ''.$langs->trans("SellByDate").''; - print ''.$langs->trans("EatByDate").''; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.$langs->trans("SellByDate").''; + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + } } print ''.$langs->trans("Warehouse").''; print ''.$langs->trans("FullList").''; @@ -191,8 +195,12 @@ if ($resql) if (!empty($conf->productbatch->enabled)) { print ''.$objp->batch.''; - print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; - print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; + } } print ''; print $warehouse->getNomUrl(1); diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index c844bae01e2..ee4c77eb2e4 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -121,6 +121,12 @@ $arrayfields = array( //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) ); +if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) { + unset($arrayfields['pl.eatby']); +} +if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + unset($arrayfields['pl.sellby']); +} // Security check if (!$user->rights->stock->mouvement->lire) { From 3c108e8bbf571d436b06a3ceeb7f77143674d900 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 20 Aug 2020 13:31:48 +0000 Subject: [PATCH 12/50] Fixing style errors. --- htdocs/product/stock/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f4669c44cea..315a5993d92 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -894,7 +894,7 @@ if (!$variants) { print ''; print ''; print ''; -// print ''; + // print ''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print '
'; print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); From b1849aed5c418b182d79829cd731b8d543d97cb9 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 24 Aug 2020 07:53:25 +0200 Subject: [PATCH 13/50] fix for mistakenly uncommented code --- htdocs/product/stock/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 315a5993d92..9f7628edc25 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -894,7 +894,7 @@ if (!$variants) { print ''; print ''; print ''; - // print ''; + print ''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''; if (!empty($arrayfields['t.batch']['checked'])) print ''; if (!empty($arrayfields['t.fk_product']['checked'])) print ''; - if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) print ''; - if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) print ''; + if (!empty($arrayfields['t.sellby']['checked'])) print ''; + if (!empty($arrayfields['t.eatby']['checked'])) print ''; if (!empty($arrayfields['t.fk_user_creat']['checked'])) print ''; if (!empty($arrayfields['t.fk_user_modif']['checked'])) print ''; if (!empty($arrayfields['t.import_key']['checked'])) print ''; @@ -387,8 +387,8 @@ if ($resql) if (!empty($arrayfields['t.entity']['checked'])) print_liste_field_titre($arrayfields['t.entity']['label'], $_SERVER['PHP_SELF'], 't.entity', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.batch']['checked'])) print_liste_field_titre($arrayfields['t.batch']['label'], $_SERVER['PHP_SELF'], 't.batch', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_product']['checked'])) print_liste_field_titre($arrayfields['t.fk_product']['label'], $_SERVER['PHP_SELF'], 't.fk_product', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) print_liste_field_titre($arrayfields['t.sellby']['label'], $_SERVER['PHP_SELF'], 't.sellby', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) print_liste_field_titre($arrayfields['t.eatby']['label'], $_SERVER['PHP_SELF'], 't.eatby', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.sellby']['checked'])) print_liste_field_titre($arrayfields['t.sellby']['label'], $_SERVER['PHP_SELF'], 't.sellby', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.eatby']['checked'])) print_liste_field_titre($arrayfields['t.eatby']['label'], $_SERVER['PHP_SELF'], 't.eatby', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_user_creat']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_creat']['label'], $_SERVER['PHP_SELF'], 't.fk_user_creat', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.fk_user_modif']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_modif']['label'], $_SERVER['PHP_SELF'], 't.fk_user_modif', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.import_key']['checked'])) print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER['PHP_SELF'], 't.import_key', '', $param, '', $sortfield, $sortorder); @@ -448,12 +448,12 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['t.sellby']['checked']) && empty($conf->global->PRODUCT_DISABLE_SELLBY)) + if (!empty($arrayfields['t.sellby']['checked'])) { print ''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['t.eatby']['checked']) && empty($conf->global->PRODUCT_DISABLE_EATBY)) + if (!empty($arrayfields['t.eatby']['checked'])) { print ''; if (!$i) $totalarray['nbfield']++; From 85575fd60443680ac4b8215ff2b3f9bd58e4b5e3 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 4 Sep 2020 12:18:32 +0200 Subject: [PATCH 18/50] NEW translate classification labels in ticket --- .../interface_50_modTicket_TicketEmail.class.php | 14 +++++++------- htdocs/ticket/card.php | 6 +++--- htdocs/ticket/list.php | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 88d988eae1f..75a91b1140a 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -182,7 +182,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $langs->load('ticket'); - $object->fetch('', $object->track_id); // Should be useless + $object->fetch('', '', $object->track_id); // Should be useless // Send email to notification email @@ -200,9 +200,9 @@ class InterfaceTicketEmail extends DolibarrTriggers $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin'); $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id).'

'; $message_admin .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; - $message_admin .= '
  • '.$langs->trans('Type').' : '.$object->type_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('Category').' : '.$object->category_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('Severity').' : '.$object->severity_label.'
  • '; + $message_admin .= '
  • ' . $langs->trans('Type') . ' : ' . $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code) . '
  • '; + $message_admin .= '
  • ' . $langs->trans('Category') . ' : ' . $langs->getLabelFromKey($this->db, 'TicketCategoryShort' . $object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code) . '
  • '; + $message_admin .= '
  • ' . $langs->trans('Severity') . ' : ' . $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code) . '
  • '; $message_admin .= '
  • '.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'
  • '; // Extrafields $extraFields = new ExtraFields($this->db); @@ -270,9 +270,9 @@ class InterfaceTicketEmail extends DolibarrTriggers $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectCustomer'); $message_customer = $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id).'

    '; $message_customer .= '
    • '.$langs->trans('Title').' : '.$object->subject.'
    • '; - $message_customer .= '
    • '.$langs->trans('Type').' : '.$object->type_label.'
    • '; - $message_customer .= '
    • '.$langs->trans('Category').' : '.$object->category_label.'
    • '; - $message_customer .= '
    • '.$langs->trans('Severity').' : '.$object->severity_label.'
    • '; + $message_customer .= '
    • ' . $langs->trans('Type') . ' : ' . $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code) . '
    • '; + $message_customer .= '
    • ' . $langs->trans('Category') . ' : ' . $langs->getLabelFromKey($this->db, 'TicketCategoryShort' . $object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code) . '
    • '; + $message_customer .= '
    • ' . $langs->trans('Severity') . ' : ' . $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code) . '
    • '; // Extrafields foreach ($this->attributes[$object->table_element]['label'] as $key => $value) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index d5da98b4a84..86ff9cb0e70 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1022,15 +1022,15 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd } else { // Type print '
'; // Group print ''; // Severity print ''; } print '
'; print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); From 335f57f9be73f2872e2017d0a0bdc2df52c82fb5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 24 Aug 2020 11:41:00 +0200 Subject: [PATCH 14/50] Fix language --- htdocs/langs/en_US/accountancy.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 1091f387cd6..490e3b34719 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -305,9 +305,9 @@ ErrorAccountingJournalIsAlreadyUse=This journal is already use AccountingAccountForSalesTaxAreDefinedInto=Note: Accounting account for Sales tax are defined into menu %s - %s NumberOfAccountancyEntries=Number of entries NumberOfAccountancyMovements=Number of movements -ACCOUNTING_DISABLE_BINDING_ON_SALES=Disable binding on sales -ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding on purchases -ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding on expense reports +ACCOUNTING_DISABLE_BINDING_ON_SALES=Disable binding & transfer in accountancy on sales +ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountancy on purchases +ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports ## Export ExportDraftJournal=Export draft journal From 4c0e1d20d6064ab06610a0109d2273511cd13fd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Aug 2020 05:27:07 +0200 Subject: [PATCH 15/50] FIX CSS --- htdocs/theme/md/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3d8f424b8ce..d6b6f3d46e4 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2773,7 +2773,7 @@ a.tabTitle { white-space: nowrap; } .tabTitleText { - display: hidden; + display: none; } .imgTabTitle { max-height: 14px; From eb83941e6166fca55a8c67b11e37c42edc7d126c Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 4 Sep 2020 10:46:05 +0200 Subject: [PATCH 16/50] NEW manage errors on update extra fields in ticket card --- htdocs/ticket/card.php | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index d5da98b4a84..50b675d49fe 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -127,6 +127,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +$error = 0; if (empty($reshook)) { // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers{ @@ -157,6 +158,8 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors'); $action = 'create'; } + $ret = $extrafields->setOptionalsFromPost(null, $object); + if ($ret < 0) $error++; if (!$error) { $db->begin(); @@ -174,12 +177,10 @@ if (empty($reshook)) { $object->fk_project = GETPOST('projectid', 'int'); - $ret = $extrafields->setOptionalsFromPost(null, $object); - $id = $object->create($user); if ($id <= 0) { $error++; - setEventMessage($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } @@ -560,18 +561,22 @@ if (empty($reshook)) { // Action to update one extrafield if ($action == "update_extras" && !empty($permissiontoadd)) { $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); - $attributekey = GETPOST('attribute', 'alpha'); - $attributekeylong = 'options_' . $attributekey; - $object->array_options['options_' . $attributekey] = GETPOST($attributekeylong, ' alpha'); - $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); - if ($result > 0) { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - $action = 'view'; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'edit_extras'; + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none')); + if ($ret < 0) $error++; + + if (!$error) { + $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); + if ($result > 0) { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + $action = 'view'; + } else { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } + + if ($error) $action = 'edit_extras'; } if ($action == "change_property" && GETPOST('btn_update_ticket_prop', 'alpha') && $user->rights->ticket->write) { From 564a47e41c17d0f527eb7fbde5a917ccf49f9f6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 12:08:10 +0200 Subject: [PATCH 17/50] Update productlot_list.php --- htdocs/product/stock/productlot_list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 58a03fd2563..ec5e3ebde69 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -344,8 +344,8 @@ if ($resql) if (!empty($arrayfields['t.entity']['checked'])) print ''.$productstatic->getNomUrl(1).''.dol_print_date($db->jdate($obj->sellby), 'day').''.dol_print_date($db->jdate($obj->eatby), 'day').'
'.$langs->trans("Type").''; - print $langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label'); + print $langs->getLabelFromKey($db, 'TicketTypeShort' . $object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); print '
'.$langs->trans("TicketCategory").''; - print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label'); + print $langs->getLabelFromKey($db, 'TicketCategoryShort' . $object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); print '
'.$langs->trans("TicketSeverity").''; - print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label'); + print $langs->getLabelFromKey($db, 'TicketSeverityShort' . $object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); print '
'; // End table actions diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index b228339971f..6ea898e92db 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -755,9 +755,9 @@ while ($i < min($num, $limit)) if ($cssforfield || $val['css']) print '"'; print '>'; if ($key == 'fk_statut') print $object->getLibStatut(5); - elseif ($key == 'category_code') print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label'); - elseif ($key == 'severity_code') print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label'); - elseif ($key == 'type_code') print $langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label'); + elseif ($key == 'category_code') print $langs->getLabelFromKey($db, 'TicketCategoryShort' . $object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); + elseif ($key == 'severity_code') print $langs->getLabelFromKey($db, 'TicketSeverityShort' . $object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); + elseif ($key == 'type_code') print $langs->getLabelFromKey($db, 'TicketTypeShort' . $object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); elseif ($key == 'tms') print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); elseif ($key == 'fk_user_create') { if ($object->fk_user_create > 0) { From 07fc85c222616d1713d75b8cf7c86e77232b0637 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 12:25:16 +0200 Subject: [PATCH 19/50] Fix minor --- htdocs/comm/action/index.php | 11 ++-- htdocs/theme/eldy/global.inc.php | 96 ++++---------------------------- htdocs/ticket/card.php | 4 +- 3 files changed, 19 insertions(+), 92 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index ce3a9f26509..b2c38b3e13e 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1207,7 +1207,7 @@ if (empty($action) || $action == 'show_month') // View by month print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); print ''; - print '
'; + print '
'; print ''; print ' '; // Column title of weeks numbers @@ -1215,7 +1215,7 @@ if (empty($action) || $action == 'show_month') // View by month $i = 0; while ($i < 7) { - print '
'; + print ' '; $numdayinweek = (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7); if (!empty($conf->dol_optimize_smallscreen)) { @@ -1308,12 +1308,12 @@ if (empty($action) || $action == 'show_month') // View by month print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); print ''; - print '
'; + print '
'; print ''; print ' '; $i = 0; while ($i < 7) { - echo ' \n"; + echo ' \n"; $i++; } echo " \n"; @@ -1368,11 +1368,10 @@ if (empty($action) || $action == 'show_month') // View by month print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); print ''; - print '
'; + print '
'; echo '
'.$langs->trans("Day".(($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7))."'.$langs->trans("Day".(($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7))."
'; echo ' '; - echo ' '; echo ' \n"; echo " \n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2b985bde752..8185ddbec92 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1077,6 +1077,15 @@ table[summary="list_of_modules"] .fa-cog { height: 100px; } +.maxscreenheightless200 { + max-height: px; /* we guarantee height of 500 */ +} +.maxscreenheightless300 { + max-height: px; /* we guarantee height of 500 */ +} + + + /* ============================================================================== */ /* Styles to hide objects */ @@ -2074,90 +2083,7 @@ a.tmenuimage:hover{ /* Do not load menu img for other if hidden to save bandwidth */ - - - - div.mainmenu.home{ - background-image: url(); - background-position-x: center; - } - - div.mainmenu.billing { - background-image: url(); - } - - div.mainmenu.accountancy { - background-image: url(); - } - - div.mainmenu.agenda { - background-image: url(); - } - - div.mainmenu.bank { - background-image: url(); - } - - div.mainmenu.cashdesk { - background-image: url(); - } - - div.mainmenu.takepos { - background-image: url(); - } - - div.mainmenu.companies { - background-image: url(); - } - - div.mainmenu.commercial { - background-image: url(); - } - - div.mainmenu.ecm { - background-image: url(); - } - - div.mainmenu.externalsite { - background-image: url(); - } - - div.mainmenu.ftp { - background-image: url(); - } - - div.mainmenu.hrm { - background-image: url(); - } - - div.mainmenu.members { - background-image: url(); - } - - div.mainmenu.products { - background-image: url(); - } - - div.mainmenu.mrp { - background-image: url(); - } - - div.mainmenu.project { - background-image: url(); - } - - div.mainmenu.ticket { - background-image: url(); - } - - div.mainmenu.tools { - background-image: url(); - } - - div.mainmenu.website { - background-image: url(); - } - + 'name of class for div') @@ -4514,7 +4440,9 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; } .cal_event_notbusy a.cal_event_title:hover { color: #111111; font-weight: normal !important; color:rgba(255,255,255,.75); } .cal_event_busy { } .cal_peruserviewname { max-width: 140px; height: 22px; } +.cal_event span.badge.badge-status { border: 1px solid #aaa; } table.cal_month tr td table.nobordernopadding tr td { padding: 0 2px 0 2px; } +table.cal_month tr.liste_titre td.tdfordaytitle { min-width: 120px; } a.dayevent-aday { padding-left: 8px; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index d5da98b4a84..e5d4a4f6fd9 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -179,7 +179,7 @@ if (empty($reshook)) { $id = $object->create($user); if ($id <= 0) { $error++; - setEventMessage($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } @@ -305,7 +305,7 @@ if (empty($reshook)) { $ret = $object->update($user); if ($ret <= 0) { $error++; - setEventMessage($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } From 9141b6b0923ae9d30fc32371d23ae4356b6dec28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Fri, 4 Sep 2020 12:36:03 +0200 Subject: [PATCH 20/50] NEW endpoint getContacts and Clean results NEW Get contacts list of a given order FIX bad function used to unlink a contact FIX Result for link contact and unlink contact --- htdocs/commande/class/api_orders.class.php | 64 +++++++++++++++++++--- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index cc7db3db852..d53634a4e08 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -456,6 +456,40 @@ class Orders extends DolibarrApi } } + /** + * Get contacts of given order + * + * Return an array with contact informations + * + * @param int $id ID of order + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) + * + * @url GET {id}/contacts + * + * @return array data without useless information + * + * @throws RestException + */ + public function getContacts($id, $type = '') + { + if (! DolibarrApiAccess::$user->rights->commande->lire) { + throw new RestException(401); + } + + $result = $this->commande->fetch($id); + if ( ! $result ) { + throw new RestException(404, 'Order not found'); + } + + if ( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $contacts = $this->commande->liste_contact(-1, 'external', 0, $type); + + return $this->_cleanObjectDatas($contacts); + } + /** * Add a contact type of given order * @@ -487,15 +521,24 @@ class Orders extends DolibarrApi $result = $this->commande->add_contact($contactid, $type, 'external'); - if (!$result) { + if ($result < 0) { throw new RestException(500, 'Error when added the contact'); } - return $this->commande; + if ($result == 0) { + throw new RestException(304, 'contact already added'); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Contact linked to the order' + ) + ); } /** - * Delete a contact type of given order + * Unlink a contact type of given order * * @param int $id Id of order to update * @param int $rowid Row key of the contact in the array contact_ids. @@ -510,26 +553,31 @@ class Orders extends DolibarrApi */ public function deleteContact($id, $rowid) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } $result = $this->commande->fetch($id); - if (!$result) { + if (! $result) { throw new RestException(404, 'Order not found'); } - if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { + if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->commande->delete_contact($rowid); + $result = $this->commande->delete_linked_contact($rowid); if (!$result) { throw new RestException(500, 'Error when deleted the contact'); } - return $this->commande; + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Contact unlinked from order' + ) + ); } /** From 1ceb7c86777f602b5a7040edc817bd2021f9894d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 12:41:56 +0200 Subject: [PATCH 21/50] Add ref_ext to product_attribute. --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 1 + htdocs/install/mysql/tables/llx_product_attribute.sql | 4 ++++ .../mysql/tables/llx_product_attribute_combination.sql | 3 ++- htdocs/install/mysql/tables/llx_product_attribute_value.sql | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 17b58f278cf..934c8495d03 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -205,6 +205,7 @@ ALTER TABLE llx_recruitment_recruitmentcandidature_extrafields ADD INDEX idx_rec ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid); +ALTER TABLE llx_product_attribute ADD COLUMN ref_ext VARCHAR(255) after ref; CREATE TABLE llx_product_attribute_combination_price_level diff --git a/htdocs/install/mysql/tables/llx_product_attribute.sql b/htdocs/install/mysql/tables/llx_product_attribute.sql index f7ebee3cc23..c81d122d9bb 100644 --- a/htdocs/install/mysql/tables/llx_product_attribute.sql +++ b/htdocs/install/mysql/tables/llx_product_attribute.sql @@ -1,5 +1,6 @@ -- ============================================================================ -- Copyright (C) 2016 Marcos García +-- Copyright (C) 2020 Laurent Destailleur -- -- 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 @@ -14,12 +15,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- llx_product_attribute is table for labels of product variants attributes. For exemple: COLOR, SIZE, ... +-- The different possible values (for example BLUE, GREEN, ... for COLOR) are defined into llx_product_attribute_value. -- ============================================================================ CREATE TABLE llx_product_attribute ( rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT, ref VARCHAR(255) NOT NULL, + ref_ext VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, rang INT DEFAULT 0 NOT NULL, entity INT DEFAULT 1 NOT NULL diff --git a/htdocs/install/mysql/tables/llx_product_attribute_combination.sql b/htdocs/install/mysql/tables/llx_product_attribute_combination.sql index a00b4009c72..041ffe5a60e 100644 --- a/htdocs/install/mysql/tables/llx_product_attribute_combination.sql +++ b/htdocs/install/mysql/tables/llx_product_attribute_combination.sql @@ -1,5 +1,6 @@ -- ============================================================================ -- Copyright (C) 2016 Marcos García +-- Copyright (C) 2020 Laurent Destailleur -- -- 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 @@ -14,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- Table to store all product variants of a parent product +-- Table to store links between a parent product and its variant products. -- ============================================================================ CREATE TABLE llx_product_attribute_combination diff --git a/htdocs/install/mysql/tables/llx_product_attribute_value.sql b/htdocs/install/mysql/tables/llx_product_attribute_value.sql index c4e0ec91459..09e7d325d0d 100644 --- a/htdocs/install/mysql/tables/llx_product_attribute_value.sql +++ b/htdocs/install/mysql/tables/llx_product_attribute_value.sql @@ -15,6 +15,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- llx_product_attribute_value is table for different available values of a product variants attributes. +-- For example BLUE, GREEN, ... for the product attribute COLOR. -- ============================================================================ CREATE TABLE llx_product_attribute_value From e21b3f66818561d20b52e9d4676e28fa83d750f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 13:23:11 +0200 Subject: [PATCH 22/50] FIX bad route url to delete subproduct with API --- htdocs/product/class/api_products.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 7fea66e325e..10cb3686752 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -456,7 +456,7 @@ class Products extends DolibarrApi * @throws RestException 401 * @throws RestException 404 * - * @url DELETE {id}/subproducts/remove + * @url DELETE {id}/subproducts/remove/{subproduct_id} */ public function delSubproducts($id, $subproduct_id) { From 092b66a7f1273aff1c92b26a738fb90b8a528516 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 13:35:16 +0200 Subject: [PATCH 23/50] Add variation_ref_ext field --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 1 + .../install/mysql/tables/llx_product_attribute_combination.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 934c8495d03..cc460f5ba42 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -206,6 +206,7 @@ ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitme ALTER TABLE llx_product_attribute ADD COLUMN ref_ext VARCHAR(255) after ref; +ALTER TABLE llx_product_attribute_combination ADD COLUMN variation_ref_ext varchar(255) AFTER variation_weight; CREATE TABLE llx_product_attribute_combination_price_level diff --git a/htdocs/install/mysql/tables/llx_product_attribute_combination.sql b/htdocs/install/mysql/tables/llx_product_attribute_combination.sql index 041ffe5a60e..ce64eafde0e 100644 --- a/htdocs/install/mysql/tables/llx_product_attribute_combination.sql +++ b/htdocs/install/mysql/tables/llx_product_attribute_combination.sql @@ -26,5 +26,6 @@ CREATE TABLE llx_product_attribute_combination variation_price DOUBLE(24,8) NOT NULL, variation_price_percentage INTEGER NULL, variation_weight REAL NOT NULL, + variation_ref_ext VARCHAR(255) NULL, entity INTEGER DEFAULT 1 NOT NULL )ENGINE=innodb; From f2a16d860e55ddf4fa9d61f77c6c4627bdf441e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 14:05:35 +0200 Subject: [PATCH 24/50] Enhance method fetchByFkProductChild() --- .../class/ProductCombination.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 4c25e32c9da..817c67dc4b8 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -228,16 +228,18 @@ class ProductCombination /** - * Retrieves a product combination by a child product row id + * Retrieves information of a variant product and ID of its parent product. * - * @param int $fk_child Product row id - * @return int <0 KO, >0 OK + * @param int $productid Product ID of variant + * @param int $donotloadpricelevel Avoid loading price impact for each level. If PRODUIT_MULTIPRICES is not set, this has no effect. + * @return int <0 if KO, 0 if product ID is not ID of a variant product (so parent not found), >0 if OK (ID of parent) */ - public function fetchByFkProductChild($fk_child) + public function fetchByFkProductChild($productid, $donotloadpricelevel = 0) { global $conf; - $sql = "SELECT rowid, fk_product_parent, fk_product_child, variation_price, variation_price_percentage, variation_weight FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_child = ".(int) $fk_child." AND entity IN (".getEntity('product').")"; + $sql = "SELECT rowid, fk_product_parent, fk_product_child, variation_price, variation_price_percentage, variation_weight"; + $sql .= " FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_child = ".((int) $productid)." AND entity IN (".getEntity('product').")"; $query = $this->db->query($sql); @@ -246,7 +248,7 @@ class ProductCombination } if (!$this->db->num_rows($query)) { - return -1; + return 0; } $result = $this->db->fetch_object($query); @@ -258,11 +260,11 @@ class ProductCombination $this->variation_price_percentage = $result->variation_price_percentage; $this->variation_weight = $result->variation_weight; - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + if (empty($donotloadpricelevel) && !empty($conf->global->PRODUIT_MULTIPRICES)) { $this->fetchCombinationPriceLevels(); } - return 1; + return $this->fk_product_parent; } /** From 4f68c694b811e2f88ec308cccdd55c6855cbc316 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 4 Sep 2020 14:25:13 +0200 Subject: [PATCH 25/50] NEW fetch object useless on create ticket trigger --- .../core/triggers/interface_50_modTicket_TicketEmail.class.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 75a91b1140a..b29c2981ae2 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -182,9 +182,6 @@ class InterfaceTicketEmail extends DolibarrTriggers $langs->load('ticket'); - $object->fetch('', '', $object->track_id); // Should be useless - - // Send email to notification email $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) From 7094cec42aa1f5bf2f2f2be657570648afd3e1e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 14:18:48 +0200 Subject: [PATCH 26/50] Fix use same duration code 'on 1 letter' than the production duration record, also than tha sprintf. --- htdocs/comm/action/card.php | 57 ++++++++----------- .../action/class/actioncommreminder.class.php | 8 +-- htdocs/core/class/html.form.class.php | 4 +- 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f3612133100..a181586815f 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -58,23 +58,23 @@ $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); -$fulldayevent = GETPOST('fullday'); +$fulldayevent = GETPOST('fullday', 'alpha'); -$aphour = GETPOST('aphour'); -$apmin = GETPOST('apmin'); -$p2hour = GETPOST('p2hour'); -$p2min = GETPOST('p2min'); +$aphour = GETPOST('aphour', 'int'); +$apmin = GETPOST('apmin', 'int'); +$p2hour = GETPOST('p2hour', 'int'); +$p2min = GETPOST('p2min', 'int'); -$addreminder = GETPOST('addreminder'); -$offsetvalue = GETPOST('offsetvalue'); -$offsetunit = GETPOST('offsetunittype_duration'); -$remindertype = GETPOST('selectremindertype'); -$modelmail = GETPOST('actioncommsendmodel_mail'); +$addreminder = GETPOST('addreminder', 'alpha'); +$offsetvalue = GETPOST('offsetvalue', 'int'); +$offsetunit = GETPOST('offsetunittype_duration', 'aZ09'); +$remindertype = GETPOST('selectremindertype', 'aZ09'); +$modelmail = GETPOST('actioncommsendmodel_mail', 'int'); //var_dump($_POST); exit; -$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); -$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); +$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); +$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); // Security check $socid = GETPOST('socid', 'int'); @@ -391,19 +391,7 @@ if (empty($reshook) && $action == 'add') if ($addreminder == 'on'){ $actionCommReminder = new ActionCommReminder($db); - if ($offsetunit == 'minute'){ - $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'i'); - } elseif ($offsetunit == 'hour'){ - $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'h'); - } elseif ($offsetunit == 'day') { - $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'd'); - } elseif ($offsetunit == 'week') { - $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'w'); - } elseif ($offsetunit == 'month') { - $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'm'); - } elseif ($offsetunit == 'year') { - $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'y'); - } + $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'i'); $actionCommReminder->dateremind = $dateremind; $actionCommReminder->typeremind = $remindertype; @@ -418,15 +406,20 @@ if (empty($reshook) && $action == 'add') if ($res <= 0){ // If error - $db->rollback(); + $error++; $langs->load("errors"); - $error = $langs->trans('ErrorReminderActionCommCreation'); - setEventMessages($error, null, 'errors'); + $error = $langs->trans('ErrorReminderActionCommCreation').' '.$actionCommReminder->error; + setEventMessages($error, $actionCommReminder->errors, 'errors'); $action = 'create'; $donotclearsession = 1; } } - $db->commit(); + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + if (!empty($backtopage)) { dol_syslog("Back to ".$backtopage.($moreparam ? (preg_match('/\?/', $backtopage) ? '&'.$moreparam : '?'.$moreparam) : '')); @@ -929,9 +922,9 @@ if ($action == 'create') print '     -     '; //print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend'); } else { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend'); } print ''; @@ -1208,7 +1201,7 @@ if ($action == 'create') //Time Type print ''; //Reminder Type diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 2d327cfc409..16384edfcde 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -50,6 +50,9 @@ class ActionCommReminder extends CommonObject */ public $picto = 'generic'; + const STATUS_TODO = 0; + const STATUS_DONE = 1; + /** * 'type' if the field format. @@ -79,7 +82,7 @@ class ActionCommReminder extends CommonObject 'typeremind' => array('type'=>'varchar(32)', 'label'=>'TypeRemind', 'visible'=>-1, 'enabled'=>1, 'position'=>55, 'notnull'=>1, 'comment'=>"email, browser, sms",), 'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,), 'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,), - 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",), + 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"y, m, d, w, h, i",), 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), 'fk_actioncomm' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1, 'index'=>1,), 'fk_email_template' => array('type'=>'integer', 'label'=>'EmailTemplate', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>0), @@ -121,9 +124,6 @@ class ActionCommReminder extends CommonObject */ public $fk_email_template; - const STATUS_TODO = 0; - const STATUS_DONE = 1; - // END MODULEBUILDER PROPERTIES diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3daaf572ca6..7ec1a32f072 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5680,11 +5680,11 @@ class Form * @param string $selected Selected type * @return string HTML select string */ - public function selectTypeDuration($prefix, $selected = 'minute') + public function selectTypeDuration($prefix, $selected = 'i') { global $langs; - $TDurationTypes = array('year'=>$langs->trans('Years'), 'month'=>$langs->trans('Month'), 'week'=>$langs->trans('Weeks'), 'day'=>$langs->trans('Days'), 'hour'=>$langs->trans('Hours'), 'minute'=>$langs->trans('Minutes')); + $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')); $retstring = ''; @@ -383,6 +383,21 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print ''; } +// Activate iDEAL +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; +} + // Warehouse for automatic decrement //if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment //{ diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index f3bb30d7efb..4113f49cd04 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -294,8 +294,8 @@ class Stripe extends CommonObject /** * Get the Stripe payment intent. Create it with confirmnow=false * Warning. If a payment was tried and failed, a payment intent was created. - * But if we change something on object to pay (amount or other), reusing same payment intent is not allowed. - * Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay), + * But if we change something on object to pay (amount or other), reusing same payment intent is not allowed by Stripe. + * Recommended solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay), * that's why i comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used) * Note: This is used when option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on when making a payment from the public/payment/newpayment.php page * but not when using the STRIPE_USE_NEW_CHECKOUT. @@ -345,14 +345,14 @@ class Stripe extends CommonObject $paymentintent = null; - if (is_object($object)) + if (is_object($object) && ! empty($conf->global->STRIPE_REUSE_EXISTING_INTENT_IF_FOUND)) { // Warning. If a payment was tried and failed, a payment intent was created. - // But if we change someting on object to pay (amount or other that does not change the idempotency key), reusing same payment intent is not allowed. - // Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay), Stripe will + // But if we change something on object to pay (amount or other that does not change the idempotency key), reusing same payment intent is not allowed by Stripe. + // Recommended solution is to recreate a new payment intent each time we need one (old one will be automatically closed by Stripe after a delay), Stripe will // automatically return the existing payment intent if idempotency is provided when we try to create the new one. // That's why we can comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used) - /* + $sql = "SELECT pi.ext_payment_id, pi.entity, pi.fk_facture, pi.sourcetype, pi.ext_payment_site"; $sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi"; $sql.= " WHERE pi.fk_facture = " . $object->id; @@ -388,7 +388,7 @@ class Stripe extends CommonObject $this->error = $e->getMessage(); } } - }*/ + } } if (empty($paymentintent)) @@ -402,12 +402,17 @@ class Stripe extends CommonObject if (is_object($object->thirdparty) && $object->thirdparty->id > 0) $metadata['dol_thirdparty_id'] = $object->thirdparty->id; } + // list of payment method types + $paymentmethodtypes = array("card"); + if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT) ) $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) + if (!empty($conf->global->STRIPE_IDEAL) ) $paymentmethodtypes[] = "ideal"; //&& ($object->thirdparty->isInEEC()) + $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent "confirmation_method" => $mode, "amount" => $stripeamount, "currency" => $currency_code, - "payment_method_types" => array("card"), + "payment_method_types" => $paymentmethodtypes, "description" => $description, "statement_descriptor_suffix" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) //"save_payment_method" => true, @@ -566,14 +571,19 @@ class Stripe extends CommonObject if (is_object($object->thirdparty) && $object->thirdparty->id > 0) $metadata['dol_thirdparty_id'] = $object->thirdparty->id; } + // list of payment method types + $paymentmethodtypes = array("card"); + if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT) ) $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) + // iDEAL not supported with setupIntent + $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent - "payment_method_types" => array("card"), - "description" => $description, + "payment_method_types" => $paymentmethodtypes, "usage" => "off_session", "metadata" => $metadata ); if (!is_null($customer)) $dataforintent["customer"] = $customer; + if (!is_null($description)) $dataforintent["description"] = $description; // payment_method = // payment_method_types = array('card') //var_dump($dataforintent);
'.$langs->trans("Day".$arraytimestamp['wday'])."
'.$langs->trans("TimeType").''; - print $form->selectTypeDuration('offsetunit'); + print $form->selectTypeDuration('offsetunit', 'i'); print '
'; print $langs->trans("VendorName").''; -print ''; +print ''; print '   '.$langs->trans("Example").': '.$mysoc->name; print '
'; + print $langs->trans("STRIPE_IDEAL").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_IDEAL'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_IDEAL", $arrval, $conf->global->STRIPE_SEPA_DIRECT_DEBIT); + } + print '   '.$langs->trans("ExampleOnlyForNLCustomers"); + print '