From 6e9a07d11951a1759b5be8434f92191b9cfe11be Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 22 Mar 2020 05:33:30 +0100 Subject: [PATCH 01/12] Work on split module fournisseur --- htdocs/comm/action/class/cactioncomm.class.php | 4 ++-- htdocs/comm/index.php | 8 ++++---- htdocs/core/ajax/selectsearchbox.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 7362a82840d..6d92a3e8263 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -169,8 +169,8 @@ class CActionComm if ($obj->module == 'invoice' && ! $conf->facture->enabled) $qualified=0; if ($obj->module == 'order' && ! $conf->commande->enabled) $qualified=0; if ($obj->module == 'propal' && ! $conf->propal->enabled) $qualified=0; - if ($obj->module == 'invoice_supplier' && ! $conf->fournisseur->enabled) $qualified=0; - if ($obj->module == 'order_supplier' && ! $conf->fournisseur->enabled) $qualified=0; + if ($obj->module == 'invoice_supplier' && (! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD || ! $conf->supplier_invoice->enabled)) $qualified=0; + if ($obj->module == 'order_supplier' && (! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD || ! $conf->supplier_order->enabled)) $qualified=0; if ($obj->module == 'shipping' && ! $conf->expedition->enabled) $qualified=0; } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 0bb38aeaa38..b7370bc1ba1 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -35,7 +35,7 @@ if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/cl if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (!empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; if (!$user->rights->societe->lire) accessforbidden(); @@ -76,7 +76,7 @@ $companystatic = new Societe($db); if (!empty($conf->propal->enabled)) $propalstatic = new Propal($db); if (!empty($conf->supplier_proposal->enabled)) $supplierproposalstatic = new SupplierProposal($db); if (!empty($conf->commande->enabled)) $orderstatic = new Commande($db); -if (!empty($conf->fournisseur->enabled)) $supplierorderstatic = new CommandeFournisseur($db); +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) $supplierorderstatic = new CommandeFournisseur($db); llxHeader("", $langs->trans("CommercialArea")); @@ -102,7 +102,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles $listofsearchfields['search_supplier_proposal'] = array('text'=>'SupplierProposalShort'); } // Search supplier order - if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { $listofsearchfields['search_supplier_order'] = array('text'=>'SupplierOrder'); } @@ -414,7 +414,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) /* * Draft suppliers orders */ -if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { $langs->load("orders"); diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index b5d9b005cdd..61cf3c074bf 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -105,11 +105,11 @@ if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEAR { $arrayresult['searchintosupplierpropal']=array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); } -if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire) +if ((! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) || ! empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { $arrayresult['searchintosupplierorder']=array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):'')); } -if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire) +if ((! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) || ! empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $arrayresult['searchintosupplierinvoice']=array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); } From c05ef16e0bf12a588cc47886a9633094854d1947 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 22 Mar 2020 05:51:14 +0100 Subject: [PATCH 02/12] Work on split module fournisseur --- htdocs/core/lib/company.lib.php | 2 +- htdocs/core/lib/contact.lib.php | 2 +- htdocs/core/lib/product.lib.php | 6 +++--- htdocs/core/lib/project.lib.php | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 700c3f0410f..da141618f00 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -173,7 +173,7 @@ function societe_prepare_head(Societe $object) } // Related items - if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled)) + if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) { $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 0082947d0c1..c1a6620fc4b 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -59,7 +59,7 @@ function contact_prepare_head(Contact $object) $tab++; // Related items - if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->fournisseur->enabled)) + if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $head[$tab][0] = DOL_URL_ROOT.'/contact/consumption.php?id='.$object->id; $head[$tab][1] = $langs->trans("Referers"); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 79d77e0268f..a6ee33e9a65 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -55,7 +55,7 @@ function product_prepare_head($object) if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase { - if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->lire) || (!empty($conf->margin->enabled) && $user->rights->margin->liretous) ) { @@ -408,7 +408,7 @@ function show_stats_for_company($product, $socid) print ''; } // Supplier orders - if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { $nblines++; $ret = $product->load_stats_commande_fournisseur($socid); @@ -462,7 +462,7 @@ function show_stats_for_company($product, $socid) print ''; } // Supplier invoices - if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $nblines++; $ret = $product->load_stats_facture_fournisseur($socid); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index ee80a525f04..ea3ddab9976 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -87,7 +87,8 @@ function project_prepare_head($object) $h++; } - if (!empty($conf->fournisseur->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) + || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) { From b6137696060cfa243acb76e0390c0db67ab15b05 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 22 Mar 2020 06:09:47 +0100 Subject: [PATCH 03/12] Work on split module fournisseur --- htdocs/core/menus/init_menu_auguria.sql | 20 +++++++++---------- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 12 +++++------ htdocs/core/modules/modCategorie.class.php | 6 +++--- .../doc/doc_generic_project_odt.modules.php | 8 ++++---- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 66ed948585f..e8b0eda2e63 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -9,9 +9,9 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- table llx_menu -- insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur|supplier_order|supplier_invoice', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); @@ -76,8 +76,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); @@ -88,14 +88,14 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); -- Third parties - Category customer insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category supplier -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category contact insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); @@ -264,9 +264,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->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 && $conf->fournisseur->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 && $conf->fournisseur->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 && $conf->fournisseur->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 && (!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__); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 390c50aa748..360a173dcee 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -381,7 +381,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t // 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)) $nature="purchases"; + 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 == 4 && ! empty($conf->banque->enabled)) $nature="bank"; if ($objp->nature == 5 && ! empty($conf->expensereport->enabled)) $nature="expensereports"; if ($objp->nature == 1) $nature="various"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index eafbdaf5ddd..7d5cb8d8ff3 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -120,7 +120,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled'=> ((!empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) ) - || !empty($conf->fournisseur->enabled) + || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) ), 'perms'=> (!empty($user->rights->societe->lire) || !empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur' @@ -848,7 +848,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Suppliers - if (!empty($conf->societe->enabled) && (!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled))) + if (!empty($conf->societe->enabled) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) { $langs->load("suppliers"); $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, ($user->rights->fournisseur->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers'); @@ -868,7 +868,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } // Categories suppliers - if (!empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire); } @@ -880,7 +880,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); - if (!empty($conf->fournisseur->enabled)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); @@ -1201,7 +1201,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if (!empty($conf->banque->enabled)) { $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70); } - if (!empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled)) { + if (!empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))) { $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80); } if (!empty($conf->tax->enabled)) { @@ -1275,7 +1275,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // 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)) $nature = "purchases"; + 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 == 4 && !empty($conf->banque->enabled)) $nature = "bank"; if ($objp->nature == 5 && !empty($conf->expensereport->enabled)) $nature = "expensereports"; if ($objp->nature == 1) $nature = "various"; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 61a4dd67d5c..4f0c1e04307 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -120,7 +120,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r] = 'category_'.$r; $this->export_label[$r] = 'CatSupList'; $this->export_icon[$r] = 'category'; - $this->export_enabled[$r] = '$conf->fournisseur->enabled'; + $this->export_enabled[$r] = '!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire")); $this->export_fields_array[$r] = array( 'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", @@ -423,7 +423,7 @@ class modCategorie extends DolibarrModules ); $typeexample = ""; if ($conf->product->enabled) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; } - if ($conf->fournisseur->enabled) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; } + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; } if ($conf->societe->enabled) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; } if ($conf->adherent->enabled) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; } $this->import_examplevalues_array[$r] = array( @@ -491,7 +491,7 @@ class modCategorie extends DolibarrModules $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_socpeople'=>"123"); } - if (!empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { // Suppliers $r++; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 488938a725b..a7e543d2d35 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -41,8 +41,8 @@ if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/p if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; @@ -1008,13 +1008,13 @@ class doc_generic_project_odt extends ModelePDFProjects 'title' => "ListSupplierOrdersAssociatedProject", 'table' => 'commande_fournisseur', 'class' => 'CommandeFournisseur', - 'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire + 'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire ), 'invoice_supplier' => array( 'title' => "ListSupplierInvoicesAssociatedProject", 'table' => 'facture_fourn', 'class' => 'FactureFournisseur', - 'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire + 'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire ), 'contract' => array( 'title' => "ListContractAssociatedProject", From e6a59dcdbb7407fe7953355d0079b024adf4aca7 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 23 Mar 2020 05:43:41 +0100 Subject: [PATCH 04/12] Work on split module fournisseur --- htdocs/comm/action/class/cactioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 6d92a3e8263..62051a45134 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -169,8 +169,8 @@ class CActionComm if ($obj->module == 'invoice' && ! $conf->facture->enabled) $qualified=0; if ($obj->module == 'order' && ! $conf->commande->enabled) $qualified=0; if ($obj->module == 'propal' && ! $conf->propal->enabled) $qualified=0; - if ($obj->module == 'invoice_supplier' && (! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD || ! $conf->supplier_invoice->enabled)) $qualified=0; - if ($obj->module == 'order_supplier' && (! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD || ! $conf->supplier_order->enabled)) $qualified=0; + if ($obj->module == 'invoice_supplier' && (! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! $conf->supplier_invoice->enabled) $qualified=0; + if ($obj->module == 'order_supplier' && (! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! $conf->supplier_order->enabled) $qualified=0; if ($obj->module == 'shipping' && ! $conf->expedition->enabled) $qualified=0; } From d5729e6dcc90484e33d60593edddc420fdb6e81f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 23 Mar 2020 05:53:33 +0100 Subject: [PATCH 05/12] Work on split module fournisseur --- htdocs/comm/action/class/cactioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 62051a45134..df65dd724da 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -169,8 +169,8 @@ class CActionComm if ($obj->module == 'invoice' && ! $conf->facture->enabled) $qualified=0; if ($obj->module == 'order' && ! $conf->commande->enabled) $qualified=0; if ($obj->module == 'propal' && ! $conf->propal->enabled) $qualified=0; - if ($obj->module == 'invoice_supplier' && (! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! $conf->supplier_invoice->enabled) $qualified=0; - if ($obj->module == 'order_supplier' && (! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! $conf->supplier_order->enabled) $qualified=0; + if ($obj->module == 'invoice_supplier' && ((! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! $conf->supplier_invoice->enabled)) $qualified=0; + if ($obj->module == 'order_supplier' && ((! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! $conf->supplier_order->enabled)) $qualified=0; if ($obj->module == 'shipping' && ! $conf->expedition->enabled) $qualified=0; } From e6d9f7885c07a774d14bb86072b87bfe96c6eba4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 24 Mar 2020 21:22:20 +0100 Subject: [PATCH 06/12] Work on split module fournisseur --- htdocs/comm/action/class/cactioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index df65dd724da..cf60911555d 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -169,8 +169,8 @@ class CActionComm if ($obj->module == 'invoice' && ! $conf->facture->enabled) $qualified=0; if ($obj->module == 'order' && ! $conf->commande->enabled) $qualified=0; if ($obj->module == 'propal' && ! $conf->propal->enabled) $qualified=0; - if ($obj->module == 'invoice_supplier' && ((! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! $conf->supplier_invoice->enabled)) $qualified=0; - if ($obj->module == 'order_supplier' && ((! $conf->fournisseur->enabled && $conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! $conf->supplier_order->enabled)) $qualified=0; + if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ! $conf->supplier_invoice->enabled)) $qualified=0; + if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ! $conf->supplier_order->enabled)) $qualified=0; if ($obj->module == 'shipping' && ! $conf->expedition->enabled) $qualified=0; } From 5528e9ef3860891e4fb11f32e52b1bd9094115f3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 24 Mar 2020 22:02:58 +0100 Subject: [PATCH 07/12] Work on split module fournisseur --- htdocs/core/modules/project/doc/pdf_beluga.modules.php | 4 ++-- htdocs/fourn/card.php | 6 +++--- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/index.php | 4 ++-- htdocs/fourn/recap-fourn.php | 4 ++-- htdocs/margin/tabs/thirdpartyMargins.php | 2 +- htdocs/product/admin/product.php | 4 ++-- htdocs/product/class/product.class.php | 6 +++--- htdocs/product/stock/product.php | 5 +++-- htdocs/societe/index.php | 4 ++-- htdocs/societe/list.php | 6 +++--- 11 files changed, 24 insertions(+), 23 deletions(-) diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 4072f22bf58..23a2a515873 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -38,8 +38,8 @@ if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/com if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_invoice->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 8051b9684f9..f905c1b3f29 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -295,7 +295,7 @@ if ($object->id > 0) print ''; print ''; - if (!empty($conf->fournisseur->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) { print ''; print ''; @@ -378,7 +378,7 @@ if ($object->id > 0) if ($link) $boxstat .= ''; } - if ($conf->fournisseur->enabled) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { // Box proposals $tmp = $object->getOutstandingOrders('supplier'); @@ -396,7 +396,7 @@ if ($object->id > 0) if ($link) $boxstat .= ''; } - if ($conf->fournisseur->enabled) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $tmp = $object->getOutstandingBills('supplier'); $outstandingOpened = $tmp['opened']; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 797e3693614..0913f5ba43b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3185,7 +3185,7 @@ class CommandeFournisseur extends CommonOrder { global $conf, $langs; - if (!empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 207133d9cfa..f9650941555 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -97,7 +97,7 @@ else // Draft orders -if (!empty($conf->fournisseur->enabled)) +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) { $langs->load("orders"); @@ -154,7 +154,7 @@ if (!empty($conf->fournisseur->enabled)) } // Draft invoices -if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $sql = "SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type"; $sql .= ", s.nom as name, s.rowid as socid"; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index 2cd52bfeb77..8cda5a20d98 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -65,7 +65,7 @@ if ($socid > 0) dol_banner_tab($societe, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); dol_fiche_end(); - if (!empty($conf->fournisseur->enabled) && $user->rights->facture->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->facture->lire) { // Invoice list print load_fiche_titre($langs->trans("SupplierPreview")); @@ -77,7 +77,7 @@ if ($socid > 0) $sql .= " u.login, u.rowid as userid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id; - $sql .= " AND f.entity IN (".getEntity("facture_fourn").")"; // Reconaissance de l'entité attribuée à cette facture pour Multicompany + $sql .= " AND f.entity IN (".getEntity("facture_fourn").")"; // Recognition of the entity attributed to this invoice for Multicompany $sql .= " AND f.fk_user_valid = u.rowid"; $sql .= " ORDER BY f.datef DESC"; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 5d7d0039b7a..a31803d2d72 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -106,7 +106,7 @@ if ($socid > 0) print ''; } - if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) { print ''; print $langs->trans('SupplierCode').''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index f3ef5441144..e1fe84600d1 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -564,7 +564,7 @@ $rowspan = 4; if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $rowspan++; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++; if (!empty($conf->global->MAIN_MULTILANGS)) $rowspan++; -if (!empty($conf->fournisseur->enabled)) $rowspan++; +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) $rowspan++; print ''; @@ -680,7 +680,7 @@ if (!empty($conf->global->MAIN_MULTILANGS)) print ''; } -if (!empty($conf->fournisseur->enabled)) +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) { print ''; print ''.$langs->trans("UseProductFournDesc").''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 96b2165c65a..7e29180a6e7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4872,19 +4872,19 @@ class Product extends CommonObject if ($result < 0) dol_print_error($this->db, $this->error); $stock_sending_client = $this->stats_expedition['qty']; } - if (!empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled)) { $result = $this->load_stats_commande_fournisseur(0, '1,2,3,4', 1); if ($result < 0) dol_print_error($this->db, $this->error); $stock_commande_fournisseur = $this->stats_commande_fournisseur['qty']; } - if (!empty($conf->fournisseur->enabled) && empty($conf->reception->enabled)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) { $result = $this->load_stats_reception(0, '4', 1); if ($result < 0) dol_print_error($this->db, $this->error); $stock_reception_fournisseur = $this->stats_reception['qty']; } - if (!empty($conf->fournisseur->enabled) && !empty($conf->reception->enabled)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) { $result = $this->load_stats_reception(0, '4', 1); // Use same tables than when module reception is not used. if ($result < 0) dol_print_error($this->db, $this->error); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index af12804aac5..1fa7dfb12a3 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -674,7 +674,8 @@ if ($id > 0 || $ref) } // Number of supplier order running - if (!empty($conf->fournisseur->enabled)) { + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) + { if ($found) $helpondiff .= '
'; else $found = 1; $result = $object->load_stats_commande_fournisseur(0, '3,4', 1); $helpondiff .= $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty']; @@ -684,7 +685,7 @@ if ($id > 0 || $ref) } // Number of product from supplier order already received (partial receipt) - if (!empty($conf->fournisseur->enabled)) { + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { if ($found) $helpondiff .= '
'; else $found = 1; $helpondiff .= $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 5b89c086c1f..f96082db62c 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -134,7 +134,7 @@ else $statstring .= ''.$langs->trans("Customers").''.round($third['customer']).''; $statstring .= ""; } - if (!empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) { $statstring2 = ""; $statstring2 .= ''.$langs->trans("Suppliers").''.round($third['supplier']).''; @@ -310,7 +310,7 @@ if ($result) $thirdparty_static->name = $langs->trans("Prospect"); print $thirdparty_static->getNomUrl(0, 'prospect', 0, 1); } - if (!empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $thirdparty_static->fournisseur) { if ($thirdparty_static->client) print " / "; $thirdparty_static->name = $langs->trans("Supplier"); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 63641f27625..253de10fc58 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -178,9 +178,9 @@ $arrayfields = array( 's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1), 's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), 's.code_client'=>array('label'=>"CustomerCodeShort", 'position'=>10, 'checked'=>$checkedcustomercode), - 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled))), + 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))), 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode), - 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled))), + 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))), 's.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>1), 's.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>1), 'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0), @@ -1226,7 +1226,7 @@ while ($i < min($num, $limit)) $companystatic->name_alias = ''; $s .= $companystatic->getNomUrl(0, 'prospect', 0, 1); } - if ((!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) && $obj->fournisseur) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) { if ($s) $s .= ", "; $companystatic->name = $langs->trans("Supplier"); From c3e5cf901d7c92983797de13786567fe403874dc Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 24 Mar 2020 22:20:25 +0100 Subject: [PATCH 08/12] Work on split module fournisseur --- htdocs/admin/workflow.php | 6 +++--- htdocs/comm/index.php | 2 +- htdocs/compta/index.php | 8 ++++---- htdocs/contact/consumption.php | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 02abcf59660..99185cce733 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -85,11 +85,11 @@ $workflowcodes = array( 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>41, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order', 'warning'=>''), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. 'separator2'=>array('family'=>'separator', 'position'=>50), // Automatic classification supplier proposal - 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'propal', 'warning'=>''), + 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', 'picto'=>'propal', 'warning'=>''), // Automatic classification supplier order - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'! empty($conf->fournisseur->enabled)', 'picto'=>'order', 'warning'=>''), + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)', 'picto'=>'order', 'warning'=>''), //Automatic classification reception - 'WORKFLOW_BILL_ON_RECEPTION'=>array('family'=>'classify_reception', 'position'=>64, 'enabled'=>'! empty($conf->reception->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'bill'), + 'WORKFLOW_BILL_ON_RECEPTION'=>array('family'=>'classify_reception', 'position'=>64, 'enabled'=>'! empty($conf->reception->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', 'picto'=>'bill'), ); if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index b7370bc1ba1..295562236b2 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -581,7 +581,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) } // Last suppliers -if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire) +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) { $langs->load("boxes"); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index c9a77e5cc26..bbbb9912bd1 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -101,7 +101,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles $listofsearchfields['search_invoice'] = array('text'=>'CustomerInvoice'); } // Search supplier invoices - if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->lire) { $listofsearchfields['search_supplier_invoice'] = array('text'=>'SupplierInvoice'); } @@ -231,7 +231,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) /** * Draft suppliers invoices */ -if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier"; $sql .= ", s.nom as name"; @@ -447,7 +447,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) // Last modified supplier invoices -if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $langs->load("boxes"); $facstatic = new FactureFournisseur($db); @@ -958,7 +958,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) /* * Unpayed supplier invoices */ -if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $facstatic = new FactureFournisseur($db); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index f27903f559e..e5150c7d81f 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -147,11 +147,11 @@ if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeA if ($object->thirdparty->fournisseur) { $thirdTypeArray['supplier']=$langs->trans("supplier"); - if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); // There no contact type for supplier proposals - // if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); + // if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); } print ''; From e15256712278343032c08734e60d597847b2c62f Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Thu, 23 Apr 2020 00:38:08 -0500 Subject: [PATCH 09/12] Add Button Cancel And cancel confirmation --- htdocs/expedition/card.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 655ba8f060f..cb3c908138b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -12,6 +12,7 @@ * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2016 Yasser Carreón * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Lenin Rivas * * 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 @@ -460,7 +461,23 @@ if (empty($reshook)) } } } + + elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->expedition->supprimer) + { + + $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); + $result = $object->cancel(0, $also_update_stock); + if ($result > 0) + { + $result = $object->setStatut(-1); + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); @@ -1689,7 +1706,7 @@ elseif ($id || $ref) $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('ValidateSending'), $text, 'confirm_valid', '', 0, 1); } // Confirm cancelation - if ($action == 'annuler') + if ($action == 'cancel') { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('CancelSending'), $langs->trans("ConfirmCancelSending", $object->ref), 'confirm_cancel', '', 0, 1); } @@ -2575,6 +2592,16 @@ elseif ($id || $ref) } } + // Cancel + if ($object->statut == Expedition::STATUS_VALIDATED) + { + if ($user->rights->expedition->supprimer) + { + print ''.$langs->trans("Cancel").''; + } + } + + // Delete if ($user->rights->expedition->supprimer) { print ''.$langs->trans("Delete").''; From 47654fd6290138c503d315d487f947314ed79cfc Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Thu, 23 Apr 2020 00:49:31 -0500 Subject: [PATCH 10/12] Shipment Canceled Shipment canceled, not delete ref and recovery stock. --- htdocs/expedition/class/expedition.class.php | 228 ++++++++++++++++++- 1 file changed, 227 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 624add5c075..92d2d146d58 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Lenin Rivas * * 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 @@ -175,7 +176,11 @@ class Expedition extends CommonObject */ const STATUS_CLOSED = 2; - + /** + * Canceled status + */ + const STATUS_CANCELED = -1; + /** * Constructor @@ -1165,6 +1170,227 @@ class Expedition extends CommonObject } } + + /** + * Cancel shipment. + * + * @param int $notrigger Disable triggers + * @param bool $also_update_stock true if the stock should be increased back (false by default) + * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO + */ + public function cancel($notrigger = 0, $also_update_stock = false) + { + global $conf, $langs, $user; + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; + + $error=0; + $this->error=''; + + $this->db->begin(); + + // Add a protection to refuse deleting if shipment has at least one delivery + $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment + if (count($this->linkedObjectsIds) > 0) + { + $this->error='ErrorThereIsSomeDeliveries'; + $error++; + } + + if (! $error) + { + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('SHIPPING_CANCEL', $user); + if ($result < 0) { $error++; } + // End call triggers + } + } + + // Stock control + if (! $error && $conf->stock->enabled && + (($conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) || + ($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE && $this->statut == self::STATUS_CLOSED && $also_update_stock))) + { + require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"; + + $langs->load("agenda"); + + // Loop on each product line to add a stock movement and delete features + $sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot, ed.rowid as expeditiondet_id"; + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd,"; + $sql .= " ".MAIN_DB_PREFIX."expeditiondet as ed"; + $sql .= " WHERE ed.fk_expedition = ".$this->id; + $sql .= " AND cd.rowid = ed.fk_origin_line"; + + dol_syslog(get_class($this)."::delete select details", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + $cpt = $this->db->num_rows($resql); + for ($i = 0; $i < $cpt; $i++) + { + dol_syslog(get_class($this)."::delete movement index ".$i); + $obj = $this->db->fetch_object($resql); + + $mouvS = new MouvementStock($this->db); + // we do not log origin because it will be deleted + $mouvS->origin = null; + // get lot/serial + $lotArray = null; + if ($conf->productbatch->enabled) + { + $lotArray = ExpeditionLineBatch::fetchAll($this->db, $obj->expeditiondet_id); + if (!is_array($lotArray)) + { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } + } + if (empty($lotArray)) { + // no lot/serial + // We increment stock of product (and sub-products) + // We use warehouse selected for each line + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref)); // Price is set to 0, because we don't want to see WAP changed + if ($result < 0) + { + $error++; $this->errors = $this->errors + $mouvS->errors; + break; + } + } + else + { + // We increment stock of batches + // We use warehouse selected for each line + foreach ($lotArray as $lot) + { + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed + if ($result < 0) + { + $error++; $this->errors = $this->errors + $mouvS->errors; + break; + } + } + if ($error) break; // break for loop incase of error + } + } + } + else + { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } + } + + // delete batch expedition line + if (!$error && $conf->productbatch->enabled) + { + if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) + { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } + } + + + if (!$error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; + $sql .= " WHERE fk_expedition = ".$this->id; + + if ($this->db->query($sql)) + { + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error++; + + // No delete expedition + if (!$error) + { + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition"; + $sql .= " WHERE rowid = ".$this->id; + + if ($this->db->query($sql)) + { + if (!empty($this->origin) && $this->origin_id > 0) + { + $this->fetch_origin(); + $origin = $this->origin; + if ($this->$origin->statut == Commande::STATUS_SHIPMENTONPROCESS) // If order source of shipment is "shipment in progress" + { + // Check if there is no more shipment. If not, we can move back status of order to "validated" instead of "shipment in progress" + $this->$origin->loadExpeditions(); + //var_dump($this->$origin->expeditions);exit; + if (count($this->$origin->expeditions) <= 0) + { + $this->$origin->setStatut(Commande::STATUS_VALIDATED); + } + } + } + + if (!$error) + { + $this->db->commit(); + + // We delete PDFs + $ref = dol_sanitizeFileName($this->ref); + if (!empty($conf->expedition->dir_output)) + { + $dir = $conf->expedition->dir_output.'/sending/'.$ref; + $file = $dir.'/'.$ref.'.pdf'; + if (file_exists($file)) + { + if (!dol_delete_file($file)) + { + return 0; + } + } + if (file_exists($dir)) + { + if (!dol_delete_dir_recursive($dir)) + { + $this->error = $langs->trans("ErrorCanNotDeleteDir", $dir); + return 0; + } + } + } + + return 1; + } + else + { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error = $this->db->lasterror()." - sql=$sql"; + $this->db->rollback(); + return -3; + } + } + else + { + $this->error = $this->db->lasterror()." - sql=$sql"; + $this->db->rollback(); + return -2; + }//*/ + } + else + { + $this->error = $this->db->lasterror()." - sql=$sql"; + $this->db->rollback(); + return -1; + } + } + else + { + $this->db->rollback(); + return -1; + } + + } + /** * Delete shipment. * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) From ff694c22d1900706d3bebe0a2a69dd29529cc57c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Apr 2020 05:54:13 +0000 Subject: [PATCH 11/12] Fixing style errors. --- htdocs/expedition/card.php | 12 +++++------- htdocs/expedition/class/expedition.class.php | 9 ++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index cb3c908138b..b8a17e35c5e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -461,10 +461,9 @@ if (empty($reshook)) } } } - + elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->expedition->supprimer) { - $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); $result = $object->cancel(0, $also_update_stock); if ($result > 0) @@ -475,9 +474,8 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - } - + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); @@ -2592,15 +2590,15 @@ elseif ($id || $ref) } } - // Cancel + // Cancel if ($object->statut == Expedition::STATUS_VALIDATED) - { + { if ($user->rights->expedition->supprimer) { print ''.$langs->trans("Cancel").''; } } - + // Delete if ($user->rights->expedition->supprimer) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 92d2d146d58..1db01a61820 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -180,7 +180,7 @@ class Expedition extends CommonObject * Canceled status */ const STATUS_CANCELED = -1; - + /** * Constructor @@ -1170,7 +1170,7 @@ class Expedition extends CommonObject } } - + /** * Cancel shipment. * @@ -1291,7 +1291,7 @@ class Expedition extends CommonObject } } - + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; @@ -1388,9 +1388,8 @@ class Expedition extends CommonObject $this->db->rollback(); return -1; } - } - + /** * Delete shipment. * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) From fdc0543b4d396287b4f35fe3c1f90cec9b54a221 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 27 Apr 2020 12:16:24 +0000 Subject: [PATCH 12/12] Fixing style errors. --- htdocs/contact/consumption.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 3f95d6acd14..ad4b5ca08f5 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -150,8 +150,8 @@ if ($object->thirdparty->fournisseur) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices'); if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']= $langs->transnoentitiesnoconv('SuppliersOrders'); - // There no contact type for supplier proposals - // if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); + // There no contact type for supplier proposals + // if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); } print '';