From c3a23b0415b51831136cad52e6d7281f2b0327ea Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Aug 2020 06:23:35 +0200 Subject: [PATCH 01/21] 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/21] 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/21] 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 335f57f9be73f2872e2017d0a0bdc2df52c82fb5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 24 Aug 2020 11:41:00 +0200 Subject: [PATCH 04/21] 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 85575fd60443680ac4b8215ff2b3f9bd58e4b5e3 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 4 Sep 2020 12:18:32 +0200 Subject: [PATCH 05/21] 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 ''.$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 ''; // Group 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 ''; // Severity 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 ''; } 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 4f68c694b811e2f88ec308cccdd55c6855cbc316 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 4 Sep 2020 14:25:13 +0200 Subject: [PATCH 06/21] 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 2e609d448c20006c78aae7658060929a600437c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 16:30:34 +0200 Subject: [PATCH 07/21] Fix error message --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f0d67f309f2..92abd359deb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3230,7 +3230,7 @@ class Facture extends CommonInvoice } else { - dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); + dol_syslog(get_class($this)."::addline status of invoice must be Draft to allow use of ->addline()", LOG_ERR); return -3; } } From 77afbd44125b44391bf094d35eafbe3e93b074f5 Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Fri, 4 Sep 2020 15:57:08 +0100 Subject: [PATCH 08/21] fix : unuseful truncation of list name elements --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b2f8905aba9..993528464fd 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1231,7 +1231,7 @@ class ExtraFields } else { if (!$notrans) { $translabel = $langs->trans($obj->{$InfoFieldList[1]}); - $labeltoshow = dol_trunc($translabel, 18); + $labeltoshow =$translabel; } if (empty($labeltoshow)) $labeltoshow = '(not defined)'; From 123d33b47c8d54b46c61bc86b12d2ab624ca7ce8 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 4 Sep 2020 17:50:49 +0200 Subject: [PATCH 09/21] NEW format tickets sent by mail in public interface --- htdocs/public/ticket/create_ticket.php | 47 ++++++++------------------ 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 131be53c756..329c557e2f8 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -208,14 +208,14 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { // Send email to customer $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id); - $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; - $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; + $message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')) . '

      '; + $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket') . '
      '; $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; - $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'')."\n"; - $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n"; + $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'') . '
      '; + $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl') . '

      '; - $message .= dol_nl2br($infos_new_ticket); + $message .= $infos_new_ticket; $message .= $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->transnoentities('TicketMessageMailSignatureText'); $sendto = GETPOST('email', 'alpha'); @@ -225,14 +225,12 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { $sendtocc = ''; $deliveryreceipt = 0; - $message = dol_nl2br($message); - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); if ($mailfile->error || $mailfile->errors) { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); } else { @@ -247,34 +245,21 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { if ($sendto) { $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id); - $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; + $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('From').' : '.$object->origin_email.'
      • '; - - if (is_array($extrafields->attributes[$object->table_element]['label'])) - { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - $enabled = 1; - if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key])) - { - $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); - } - $perms = 1; - if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) - { - $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); - } - - $qualified = true; - if (empty($enabled) || $enabled == 2) $qualified = false; - if (empty($perms)) $qualified = false; - if ($qualified) $message_admin .= '
      • '.$langs->trans($key).' : '.$value.'
      • '; + // Extrafields + $extrafields->fetch_name_optionals_label($object->table_element); + if (is_array($object->array_options) && count($object->array_options) > 0) { + foreach ($object->array_options as $key => $value) { + $key = substr($key, 8); // remove "options_" + $message_admin .= '
      • ' . $langs->trans($extrafields->attributes[$object->element]['label'][$key]) . ' : ' . $extrafields->showOutputField($key, $value) . '
      • '; } } + $message_admin .= '
      '; $message_admin .= '
    '; $message_admin .= '

    '.$langs->trans('Message').' :
    '.$object->message.'

    '; @@ -283,14 +268,12 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; $replyto = $from; - $message_admin = dol_nl2br($message_admin); - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); + $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); if ($mailfile->error || $mailfile->errors) { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); } else { From 0c1a5d9e2547a40a6d925a77c425a42de80fb9ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 19:34:20 +0200 Subject: [PATCH 10/21] FIX using decimal on stock correction --- htdocs/product/stock/product.php | 65 +++++++++++++++++--------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f59698ef6d6..62fa40a9a2c 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -1,14 +1,14 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013-2018 Juanjo Menent - * Copyright (C) 2014-2015 Cédric Gross - * Copyright (C) 2015 Marcos García - * Copyright (C) 2018-2019 Frédéric France +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2020 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Simon TOSSER + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2013-2018 Juanjo Menent + * Copyright (C) 2014-2015 Cédric Gross + * Copyright (C) 2015 Marcos García + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,8 +67,8 @@ $stocklimit = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel', 'alpha'); $fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid'; -$d_eatby = dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); -$d_sellby = dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); +$d_eatby = dol_mktime(0, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int')); +$d_sellby = dol_mktime(0, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int')); $pdluoid = GETPOST('pdluoid', 'int'); $batchnumber = GETPOST('batch_number', 'san_alpha'); if (!empty($batchnumber)) { @@ -224,7 +224,8 @@ if ($action == "correct_stock" && !$cancel) if (!$error) { $priceunit = price2num(GETPOST("unitprice")); - if (is_numeric(GETPOST("nbpiece")) && $id) + $nbpiece = price2num(GETPOST("nbpiece", 'alphanohtml')); + if (is_numeric($nbpiece) && $nbpiece != 0 && $id) { $origin_element = ''; $origin_id = null; @@ -244,14 +245,14 @@ if ($action == "correct_stock" && !$cancel) $result = $object->correct_stock_batch( $user, GETPOST("id_entrepot", 'int'), - GETPOST("nbpiece"), - GETPOST("mouvement"), + $nbpiece, + GETPOST("mouvement", 'int'), GETPOST("label", 'alphanohtml'), // label movement $priceunit, $d_eatby, $d_sellby, $batchnumber, - GETPOST('inventorycode'), + GETPOST('inventorycode', 'alphanohtml'), $origin_element, $origin_id ); // We do not change value of stock for a correction @@ -259,11 +260,11 @@ if ($action == "correct_stock" && !$cancel) $result = $object->correct_stock( $user, GETPOST("id_entrepot", 'int'), - GETPOST("nbpiece"), - GETPOST("mouvement"), + $nbpiece, + GETPOST("mouvement", 'int'), GETPOST("label", 'alphanohtml'), $priceunit, - GETPOST('inventorycode'), + GETPOST('inventorycode', 'alphanohtml'), $origin_element, $origin_id ); // We do not change value of stock for a correction @@ -361,18 +362,20 @@ if ($action == "transfert_stock" && !$cancel) $sellby = $d_sellby; } + $nbpiece = price2num(GETPOST("nbpiece", 'alphanohtml')); + if (!$error) { // Remove stock $result1 = $object->correct_stock_batch( $user, $srcwarehouseid, - GETPOST("nbpiece", 'int'), + $nbpiece, 1, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), $pricesrc, $eatby, $sellby, $batch, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alphanohtml') ); if ($result1 < 0) $error++; } @@ -382,12 +385,12 @@ if ($action == "transfert_stock" && !$cancel) $result2 = $object->correct_stock_batch( $user, GETPOST("id_entrepot_destination", 'int'), - GETPOST("nbpiece", 'int'), + $nbpiece, 0, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), $pricedest, $eatby, $sellby, $batch, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alphanohtml') ); if ($result2 < 0) $error++; } @@ -398,11 +401,11 @@ if ($action == "transfert_stock" && !$cancel) $result1 = $object->correct_stock( $user, GETPOST("id_entrepot", 'int'), - GETPOST("nbpiece"), + $nbpiece, 1, - GETPOST("label"), + GETPOST("label", 'alphanohtml'), $pricesrc, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alphanohtml') ); if ($result1 < 0) $error++; } @@ -412,11 +415,11 @@ if ($action == "transfert_stock" && !$cancel) $result2 = $object->correct_stock( $user, GETPOST("id_entrepot_destination", 'int'), - GETPOST("nbpiece"), + $nbpiece, 0, - GETPOST("label"), + GETPOST("label", 'alphanohtml'), $pricedest, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alphanohtml') ); if ($result2 < 0) $error++; } From 2e7f588cacd3731b037db4f3ff2a4bf6154312d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 19:34:20 +0200 Subject: [PATCH 11/21] FIX using decimal on stock correction Conflicts: htdocs/product/stock/product.php --- htdocs/product/stock/product.php | 77 +++++++++++++++++--------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 69f9dc89d9a..dcb87c9dcbc 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -1,14 +1,14 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013-2018 Juanjo Menent - * Copyright (C) 2014-2015 Cédric Gross - * Copyright (C) 2015 Marcos García - * Copyright (C) 2018-2019 Frédéric France +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2020 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Simon TOSSER + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2013-2018 Juanjo Menent + * Copyright (C) 2014-2015 Cédric Gross + * Copyright (C) 2015 Marcos García + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,8 +67,8 @@ $stocklimit = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel', 'alpha'); $fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid'; -$d_eatby = dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); -$d_sellby = dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); +$d_eatby = dol_mktime(0, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int')); +$d_sellby = dol_mktime(0, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int')); $pdluoid = GETPOST('pdluoid', 'int'); $batchnumber = GETPOST('batch_number', 'san_alpha'); if (!empty($batchnumber)) { @@ -224,7 +224,8 @@ if ($action == "correct_stock" && !$cancel) if (!$error) { $priceunit = price2num(GETPOST("unitprice")); - if (is_numeric(GETPOST("nbpiece")) && $id) + $nbpiece = price2num(GETPOST("nbpiece", 'alphanohtml')); + if (is_numeric($nbpiece) && $nbpiece != 0 && $id) { $origin_element = ''; $origin_id = null; @@ -243,15 +244,15 @@ if ($action == "correct_stock" && !$cancel) { $result = $object->correct_stock_batch( $user, - GETPOST("id_entrepot"), - GETPOST("nbpiece"), - GETPOST("mouvement"), - GETPOST("label"), // label movement + GETPOST("id_entrepot", 'int'), + $nbpiece, + GETPOST("mouvement", 'int'), + GETPOST("label", 'alphanohtml'), // label movement $priceunit, $d_eatby, $d_sellby, $batchnumber, - GETPOST('inventorycode'), + GETPOST('inventorycode', 'alphanohtml'), $origin_element, $origin_id ); // We do not change value of stock for a correction @@ -260,12 +261,12 @@ if ($action == "correct_stock" && !$cancel) { $result = $object->correct_stock( $user, - GETPOST("id_entrepot"), - GETPOST("nbpiece"), - GETPOST("mouvement"), - GETPOST("label"), + GETPOST("id_entrepot", 'int'), + $nbpiece, + GETPOST("mouvement", 'int'), + GETPOST("label", 'alphanohtml'), $priceunit, - GETPOST('inventorycode'), + GETPOST('inventorycode', 'alphanohtml'), $origin_element, $origin_id ); // We do not change value of stock for a correction @@ -343,6 +344,8 @@ if ($action == "transfert_stock" && !$cancel) if (isset($object->pmp)) $pricesrc = $object->pmp; $pricedest = $pricesrc; + $nbpiece = price2num(GETPOST("nbpiece", 'alphanohtml')); + if ($object->hasbatch()) { $pdluo = new Productbatch($db); @@ -377,12 +380,12 @@ if ($action == "transfert_stock" && !$cancel) $result1 = $object->correct_stock_batch( $user, $srcwarehouseid, - GETPOST("nbpiece", 'int'), + $nbpiece, 1, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), $pricesrc, $eatby, $sellby, $batch, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alphanohtml') ); if ($result1 < 0) $error++; } @@ -392,12 +395,12 @@ if ($action == "transfert_stock" && !$cancel) $result2 = $object->correct_stock_batch( $user, GETPOST("id_entrepot_destination", 'int'), - GETPOST("nbpiece", 'int'), + $nbpiece, 0, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), $pricedest, $eatby, $sellby, $batch, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alphanohtml') ); if ($result2 < 0) $error++; } @@ -409,12 +412,12 @@ if ($action == "transfert_stock" && !$cancel) // Remove stock $result1 = $object->correct_stock( $user, - GETPOST("id_entrepot"), - GETPOST("nbpiece"), + GETPOST("id_entrepot", 'int'), + $nbpiece, 1, - GETPOST("label"), + GETPOST("label", 'alphanohtml'), $pricesrc, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alphanohtml') ); if ($result1 < 0) $error++; } @@ -423,12 +426,12 @@ if ($action == "transfert_stock" && !$cancel) // Add stock $result2 = $object->correct_stock( $user, - GETPOST("id_entrepot_destination"), - GETPOST("nbpiece"), + GETPOST("id_entrepot_destination", 'int'), + $nbpiece, 0, - GETPOST("label"), + GETPOST("label", 'alphanohtml'), $pricedest, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alphanohtml') ); if ($result2 < 0) $error++; } From 1f82fcc1f088e602bfd26653a914f91eff846078 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 21:11:58 +0200 Subject: [PATCH 12/21] NEW ref_ext field for order lines --- htdocs/commande/class/commande.class.php | 44 +++++++++++++++++++----- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 77ba4456c1c..7ebe1fa7884 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1003,6 +1003,11 @@ class Commande extends CommonOrder $originid = $line->id; $origintype = $this->element; } + + // ref_ext + if (empty($line->ref_ext)) { + $line->ref_ext = ''; + } $result = $this->addline( $line->desc, @@ -1029,7 +1034,8 @@ class Commande extends CommonOrder $line->array_options, $line->fk_unit, $origintype, - $originid + $originid, + $line->ref_ext ); if ($result < 0) { @@ -1214,6 +1220,13 @@ class Commande extends CommonOrder $this->date_creation = ''; $this->date_validation = ''; if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = ''; + + // Do not clone ref_ext + $num = count($this->lines); + for ($i = 0; $i < $num; $i++) + { + $this->lines[$i]->ref_ext = ''; + } // Create clone $this->context['createfromclone'] = 'createfromclone'; @@ -1423,6 +1436,7 @@ class Commande extends CommonOrder * @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'.... * @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id * @param double $pu_ht_devise Unit price in currency + * @param string $ref_ext line external reference * @return int >0 if OK, <0 if KO * * @see add_product() @@ -1432,13 +1446,13 @@ class Commande extends CommonOrder * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '') { global $mysoc, $conf, $langs, $user; $logtext = "::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent"; $logtext .= ", info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start"; - $logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise"; + $logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise, ref_ext=$ref_ext"; dol_syslog(get_class($this).$logtext, LOG_DEBUG); if ($this->statut == self::STATUS_DRAFT) @@ -1446,6 +1460,7 @@ class Commande extends CommonOrder include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Clean parameters + if (empty($remise_percent)) $remise_percent = 0; if (empty($qty)) $qty = 0; if (empty($info_bits)) $info_bits = 0; @@ -1455,6 +1470,7 @@ class Commande extends CommonOrder if (empty($txlocaltax2)) $txlocaltax2 = 0; if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line = 0; if (empty($this->fk_multicurrency)) $this->fk_multicurrency = 0; + if (empty($ref_ext)) $ref_ext = ''; $remise_percent = price2num($remise_percent); $qty = price2num($qty); @@ -1570,6 +1586,7 @@ class Commande extends CommonOrder $this->line->label = $label; $this->line->desc = $desc; $this->line->qty = $qty; + $this->line->ref_ext = $ref_ext; $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; @@ -1977,7 +1994,7 @@ class Commande extends CommonOrder // phpcs:enable $this->lines = array(); - $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,'; + $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx, l.ref_ext,'; $sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,'; $sql .= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; $sql .= ' l.fk_unit,'; @@ -2012,6 +2029,7 @@ class Commande extends CommonOrder $line->description = $objp->description; // Description line $line->product_type = $objp->product_type; $line->qty = $objp->qty; + $line->ref_ext = $objp->ref_ext; $line->vat_src_code = $objp->vat_src_code; $line->tva_tx = $objp->tva_tx; @@ -2981,13 +2999,14 @@ class Commande extends CommonOrder * @param string $fk_unit Code of the unit to use. Null to use the default one * @param double $pu_ht_devise Amount in currency * @param int $notrigger disable line update trigger + * @param string $ref_ext external reference * @return int < 0 if KO, > 0 if OK */ - public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) + public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '') { global $conf, $mysoc, $langs, $user; - dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code"); + dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code, ref_ext=$ref_ext"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; if ($this->statut == Commande::STATUS_DRAFT) @@ -3000,6 +3019,7 @@ class Commande extends CommonOrder if (empty($txlocaltax2)) $txlocaltax2 = 0; if (empty($remise_percent)) $remise_percent = 0; if (empty($special_code) || $special_code == 3) $special_code = 0; + if (empty($ref_ext)) $ref_ext = ''; if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); @@ -3104,6 +3124,7 @@ class Commande extends CommonOrder $this->line->label = $label; $this->line->desc = $desc; $this->line->qty = $qty; + $this->line->ref_ext = $ref_ext; $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; @@ -3969,6 +3990,8 @@ class OrderLine extends CommonOrderLine * @var string Order lines label */ public $label; + + public $ref_ext; public $fk_remise_except; public $rang = 0; @@ -4014,7 +4037,7 @@ class OrderLine extends CommonOrderLine public function fetch($rowid) { $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_parent_line, cd.fk_product, cd.product_type, cd.label as custom_label, cd.description, cd.price, cd.qty, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx,'; - $sql .= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,'; + $sql .= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice, cd.ref_ext,'; $sql .= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht, cd.rang, cd.special_code,'; $sql .= ' cd.fk_unit,'; $sql .= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,'; @@ -4036,6 +4059,7 @@ class OrderLine extends CommonOrderLine $this->qty = $objp->qty; $this->price = $objp->price; $this->subprice = $objp->subprice; + $this->ref_ext = $objp->ref_ext; $this->vat_src_code = $objp->vat_src_code; $this->tva_tx = $objp->tva_tx; $this->localtax1_tx = $objp->localtax1_tx; @@ -4205,6 +4229,7 @@ class OrderLine extends CommonOrderLine if (empty($this->special_code)) $this->special_code = 0; if (empty($this->fk_parent_line)) $this->fk_parent_line = 0; if (empty($this->pa_ht)) $this->pa_ht = 0; + if (empty($this->ref_ext)) $this->ref_ext = ''; // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0 && $pa_ht_isemptystring) @@ -4224,7 +4249,7 @@ class OrderLine extends CommonOrderLine // Insertion dans base de la ligne $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet'; - $sql .= ' (fk_commande, fk_parent_line, label, description, qty, '; + $sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,'; $sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; $sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,'; $sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,'; @@ -4237,6 +4262,7 @@ class OrderLine extends CommonOrderLine $sql .= " ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; $sql .= " '".$this->db->escape($this->desc)."',"; $sql .= " '".price2num($this->qty)."',"; + $sql .= " '".$this->db->escape($this->ref_ext)."',"; $sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").","; $sql .= " '".price2num($this->tva_tx)."',"; $sql .= " '".price2num($this->localtax1_tx)."',"; @@ -4347,6 +4373,7 @@ class OrderLine extends CommonOrderLine if (empty($this->product_type)) $this->product_type = 0; if (empty($this->fk_parent_line)) $this->fk_parent_line = 0; if (empty($this->pa_ht)) $this->pa_ht = 0; + if (empty($this->ref_ext)) $this->ref_ext = ''; // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0 && $pa_ht_isemptystring) @@ -4372,6 +4399,7 @@ class OrderLine extends CommonOrderLine $sql .= " , localtax1_type='".$this->db->escape($this->localtax1_type)."'"; $sql .= " , localtax2_type='".$this->db->escape($this->localtax2_type)."'"; $sql .= " , qty=".price2num($this->qty); + $sql .= " , ref_ext='".$this->db->escape($this->ref_ext)."'"; $sql .= " , subprice=".price2num($this->subprice).""; $sql .= " , remise_percent=".price2num($this->remise_percent).""; $sql .= " , price=".price2num($this->price).""; // TODO A virer From c06cb1eff3a2895cc268e9d154686ec37805dec8 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 21:25:20 +0200 Subject: [PATCH 13/21] NEW ref_ext for order lines --- htdocs/commande/class/api_orders.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index d53634a4e08..e4d432b234a 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -348,7 +348,8 @@ class Orders extends DolibarrApi $request_data->fk_unit, $request_data->origin, $request_data->origin_id, - $request_data->multicurrency_subprice + $request_data->multicurrency_subprice, + $request_data->ref_ext ); if ($updateRes > 0) { @@ -406,7 +407,9 @@ class Orders extends DolibarrApi $request_data->special_code, $request_data->array_options, $request_data->fk_unit, - $request_data->multicurrency_subprice + $request_data->multicurrency_subprice, + 0, + $request_data->ref_ext ); if ($updateRes > 0) { From e84a2ab07c8f2019d4b968e63bc4c6eeb650f37c 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 21:26:57 +0200 Subject: [PATCH 14/21] Fix addline commande.class.php --- htdocs/commande/class/commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7ebe1fa7884..74338d7bddc 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1035,6 +1035,7 @@ class Commande extends CommonOrder $line->fk_unit, $origintype, $originid, + 0, $line->ref_ext ); if ($result < 0) From e9d6e04c257e944687e6cff8bc6aacd1cc06e1da 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 21:36:01 +0200 Subject: [PATCH 15/21] NEW field ref_ext in llx_commandedet --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 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 cc460f5ba42..9ec6949e198 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 @@ -312,4 +312,4 @@ ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_status (st ALTER TABLE llx_inventorydet ADD UNIQUE uk_inventorydet(fk_inventory, fk_warehouse, fk_product, batch); - +ALTER TABLE llx_commandedet ADD COLUMN ref_ext varchar(255) AFTER label; From ebb69e9d6e4556187381646998faf32b2bbb5ff4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 4 Sep 2020 19:38:49 +0000 Subject: [PATCH 16/21] Fixing style errors. --- htdocs/commande/class/commande.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 74338d7bddc..73dd2cee9fb 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1003,7 +1003,7 @@ class Commande extends CommonOrder $originid = $line->id; $origintype = $this->element; } - + // ref_ext if (empty($line->ref_ext)) { $line->ref_ext = ''; @@ -1221,7 +1221,7 @@ class Commande extends CommonOrder $this->date_creation = ''; $this->date_validation = ''; if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = ''; - + // Do not clone ref_ext $num = count($this->lines); for ($i = 0; $i < $num; $i++) @@ -1461,7 +1461,7 @@ class Commande extends CommonOrder include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Clean parameters - + if (empty($remise_percent)) $remise_percent = 0; if (empty($qty)) $qty = 0; if (empty($info_bits)) $info_bits = 0; @@ -3991,7 +3991,7 @@ class OrderLine extends CommonOrderLine * @var string Order lines label */ public $label; - + public $ref_ext; public $fk_remise_except; From 972b95232e40f1e4843dfadb03e4279b1b010fcb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 22:30:53 +0200 Subject: [PATCH 17/21] Fix typo --- ChangeLog | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3a5558db6b..85ed40c9d19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -341,14 +341,14 @@ Following changes may create regressions for some external modules, but were nec WARNING FOR DOLIWAMP USERS ONLY: -Only people that installed Dolibarr using the all-in-one autoinstaller for Windows called "DoliWAMP" are concerned by the following warnings: +Only people that installed Dolibarr using the all-in-one auto-installer for Windows called "DoliWAMP" are concerned by the following warnings: -* DoliWAMP autoinstaller for Windows is not more available on 32bits systems. Use standard package if you need to use such architecture. -* It is not possible to migrate from an installation done with the old DoliWAMP autoinstaller for Windows by using this new one. You must make a backup - of your database, make a fresh installation using the new installer and reload your backup. Don't forget that DoliWAMP is a good solution to make a - quick test of Dolibarr on your local computer but was never recommanded as a production solution on a local desktop since a desktop computer has not - a backup and security policy as good as on a server (when there is one). - DoliWAMP remains a solution for fast test or demo purposes. Prefer using standard package for production. +* DoliWAMP auto-installer for Windows is no more available on 32 bits systems. Use standard package if you need to use such architecture. +* It is not possible to migrate from an installation done with the old DoliWAMP auto-installer for Windows by using this new one. + You must make a backup of your database, make a fresh installation using the new installer and reload your backup. + Don't forget that DoliWAMP is a good solution to make a quick test of Dolibarr on your local computer but was never recommended as a production + solution on a local desktop since a local desktop computer has often no backup and security policy, or not as good as on a server (when there is one). + DoliWAMP remains a solution for fast test or demo purposes. Prefer using standard packages for production. ***** ChangeLog for 11.0.5 compared to 11.0.4 ***** From 714c86ce54659e8ecc10e30e3e9622c0a83db726 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 22:33:16 +0200 Subject: [PATCH 18/21] Typo --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 85ed40c9d19..e534e9e3d6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -346,7 +346,7 @@ Only people that installed Dolibarr using the all-in-one auto-installer for Wind * DoliWAMP auto-installer for Windows is no more available on 32 bits systems. Use standard package if you need to use such architecture. * It is not possible to migrate from an installation done with the old DoliWAMP auto-installer for Windows by using this new one. You must make a backup of your database, make a fresh installation using the new installer and reload your backup. - Don't forget that DoliWAMP is a good solution to make a quick test of Dolibarr on your local computer but was never recommended as a production + Don't forget that DoliWAMP is a good solution to make a quick test of Dolibarr on your local computer but is not recommended as a production solution on a local desktop since a local desktop computer has often no backup and security policy, or not as good as on a server (when there is one). DoliWAMP remains a solution for fast test or demo purposes. Prefer using standard packages for production. From 451c878cfc541c3bff4e4fa69490fd01b7180b08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 22:42:37 +0200 Subject: [PATCH 19/21] Fix add missing field --- htdocs/install/mysql/tables/llx_commandedet.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_commandedet.sql b/htdocs/install/mysql/tables/llx_commandedet.sql index 615ec8f269c..c7b94a46add 100644 --- a/htdocs/install/mysql/tables/llx_commandedet.sql +++ b/htdocs/install/mysql/tables/llx_commandedet.sql @@ -57,6 +57,7 @@ create table llx_commandedet rang integer DEFAULT 0, fk_unit integer DEFAULT NULL, -- lien vers table des unités import_key varchar(14), + ref_ext varchar(255) DEFAULT NULL, fk_commandefourndet integer DEFAULT NULL, -- link to detail line of commande fourn (resplenish) From a2db403abe33607281fd27a80809ca05828f0e5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 22:44:31 +0200 Subject: [PATCH 20/21] Fix phpcs --- 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 dcb87c9dcbc..c648d3f5f4c 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -345,7 +345,7 @@ if ($action == "transfert_stock" && !$cancel) $pricedest = $pricesrc; $nbpiece = price2num(GETPOST("nbpiece", 'alphanohtml')); - + if ($object->hasbatch()) { $pdluo = new Productbatch($db); From f04b5c48ea3843d9d097a6d5ec354e24f18f8f50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Sep 2020 23:09:34 +0200 Subject: [PATCH 21/21] Update accountancy.lang --- 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 490e3b34719..29a857c914b 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 & 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 +ACCOUNTING_DISABLE_BINDING_ON_SALES=Disable binding & transfer in accountancy on sales (customer invoices will not be taken into account in accounting) +ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountancy on purchases (vendor invoices will not be taken into account in accounting) +ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) ## Export ExportDraftJournal=Export draft journal